From 71915af23beb9fb02543f102b0973886afc4f412 Mon Sep 17 00:00:00 2001 From: Trixkz Date: Wed, 24 Nov 2021 12:04:12 -0500 Subject: [PATCH] t --- .../bedwars/listeners/game/GameEndListener.java | 6 ++++++ .../currentgame/PlayerCurrentGameData.java | 12 ++++++------ .../bedwars/utils/menusystem/menu/UpgradesMenu.java | 5 ++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java index 2fd6311..a1a3daf 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java @@ -11,6 +11,7 @@ import rip.tilly.bedwars.game.GameState; import rip.tilly.bedwars.game.GameTeam; import rip.tilly.bedwars.generators.Generator; import rip.tilly.bedwars.playerdata.PlayerData; +import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.PlayerUtil; @@ -37,10 +38,15 @@ public class GameEndListener implements Listener { PlayerUtil.clearPlayer(player); PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId()); + + PlayerCurrentGameData playerCurrentGameData = playerData.getCurrentGameData(); + playerData.setLastDamager(null); playerData.getCurrentGameData().setGameKills(0); playerData.getCurrentGameData().setGameBedsDestroyed(0); + playerCurrentGameData.getUpgrades().clear(); + String winnerTitle = CC.translate("&aVICTORY!"); String losingTitle = CC.translate("&cDEFEAT!"); String subTitle = CC.translate(winningTeam.getPlayerTeam().getChatColor() + winningTeam.getPlayerTeam().getName() + " &fhas won the game!"); diff --git a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java index c72c605..3d88011 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java @@ -151,14 +151,14 @@ public class PlayerCurrentGameData { GameTeam gameTeam = game.getTeams().get(playerData.getTeamId()); - player.getInventory().setHelmet((new ItemBuilder(Material.LEATHER_HELMET)).durability(gameTeam.getPlayerTeam().getColorData()).addEnchantments(protection).build()); - player.getInventory().setChestplate((new ItemBuilder(Material.LEATHER_CHESTPLATE)).durability(gameTeam.getPlayerTeam().getColorData()).addEnchantments(protection).build()); + player.getInventory().setHelmet((new ItemBuilder(Material.LEATHER_HELMET)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); + player.getInventory().setChestplate((new ItemBuilder(Material.LEATHER_CHESTPLATE)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); ArmorType armorType = this.getArmorType(player); if (armorType == ArmorType.LEATHER) { - player.getInventory().setLeggings((new ItemBuilder(Material.LEATHER_LEGGINGS)).durability(gameTeam.getPlayerTeam().getColorData()).addEnchantments(protection).build()); - player.getInventory().setBoots((new ItemBuilder(Material.LEATHER_BOOTS)).durability(gameTeam.getPlayerTeam().getColorData()).addEnchantments(protection).build()); + player.getInventory().setLeggings((new ItemBuilder(Material.LEATHER_LEGGINGS)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); + player.getInventory().setBoots((new ItemBuilder(Material.LEATHER_BOOTS)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); return; } @@ -183,7 +183,7 @@ public class PlayerCurrentGameData { return; } - player.getInventory().setLeggings((new ItemBuilder(leggingsMaterial)).durability(gameTeam.getPlayerTeam().getColorData()).addEnchantments(protection).build()); - player.getInventory().setBoots((new ItemBuilder(bootsMaterial)).durability(gameTeam.getPlayerTeam().getColorData()).addEnchantments(protection).build()); + player.getInventory().setLeggings((new ItemBuilder(leggingsMaterial)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); + player.getInventory().setBoots((new ItemBuilder(bootsMaterial)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); } } diff --git a/src/main/java/rip/tilly/bedwars/utils/menusystem/menu/UpgradesMenu.java b/src/main/java/rip/tilly/bedwars/utils/menusystem/menu/UpgradesMenu.java index 021dc1d..37d191d 100644 --- a/src/main/java/rip/tilly/bedwars/utils/menusystem/menu/UpgradesMenu.java +++ b/src/main/java/rip/tilly/bedwars/utils/menusystem/menu/UpgradesMenu.java @@ -16,7 +16,6 @@ import rip.tilly.bedwars.utils.menusystem.PlayerMenuUtil; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import java.util.logging.Level; public class UpgradesMenu extends Menu { @@ -55,8 +54,8 @@ public class UpgradesMenu extends Menu { PlayerCurrentGameData playerCurrentGameData = playerData.getCurrentGameData(); Game game = this.main.getGameManager().getGame(player.getUniqueId()); + if (game == null) { - this.main.getLogger().log(Level.INFO, "GAME == NULL"); return; } @@ -74,7 +73,7 @@ public class UpgradesMenu extends Menu { if (upgradeItem.canBuy(player, playerCurrentGameData.getLevelForUpgrade(upgradeItem.getUpgrade()) + 1)) { upgradeItem.buy(player, playerCurrentGameData.getLevelForUpgrade(upgradeItem.getUpgrade()) + 1, game, gameTeam, playerCurrentGameData); - player.updateInventory(); + new UpgradesMenu(this.main.getPlayerMenuUtil(player)).open(player); break; }