eeeeee
This commit is contained in:
parent
d846b722c4
commit
9209b3e5cc
@ -125,7 +125,7 @@ public class InteractListener implements Listener {
|
|||||||
// open player tracker menu
|
// open player tracker menu
|
||||||
break;
|
break;
|
||||||
case SPECTATOR_LEAVE:
|
case SPECTATOR_LEAVE:
|
||||||
// leave spectator mode
|
this.plugin.getGameManager().removeSpectator(player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -86,8 +86,8 @@ public class GameStartListener implements Listener {
|
|||||||
|
|
||||||
player.teleport(team.getId() == 1 ? locationA.toBukkitLocation() : locationB.toBukkitLocation());
|
player.teleport(team.getId() == 1 ? locationA.toBukkitLocation() : locationB.toBukkitLocation());
|
||||||
|
|
||||||
player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData));
|
player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData, playerData.getPlayerTeam().getTeamUpgrades()));
|
||||||
for (ItemStack stack : this.plugin.getGameManager().getGameItems(playerData.getCurrentGameData())) {
|
for (ItemStack stack : this.plugin.getGameManager().getGameItems(playerData.getCurrentGameData(), playerData.getPlayerTeam().getTeamUpgrades())) {
|
||||||
player.getInventory().addItem(stack);
|
player.getInventory().addItem(stack);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -9,6 +9,7 @@ import rip.tilly.bedwars.game.Game;
|
|||||||
import rip.tilly.bedwars.game.GameTeam;
|
import rip.tilly.bedwars.game.GameTeam;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerState;
|
import rip.tilly.bedwars.playerdata.PlayerState;
|
||||||
|
import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData;
|
||||||
import rip.tilly.bedwars.runnables.RespawnRunnable;
|
import rip.tilly.bedwars.runnables.RespawnRunnable;
|
||||||
|
|
||||||
public class PlayerKillListener implements Listener {
|
public class PlayerKillListener implements Listener {
|
||||||
@ -38,6 +39,14 @@ public class PlayerKillListener implements Listener {
|
|||||||
PlayerData killerData = this.plugin.getPlayerDataManager().getPlayerData(killer.getUniqueId());
|
PlayerData killerData = this.plugin.getPlayerDataManager().getPlayerData(killer.getUniqueId());
|
||||||
killerData.addRandomXp(killer);
|
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!");
|
game.broadcast(playerData.getPlayerTeam().getChatColor() + player.getName() + " &ewas killed by " + killerData.getPlayerTeam().getChatColor() + killer.getName() + "&e!");
|
||||||
} else {
|
} else {
|
||||||
game.broadcast(playerData.getPlayerTeam().getChatColor() + player.getName() + " &efell into the void!");
|
game.broadcast(playerData.getPlayerTeam().getChatColor() + player.getName() + " &efell into the void!");
|
||||||
|
@ -3,6 +3,7 @@ package rip.tilly.bedwars.managers;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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.currentgame.PlayerCurrentGameData;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerState;
|
import rip.tilly.bedwars.playerdata.PlayerState;
|
||||||
|
import rip.tilly.bedwars.playerdata.currentgame.TeamUpgrades;
|
||||||
import rip.tilly.bedwars.utils.ItemBuilder;
|
import rip.tilly.bedwars.utils.ItemBuilder;
|
||||||
|
import rip.tilly.bedwars.utils.ItemUtil;
|
||||||
import rip.tilly.bedwars.utils.PlayerUtil;
|
import rip.tilly.bedwars.utils.PlayerUtil;
|
||||||
import rip.tilly.bedwars.utils.TtlHashMap;
|
import rip.tilly.bedwars.utils.TtlHashMap;
|
||||||
|
|
||||||
@ -210,44 +213,282 @@ public class GameManager {
|
|||||||
this.plugin.getPlayerDataManager().resetPlayer(player, true);
|
this.plugin.getPlayerDataManager().resetPlayer(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getGameItems(PlayerCurrentGameData currentGameData) {
|
public List<ItemStack> getGameItems(PlayerCurrentGameData currentGameData, TeamUpgrades teamUpgrades) {
|
||||||
List<ItemStack> allItems = new ArrayList<>();
|
List<ItemStack> 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);
|
allItems.add(sword);
|
||||||
|
|
||||||
if (currentGameData.isShears()) {
|
if (currentGameData.isShears()) {
|
||||||
ItemStack shears = new ItemBuilder(Material.SHEARS).build();
|
ItemStack shears = new ItemBuilder(Material.SHEARS).addUnbreakable().build();
|
||||||
allItems.add(shears);
|
allItems.add(shears);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack axe = null;
|
||||||
if (currentGameData.getAxeLevel() > 0) {
|
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 (axe != null) {
|
||||||
}
|
allItems.add(axe);
|
||||||
if (currentGameData.getAxeLevel() == 1) {
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if (currentGameData.getAxeLevel() == 1) {
|
|
||||||
|
|
||||||
|
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;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getGameArmor(PlayerData playerData) {
|
public ItemStack[] getGameArmor(PlayerData playerData, TeamUpgrades teamUpgrades) {
|
||||||
Color color = playerData.getPlayerTeam().getColor();
|
Color color = playerData.getPlayerTeam().getColor();
|
||||||
|
PlayerCurrentGameData currentGameData = playerData.getCurrentGameData();
|
||||||
|
|
||||||
return new ItemStack[] {
|
ItemStack leatherBoots = new ItemBuilder(Material.LEATHER_BOOTS).color(color).addUnbreakable().build();
|
||||||
new ItemBuilder(Material.LEATHER_BOOTS).color(color).build(),
|
ItemStack leatherLeggings = new ItemBuilder(Material.LEATHER_LEGGINGS).color(color).addUnbreakable().build();
|
||||||
new ItemBuilder(Material.LEATHER_LEGGINGS).color(color).build(),
|
ItemStack leatherChestplate = new ItemBuilder(Material.LEATHER_CHESTPLATE).color(color).addUnbreakable().build();
|
||||||
new ItemBuilder(Material.LEATHER_CHESTPLATE).color(color).build(),
|
ItemStack leatherHelmet = new ItemBuilder(Material.LEATHER_HELMET).color(color).addUnbreakable().build();
|
||||||
new ItemBuilder(Material.LEATHER_HELMET).color(color).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) {
|
public void clearBlocks(Game game) {
|
||||||
|
@ -3,6 +3,7 @@ package rip.tilly.bedwars.playerdata;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
|
import rip.tilly.bedwars.playerdata.currentgame.TeamUpgrades;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ public enum PlayerTeam {
|
|||||||
private final ChatColor chatColor;
|
private final ChatColor chatColor;
|
||||||
private final int colorData;
|
private final int colorData;
|
||||||
private final String smallName;
|
private final String smallName;
|
||||||
|
private TeamUpgrades teamUpgrades;
|
||||||
|
|
||||||
PlayerTeam(String name, Color color, ChatColor chatColor, int colorData, String smallName) {
|
PlayerTeam(String name, Color color, ChatColor chatColor, int colorData, String smallName) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -36,6 +38,7 @@ public enum PlayerTeam {
|
|||||||
this.chatColor = chatColor;
|
this.chatColor = chatColor;
|
||||||
this.colorData = colorData;
|
this.colorData = colorData;
|
||||||
this.smallName = smallName;
|
this.smallName = smallName;
|
||||||
|
this.teamUpgrades = new TeamUpgrades();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerTeam getFromName(String name) {
|
public static PlayerTeam getFromName(String name) {
|
||||||
|
@ -5,6 +5,5 @@ public enum ArmorType {
|
|||||||
LEATHER,
|
LEATHER,
|
||||||
CHAIN,
|
CHAIN,
|
||||||
IRON,
|
IRON,
|
||||||
DIAMOND
|
DIAMOND;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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<String> trapList;
|
||||||
|
}
|
@ -252,11 +252,11 @@ public class ScoreboardProvider implements BoardAdapter {
|
|||||||
lines.add("&fDuration: &d" + game.getDuration());
|
lines.add("&fDuration: &d" + game.getDuration());
|
||||||
lines.add(" ");
|
lines.add(" ");
|
||||||
if (yourTeam.isHasBed()) {
|
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) {
|
} 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 {
|
} 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()) {
|
if (opposingTeam.isHasBed()) {
|
||||||
lines.add("&7[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&7] &a&l✓");
|
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(yourTeam.getPlayerTeam().getChatColor() + yourTeam.playingPlayers().collect(Collectors.toList()).get(0).getName());
|
||||||
lines.add("&7VS");
|
lines.add("&7VS");
|
||||||
lines.add(opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.playingPlayers().collect(Collectors.toList()).get(0).getName());
|
lines.add(opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.playingPlayers().collect(Collectors.toList()).get(0).getName());
|
||||||
|
lines.add(" ");
|
||||||
lines.add("&dtilly.rip");
|
lines.add("&dtilly.rip");
|
||||||
lines.add(CC.scoreboardBar);
|
lines.add(CC.scoreboardBar);
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ public class RespawnRunnable extends BukkitRunnable {
|
|||||||
this.player.sendMessage(CC.translate("&aYou have respawned!"));
|
this.player.sendMessage(CC.translate("&aYou have respawned!"));
|
||||||
this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F);
|
this.player.playSound(this.player.getLocation(), Sound.ORB_PICKUP, 10F, 1F);
|
||||||
|
|
||||||
this.player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(playerData));
|
this.player.getInventory().setArmorContents(this.plugin.getGameManager().getGameArmor(this.playerData, this.playerData.getPlayerTeam().getTeamUpgrades()));
|
||||||
for (ItemStack stack : this.plugin.getGameManager().getGameItems(this.playerData.getCurrentGameData())) {
|
for (ItemStack stack : this.plugin.getGameManager().getGameItems(this.playerData.getCurrentGameData(), this.playerData.getPlayerTeam().getTeamUpgrades())) {
|
||||||
this.player.getInventory().addItem(stack);
|
this.player.getInventory().addItem(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package rip.tilly.bedwars.utils;
|
package rip.tilly.bedwars.utils;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
@ -119,6 +120,15 @@ public final class ItemUtil {
|
|||||||
return reloreItem(ReloreType.OVERWRITE, item, lores);
|
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) {
|
public static ItemStack reloreItem(ReloreType type, ItemStack item, String... lores) {
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user