From 359672f599de9c23e97971d90d1373d80123d2b1 Mon Sep 17 00:00:00 2001 From: Trixkz Date: Fri, 27 Oct 2023 18:43:47 -0400 Subject: [PATCH] Updates (Event Management Menu) --- .../com/loganmagnan/eventcore/EventCore.java | 7 +- .../eventcore/commands/ChatCommand.java | 4 +- .../eventcore/commands/EventCommand.java | 45 +++ .../eventcore/managers/event/Event.java | 29 +- .../managers/event/EventManager.java | 21 +- ...anagementMenu.java => ChatManageMenu.java} | 36 +-- .../menusystem/menus/EventManageMenu.java | 272 ++++++++++++++++++ .../eventcore/utils/Constants.java | 3 + src/main/resources/messages.yml | 10 + 9 files changed, 386 insertions(+), 41 deletions(-) create mode 100644 src/main/java/com/loganmagnan/eventcore/commands/EventCommand.java rename src/main/java/com/loganmagnan/eventcore/menusystem/menus/{ChatManagementMenu.java => ChatManageMenu.java} (80%) create mode 100644 src/main/java/com/loganmagnan/eventcore/menusystem/menus/EventManageMenu.java diff --git a/src/main/java/com/loganmagnan/eventcore/EventCore.java b/src/main/java/com/loganmagnan/eventcore/EventCore.java index be4977e..70704b0 100644 --- a/src/main/java/com/loganmagnan/eventcore/EventCore.java +++ b/src/main/java/com/loganmagnan/eventcore/EventCore.java @@ -20,7 +20,10 @@ import lombok.Getter; import lombok.Setter; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; + +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.UUID; @Getter @@ -72,13 +75,15 @@ public class EventCore extends JavaPlugin { @Override public void onDisable() { + List playersInStaffMode = new ArrayList(this.staffManager.getPlayersInStaffMode()); + for (Player player : this.getServer().getOnlinePlayers()) { PlayerData playerData = this.playerDataManager.getPlayerData(player.getUniqueId()); this.playerDataManager.savePlayerData(playerData); } - for (UUID playerInStaffModeUUID : this.staffManager.getPlayersInStaffMode()) { + for (UUID playerInStaffModeUUID : playersInStaffMode) { Player playerInStaffMode = this.getServer().getPlayer(playerInStaffModeUUID); if (playerInStaffMode == null) { diff --git a/src/main/java/com/loganmagnan/eventcore/commands/ChatCommand.java b/src/main/java/com/loganmagnan/eventcore/commands/ChatCommand.java index 15f0f29..4a23b97 100644 --- a/src/main/java/com/loganmagnan/eventcore/commands/ChatCommand.java +++ b/src/main/java/com/loganmagnan/eventcore/commands/ChatCommand.java @@ -1,7 +1,7 @@ package com.loganmagnan.eventcore.commands; import com.loganmagnan.eventcore.EventCore; -import com.loganmagnan.eventcore.menusystem.menus.ChatManagementMenu; +import com.loganmagnan.eventcore.menusystem.menus.ChatManageMenu; import com.loganmagnan.eventcore.utils.ColorUtils; import com.loganmagnan.eventcore.utils.Constants; import com.loganmagnan.eventcore.utils.Utils; @@ -28,7 +28,7 @@ public class ChatCommand extends BaseCommand { } else { switch (args[0]) { case "manage": - new ChatManagementMenu(this.main.getPlayerMenuUtil(player), this.main.getChatManager().getDelayAmount()).open(player); + new ChatManageMenu(this.main.getPlayerMenuUtil(player), this.main.getChatManager().getDelayAmount()).open(player); break; case "toggle": diff --git a/src/main/java/com/loganmagnan/eventcore/commands/EventCommand.java b/src/main/java/com/loganmagnan/eventcore/commands/EventCommand.java new file mode 100644 index 0000000..9b9fa12 --- /dev/null +++ b/src/main/java/com/loganmagnan/eventcore/commands/EventCommand.java @@ -0,0 +1,45 @@ +package com.loganmagnan.eventcore.commands; + +import com.loganmagnan.eventcore.EventCore; +import com.loganmagnan.eventcore.menusystem.menus.EventManageMenu; +import com.loganmagnan.eventcore.utils.ColorUtils; +import com.loganmagnan.eventcore.utils.Constants; +import com.loganmagnan.eventcore.utils.Utils; +import com.loganmagnan.eventcore.utils.command.BaseCommand; +import com.loganmagnan.eventcore.utils.command.Command; +import com.loganmagnan.eventcore.utils.command.CommandArguments; +import org.bukkit.entity.Player; + +public class EventCommand extends BaseCommand { + + private EventCore main = EventCore.getInstance(); + + @Command(name = "event", permission = "eventcore.command.event") + @Override + public void executeAs(CommandArguments command) { + Player player = command.getPlayer(); + + String[] args = command.getArgs(); + + if (args.length == 0) { + for (String string : Constants.COMMAND_MESSAGES.get("event.help")) { + player.sendMessage(ColorUtils.getMessageType(string.replace("%line%", Utils.chatBar))); + } + } else { + switch (args[0]) { + case "start": + // To Do: Setup Event Starting System + + break; + case "stop": + // To Do: Setup Event Stopping System + + break; + case "manage": + new EventManageMenu(this.main.getPlayerMenuUtil(player)).open(player); + + break; + } + } + } +} diff --git a/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java b/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java index 89d50f3..f45e272 100644 --- a/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java +++ b/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java @@ -15,22 +15,29 @@ import java.util.List; @RequiredArgsConstructor public class Event { + // General Information private String name; - private CustomLocation spawnPoint; - - private List teams; - - private int amountOfTeams; - private int amountPerTeam; - - private List teamSpawnPoints; - private String duration; + // Teams Information + private List teams; + private int amountOfTeams; + private int amountPerTeam; + private List teamSpawnPoints; + + // Toggleable Settings private boolean scoreboardEnabled; private boolean timerEnabled; - private boolean blockPlaceEventCancelled; - private boolean blockBreakEventCancelled; + private boolean eventsEnabled; + + // Events + // BlockPlaceEvent + private boolean blockPlaceEventEnabled; + + // BlockBreakEvent + private boolean blockBreakEventEnabled; + + // Other private boolean started; } diff --git a/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java b/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java index 83cf975..1253f2f 100644 --- a/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java +++ b/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java @@ -68,15 +68,16 @@ public class EventManager { this.event = new Event( this.config.getString("EVENT.NAME"), CustomLocation.stringToLocation(this.config.getString("EVENT.SPAWN-POINT")), + this.config.getString("EVENT.DURATION"), teams, this.config.getInt("EVENT.AMOUNT-OF-TEAMS"), this.config.getInt("EVENT.AMOUNT-PER-TEAM"), teamSpawnPoints, - this.config.getString("EVENT.DURATION"), this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.SCOREBOARD-ENABLED"), this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.TIMER-ENABLED"), - this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-PLACE.CANCELLED"), - this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-BREAK.CANCELLED"), + this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.ENABLED"), + this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-PLACE.ENABLED"), + this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-BREAK.ENABLED"), this.config.getBoolean("EVENT.STARTED") ); } catch (NullPointerException exception) { @@ -86,15 +87,16 @@ public class EventManager { this.event = new Event( "Event", this.main.getSpawnManager().getSpawnLocation(), + "10m", new ArrayList(), 2, 10, new ArrayList(), - "10m", true, true, false, false, + false, false ); } @@ -134,14 +136,15 @@ public class EventManager { this.config.set("EVENT.NAME", this.event.getName()); this.config.set("EVENT.SPAWN-POINT", CustomLocation.locationToString(this.event.getSpawnPoint())); + this.config.set("EVENT.DURATION", this.event.getDuration()); this.config.set("EVENT.AMOUNT-OF-TEAMS", this.event.getAmountOfTeams()); this.config.set("EVENT.AMOUNT-PER-TEAM", this.event.getAmountPerTeam()); this.config.set("EVENT.TEAM-SPAWN-POINTS", teamSpawnPoints); - this.config.set("EVENT.DURATION", this.event.getDuration()); - this.config.set("EVENT.TOGGLEABLE-OPTIONS.SCOREBOARD-ENABLED", this.event.isScoreboardEnabled()); - this.config.set("EVENT.TOGGLEABLE-OPTIONS.TIMER-ENABLED", this.event.isTimerEnabled()); - this.config.set("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-PLACE.CANCELLED", this.event.isBlockPlaceEventCancelled()); - this.config.set("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-BREAK.CANCELLED", this.event.isBlockBreakEventCancelled()); + this.config.set("EVENT.TOGGLEABLE-SETTINGS.SCOREBOARD-ENABLED", this.event.isScoreboardEnabled()); + this.config.set("EVENT.TOGGLEABLE-SETTINGS.TIMER-ENABLED", this.event.isTimerEnabled()); + this.config.set("EVENT.TOGGLEABLE-SETTINGS.EVENTS.ENABLED", this.event.isEventsEnabled()); + this.config.set("EVENT.TOGGLEABLE-SETTINGS.EVENTS.BLOCK-PLACE.ENABLED", this.event.isBlockPlaceEventEnabled()); + this.config.set("EVENT.TOGGLEABLE-SETTINGS.EVENTS.BLOCK-BREAK.ENABLED", this.event.isBlockBreakEventEnabled()); this.config.set("EVENT.STARTED", this.event.isStarted()); this.main.getMainConfig().save(); } diff --git a/src/main/java/com/loganmagnan/eventcore/menusystem/menus/ChatManagementMenu.java b/src/main/java/com/loganmagnan/eventcore/menusystem/menus/ChatManageMenu.java similarity index 80% rename from src/main/java/com/loganmagnan/eventcore/menusystem/menus/ChatManagementMenu.java rename to src/main/java/com/loganmagnan/eventcore/menusystem/menus/ChatManageMenu.java index 2140e32..f5c4b0b 100644 --- a/src/main/java/com/loganmagnan/eventcore/menusystem/menus/ChatManagementMenu.java +++ b/src/main/java/com/loganmagnan/eventcore/menusystem/menus/ChatManageMenu.java @@ -12,13 +12,13 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import java.util.Arrays; -public class ChatManagementMenu extends Menu { +public class ChatManageMenu extends Menu { private EventCore main = EventCore.getInstance(); private int delayAmount = 0; - public ChatManagementMenu(PlayerMenuUtil playerMenuUtil, int delayAmount) { + public ChatManageMenu(PlayerMenuUtil playerMenuUtil, int delayAmount) { super(playerMenuUtil); this.delayAmount = delayAmount; @@ -26,7 +26,7 @@ public class ChatManagementMenu extends Menu { @Override public String getMenuName() { - return ColorUtils.getMessageType("&bChat Management"); + return ColorUtils.getMessageType("&b&lChat Management"); } @Override @@ -38,7 +38,7 @@ public class ChatManagementMenu extends Menu { public void handleMenu(InventoryClickEvent event) { Player player = (Player) event.getWhoClicked(); - if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&bChat Management"))) { + if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&b&lChat Management"))) { switch (event.getCurrentItem().getType()) { case DIAMOND_SWORD: this.main.getChatManager().toggleChat(player); @@ -64,19 +64,19 @@ public class ChatManagementMenu extends Menu { break; } - new ChatManagementMenu(this.playerMenuUtil, this.delayAmount).open(player); + new ChatManageMenu(this.playerMenuUtil, this.delayAmount).open(player); } } @Override public void setMenuItems(Player player) { ItemStackButton muteChatItemStackButton = new ItemStackButton( - ColorUtils.getMessageType("&bToggle Chat"), + ColorUtils.getMessageType("&b&lToggle Chat"), ColorUtils.getMessageType( Arrays.asList( "&fMuted: " + (this.main.getChatManager().isMuted() ? "&aYes" : "&cNo"), - "&fToggled By: &b" + (this.main.getChatManager().getToggledBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getToggledBy()).getName()), - "&fLast Toggled: &b" + (this.main.getChatManager().getLastToggledTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastToggledTime())), + "&fToggled By: &3" + (this.main.getChatManager().getToggledBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getToggledBy()).getName()), + "&fLast Toggled: &3" + (this.main.getChatManager().getLastToggledTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastToggledTime())), "", "&bClick to mute the chat" ) @@ -87,17 +87,17 @@ public class ChatManagementMenu extends Menu { ); ItemStackButton slowChatItemStackButton = new ItemStackButton( - ColorUtils.getMessageType("&bSlow Chat"), + ColorUtils.getMessageType("&b&lSlow Chat"), ColorUtils.getMessageType( Arrays.asList( - "&fDelay Amount: &b" + this.main.getChatManager().getDelayAmount(), - "&fSlowed By: &b" + (this.main.getChatManager().getSlowedBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getSlowedBy()).getName()), - "&fLast Slowed: &b" + (this.main.getChatManager().getLastSlowedTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastSlowedTime())), + "&fDelay Amount: &3" + this.main.getChatManager().getDelayAmount(), + "&fSlowed By: &3" + (this.main.getChatManager().getSlowedBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getSlowedBy()).getName()), + "&fLast Slowed: &3" + (this.main.getChatManager().getLastSlowedTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastSlowedTime())), "", - "&bShift click to slow the chat for &3" + (this.delayAmount + " &bsecond" + (this.delayAmount > 1 ? "s" : "")), + "&bShift click to slow the chat for &3" + (this.delayAmount + " &3second" + (this.delayAmount > 1 ? "s" : "")), "", - "&fLeft Click: &b+1", - "&fRight Click: &b-1" + "&fLeft Click: &3+1", + "&fRight Click: &3-1" ) ), Material.SOUL_SAND, @@ -106,11 +106,11 @@ public class ChatManagementMenu extends Menu { ); ItemStackButton clearChatItemStackButton = new ItemStackButton( - ColorUtils.getMessageType("&bClear Chat"), + ColorUtils.getMessageType("&b&lClear Chat"), ColorUtils.getMessageType( Arrays.asList( - "&fCleared By: &b" + (this.main.getChatManager().getClearedBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getClearedBy()).getName()), - "&fLast Cleared: &b" + (this.main.getChatManager().getLastClearedTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastClearedTime())), + "&fCleared By: &3" + (this.main.getChatManager().getClearedBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getClearedBy()).getName()), + "&fLast Cleared: &3" + (this.main.getChatManager().getLastClearedTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastClearedTime())), "", "&bClick to clear the chat" ) diff --git a/src/main/java/com/loganmagnan/eventcore/menusystem/menus/EventManageMenu.java b/src/main/java/com/loganmagnan/eventcore/menusystem/menus/EventManageMenu.java new file mode 100644 index 0000000..d924db5 --- /dev/null +++ b/src/main/java/com/loganmagnan/eventcore/menusystem/menus/EventManageMenu.java @@ -0,0 +1,272 @@ +package com.loganmagnan.eventcore.menusystem.menus; + +import com.loganmagnan.eventcore.EventCore; +import com.loganmagnan.eventcore.managers.event.teams.Team; +import com.loganmagnan.eventcore.menusystem.ItemStackButton; +import com.loganmagnan.eventcore.menusystem.Menu; +import com.loganmagnan.eventcore.menusystem.PlayerMenuUtil; +import com.loganmagnan.eventcore.utils.ColorUtils; +import com.loganmagnan.eventcore.utils.CustomLocation; +import com.loganmagnan.eventcore.utils.Utils; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class EventManageMenu extends Menu { + + private EventCore main = EventCore.getInstance(); + + public EventManageMenu(PlayerMenuUtil playerMenuUtil) { + super(playerMenuUtil); + } + + @Override + public String getMenuName() { + return ColorUtils.getMessageType("&b&lEvent Management"); + } + + @Override + public int getSlots() { + return 54; + } + + @Override + public void handleMenu(InventoryClickEvent event) { + Player player = (Player) event.getWhoClicked(); + + if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType("&b&lEvent Management"))) { + switch (event.getCurrentItem().getType()) { + + } + + new EventManageMenu(this.playerMenuUtil).open(player); + } + } + + @Override + public void setMenuItems(Player player) { + List teamSpawnPoints = new ArrayList(); + List teamSpawnPointsLore = new ArrayList(); + + Material material = Material.RED_STAINED_GLASS_PANE; + + for (CustomLocation teamSpawnPoint : this.main.getEventManager().getEvent().getTeamSpawnPoints()) { + teamSpawnPoints.add("&3" + Math.floor(teamSpawnPoint.toBukkitLocation().getX()) + "&7, &3" + Math.floor(teamSpawnPoint.toBukkitLocation().getY()) + "&7, &3" + Math.floor(teamSpawnPoint.toBukkitLocation().getZ()) + " &7(&f" + teamSpawnPoint.toBukkitLocation().getWorld().getName() + "&7)"); + } + + if (teamSpawnPoints.size() == 0) { + teamSpawnPointsLore.add("&7» &3None"); + } else { + for (String teamSpawnPoint : teamSpawnPoints) { + teamSpawnPointsLore.add("&7» " + teamSpawnPoint); + } + } + + teamSpawnPointsLore.add(""); + teamSpawnPointsLore.add("&bClick to change"); + + ItemStackButton nameItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lName"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» &3" + this.main.getEventManager().getEvent().getName(), + "", + "&bClick to change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.NAME_TAG, + 0, + 1 + ); + + ItemStackButton spawnPointItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lSpawn Point"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» &3" + Math.floor(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getX()) + "&7, &3" + Math.floor(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getY()) + "&7, &3" + Math.floor(this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getZ()) + " &7(&f" + this.main.getEventManager().getEvent().getSpawnPoint().toBukkitLocation().getWorld().getName() + "&7)", + "", + "&fLeft Click: &3Teleport", + "&fRight Click: &3Change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.COMPASS, + 0, + 1 + ); + + ItemStackButton durationItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lDuration"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» &3" + Utils.makeTimeReadable(Utils.parseTime(this.main.getEventManager().getEvent().getDuration())), + "", + "&bClick to change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.CLOCK, + 0, + 1 + ); + + ItemStackButton amountOfTeamsItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lAmount of Teams"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» &3" + this.main.getEventManager().getEvent().getAmountOfTeams(), + "", + "&bClick to change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.BOOK, + 0, + 1 + ); + + ItemStackButton amountPerTeamItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lAmount Per Team"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» &3" + this.main.getEventManager().getEvent().getAmountPerTeam(), + "", + "&bClick to change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.PAPER, + 0, + 1 + ); + + ItemStackButton teamSpawnPointsItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lTeam Spawn Points"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + teamSpawnPointsLore + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.ENDER_EYE, + 0, + 1 + ); + + ItemStackButton scoreboardEnabledItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lScoreboard Enabled"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» " + (this.main.getEventManager().getEvent().isScoreboardEnabled() ? "&aYes" : "&cNo"), + "", + "&bClick to change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.PAINTING, + 0, + 1 + ); + + ItemStackButton timerEnabledItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lTimer Enabled"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» " + (this.main.getEventManager().getEvent().isTimerEnabled() ? "&aYes" : "&cNo"), + "", + "&bClick to change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.ANVIL, + 0, + 1 + ); + + ItemStackButton eventsEnabledItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lEvents Enabled"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&7» " + (this.main.getEventManager().getEvent().isEventsEnabled() ? "&aYes" : "&cNo"), + "", + "&b&lEvents", + "&7» " + (this.main.getEventManager().getEvent().isBlockPlaceEventEnabled() ? "&aBlockPlaceEvent" : "&cBlockPlaceEvent"), + "&7» " + (this.main.getEventManager().getEvent().isBlockBreakEventEnabled() ? "&aBlockBreakEvent" : "&cBlockBreakEvent"), + "", + "&fLeft Click: " + (this.main.getEventManager().getEvent().isEventsEnabled() ? "&cDisable" : "&aEnable"), + "&fRight Click: &3Change" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.DIAMOND, + 0, + 1 + ); + + ItemStackButton startItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&c&lAccess Denied" : "&b&lStart"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? new ArrayList() : + Arrays.asList( + "&bClick to start" + ) + ), + this.main.getEventManager().getEvent().isStarted() ? material : Material.LIME_WOOL, + 0, + 1 + ); + + ItemStackButton stopItemStackButton = new ItemStackButton( + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? "&b&lStop" : "&c&lAccess Denied"), + ColorUtils.getMessageType(this.main.getEventManager().getEvent().isStarted() ? + Arrays.asList( + "&bClick to stop" + ) : new ArrayList() + ), + this.main.getEventManager().getEvent().isStarted() ? Material.RED_WOOL : material, + 0, + 1 + ); + + ItemStackButton startedItemStackButton = new ItemStackButton( + ColorUtils.getMessageType("&b&lStarted"), + ColorUtils.getMessageType( + Arrays.asList( + "&7» " + (this.main.getEventManager().getEvent().isStarted() ? "&aYes" : "&cNo") + ) + ), + Material.NETHER_STAR, + 0, + 1 + ); + + ItemStack nameItemStack = nameItemStackButton.makeItemStack(); + ItemStack spawnPointItemStack = spawnPointItemStackButton.makeItemStack(); + ItemStack durationItemStack = durationItemStackButton.makeItemStack(); + ItemStack amountOfTeamsItemStack = amountOfTeamsItemStackButton.makeItemStack(); + ItemStack amountPerTeamItemStack = amountPerTeamItemStackButton.makeItemStack(); + ItemStack teamSpawnPointsItemStack = teamSpawnPointsItemStackButton.makeItemStack(); + ItemStack scoreboardEnabledItemStack = scoreboardEnabledItemStackButton.makeItemStack(); + ItemStack timerEnabledItemStack = timerEnabledItemStackButton.makeItemStack(); + ItemStack eventsEnabledItemStack = eventsEnabledItemStackButton.makeItemStack(); + ItemStack startItemStack = startItemStackButton.makeItemStack(); + ItemStack stopItemStack = stopItemStackButton.makeItemStack(); + ItemStack startedItemStack = startedItemStackButton.makeItemStack(); + + this.setFillerGlass(); + this.inventory.setItem(10, new ItemStackButton(ColorUtils.getMessageType("&b&lGeneral Information"), new ArrayList(), Material.OAK_SIGN, 0, 1).makeItemStack()); + this.inventory.setItem(11, new ItemStackButton(ColorUtils.getMessageType(""), new ArrayList(), Material.WHITE_STAINED_GLASS_PANE, 0, 1).makeItemStack()); + this.inventory.setItem(12, nameItemStack); + this.inventory.setItem(13, spawnPointItemStack); + this.inventory.setItem(14, durationItemStack); + this.inventory.setItem(19, new ItemStackButton(ColorUtils.getMessageType("&b&lTeams Information"), new ArrayList(), Material.OAK_SIGN, 0, 1).makeItemStack()); + this.inventory.setItem(20, new ItemStackButton(ColorUtils.getMessageType(""), new ArrayList(), Material.WHITE_STAINED_GLASS_PANE, 0, 1).makeItemStack()); + this.inventory.setItem(21, amountOfTeamsItemStack); + this.inventory.setItem(22, amountPerTeamItemStack); + this.inventory.setItem(23, teamSpawnPointsItemStack); + this.inventory.setItem(28, new ItemStackButton(ColorUtils.getMessageType("&b&lToggleable Settings"), new ArrayList(), Material.OAK_SIGN, 0, 1).makeItemStack()); + this.inventory.setItem(29, new ItemStackButton(ColorUtils.getMessageType(""), new ArrayList(), Material.WHITE_STAINED_GLASS_PANE, 0, 1).makeItemStack()); + this.inventory.setItem(30, scoreboardEnabledItemStack); + this.inventory.setItem(31, timerEnabledItemStack); + this.inventory.setItem(32, eventsEnabledItemStack); + this.inventory.setItem(37, new ItemStackButton(ColorUtils.getMessageType("&b&lManagement Settings"), new ArrayList(), Material.OAK_SIGN, 0, 1).makeItemStack()); + this.inventory.setItem(38, new ItemStackButton(ColorUtils.getMessageType(""), new ArrayList(), Material.WHITE_STAINED_GLASS_PANE, 0, 1).makeItemStack()); + this.inventory.setItem(39, startItemStack); + this.inventory.setItem(40, stopItemStack); + this.inventory.setItem(41, startedItemStack); + } +} diff --git a/src/main/java/com/loganmagnan/eventcore/utils/Constants.java b/src/main/java/com/loganmagnan/eventcore/utils/Constants.java index 9338e8b..5d0a3ae 100644 --- a/src/main/java/com/loganmagnan/eventcore/utils/Constants.java +++ b/src/main/java/com/loganmagnan/eventcore/utils/Constants.java @@ -33,6 +33,9 @@ public class Constants { COMMAND_MESSAGES.put("bypass-mode.enabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.BYPASS-MODE.ENABLED"))); COMMAND_MESSAGES.put("bypass-mode.disabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.BYPASS-MODE.DISABLED"))); + // /event + COMMAND_MESSAGES.put("event.help", this.main.getMessagesConfig().getConfig().getStringList("MESSAGES.COMMANDS.EVENT.HELP")); + // AsyncPlayerChatEvent LISTENER_MESSAGES.put("chat-muted", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.LISTENERS.CHAT-MUTED"))); LISTENER_MESSAGES.put("chat-cooldown", this.main.getMessagesConfig().getConfig().getStringList("MESSAGES.LISTENERS.CHAT-COOLDOWN")); diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 1c0c413..ada4984 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -22,6 +22,16 @@ MESSAGES: BYPASS-MODE: # Permission Node - eventcore.command.bypassmode ENABLED: "&bYou've &aenabled &bbypass mode" DISABLED: "&bYou've &cdisabled &bbypass mode" + EVENT: # Permission Node - eventcore.command.event + HELP: + - "%line%" + - "&bEvent Commands" + - "%line%" + - "&7⚫ &9/event &7- &eList of commands" + - "&7⚫ &9/event start &7- &eStart the event" + - "&7⚫ &9/event stop &7- &eStop the event" + - "&7⚫ &9/event manage &7- &eManagement menu" + - "%line%" LISTENERS: CHAT-MUTED: "&cChat is muted" CHAT-COOLDOWN: