diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b23d28b..5be159c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -23,11 +23,12 @@ - - - - + + + + + \ No newline at end of file diff --git a/src/main/java/rip/tilly/bedwars/game/GameType.java b/src/main/java/rip/tilly/bedwars/game/GameType.java index 414e6cb..abd28a7 100644 --- a/src/main/java/rip/tilly/bedwars/game/GameType.java +++ b/src/main/java/rip/tilly/bedwars/game/GameType.java @@ -11,16 +11,16 @@ import java.util.List; @RequiredArgsConstructor public enum GameType { - V1(10, "1v1", Arrays.asList(" ", "&9You have to start somewhere,", "&9so why not start here?"), + V1(10, "BedWars 1v1", Arrays.asList(" ", "&9You have to start somewhere,", "&9so why not start here?"), Material.WOOD_SWORD, 0, 2), - V2(12, "2v2", Arrays.asList(" ", "&9Adapt, overcome and conquer,", "&9you are advancing rapidly."), + V2(12, "BedWars 2v2", Arrays.asList(" ", "&9Adapt, overcome and conquer,", "&9you are advancing rapidly"), Material.STONE_SWORD, 0, 4), - V3(14, "3v3", Arrays.asList(" ", "&9How crazy is this, it seems", "&9like it was just yesterday", "&9since you started."), + V3(14, "BedWars 3v3", Arrays.asList(" ", "&9How crazy is this,", "&9it seems like it was just yesterday", "&9since you started"), Material.IRON_SWORD, 0, 6), - V4(16, "4v4", Arrays.asList(" ", "&9You are now a master of BedWars,", "&9you are now capable of going", "&9up against the undefeated PvP Bot", "&7(Coming soon...)"), + V4(16, "BedWars 4v4", Arrays.asList(" ", "&9You are now a master,", "&9you can go up against", "&9the undefeated PvP bot &7(Coming soon)"), Material.DIAMOND_SWORD, 0, 8); private final int slot; diff --git a/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java b/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java index c332db5..b291cd7 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java @@ -10,10 +10,8 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.material.TrapDoor; import rip.tilly.bedwars.BedWars; -import rip.tilly.bedwars.game.GameType; import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem; -import rip.tilly.bedwars.menus.queue.QueueMenu; -import rip.tilly.bedwars.menusystem.menu.PlayAGameMenu; +import rip.tilly.bedwars.menus.queue.PlayAGameMenu; import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; @@ -77,10 +75,7 @@ public class InteractListener implements Listener { case SPAWN: switch (hotbarItem.getActionType()) { case QUEUE_MENU: - new QueueMenu().openMenu(player); -// for (GameType gameType : GameType.values()) { -// new PlayAGameMenu(this.plugin.getPlayerMenuUtil(player), gameType).open(); -// } + new PlayAGameMenu().openMenu(player); break; case SETTINGS_MENU: @@ -101,7 +96,7 @@ public class InteractListener implements Listener { // open party games menu break; case PARTY_INFO: - player.performCommand("party info"); + player.chat("/party info"); break; case PARTY_LEAVE: diff --git a/src/main/java/rip/tilly/bedwars/menus/queue/QueueMenu.java b/src/main/java/rip/tilly/bedwars/menus/queue/PlayAGameMenu.java similarity index 74% rename from src/main/java/rip/tilly/bedwars/menus/queue/QueueMenu.java rename to src/main/java/rip/tilly/bedwars/menus/queue/PlayAGameMenu.java index eee350a..0d9a5c0 100644 --- a/src/main/java/rip/tilly/bedwars/menus/queue/QueueMenu.java +++ b/src/main/java/rip/tilly/bedwars/menus/queue/PlayAGameMenu.java @@ -17,7 +17,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class QueueMenu extends Menu { +public class PlayAGameMenu extends Menu { @Override public boolean isUpdateAfterClick() { @@ -34,17 +34,17 @@ public class QueueMenu extends Menu { Map buttons = new HashMap<>(); for (GameType type : GameType.values()) { - buttons.put(type.getSlot(), new QueueButton("&d&l" + type.getName(), type.getLore(), type, type.getMaterial(), type.getData())); + buttons.put(type.getSlot(), new QueueButton("&d" + type.getName(), type.getLore(), type, type.getMaterial(), type.getData())); } - fillEmptySlots(buttons, new ItemBuilder(Material.STAINED_GLASS_PANE).durability(7).name(" ").build()); + fillEmptySlots(buttons, new ItemBuilder(Material.STAINED_GLASS_PANE).durability(7).name("").build()); return buttons; } @Override public int getSize() { - return 3 * 9; + return 27; } @AllArgsConstructor @@ -62,19 +62,12 @@ public class QueueMenu extends Menu { loreList.add(" "); loreList.add("&fPlaying: &b" + BedWars.getInstance().getGameManager().getPlayingByType(gameType)); - return new ItemBuilder(material) - .name(name) - .durability(data) - .amount(BedWars.getInstance().getGameManager().getPlayingByType(gameType) > 0 ? BedWars.getInstance().getGameManager().getPlayingByType(gameType) : 1) - .lore(loreList) - .hideFlags() - .build(); + return new ItemBuilder(material).name(name).durability(data).amount(BedWars.getInstance().getGameManager().getPlayingByType(gameType) > 0 ? BedWars.getInstance().getGameManager().getPlayingByType(gameType) : 1).lore(loreList).build(); } @Override public void clicked(Player player, int slot, ClickType clickType, int hotbarButton) { BedWars.getInstance().getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), gameType); - playNeutral(player); } } } diff --git a/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java b/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java deleted file mode 100644 index 3657653..0000000 --- a/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java +++ /dev/null @@ -1,98 +0,0 @@ -package rip.tilly.bedwars.menusystem.menu; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemStack; -import rip.tilly.bedwars.BedWars; -import rip.tilly.bedwars.game.GameType; -import rip.tilly.bedwars.menusystem.Menu; -import rip.tilly.bedwars.menusystem.PlayerMenuUtil; -import rip.tilly.bedwars.utils.CC; -import rip.tilly.bedwars.utils.ItemBuilder; - -import java.util.ArrayList; -import java.util.List; - -public class PlayAGameMenu extends Menu { - - private BedWars main = BedWars.getInstance(); - - private GameType gameType; - - public PlayAGameMenu(PlayerMenuUtil playerMenuUtil, GameType gameType) { - super(playerMenuUtil); - - this.gameType = gameType; - } - - @Override - public String getMenuName() { - return CC.translate("&eSelect a game to play..."); - } - - @Override - public int getSlots() { - return 27; - } - - @Override - public void handleMenu(InventoryClickEvent event) { - Player player = (Player) event.getWhoClicked(); - - if (event.getView().getTitle().equalsIgnoreCase(CC.translate("&eSelect a game to play..."))) { - this.main.getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), this.gameType); - - player.closeInventory(); - } - } - - @Override - public void setMenuItems() { - List bedWars1v1Lore = new ArrayList(); - bedWars1v1Lore.add(CC.translate("")); - bedWars1v1Lore.add(CC.translate("&9You have to start somewhere,")); - bedWars1v1Lore.add(CC.translate("&9so why not start here?")); - bedWars1v1Lore.add(CC.translate("")); - bedWars1v1Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType))); - - ItemStack bedWars1v1ItemStack = new ItemBuilder(Material.WOOD_SWORD).name(CC.translate("&dBedWars 1v1")).lore(bedWars1v1Lore).build(); - - List bedWars2v2Lore = new ArrayList(); - bedWars2v2Lore.add(CC.translate("")); - bedWars2v2Lore.add(CC.translate("&9Adapt, overcome, and conquer,")); - bedWars2v2Lore.add(CC.translate("&9you are advancing rapidly")); - bedWars2v2Lore.add(CC.translate("")); - bedWars2v2Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType))); - - ItemStack bedWars2v2ItemStack = new ItemBuilder(Material.STONE_SWORD).name(CC.translate("&dBedWars 2v2")).lore(bedWars2v2Lore).build(); - - List bedWars3v3Lore = new ArrayList(); - bedWars3v3Lore.add(CC.translate("")); - bedWars3v3Lore.add(CC.translate("&9How crazy is this,")); - bedWars3v3Lore.add(CC.translate("&9it seems like it was just yesterday")); - bedWars3v3Lore.add(CC.translate("&9since you started")); - bedWars3v3Lore.add(CC.translate("")); - bedWars3v3Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType))); - - - ItemStack bedWars3v3ItemStack = new ItemBuilder(Material.IRON_SWORD).name(CC.translate("&dBedWars 3v3")).lore(bedWars3v3Lore).build(); - - List bedWars4v4Lore = new ArrayList(); - bedWars4v4Lore.add(CC.translate("")); - bedWars4v4Lore.add(CC.translate("&9You are now a master,")); - bedWars4v4Lore.add(CC.translate("&9you can go up against")); - bedWars4v4Lore.add(CC.translate("&9the undefeated PvP bot &7(Coming soon)")); - bedWars4v4Lore.add(CC.translate("")); - bedWars4v4Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType))); - - ItemStack bedWars4v4ItemStack = new ItemBuilder(Material.DIAMOND_SWORD).name(CC.translate("&dBedWars 4v4")).lore(bedWars4v4Lore).build(); - - this.inventory.setItem(10, bedWars1v1ItemStack); - this.inventory.setItem(12, bedWars2v2ItemStack); - this.inventory.setItem(14, bedWars3v3ItemStack); - this.inventory.setItem(16, bedWars4v4ItemStack); - - this.setFillerGlass(); - } -} diff --git a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java index c066e29..6818622 100644 --- a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java +++ b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java @@ -51,6 +51,7 @@ public class ScoreboardProvider implements AssembleAdapter { if (this.main.getPartyManager().getParty(playerData.getUniqueId()) != null) { Party party = this.main.getPartyManager().getParty(playerData.getUniqueId()); + lines.add("&9Party Leader: &d" + Bukkit.getPlayer(party.getLeader()).getName()); lines.add("&9Party Members: &d" + party.getMembers().size() + "&7/&d" + party.getLimit()); lines.add(CC.scoreboardBar); @@ -58,9 +59,12 @@ public class ScoreboardProvider implements AssembleAdapter { if (playerData.getPlayerState() == PlayerState.QUEUE) { QueueEntry queueEntry = this.main.getQueueManager().getQueueEntry(playerData.getUniqueId()); + if (queueEntry != null) { long queueTime = System.currentTimeMillis() - (this.main.getQueueManager().getPlayerQueueTime(playerData.getUniqueId())); + String formattedQueueTime = TimeUtils.formatIntoMMSS(Math.round(queueTime / 1000L)); + lines.add("&e" + queueEntry.getGameType().getName() + " Queue"); lines.add("&fTime: &d" + formattedQueueTime); lines.add(CC.scoreboardBar);