diff --git a/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java b/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java index 2b61a4f..ca9740b 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java @@ -125,7 +125,7 @@ public class InteractListener implements Listener { // open player tracker menu break; case SPECTATOR_LEAVE: - // leave spectator mode + this.plugin.getGameManager().removeSpectator(player); break; } break; diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java index 8be2c64..205cf6a 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java @@ -86,8 +86,8 @@ public class GameStartListener implements Listener { player.teleport(team.getId() == 1 ? locationA.toBukkitLocation() : locationB.toBukkitLocation()); - player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData)); - for (ItemStack stack : this.plugin.getGameManager().getGameItems(playerData.getCurrentGameData())) { + player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData, playerData.getPlayerTeam().getTeamUpgrades())); + for (ItemStack stack : this.plugin.getGameManager().getGameItems(playerData.getCurrentGameData(), playerData.getPlayerTeam().getTeamUpgrades())) { player.getInventory().addItem(stack); } })); diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/PlayerKillListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/PlayerKillListener.java index 020161b..0309182 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/PlayerKillListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/PlayerKillListener.java @@ -9,6 +9,7 @@ import rip.tilly.bedwars.game.Game; import rip.tilly.bedwars.game.GameTeam; import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; +import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.runnables.RespawnRunnable; public class PlayerKillListener implements Listener { @@ -38,6 +39,14 @@ public class PlayerKillListener implements Listener { PlayerData killerData = this.plugin.getPlayerDataManager().getPlayerData(killer.getUniqueId()); killerData.addRandomXp(killer); + PlayerCurrentGameData currentGameData = playerData.getCurrentGameData(); + if (currentGameData.getAxeLevel() > 0) { + currentGameData.setAxeLevel(currentGameData.getAxeLevel() - 1); + } + if (currentGameData.getPickaxeLevel() > 0) { + currentGameData.setPickaxeLevel(currentGameData.getPickaxeLevel() - 1); + } + game.broadcast(playerData.getPlayerTeam().getChatColor() + player.getName() + " &ewas killed by " + killerData.getPlayerTeam().getChatColor() + killer.getName() + "&e!"); } else { game.broadcast(playerData.getPlayerTeam().getChatColor() + player.getName() + " &efell into the void!"); diff --git a/src/main/java/rip/tilly/bedwars/managers/GameManager.java b/src/main/java/rip/tilly/bedwars/managers/GameManager.java index dbc0a4e..69d8bcf 100644 --- a/src/main/java/rip/tilly/bedwars/managers/GameManager.java +++ b/src/main/java/rip/tilly/bedwars/managers/GameManager.java @@ -3,6 +3,7 @@ package rip.tilly.bedwars.managers; import lombok.Getter; import org.bukkit.Color; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -17,7 +18,9 @@ import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem; import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; +import rip.tilly.bedwars.playerdata.currentgame.TeamUpgrades; import rip.tilly.bedwars.utils.ItemBuilder; +import rip.tilly.bedwars.utils.ItemUtil; import rip.tilly.bedwars.utils.PlayerUtil; import rip.tilly.bedwars.utils.TtlHashMap; @@ -210,44 +213,282 @@ public class GameManager { this.plugin.getPlayerDataManager().resetPlayer(player, true); } - public List getGameItems(PlayerCurrentGameData currentGameData) { + public List getGameItems(PlayerCurrentGameData currentGameData, TeamUpgrades teamUpgrades) { List allItems = new ArrayList<>(); - ItemStack sword = new ItemBuilder(Material.WOOD_SWORD).build(); + ItemStack sword = new ItemBuilder(Material.WOOD_SWORD).addUnbreakable().build(); + if (teamUpgrades.isSharpenedSwords()) { + sword = new ItemBuilder(Material.WOOD_SWORD).enchantment(Enchantment.DAMAGE_ALL, 1).addUnbreakable().build(); + } allItems.add(sword); if (currentGameData.isShears()) { - ItemStack shears = new ItemBuilder(Material.SHEARS).build(); + ItemStack shears = new ItemBuilder(Material.SHEARS).addUnbreakable().build(); allItems.add(shears); } + ItemStack axe = null; if (currentGameData.getAxeLevel() > 0) { - if (currentGameData.getAxeLevel() == 1) { - + switch (currentGameData.getAxeLevel()) { + case 1: + axe = new ItemBuilder(Material.WOOD_AXE).enchantment(Enchantment.DIG_SPEED, 1).addUnbreakable().build(); + break; + case 2: + axe = new ItemBuilder(Material.STONE_AXE).enchantment(Enchantment.DIG_SPEED, 1).addUnbreakable().build(); + break; + case 3: + axe = new ItemBuilder(Material.IRON_AXE).enchantment(Enchantment.DIG_SPEED, 2).addUnbreakable().build(); + break; + case 4: + axe = new ItemBuilder(Material.DIAMOND_AXE).enchantment(Enchantment.DIG_SPEED, 3).addUnbreakable().build(); + break; + default: + axe = null; + break; } - if (currentGameData.getAxeLevel() == 1) { - - } - if (currentGameData.getAxeLevel() == 1) { - - } - if (currentGameData.getAxeLevel() == 1) { + } + if (axe != null) { + allItems.add(axe); + } + ItemStack pickaxe = null; + if (currentGameData.getPickaxeLevel() > 0) { + switch (currentGameData.getPickaxeLevel()) { + case 1: + pickaxe = new ItemBuilder(Material.WOOD_PICKAXE).enchantment(Enchantment.DIG_SPEED, 1).addUnbreakable().build(); + break; + case 2: + pickaxe = new ItemBuilder(Material.IRON_PICKAXE).enchantment(Enchantment.DIG_SPEED, 2).addUnbreakable().build(); + break; + case 3: + pickaxe = new ItemBuilder(Material.GOLD_PICKAXE).enchantment(Enchantment.DIG_SPEED, 3).enchantment(Enchantment.DAMAGE_ALL, 2).addUnbreakable().build(); + break; + case 4: + pickaxe = new ItemBuilder(Material.DIAMOND_PICKAXE).enchantment(Enchantment.DIG_SPEED, 3).addUnbreakable().build(); + break; + default: + pickaxe = null; + break; } } + if (pickaxe != null) { + allItems.add(pickaxe); + } return allItems; } - public ItemStack[] getGameArmor(PlayerData playerData) { + public ItemStack[] getGameArmor(PlayerData playerData, TeamUpgrades teamUpgrades) { Color color = playerData.getPlayerTeam().getColor(); + PlayerCurrentGameData currentGameData = playerData.getCurrentGameData(); - return new ItemStack[] { - new ItemBuilder(Material.LEATHER_BOOTS).color(color).build(), - new ItemBuilder(Material.LEATHER_LEGGINGS).color(color).build(), - new ItemBuilder(Material.LEATHER_CHESTPLATE).color(color).build(), - new ItemBuilder(Material.LEATHER_HELMET).color(color).build() - }; + ItemStack leatherBoots = new ItemBuilder(Material.LEATHER_BOOTS).color(color).addUnbreakable().build(); + ItemStack leatherLeggings = new ItemBuilder(Material.LEATHER_LEGGINGS).color(color).addUnbreakable().build(); + ItemStack leatherChestplate = new ItemBuilder(Material.LEATHER_CHESTPLATE).color(color).addUnbreakable().build(); + ItemStack leatherHelmet = new ItemBuilder(Material.LEATHER_HELMET).color(color).addUnbreakable().build(); + ItemStack chainBoots = new ItemBuilder(Material.CHAINMAIL_BOOTS).addUnbreakable().build(); + ItemStack chainLeggings = new ItemBuilder(Material.CHAINMAIL_LEGGINGS).addUnbreakable().build(); + ItemStack ironBoots = new ItemBuilder(Material.IRON_BOOTS).addUnbreakable().build(); + ItemStack ironLeggings = new ItemBuilder(Material.IRON_LEGGINGS).addUnbreakable().build(); + ItemStack diamondBoots = new ItemBuilder(Material.DIAMOND_BOOTS).addUnbreakable().build(); + ItemStack diamondLeggings = new ItemBuilder(Material.DIAMOND_LEGGINGS).addUnbreakable().build(); + + switch (teamUpgrades.getArmorLevel()) { + case 0: + switch (currentGameData.getArmorType()) { + case LEATHER: + return new ItemStack[]{ + leatherBoots, + leatherLeggings, + leatherChestplate, + leatherHelmet + }; + case CHAIN: + return new ItemStack[]{ + chainBoots, + chainLeggings, + leatherChestplate, + leatherHelmet + }; + case IRON: + return new ItemStack[]{ + ironBoots, + ironLeggings, + leatherChestplate, + leatherHelmet + }; + case DIAMOND: + return new ItemStack[]{ + diamondBoots, + diamondLeggings, + leatherChestplate, + leatherHelmet + }; + } + break; + case 1: + switch (currentGameData.getArmorType()) { + case LEATHER: + return new ItemStack[]{ + ItemUtil.reEnchantItem(leatherBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + }; + case CHAIN: + return new ItemStack[]{ + ItemUtil.reEnchantItem(chainBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(chainLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + }; + case IRON: + return new ItemStack[]{ + ItemUtil.reEnchantItem(ironBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(ironLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + }; + case DIAMOND: + return new ItemStack[]{ + ItemUtil.reEnchantItem(diamondBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(diamondLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 1, true), + }; + } + break; + case 2: + switch (currentGameData.getArmorType()) { + case LEATHER: + return new ItemStack[]{ + ItemUtil.reEnchantItem(leatherBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + }; + case CHAIN: + return new ItemStack[]{ + ItemUtil.reEnchantItem(chainBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(chainLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + }; + case IRON: + return new ItemStack[]{ + ItemUtil.reEnchantItem(ironBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(ironLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + }; + case DIAMOND: + return new ItemStack[]{ + ItemUtil.reEnchantItem(diamondBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(diamondLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 2, true), + }; + } + break; + case 3: + switch (currentGameData.getArmorType()) { + case LEATHER: + return new ItemStack[]{ + ItemUtil.reEnchantItem(leatherBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + }; + case CHAIN: + return new ItemStack[]{ + ItemUtil.reEnchantItem(chainBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(chainLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + }; + case IRON: + return new ItemStack[]{ + ItemUtil.reEnchantItem(ironBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(ironLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + }; + case DIAMOND: + return new ItemStack[]{ + ItemUtil.reEnchantItem(diamondBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(diamondLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 3, true), + }; + } + break; + case 4: + switch (currentGameData.getArmorType()) { + case LEATHER: + return new ItemStack[]{ + ItemUtil.reEnchantItem(leatherBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + }; + case CHAIN: + return new ItemStack[]{ + ItemUtil.reEnchantItem(chainBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(chainLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + }; + case IRON: + return new ItemStack[]{ + ItemUtil.reEnchantItem(ironBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(ironLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + }; + case DIAMOND: + return new ItemStack[]{ + ItemUtil.reEnchantItem(diamondBoots, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(diamondLeggings, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherChestplate, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + ItemUtil.reEnchantItem(leatherHelmet, Enchantment.PROTECTION_ENVIRONMENTAL, 4, true), + }; + } + break; + default: + switch (currentGameData.getArmorType()) { + case LEATHER: + return new ItemStack[]{ + leatherBoots, + leatherLeggings, + leatherChestplate, + leatherHelmet + }; + case CHAIN: + return new ItemStack[]{ + chainBoots, + chainLeggings, + leatherChestplate, + leatherHelmet + }; + case IRON: + return new ItemStack[]{ + ironBoots, + ironLeggings, + leatherChestplate, + leatherHelmet + }; + case DIAMOND: + return new ItemStack[]{ + diamondBoots, + diamondLeggings, + leatherChestplate, + leatherHelmet + }; + } + break; + } + + return null; } public void clearBlocks(Game game) { diff --git a/src/main/java/rip/tilly/bedwars/playerdata/PlayerTeam.java b/src/main/java/rip/tilly/bedwars/playerdata/PlayerTeam.java index 62d3598..c20c8ed 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/PlayerTeam.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/PlayerTeam.java @@ -3,6 +3,7 @@ package rip.tilly.bedwars.playerdata; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.Color; +import rip.tilly.bedwars.playerdata.currentgame.TeamUpgrades; import java.util.Arrays; @@ -29,6 +30,7 @@ public enum PlayerTeam { private final ChatColor chatColor; private final int colorData; private final String smallName; + private TeamUpgrades teamUpgrades; PlayerTeam(String name, Color color, ChatColor chatColor, int colorData, String smallName) { this.name = name; @@ -36,6 +38,7 @@ public enum PlayerTeam { this.chatColor = chatColor; this.colorData = colorData; this.smallName = smallName; + this.teamUpgrades = new TeamUpgrades(); } public static PlayerTeam getFromName(String name) { diff --git a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java index c0d548a..ed68391 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java @@ -5,6 +5,5 @@ public enum ArmorType { LEATHER, CHAIN, IRON, - DIAMOND - + DIAMOND; } diff --git a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/TeamUpgrades.java b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/TeamUpgrades.java new file mode 100644 index 0000000..99ea19d --- /dev/null +++ b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/TeamUpgrades.java @@ -0,0 +1,17 @@ +package rip.tilly.bedwars.playerdata.currentgame; + +import lombok.Data; + +import java.util.List; + +@Data +public class TeamUpgrades { + + private boolean sharpenedSwords; + private int armorLevel = 0; + private int maniacMiner = 0; + private int forgeLevel = 0; + private boolean healPool; + private boolean dragonBuff; + private List trapList; +} diff --git a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java index 485fd79..a334770 100644 --- a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java +++ b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java @@ -252,11 +252,11 @@ public class ScoreboardProvider implements BoardAdapter { lines.add("&fDuration: &d" + game.getDuration()); lines.add(" "); if (yourTeam.isHasBed()) { - lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓ &7(You)"); + lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓"); } else if (yourTeam.getPlayingPlayers().size() > 0) { - lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &f" + yourTeam.getPlayingPlayers().size() + " &7(You)"); + lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &f" + yourTeam.getPlayingPlayers().size()); } else { - lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗ &7(You)"); + lines.add("&7[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗"); } if (opposingTeam.isHasBed()) { lines.add("&7[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓"); @@ -269,6 +269,7 @@ public class ScoreboardProvider implements BoardAdapter { lines.add(yourTeam.getPlayerTeam().getChatColor() + yourTeam.playingPlayers().collect(Collectors.toList()).get(0).getName()); lines.add("&7VS"); lines.add(opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.playingPlayers().collect(Collectors.toList()).get(0).getName()); + lines.add(" "); lines.add("&dtilly.rip"); lines.add(CC.scoreboardBar); diff --git a/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java b/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java index c8f7a91..a95345a 100644 --- a/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java +++ b/src/main/java/rip/tilly/bedwars/runnables/RespawnRunnable.java @@ -46,8 +46,8 @@ public class RespawnRunnable extends BukkitRunnable { this.player.sendMessage(CC.translate("&aYou have respawned!")); this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F); - this.player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData)); - for (ItemStack stack : this.plugin.getGameManager().getGameItems(this.playerData.getCurrentGameData())) { + 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); } diff --git a/src/main/java/rip/tilly/bedwars/utils/ItemUtil.java b/src/main/java/rip/tilly/bedwars/utils/ItemUtil.java index 646761a..ca4fabb 100644 --- a/src/main/java/rip/tilly/bedwars/utils/ItemUtil.java +++ b/src/main/java/rip/tilly/bedwars/utils/ItemUtil.java @@ -1,6 +1,7 @@ package rip.tilly.bedwars.utils; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -119,6 +120,15 @@ public final class ItemUtil { return reloreItem(ReloreType.OVERWRITE, item, lores); } + public static ItemStack reEnchantItem(ItemStack itemStack, Enchantment enchantment, int level, boolean b) { + ItemMeta meta = itemStack.getItemMeta(); + + meta.addEnchant(enchantment, level, b); + + itemStack.setItemMeta(meta); + return itemStack; + } + public static ItemStack reloreItem(ReloreType type, ItemStack item, String... lores) { ItemMeta meta = item.getItemMeta();