eeeeee
This commit is contained in:
@ -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<ItemStack> getGameItems(PlayerCurrentGameData currentGameData) {
|
||||
public List<ItemStack> getGameItems(PlayerCurrentGameData currentGameData, TeamUpgrades teamUpgrades) {
|
||||
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);
|
||||
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user