This commit is contained in:
Trixkz 2021-11-24 12:04:12 -05:00
parent 248d378161
commit 71915af23b
3 changed files with 14 additions and 9 deletions

View File

@ -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!");

View File

@ -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());
}
}

View File

@ -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;
}