Skip to content

Commit

Permalink
Arena editor menu improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Despical committed Jul 10, 2024
1 parent 4c7c43d commit bda4822
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/main/java/me/despical/kotl/commands/AdminCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void reloadCommand(CommandArguments arguments) {
)
public void helpCommand(CommandArguments arguments) {
arguments.sendMessage("");
MiscUtils.sendCenteredMessage(arguments.getSender(), "&3&l---- King of the Ladder Commands ----");
MiscUtils.sendCenteredMessage(arguments.getSender(), "&3&l---- King of the Ladder ----");
arguments.sendMessage("");

final CommandSender sender = arguments.getSender();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class AbstractComponent {
protected final ChatManager chatManager;

static {
mainMenuItem = new ItemBuilder(XMaterial.REDSTONE).name("&c&lReturn KOTL Menu").lore("&7Click to return last page!").build();
mainMenuItem = new ItemBuilder(XMaterial.REDSTONE).name("&c&lReturn Main Menu").build();
}

public AbstractComponent(Main plugin) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void injectComponents(SetupInventory setup) {
final var config = ConfigUtils.getConfig(plugin, "arenas");
final var path = "instances.%s.".formatted(arena.getId());
final var arenaOptions = new StaticPane(9, 3);
final var outlineItem = new ItemBuilder(arena.isShowOutlines() ? XMaterial.ENDER_PEARL : XMaterial.ENDER_EYE).name(" " + (arena.isShowOutlines() ? "&c&lDisable" : "&e&lEnable") + " Outline Particles ").lore("&7You can create particles around the game arena.");
final var outlineItem = new ItemBuilder(arena.isShowOutlines() ? XMaterial.ENDER_PEARL : XMaterial.ENDER_EYE).name(" " + (arena.isShowOutlines() ? "&c&l Disable" : "&e&l Enable") + " Outline Particles").lore("&7You can create particles around the arena.");

arenaOptions.fillWith(new ItemBuilder(XMaterial.BLACK_STAINED_GLASS_PANE).name("&7You can edit additional arena options here.").build());
arenaOptions.addItem(GuiItem.of(mainMenuItem, event -> setup.restorePage()), 8, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,14 @@ public void injectComponents(SetupInventory setup) {
final var arena = setup.getArena();
final var path = "instances.%s.".formatted(arena.getId());
final var pane = setup.getPane();
final var optionsItem = new ItemBuilder(XMaterial.CLOCK).name("&e&l Additional Options").lore("&7Click to open additional options menu.").enchantment(Enchantment.DAMAGE_ALL).flag(ItemFlag.HIDE_ENCHANTS);
final var optionsItem = new ItemBuilder(XMaterial.CLOCK).name("&e&l Additional Options").lore("&7Click to open additional options menu.");

pane.addItem(GuiItem.of(optionsItem.build(), event -> setup.setPage(" Set Additional Arena Options", 3, 3)), 4, 2);

pane.addItem(new GuiItem(new ItemBuilder(XMaterial.REDSTONE_BLOCK)
.name("&e&l Set Ending Location ")
.lore("&7Click to set ending location on")
.name("&e&l Set Ending Location")
.lore("&7Click to set the ending location on")
.lore("&7the place where you are standing.")
.lore("&8(location where players will be")
.lore("&8teleported after the reloading)")
.lore("", isOptionDoneBool(config, path + "endLocation"))
.build(), e -> {

Expand All @@ -77,19 +75,17 @@ public void injectComponents(SetupInventory setup) {
}), 1, 1);

pane.addItem(GuiItem.of(new ItemBuilder(arena.getArenaPlate())
.name("&e&l Set Plate Location ")
.lore("&7Click to set plate location on")
.lore("&7the place where you are standing.")
.lore("&8(location where players will try to")
.lore("&8reach)")
.name("&e&l Set Plate Location")
.lore("&7Click to set plate location on the place")
.lore("&7 where you are standing.")

.lore("", isOptionDoneBool(config, path + "plateLocation"))
.build(), e -> {

setup.closeInventory();

final var plateMaterial = arena.getArenaPlate().parseMaterial();

// Remove the old one if present.
Optional.ofNullable(arena.getPlateLocation()).ifPresent(location -> {
var block = location.getBlock();

Expand All @@ -109,10 +105,9 @@ public void injectComponents(SetupInventory setup) {
}), 5, 1);

pane.addItem(GuiItem.of(new ItemBuilder(XMaterial.BLAZE_ROD.parseItem())
.name("&e&l Set Arena Region ")
.name("&e&l Set Arena Region")
.lore("&7Click to set arena's region with the")
.lore("&7cuboid selector.")
.lore("&8(area where the game will be playing)")
.lore("&7 cuboid selector.")
.lore("", isOptionDoneBool(config, path + "areaMax"))
.build(), e -> {

Expand Down Expand Up @@ -142,9 +137,8 @@ public void injectComponents(SetupInventory setup) {
}), 3, 1);

pane.addItem(GuiItem.of(new ItemBuilder(XMaterial.ENCHANTED_BOOK)
.name("&e&l Change Arena Plate ")
.name("&e&l Change Arena Plate")
.lore("&7Click here to change arena plate.")
.lore("&8(opens arena plate changer menu)")
.build(), e -> {

setup.getPaginatedPane().setPage(2);
Expand All @@ -155,23 +149,23 @@ public void injectComponents(SetupInventory setup) {
gui.update();
}), 7, 1);

final ItemBuilder registeredItem;
final ItemBuilder registerItem;

if (!arena.isReady()) {
registeredItem = new ItemBuilder(XMaterial.FIREWORK_ROCKET)
.name("&e&l Register Arena - Finish Setup")
.lore("&7Click this when you're done with configuration.")
.lore("&7It will validate and register arena.");
} else {
registeredItem = new ItemBuilder(Material.BARRIER)
.name("&a&lArena Registered - Congratulations")
.lore("&7This arena is already registered!")
if (arena.isReady()) {
registerItem = new ItemBuilder(XMaterial.BARRIER)
.name("&a&l Arena Registered")
.lore("&7Good job, you went through whole setup!")
.enchantment(Enchantment.ARROW_DAMAGE)
.lore("&7 You can play on this arena now!")
.enchantment(Enchantment.DURABILITY)
.flag(ItemFlag.HIDE_ENCHANTS);
} else {
registerItem = new ItemBuilder(XMaterial.FIREWORK_ROCKET)
.name(" &e&lFinish Arena Setup")
.lore("&7 Click this when you are done.")
.lore("&7You'll still be able to edit arena.");
}

pane.addItem(GuiItem.of(registeredItem.build(), e -> {
pane.addItem(GuiItem.of(registerItem.build(), e -> {
setup.closeInventory();

if (config.getBoolean(path + "isdone")) {
Expand Down

0 comments on commit bda4822

Please sign in to comment.