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 3d88011..6325a45 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)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); - player.getInventory().setChestplate((new ItemBuilder(Material.LEATHER_CHESTPLATE)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).build()); + player.getInventory().setHelmet((new ItemBuilder(Material.LEATHER_HELMET)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).addUnbreakable().build()); + player.getInventory().setChestplate((new ItemBuilder(Material.LEATHER_CHESTPLATE)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).addUnbreakable().build()); ArmorType armorType = this.getArmorType(player); if (armorType == ArmorType.LEATHER) { - 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()); + player.getInventory().setLeggings((new ItemBuilder(Material.LEATHER_LEGGINGS)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).addUnbreakable().build()); + player.getInventory().setBoots((new ItemBuilder(Material.LEATHER_BOOTS)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).addUnbreakable().build()); return; } @@ -183,7 +183,7 @@ public class PlayerCurrentGameData { return; } - 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()); + player.getInventory().setLeggings((new ItemBuilder(leggingsMaterial)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).addUnbreakable().build()); + player.getInventory().setBoots((new ItemBuilder(bootsMaterial)).color(gameTeam.getPlayerTeam().getColor()).addEnchantments(protection).addUnbreakable().build()); } } diff --git a/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java b/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java index c5fa64b..ed26124 100644 --- a/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java +++ b/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java @@ -19,6 +19,7 @@ import rip.tilly.bedwars.playerdata.PlayerState; import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.upgrades.Upgrade; import rip.tilly.bedwars.utils.CC; +import rip.tilly.bedwars.utils.ItemBuilder; @AllArgsConstructor public class RespawnRunnable extends BukkitRunnable { @@ -62,17 +63,17 @@ public class RespawnRunnable extends BukkitRunnable { PlayerCurrentGameData playerCurrentGameData = playerData.getCurrentGameData(); playerCurrentGameData.giveTeamArmor(this.player, playerCurrentGameData); - ItemStack itemStack = new ItemStack(Material.WOOD_SWORD, 1); + ItemBuilder itemBuilder = new ItemBuilder(Material.WOOD_SWORD).addUnbreakable(); if (playerCurrentGameData.getLevelForUpgrade(Upgrade.SHARPENED_SWORDS) == 1) { - itemStack.addEnchantment(Enchantment.DAMAGE_ALL, 1); + itemBuilder.enchantment(Enchantment.DAMAGE_ALL, 1); } if (playerCurrentGameData.getLevelForUpgrade(Upgrade.MANIAC_MINER) != 0) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1000000, playerCurrentGameData.getLevelForUpgrade(Upgrade.MANIAC_MINER))); } - player.getInventory().addItem(itemStack); + player.getInventory().addItem(itemBuilder.build()); this.game.getTeams().forEach(team -> team.playingPlayers().filter(player1 -> !this.player.equals(player1)) .forEach(matchplayer -> matchplayer.sendMessage(CC.translate(this.gameTeam.getPlayerTeam().getChatColor() + this.player.getName() + " &ehas respawned!"))));