From db09e4b59be5eefa6b7c49f9d2550859516a0318 Mon Sep 17 00:00:00 2001 From: Trixkz Date: Wed, 24 Nov 2021 12:14:14 -0500 Subject: [PATCH] t --- .../tilly/bedwars/runnables/RespawnRunnable.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java b/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java index 7b2a75e..c5fa64b 100644 --- a/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java +++ b/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java @@ -1,7 +1,9 @@ package rip.tilly.bedwars.runnables; import lombok.AllArgsConstructor; +import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -51,19 +53,27 @@ public class RespawnRunnable extends BukkitRunnable { this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F); // this.player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(this.playerData, this.playerData.getPlayerTeam().getTeamUpgrades())); - for (ItemStack stack : this.plugin.getGameManager().getGameItems(this.playerData.getCurrentGameData(), this.playerData.getPlayerTeam().getTeamUpgrades())) { - this.player.getInventory().addItem(stack); - } +// for (ItemStack stack : this.plugin.getGameManager().getGameItems(this.playerData.getCurrentGameData(), this.playerData.getPlayerTeam().getTeamUpgrades())) { +// this.player.getInventory().addItem(stack); +// } PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(this.player.getUniqueId()); PlayerCurrentGameData playerCurrentGameData = playerData.getCurrentGameData(); playerCurrentGameData.giveTeamArmor(this.player, playerCurrentGameData); + ItemStack itemStack = new ItemStack(Material.WOOD_SWORD, 1); + + if (playerCurrentGameData.getLevelForUpgrade(Upgrade.SHARPENED_SWORDS) == 1) { + itemStack.addEnchantment(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); + 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!"))));