This commit is contained in:
Trixkz 2021-11-24 12:14:14 -05:00
parent 71915af23b
commit db09e4b59b

View File

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