holnap folytatom
This commit is contained in:
@@ -40,6 +40,20 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int[] getItemSlotArray(String key, String kit, Player player) {
|
||||
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
|
||||
|
||||
if (plugin.getConfig().contains(path)) {
|
||||
try {
|
||||
return new int[]{plugin.getConfig().getInt(path)};
|
||||
} catch (NumberFormatException e) {
|
||||
plugin.getLogger().warning("Invalid slot number in config for " + path);
|
||||
}
|
||||
}
|
||||
|
||||
return new int[]{-1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
|
||||
if (cmds.hasPermission("wolfffa.command.editkit")) {
|
||||
@@ -110,19 +124,14 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
|
||||
ItemStack uhcaxe = new ItemStack(Material.DIAMOND_AXE);
|
||||
ItemStack uhcsword = new ItemStack(Material.DIAMOND_SWORD);
|
||||
ItemStack uhclava = new ItemStack(Material.LAVA_BUCKET);
|
||||
ItemStack uhclava2 = new ItemStack(Material.LAVA_BUCKET);
|
||||
ItemStack uhccobweb = new ItemStack(Material.COBWEB, 8);
|
||||
ItemStack uhccobblestone = new ItemStack(Material.COBBLESTONE, 64);
|
||||
ItemStack uhcgoldenapple = new ItemStack(Material.GOLDEN_APPLE, 13);
|
||||
ItemStack uhcwater = new ItemStack(Material.WATER_BUCKET);
|
||||
ItemStack uhcwater2 = new ItemStack(Material.WATER_BUCKET);
|
||||
ItemStack uhcwater3 = new ItemStack(Material.WATER_BUCKET);
|
||||
ItemStack uhcwater4 = new ItemStack(Material.WATER_BUCKET);
|
||||
ItemStack uhccrossbow = new ItemStack(Material.CROSSBOW);
|
||||
ItemStack uhcbow = new ItemStack(Material.BOW);
|
||||
ItemStack uhcarrow = new ItemStack(Material.ARROW, 16);
|
||||
ItemStack uhcshield = new ItemStack(Material.SHIELD);
|
||||
ItemStack uhcshield2 = new ItemStack(Material.SHIELD);
|
||||
ItemStack uhcplanks = new ItemStack(Material.OAK_PLANKS, 64);
|
||||
ItemStack uhcpickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
|
||||
|
||||
@@ -140,45 +149,25 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
|
||||
uhcpickaxe.addEnchantment(Enchantment.UNBREAKING,3);
|
||||
uhcpickaxe.addEnchantment(Enchantment.EFFICIENCY, 3);
|
||||
|
||||
ItemMeta uhcmetalava2 = uhclava2.getItemMeta();
|
||||
ItemMeta uhcmetawater2 = uhcwater2.getItemMeta();
|
||||
ItemMeta uhcmetawater3 = uhcwater3.getItemMeta();
|
||||
ItemMeta uhcmetawater4 = uhcwater4.getItemMeta();
|
||||
ItemMeta uhcmetashield2 = uhcshield2.getItemMeta();
|
||||
|
||||
uhcmetalava2.getPersistentDataContainer().set(new NamespacedKey("wolfffa", "lavab"), PersistentDataType.STRING, "lava2uuid");
|
||||
uhclava2.setItemMeta(uhcmetalava2);
|
||||
|
||||
uhcmetawater2.getPersistentDataContainer().set(new NamespacedKey("wolfffa", "waterb"), PersistentDataType.STRING, "water2uuid");
|
||||
uhcwater2.setItemMeta(uhcmetawater2);
|
||||
|
||||
uhcmetawater3.getPersistentDataContainer().set(new NamespacedKey("wolfffa", "waterc"), PersistentDataType.STRING, "water3uuid");
|
||||
uhcwater3.setItemMeta(uhcmetawater3);
|
||||
|
||||
uhcmetawater4.getPersistentDataContainer().set(new NamespacedKey("wolfffa", "waterd"), PersistentDataType.STRING, "water4uuid");
|
||||
uhcwater4.setItemMeta(uhcmetawater4);
|
||||
|
||||
uhcmetashield2.getPersistentDataContainer().set(new NamespacedKey("wolfffa", "shieldb"), PersistentDataType.STRING, "shield2uuid");
|
||||
uhcshield2.setItemMeta(uhcmetashield2);
|
||||
|
||||
inv.setItem(getItemSlot("axe", "uhc", player), uhcaxe);
|
||||
inv.setItem(getItemSlot("sword", "uhc", player), uhcsword);
|
||||
inv.setItem(getItemSlot("lava", "uhc", player), uhclava);
|
||||
for (int slot : getItemSlotArray("lava", "uhc", player)) {
|
||||
inv.setItem(slot, uhclava);
|
||||
}
|
||||
inv.setItem(getItemSlot("cobweb", "uhc", player), uhccobweb);
|
||||
inv.setItem(getItemSlot("cobblestone", "uhc", player), uhccobblestone);
|
||||
inv.setItem(getItemSlot("goldenapple", "uhc", player), uhcgoldenapple);
|
||||
inv.setItem(getItemSlot("water", "uhc", player), uhcwater);
|
||||
for (int slot : getItemSlotArray("water", "uhc", player)) {
|
||||
inv.setItem(slot, uhcwater);
|
||||
}
|
||||
inv.setItem(getItemSlot("crossbow", "uhc", player), uhccrossbow);
|
||||
inv.setItem(getItemSlot("bow", "uhc", player), uhcbow);
|
||||
inv.setItem(getItemSlot("shield", "uhc", player), uhcshield);
|
||||
for (int slot : getItemSlotArray("shield", "uhc", player)) {
|
||||
inv.setItem(slot, uhcshield);
|
||||
}
|
||||
inv.setItem(getItemSlot("arrow", "uhc", player), uhcarrow);
|
||||
inv.setItem(getItemSlot("shield2", "uhc", player), uhcshield2);
|
||||
inv.setItem(getItemSlot("planks", "uhc", player), uhcplanks);
|
||||
inv.setItem(getItemSlot("pickaxe", "uhc", player), uhcpickaxe);
|
||||
inv.setItem(getItemSlot("lava2", "uhc", player), uhclava2);
|
||||
inv.setItem(getItemSlot("water2", "uhc", player), uhcwater2);
|
||||
inv.setItem(getItemSlot("water3", "uhc", player), uhcwater3);
|
||||
inv.setItem(getItemSlot("water4", "uhc", player), uhcwater4);
|
||||
|
||||
infoMeta.setDisplayName("§fUHC Kit");
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
|
||||
Reference in New Issue
Block a user