Initial commit

This commit is contained in:
Scifi9902
2026-10-12 13:57:05 -03:00
commit 4bde3b176a
2576 changed files with 212659 additions and 0 deletions
@@ -0,0 +1,30 @@
package net.crankedpvp.customblocks.guis;
import dev.triumphteam.gui.guis.GuiItem;
import dev.triumphteam.gui.guis.PaginatedGui;
import lombok.Getter;
import net.crankedpvp.crankedutils.utils.PlayerUtils;
import net.crankedpvp.customblocks.struct.CustomBlockType;
import net.crankedpvp.customblocks.struct.abilities.LevelAble;
import org.bukkit.entity.Player;
@Getter
public class CustomBlocksGui {
private final PaginatedGui gui;
public CustomBlocksGui(Player player) throws IllegalAccessException, InstantiationException {
this.gui = new PaginatedGui(3, 27, "Cranked CustomBlocks");
this.gui.setDefaultClickAction(event -> event.setCancelled(true));
for (CustomBlockType type : CustomBlockType.values()) {
this.gui.addItem(new GuiItem(type.getCustomBlockClass().newInstance() instanceof LevelAble ? type.build(1) : type.build(0), event -> {
if (player.isOp()) {
try {
PlayerUtils.giveOrDropProtectedItem(player, type.getCustomBlockClass().newInstance() instanceof LevelAble ? type.build(1) : type.build(0), 60);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}
}));
}
}
}