mace axe diasmp kit, + updateik c:

This commit is contained in:
2025-03-06 20:16:05 +01:00
parent 987994aab4
commit 838c002a8c
8 changed files with 909 additions and 409 deletions

View File

@@ -1,6 +1,7 @@
package hu.jgj52.wolfFFA.Commands; package hu.jgj52.wolfFFA.Commands;
import hu.jgj52.wolfFFA.Main; import hu.jgj52.wolfFFA.Main;
import hu.jgj52.wolfFFA.Utils.Kits;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@@ -69,6 +70,7 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
if (cmds.hasPermission("wolfffa.command.editkit")) { if (cmds.hasPermission("wolfffa.command.editkit")) {
if (cmds instanceof Player player) { if (cmds instanceof Player player) {
if (args.length > 0) { if (args.length > 0) {
Kits kitManager = new Kits(plugin);
Inventory gui = Bukkit.createInventory(null, 27, "Kit Editor"); Inventory gui = Bukkit.createInventory(null, 27, "Kit Editor");
ItemStack saveKit = new ItemStack(Material.GREEN_STAINED_GLASS_PANE); ItemStack saveKit = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
@@ -105,13 +107,8 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
Inventory inv = player.getInventory(); Inventory inv = player.getInventory();
switch (args[0]) { switch (args[0]) {
case "sword": case "sword":
if (true) {
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
inv.clear(); inv.clear();
inv.setContents(kitManager.getSwordKit(player).getContents());
inv.setItem(getItemSlot("sword", "sword", player), sword);
infoMeta.setDisplayName("§fSword Kit"); infoMeta.setDisplayName("§fSword Kit");
infoItem.setItemMeta(infoMeta); infoItem.setItemMeta(infoMeta);
@@ -126,61 +123,10 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
gui.setItem(23, infoItem); gui.setItem(23, infoItem);
player.openInventory(gui); player.openInventory(gui);
}
break; break;
case "uhc": case "uhc":
if (true) {
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack lava = new ItemStack(Material.LAVA_BUCKET);
ItemStack cobweb = new ItemStack(Material.COBWEB, 8);
ItemStack cobblestone = new ItemStack(Material.COBBLESTONE, 64);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 13);
ItemStack water = new ItemStack(Material.WATER_BUCKET);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 16);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack planks = new ItemStack(Material.OAK_PLANKS, 64);
ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
inv.clear(); inv.clear();
inv.setContents(kitManager.getUhcKit(player).getContents());
helmet.addEnchantment(Enchantment.PROTECTION, 2);
chestplate.addEnchantment(Enchantment.PROTECTION, 3);
leggings.addEnchantment(Enchantment.PROTECTION, 3);
boots.addEnchantment(Enchantment.PROTECTION, 3);
axe.addEnchantment(Enchantment.SHARPNESS, 1);
axe.addEnchantment(Enchantment.EFFICIENCY, 3);
sword.addEnchantment(Enchantment.SHARPNESS, 4);
crossbow.addEnchantment(Enchantment.PIERCING, 1);
bow.addEnchantment(Enchantment.POWER, 1);
pickaxe.addEnchantment(Enchantment.UNBREAKING, 3);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 3);
inv.setItem(getItemSlot("axe", "uhc", player), axe);
inv.setItem(getItemSlot("sword", "uhc", player), sword);
for (int slot : getItemSlotArray("lava", "uhc", player)) {
inv.setItem(slot, lava);
}
inv.setItem(getItemSlot("cobweb", "uhc", player), cobweb);
inv.setItem(getItemSlot("cobblestone", "uhc", player), cobblestone);
inv.setItem(getItemSlot("goldenapple", "uhc", player), goldenapple);
for (int slot : getItemSlotArray("water", "uhc", player)) {
inv.setItem(slot, water);
}
inv.setItem(getItemSlot("crossbow", "uhc", player), crossbow);
inv.setItem(getItemSlot("bow", "uhc", player), bow);
for (int slot : getItemSlotArray("shield", "uhc", player)) {
inv.setItem(slot, shield);
}
inv.setItem(getItemSlot("arrow", "uhc", player), arrow);
inv.setItem(getItemSlot("planks", "uhc", player), planks);
inv.setItem(getItemSlot("pickaxe", "uhc", player), pickaxe);
infoMeta.setDisplayName("§fUHC Kit"); infoMeta.setDisplayName("§fUHC Kit");
infoItem.setItemMeta(infoMeta); infoItem.setItemMeta(infoMeta);
@@ -195,108 +141,10 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
gui.setItem(23, infoItem); gui.setItem(23, infoItem);
player.openInventory(gui); player.openInventory(gui);
}
break; break;
case "boxcart": case "boxcart":
if (true) { inv.clear();
ItemStack axe = new ItemStack(Material.NETHERITE_AXE); inv.setContents(kitManager.getBoxCartKit(player).getContents());
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD);
ItemStack enderpearl = new ItemStack(Material.ENDER_PEARL, 16);
ItemStack rail = new ItemStack(Material.RAIL, 64);
ItemStack cart = new ItemStack(Material.TNT_MINECART);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 64);
ItemStack cobweb = new ItemStack(Material.COBWEB, 64);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 64);
ItemStack fireresistance = new ItemStack(Material.SPLASH_POTION);
ItemStack strength = new ItemStack(Material.SPLASH_POTION);
ItemStack speed = new ItemStack(Material.SPLASH_POTION);
ItemStack cherrylog = new ItemStack(Material.CHERRY_LOG, 64);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack flintandsteel = new ItemStack(Material.FLINT_AND_STEEL);
ItemStack totem = new ItemStack(Material.TOTEM_OF_UNDYING);
ItemStack pickaxe = new ItemStack(Material.NETHERITE_PICKAXE);
ItemStack shulker = new ItemStack(Material.RED_SHULKER_BOX);
sword.addEnchantment(Enchantment.SHARPNESS, 5);
sword.addEnchantment(Enchantment.SWEEPING_EDGE, 3);
sword.addEnchantment(Enchantment.FIRE_ASPECT, 2);
sword.addEnchantment(Enchantment.KNOCKBACK, 1);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
sword.addEnchantment(Enchantment.MENDING, 1);
axe.addEnchantment(Enchantment.SHARPNESS, 5);
axe.addEnchantment(Enchantment.EFFICIENCY, 5);
axe.addEnchantment(Enchantment.UNBREAKING, 3);
axe.addEnchantment(Enchantment.MENDING, 1);
bow.addEnchantment(Enchantment.POWER, 5);
bow.addEnchantment(Enchantment.PUNCH, 2);
bow.addEnchantment(Enchantment.FLAME, 1);
bow.addEnchantment(Enchantment.UNBREAKING, 3);
bow.addEnchantment(Enchantment.MENDING, 1);
crossbow.addEnchantment(Enchantment.PIERCING, 4);
crossbow.addEnchantment(Enchantment.QUICK_CHARGE, 3);
crossbow.addEnchantment(Enchantment.UNBREAKING, 3);
crossbow.addEnchantment(Enchantment.MENDING, 1);
flintandsteel.addEnchantment(Enchantment.UNBREAKING, 3);
flintandsteel.addEnchantment(Enchantment.MENDING, 1);
shield.addEnchantment(Enchantment.UNBREAKING, 3);
shield.addEnchantment(Enchantment.MENDING, 1);
pickaxe.addEnchantment(Enchantment.UNBREAKING, 3);
pickaxe.addEnchantment(Enchantment.MENDING, 1);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 5);
PotionMeta fireresistancemeta = (PotionMeta) fireresistance.getItemMeta();
fireresistancemeta.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 9600, 0), true);
fireresistancemeta.setDisplayName("§fSplash Potion of Fire Resistance");
fireresistance.setItemMeta(fireresistancemeta);
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
strengthmeta.setDisplayName("§fSplash Potion of Strength");
strength.setItemMeta(strengthmeta);
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1800, 1), true);
speedmeta.setDisplayName("§fSplash Potion of Swiftness");
speed.setItemMeta(speedmeta);
BlockStateMeta shulkermeta = (BlockStateMeta) shulker.getItemMeta();
ShulkerBox shulkerbox = (ShulkerBox) shulkermeta.getBlockState();
Inventory shulkerinv = shulkerbox.getInventory();
for (int i = 0; i < 27; i++) {
shulkerinv.setItem(i, new ItemStack(Material.TNT_MINECART));
}
shulkermeta.setBlockState(shulkerbox);
shulker.setItemMeta(shulkermeta);
inv.setItem(getItemSlot("axe", "boxcart", player), axe);
inv.setItem(getItemSlot("sword", "boxcart", player), sword);
for (int slot : getItemSlotArray("enderpearl", "boxcart", player)) {
inv.setItem(slot, enderpearl);
}
inv.setItem(getItemSlot("rail", "boxcart", player), rail);
for (int slot : getItemSlotArray("cart", "boxcart", player)) {
inv.setItem(slot, cart);
}
inv.setItem(getItemSlot("goldenapple", "boxcart", player), goldenapple);
inv.setItem(getItemSlot("cobweb", "boxcart", player), cobweb);
inv.setItem(getItemSlot("shield", "boxcart", player), shield);
inv.setItem(getItemSlot("bow", "boxcart", player), bow);
inv.setItem(getItemSlot("arrow", "boxcart", player), arrow);
for (int slot : getItemSlotArray("fireresistance", "boxcart", player)) {
inv.setItem(slot, fireresistance);
}
for (int slot : getItemSlotArray("strength", "boxcart", player)) {
inv.setItem(slot, strength);
}
for (int slot : getItemSlotArray("speed", "boxcart", player)) {
inv.setItem(slot, speed);
}
inv.setItem(getItemSlot("cherrylog", "boxcart", player), cherrylog);
inv.setItem(getItemSlot("crossbow", "boxcart", player), crossbow);
inv.setItem(getItemSlot("flintandsteel", "boxcart", player), flintandsteel);
inv.setItem(getItemSlot("pickaxe", "boxcart", player), pickaxe);
inv.setItem(getItemSlot("shulker", "boxcart", player), shulker);
inv.setItem(getItemSlot("totem", "boxcart", player), totem);
infoMeta.setDisplayName("§fBoxCart Kit"); infoMeta.setDisplayName("§fBoxCart Kit");
infoItem.setItemMeta(infoMeta); infoItem.setItemMeta(infoMeta);
@@ -311,7 +159,60 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
gui.setItem(23, infoItem); gui.setItem(23, infoItem);
player.openInventory(gui); player.openInventory(gui);
} break;
case "mace":
inv.clear();
inv.setContents(kitManager.getMaceKit(player).getContents());
infoMeta.setDisplayName("§fMace Kit");
infoItem.setItemMeta(infoMeta);
gui.setItem(3, infoItem);
gui.setItem(4, infoItem);
gui.setItem(5, infoItem);
gui.setItem(12, infoItem);
gui.setItem(13, infoItem);
gui.setItem(14, infoItem);
gui.setItem(21, infoItem);
gui.setItem(22, infoItem);
gui.setItem(23, infoItem);
player.openInventory(gui);
break;
case "axe":
inv.clear();
inv.setContents(kitManager.getAxeKit(player).getContents());
infoMeta.setDisplayName("§fAxe Kit");
infoItem.setItemMeta(infoMeta);
gui.setItem(3, infoItem);
gui.setItem(4, infoItem);
gui.setItem(5, infoItem);
gui.setItem(12, infoItem);
gui.setItem(13, infoItem);
gui.setItem(14, infoItem);
gui.setItem(21, infoItem);
gui.setItem(22, infoItem);
gui.setItem(23, infoItem);
player.openInventory(gui);
break;
case "diasmp":
inv.clear();
inv.setContents(kitManager.getAxeKit(player).getContents());
infoMeta.setDisplayName("§fDiamondSmp Kit");
infoItem.setItemMeta(infoMeta);
gui.setItem(3, infoItem);
gui.setItem(4, infoItem);
gui.setItem(5, infoItem);
gui.setItem(12, infoItem);
gui.setItem(13, infoItem);
gui.setItem(14, infoItem);
gui.setItem(21, infoItem);
gui.setItem(22, infoItem);
gui.setItem(23, infoItem);
player.openInventory(gui);
break; break;
default: default:
player.sendMessage("§cNincs ilyen FFA típus!"); player.sendMessage("§cNincs ilyen FFA típus!");
@@ -326,7 +227,7 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
@Override @Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { public @Nullable List<String> onTabComplete(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
if (args.length == 1) { if (args.length == 1) {
return List.of("sword", "uhc", "boxcart"); return List.of("sword", "uhc", "boxcart", "mace", "axe", "diasmp");
} }
return List.of(); return List.of();
} }

View File

@@ -1,23 +1,19 @@
package hu.jgj52.wolfFFA.Commands; package hu.jgj52.wolfFFA.Commands;
import hu.jgj52.wolfFFA.Utils.Kits;
import hu.jgj52.wolfFFA.Main; import hu.jgj52.wolfFFA.Main;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.ShulkerBox;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter; import org.bukkit.command.TabCompleter;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -67,26 +63,14 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
if (cmds.hasPermission("wolfffa.admin.tptoffa")) { if (cmds.hasPermission("wolfffa.admin.tptoffa")) {
if (args.length > 0) { if (args.length > 0) {
Kits kitManager = new Kits(plugin);
switch (args[0]) { switch (args[0]) {
case "sword": case "sword":
if (args.length > 1) { if (args.length > 1) {
Player target = Bukkit.getPlayer(args[1]); Player target = Bukkit.getPlayer(args[1]);
if (target instanceof Player player) { if (target instanceof Player player) {
player.getInventory().clear(); player.getInventory().clear();
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET); player.getInventory().setContents(kitManager.getSwordKit(player).getContents());
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
helmet.addEnchantment(Enchantment.PROTECTION, 3);
chestplate.addEnchantment(Enchantment.PROTECTION, 3);
leggings.addEnchantment(Enchantment.PROTECTION, 3);
boots.addEnchantment(Enchantment.PROTECTION, 3);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
player.getInventory().setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
player.getInventory().setItem(getItemSlot("sword", "sword", player), sword);
World world = Bukkit.getWorld("world"); World world = Bukkit.getWorld("world");
double x = 0.5; double x = 0.5;
@@ -96,6 +80,12 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
float pitch = (float) 0; float pitch = (float) 0;
Location loc = new Location(world, x, y, z, yaw, pitch); Location loc = new Location(world, x, y, z, yaw, pitch);
player.teleport(loc); player.teleport(loc);
player.setHealth(20D);
player.setFoodLevel(20);
player.setSaturation(5);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
} }
} }
break; break;
@@ -104,56 +94,7 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
Player target = Bukkit.getPlayer(args[1]); Player target = Bukkit.getPlayer(args[1]);
if (target instanceof Player player) { if (target instanceof Player player) {
player.getInventory().clear(); player.getInventory().clear();
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET); player.getInventory().setContents(kitManager.getUhcKit(player).getContents());
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack lava = new ItemStack(Material.LAVA_BUCKET);
ItemStack cobweb = new ItemStack(Material.COBWEB, 8);
ItemStack cobblestone = new ItemStack(Material.COBBLESTONE, 64);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 13);
ItemStack water = new ItemStack(Material.WATER_BUCKET);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 16);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack planks = new ItemStack(Material.OAK_PLANKS, 64);
ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
helmet.addEnchantment(Enchantment.PROTECTION, 2);
chestplate.addEnchantment(Enchantment.PROTECTION, 3);
leggings.addEnchantment(Enchantment.PROTECTION, 3);
boots.addEnchantment(Enchantment.PROTECTION, 3);
axe.addEnchantment(Enchantment.SHARPNESS, 1);
axe.addEnchantment(Enchantment.EFFICIENCY, 3);
sword.addEnchantment(Enchantment.SHARPNESS, 4);
crossbow.addEnchantment(Enchantment.PIERCING, 1);
bow.addEnchantment(Enchantment.POWER, 1);
pickaxe.addEnchantment(Enchantment.UNBREAKING,3);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 3);
player.getInventory().setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
player.getInventory().setItem(getItemSlot("axe", "uhc", player), axe);
player.getInventory().setItem(getItemSlot("sword", "uhc", player), sword);
for (int slot : getItemSlotArray("lava", "uhc", player)) {
player.getInventory().setItem(slot, lava);
}
player.getInventory().setItem(getItemSlot("cobweb", "uhc", player), cobweb);
player.getInventory().setItem(getItemSlot("cobblestone", "uhc", player), cobblestone);
player.getInventory().setItem(getItemSlot("goldenapple", "uhc", player), goldenapple);
for (int slot : getItemSlotArray("water", "uhc", player)) {
player.getInventory().setItem(slot, water);
}
player.getInventory().setItem(getItemSlot("crossbow", "uhc", player), crossbow);
player.getInventory().setItem(getItemSlot("bow", "uhc", player), bow);
player.getInventory().setItem(getItemSlot("arrow", "uhc", player), arrow);
for (int slot : getItemSlotArray("shield", "uhc", player)) {
player.getInventory().setItem(slot, shield);
}
player.getInventory().setItem(getItemSlot("planks", "uhc", player), planks);
player.getInventory().setItem(getItemSlot("pickaxe", "uhc", player), pickaxe);
World world = Bukkit.getWorld("world"); World world = Bukkit.getWorld("world");
double x = 0.5; double x = 0.5;
@@ -163,6 +104,12 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
float pitch = (float) 0; float pitch = (float) 0;
Location loc = new Location(world, x, y, z, yaw, pitch); Location loc = new Location(world, x, y, z, yaw, pitch);
player.teleport(loc); player.teleport(loc);
player.setHealth(20D);
player.setFoodLevel(20);
player.setSaturation(5);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
} }
} }
break; break;
@@ -170,123 +117,8 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
if (args.length > 1) { if (args.length > 1) {
Player target = Bukkit.getPlayer(args[1]); Player target = Bukkit.getPlayer(args[1]);
if (target instanceof Player player) { if (target instanceof Player player) {
ItemStack helmet = new ItemStack(Material.NETHERITE_HELMET); player.getInventory().clear();
ItemStack chestplate = new ItemStack(Material.NETHERITE_CHESTPLATE); player.getInventory().setContents(kitManager.getBoxCartKit(player).getContents());
ItemStack leggings = new ItemStack(Material.NETHERITE_LEGGINGS);
ItemStack boots = new ItemStack(Material.NETHERITE_BOOTS);
ItemStack axe = new ItemStack(Material.NETHERITE_AXE);
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD);
ItemStack enderpearl = new ItemStack(Material.ENDER_PEARL, 16);
ItemStack rail = new ItemStack(Material.RAIL, 64);
ItemStack cart = new ItemStack(Material.TNT_MINECART);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 64);
ItemStack cobweb = new ItemStack(Material.COBWEB, 64);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 64);
ItemStack fireresistance = new ItemStack(Material.SPLASH_POTION);
ItemStack strength = new ItemStack(Material.SPLASH_POTION);
ItemStack speed = new ItemStack(Material.SPLASH_POTION);
ItemStack cherrylog = new ItemStack(Material.CHERRY_LOG, 64);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack flintandsteel = new ItemStack(Material.FLINT_AND_STEEL);
ItemStack totem = new ItemStack(Material.TOTEM_OF_UNDYING);
ItemStack pickaxe = new ItemStack(Material.NETHERITE_PICKAXE);
ItemStack shulker = new ItemStack(Material.RED_SHULKER_BOX);
helmet.addEnchantment(Enchantment.PROTECTION, 4);
helmet.addEnchantment(Enchantment.RESPIRATION, 3);
helmet.addEnchantment(Enchantment.UNBREAKING, 3);
helmet.addEnchantment(Enchantment.MENDING, 1);
chestplate.addEnchantment(Enchantment.PROTECTION, 4);
chestplate.addEnchantment(Enchantment.UNBREAKING, 3);
chestplate.addEnchantment(Enchantment.MENDING, 1);
leggings.addEnchantment(Enchantment.BLAST_PROTECTION, 4);
leggings.addEnchantment(Enchantment.UNBREAKING, 3);
leggings.addEnchantment(Enchantment.MENDING, 1);
boots.addEnchantment(Enchantment.FEATHER_FALLING, 4);
boots.addEnchantment(Enchantment.PROTECTION, 4);
boots.addEnchantment(Enchantment.UNBREAKING,3);
boots.addEnchantment(Enchantment.MENDING, 1);
sword.addEnchantment(Enchantment.SHARPNESS, 5);
sword.addEnchantment(Enchantment.SWEEPING_EDGE, 3);
sword.addEnchantment(Enchantment.FIRE_ASPECT, 2);
sword.addEnchantment(Enchantment.KNOCKBACK, 1);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
sword.addEnchantment(Enchantment.MENDING, 1);
axe.addEnchantment(Enchantment.SHARPNESS, 5);
axe.addEnchantment(Enchantment.EFFICIENCY, 5);
axe.addEnchantment(Enchantment.UNBREAKING, 3);
axe.addEnchantment(Enchantment.MENDING, 1);
bow.addEnchantment(Enchantment.POWER, 5);
bow.addEnchantment(Enchantment.PUNCH, 2);
bow.addEnchantment(Enchantment.FLAME, 1);
bow.addEnchantment(Enchantment.UNBREAKING,3);
bow.addEnchantment(Enchantment.MENDING, 1);
crossbow.addEnchantment(Enchantment.PIERCING, 4);
crossbow.addEnchantment(Enchantment.QUICK_CHARGE, 3);
crossbow.addEnchantment(Enchantment.UNBREAKING, 3);
crossbow.addEnchantment(Enchantment.MENDING, 1);
flintandsteel.addEnchantment(Enchantment.UNBREAKING, 3);
flintandsteel.addEnchantment(Enchantment.MENDING, 1);
shield.addEnchantment(Enchantment.UNBREAKING, 3);
shield.addEnchantment(Enchantment.MENDING, 1);
pickaxe.addEnchantment(Enchantment.UNBREAKING, 3);
pickaxe.addEnchantment(Enchantment.MENDING, 1);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 5);
PotionMeta fireresistancemeta = (PotionMeta) fireresistance.getItemMeta();
fireresistancemeta.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 9600, 0), true);
fireresistancemeta.setDisplayName("§fSplash Potion of Fire Resistance");
fireresistance.setItemMeta(fireresistancemeta);
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
strengthmeta.setDisplayName("§fSplash Potion of Strength");
strength.setItemMeta(strengthmeta);
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1800, 1), true);
speedmeta.setDisplayName("§fSplash Potion of Swiftness");
speed.setItemMeta(speedmeta);
BlockStateMeta shulkermeta = (BlockStateMeta) shulker.getItemMeta();
ShulkerBox shulkerbox = (ShulkerBox) shulkermeta.getBlockState();
Inventory shulkerinv = shulkerbox.getInventory();
for (int i = 0; i < 27; i++) {
shulkerinv.setItem(i, new ItemStack(Material.TNT_MINECART));
}
shulkermeta.setBlockState(shulkerbox);
shulker.setItemMeta(shulkermeta);
player.getInventory().setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
player.getInventory().setItem(getItemSlot("axe", "boxcart", player), axe);
player.getInventory().setItem(getItemSlot("sword", "boxcart", player), sword);
for (int slot : getItemSlotArray("enderpearl", "boxcart", player)) {
player.getInventory().setItem(slot, enderpearl);
}
player.getInventory().setItem(getItemSlot("rail", "boxcart", player), rail);
for (int slot : getItemSlotArray("cart", "boxcart", player)) {
player.getInventory().setItem(slot, cart);
}
player.getInventory().setItem(getItemSlot("goldenapple", "boxcart", player), goldenapple);
player.getInventory().setItem(getItemSlot("cobweb", "boxcart", player), cobweb);
player.getInventory().setItem(getItemSlot("shield", "boxcart", player), shield);
player.getInventory().setItem(getItemSlot("bow", "boxcart", player), bow);
player.getInventory().setItem(getItemSlot("arrow", "boxcart", player), arrow);
for (int slot : getItemSlotArray("fireresistance", "boxcart", player)) {
player.getInventory().setItem(slot, fireresistance);
}
for (int slot : getItemSlotArray("strength", "boxcart", player)) {
player.getInventory().setItem(slot, strength);
}
for (int slot : getItemSlotArray("speed", "boxcart", player)) {
player.getInventory().setItem(slot, speed);
}
player.getInventory().setItem(getItemSlot("cherrylog", "boxcart", player), cherrylog);
player.getInventory().setItem(getItemSlot("crossbow", "boxcart", player), crossbow);
player.getInventory().setItem(getItemSlot("flintandsteel", "boxcart", player), flintandsteel);
player.getInventory().setItem(getItemSlot("totem", "boxcart", player), totem);
player.getInventory().setItem(getItemSlot("pickaxe", "boxcart", player), pickaxe);
player.getInventory().setItem(getItemSlot("shulker", "boxcart", player), shulker);
World world = Bukkit.getWorld("world"); World world = Bukkit.getWorld("world");
double x = -1000.5; double x = -1000.5;
@@ -296,6 +128,84 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
float pitch = (float) 0; float pitch = (float) 0;
Location loc = new Location(world, x, y, z, yaw, pitch); Location loc = new Location(world, x, y, z, yaw, pitch);
player.teleport(loc); player.teleport(loc);
player.setHealth(20D);
player.setFoodLevel(20);
player.setSaturation(5);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
}
}
break;
case "mace":
if (args.length > 1) {
Player target = Bukkit.getPlayer(args[1]);
if (target instanceof Player player) {
player.getInventory().clear();
player.getInventory().setContents(kitManager.getMaceKit(player).getContents());
World world = Bukkit.getWorld("world");
double x = 1000.5;
double y = 3.0;
double z = -1000.5;
float yaw = (float) 0;
float pitch = (float) 0;
Location loc = new Location(world, x, y, z, yaw, pitch);
player.teleport(loc);
player.setHealth(20D);
player.setFoodLevel(20);
player.setSaturation(5);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
}
}
break;
case "axe":
if (args.length > 1) {
Player target = Bukkit.getPlayer(args[1]);
if (target instanceof Player player) {
player.getInventory().clear();
player.getInventory().setContents(kitManager.getAxeKit(player).getContents());
World world = Bukkit.getWorld("world");
double x = -1000.5;
double y = 0.0;
double z = 1000.5;
float yaw = (float) 0;
float pitch = (float) 0;
Location loc = new Location(world, x, y, z, yaw, pitch);
//player.teleport(loc);
player.setHealth(20D);
player.setFoodLevel(20);
player.setSaturation(5);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
}
}
break;
case "diasmp":
if (args.length > 1) {
Player target = Bukkit.getPlayer(args[1]);
if (target instanceof Player player) {
player.getInventory().clear();
player.getInventory().setContents(kitManager.getDiamondSmpKit(player).getContents());
World world = Bukkit.getWorld("world");
double x = -1000.5;
double y = 0.0;
double z = 1000.5;
float yaw = (float) 0;
float pitch = (float) 0;
Location loc = new Location(world, x, y, z, yaw, pitch);
//player.teleport(loc);
player.setHealth(20D);
player.setFoodLevel(20);
player.setSaturation(5);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
} }
} }
break; break;
@@ -310,7 +220,7 @@ public class TpToFfaCommand implements CommandExecutor, TabCompleter {
@Override @Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { public @Nullable List<String> onTabComplete(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
if (args.length == 1) { if (args.length == 1) {
return List.of("sword", "uhc", "boxcart"); return List.of("sword", "uhc", "boxcart", "mace", "axe", "diamp");
} else if (args.length == 2) { } else if (args.length == 2) {
return null; return null;
} }

View File

@@ -3,6 +3,7 @@ package hu.jgj52.wolfFFA.Listeners;
import hu.jgj52.wolfFFA.Main; import hu.jgj52.wolfFFA.Main;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@@ -28,65 +29,128 @@ public class KitListener implements Listener {
public void onJoin(PlayerJoinEvent event) { public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (plugin.getConfig().getString("kits.sword." + player.getUniqueId()) == null) { if (plugin.getConfig().getString("kits.sword." + player.getUniqueId()) == null) {
Map<String, Object> swordKit = new HashMap<>(); Map<String, Object> kit = new HashMap<>();
swordKit.put("sword", 0); kit.put("sword", 0);
plugin.getConfig().set("kits.sword." + player.getUniqueId(), swordKit); plugin.getConfig().set("kits.sword." + player.getUniqueId(), kit);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig(); plugin.reloadConfig();
} }
if (plugin.getConfig().getString("kits.uhc." + player.getUniqueId()) == null) { if (plugin.getConfig().getString("kits.uhc." + player.getUniqueId()) == null) {
Map<String, Object> uhcKit = new HashMap<>(); Map<String, Object> kit = new HashMap<>();
int[] uhcshield = new int[]{13, 40}; int[] shield = new int[]{13, 40};
int[] uhcwater = new int[]{6, 22, 23, 24}; int[] water = new int[]{6, 22, 23, 24};
int[] uhclava = new int[]{2, 21}; int[] lava = new int[]{2, 21};
uhcKit.put("axe", 0); kit.put("axe", 0);
uhcKit.put("sword", 1); kit.put("sword", 1);
uhcKit.put("lava", uhclava); kit.put("lava", lava);
uhcKit.put("cobweb", 3); kit.put("cobweb", 3);
uhcKit.put("cobblestone", 4); kit.put("cobblestone", 4);
uhcKit.put("goldenapple", 5); kit.put("goldenapple", 5);
uhcKit.put("water", uhcwater); kit.put("water", water);
uhcKit.put("crossbow", 7); kit.put("crossbow", 7);
uhcKit.put("bow", 8); kit.put("bow", 8);
uhcKit.put("arrow", 9); kit.put("arrow", 9);
uhcKit.put("planks", 17); kit.put("planks", 17);
uhcKit.put("pickaxe", 20); kit.put("pickaxe", 20);
uhcKit.put("shield", uhcshield); kit.put("shield", shield);
plugin.getConfig().set("kits.uhc." + player.getUniqueId(), uhcKit); plugin.getConfig().set("kits.uhc." + player.getUniqueId(), kit);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig(); plugin.reloadConfig();
} }
if (plugin.getConfig().getString("kits.boxcart." + player.getUniqueId()) == null) { if (plugin.getConfig().getString("kits.boxcart." + player.getUniqueId()) == null) {
Map<String, Object> boxcartKit = new HashMap<>(); Map<String, Object> kit = new HashMap<>();
int[] boxcartstrenght = new int[]{16, 25, 34}; int[] strength = new int[]{16, 25, 34};
int[] boxcartspeed = new int[]{17, 26, 35}; int[] speed = new int[]{17, 26, 35};
int[] boxcartfireresistance = new int[]{24, 33}; int[] fireresistance = new int[]{24, 33};
int[] boxcartcart = new int[]{4, 12, 21, 30, 13, 22, 31, 14, 23, 32, 15}; int[] cart = new int[]{4, 12, 21, 30, 13, 22, 31, 14, 23, 32, 15};
int[] boxcartenderpearl = new int[]{2, 11, 20, 29}; int[] enderpearl = new int[]{2, 11, 20, 29};
boxcartKit.put("axe", 0); kit.put("axe", 0);
boxcartKit.put("sword", 1); kit.put("sword", 1);
boxcartKit.put("enderpearl", boxcartenderpearl); kit.put("enderpearl", enderpearl);
boxcartKit.put("rail", 3); kit.put("rail", 3);
boxcartKit.put("cart", boxcartcart); kit.put("cart", cart);
boxcartKit.put("goldenapple", 5); kit.put("goldenapple", 5);
boxcartKit.put("cobweb", 6); kit.put("cobweb", 6);
boxcartKit.put("shield", 7); kit.put("shield", 7);
boxcartKit.put("bow", 8); kit.put("bow", 8);
boxcartKit.put("arrow", 9); kit.put("arrow", 9);
boxcartKit.put("strength", boxcartstrenght); kit.put("strength", strength);
boxcartKit.put("speed", boxcartspeed); kit.put("speed", speed);
boxcartKit.put("fireresistance", boxcartfireresistance); kit.put("fireresistance", fireresistance);
boxcartKit.put("cherrylog", 10); kit.put("cherrylog", 10);
boxcartKit.put("pickaxe", 18); kit.put("pickaxe", 18);
boxcartKit.put("crossbow", 19); kit.put("crossbow", 19);
boxcartKit.put("shulker", 27); kit.put("shulker", 27);
boxcartKit.put("flintandsteel", 28); kit.put("flintandsteel", 28);
boxcartKit.put("totem", 40); kit.put("totem", 40);
plugin.getConfig().set("kits.boxcart." + player.getUniqueId(), boxcartKit); plugin.getConfig().set("kits.boxcart." + player.getUniqueId(), kit);
plugin.saveConfig();
plugin.reloadConfig();
}
if (plugin.getConfig().getString("kits.mace." + player.getUniqueId()) == null) {
Map<String, Object> kit = new HashMap<>();
int[] strength = new int[]{10, 11, 12, 13, 14, 15, 16, 28, 29, 30};
int[] speed = new int[]{19, 20, 21, 22, 23, 24, 25, 31, 32, 33};
int[] totem = new int[]{35, 40};
int[] enderpearl = new int[]{2, 9, 18, 27};
int[] goldenapple = new int[]{5, 17};
int[] windcharge = new int[]{7, 34};
kit.put("axe", 0);
kit.put("sword", 1);
kit.put("enderpearl", enderpearl);
kit.put("shield", 3);
kit.put("density", 4);
kit.put("goldenapple", goldenapple);
kit.put("breach", 6);
kit.put("windcharge", windcharge);
kit.put("elytra", 8);
kit.put("strength", strength);
kit.put("speed", speed);
kit.put("totem", totem);
kit.put("jumpboost", 26);
plugin.getConfig().set("kits.mace." + player.getUniqueId(), kit);
plugin.saveConfig();
plugin.reloadConfig();
}
if (plugin.getConfig().getString("kits.axe." + player.getUniqueId()) == null) {
Map<String, Object> kit = new HashMap<>();
kit.put("axe", 0);
kit.put("sword", 1);
kit.put("crossbow", 2);
kit.put("bow", 3);
kit.put("arrow", 8);
kit.put("shield", 40);
plugin.getConfig().set("kits.axe." + player.getUniqueId(), kit);
plugin.saveConfig();
plugin.reloadConfig();
}
if (plugin.getConfig().getString("kits.diasmp." + player.getUniqueId()) == null) {
Map<String, Object> kit = new HashMap<>();
int[] goldenapple = new int[]{5, 32};
int[] strength = new int[]{7, 12, 13, 14, 15, 19, 20, 21, 22, 23, 24, 29, 30, 31, 33};
int[] speed = new int[]{16, 25, 34};
int[] fireresistance = new int[]{17, 26, 35};
int[] water = new int[]{4, 10, 11};
int[] xp = new int[]{18, 27};
kit.put("axe", 0);
kit.put("sword", 1);
kit.put("enderpearl", 2);
kit.put("log", 3);
kit.put("water", water);
kit.put("goldenapple", goldenapple);
kit.put("cobweb", 6);
kit.put("strength", strength);
kit.put("totem", 8);
kit.put("pickaxe", 9);
kit.put("speed", speed);
kit.put("fireresistance", fireresistance);
kit.put("xp", xp);
kit.put("chorusfruit", 28);
kit.put("shield", 40);
plugin.getConfig().set("kits.diasmp." + player.getUniqueId(), kit);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig(); plugin.reloadConfig();
} }
} }
@EventHandler @EventHandler
@@ -106,6 +170,18 @@ public class KitListener implements Listener {
List<Integer> boxcartfireresistanceSlots = null; List<Integer> boxcartfireresistanceSlots = null;
List<Integer> boxcartcartSlots = null; List<Integer> boxcartcartSlots = null;
List<Integer> boxcartenderpearlSlots = null; List<Integer> boxcartenderpearlSlots = null;
List<Integer> macetotemSlots = null;
List<Integer> maceenderpearlSlots = null;
List<Integer> macestrengthSlots = null;
List<Integer> macespeedSlots = null;
List<Integer> macegoldenappleSlots = null;
List<Integer> macewindchargeSlots = null;
List<Integer> diasmpwaterSlots = null;
List<Integer> diasmpxpSlots = null;
List<Integer> diasmpstrengthSlots = null;
List<Integer> diasmpspeedSlots = null;
List<Integer> diasmpfireresistanceSlots = null;
List<Integer> diasmpgoldenappleSlots = null;
if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fSword Kit")) { if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fSword Kit")) {
for (int i = 0; i < inv.length; i++) { for (int i = 0; i < inv.length; i++) {
ItemStack item = inv[i]; ItemStack item = inv[i];
@@ -202,6 +278,10 @@ public class KitListener implements Listener {
} else if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Fire Resistance")) { } else if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Fire Resistance")) {
boxcartfireresistanceSlots.add(i); boxcartfireresistanceSlots.add(i);
} }
} else if (item.getType() == Material.RED_SHULKER_BOX) {
plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".shulker", i);
} else if (item.getType() == Material.NETHERITE_PICKAXE) {
plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".pickaxe", i);
} }
} }
} }
@@ -210,11 +290,128 @@ public class KitListener implements Listener {
plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".strength", boxcartstrenghtSlots); plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".strength", boxcartstrenghtSlots);
plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".speed", boxcartspeedSlots); plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".speed", boxcartspeedSlots);
plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".fireresistance", boxcartfireresistanceSlots); plugin.getConfig().set("kits.boxcart." + player.getUniqueId() + ".fireresistance", boxcartfireresistanceSlots);
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fMace Kit")) {
macetotemSlots = new ArrayList<>();
maceenderpearlSlots = new ArrayList<>();
macestrengthSlots = new ArrayList<>();
macespeedSlots = new ArrayList<>();
macegoldenappleSlots = new ArrayList<>();
macewindchargeSlots = new ArrayList<>();
for (int i = 0; i < inv.length; i++) {
ItemStack item = inv[i];
if (item != null) {
if (item.getType() == Material.NETHERITE_AXE) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".axe", i);
} else if (item.getType() == Material.NETHERITE_SWORD) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".sword", i);
} else if (item.getType() == Material.ENDER_PEARL) {
maceenderpearlSlots.add(i);
} else if (item.getType() == Material.SPLASH_POTION) {
if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Strength")) {
macestrengthSlots.add(i);
} else if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Swiftness")) {
macespeedSlots.add(i);
}
} else if (item.getType() == Material.SHIELD) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".shield", i);
} else if (item.getType() == Material.MACE) {
if (item.getItemMeta().getEnchants().containsKey(Enchantment.DENSITY)) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".density", i);
} else if (item.getItemMeta().getEnchants().containsKey(Enchantment.BREACH)) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".breach", i);
}
} else if (item.getType() == Material.GOLDEN_APPLE) {
macegoldenappleSlots.add(i);
} else if (item.getType() == Material.WIND_CHARGE) {
macewindchargeSlots.add(i);
} else if (item.getType() == Material.POTION) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".jumpboost", i);
} else if (item.getType() == Material.ELYTRA) {
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".elytra", i);
} else if (item.getType() == Material.TOTEM_OF_UNDYING) {
macetotemSlots.add(i);
}
}
}
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".totem", macetotemSlots);
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".enderpearl", maceenderpearlSlots);
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".strength", macestrengthSlots);
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".speed", macespeedSlots);
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".goldenapple", macegoldenappleSlots);
plugin.getConfig().set("kits.mace." + player.getUniqueId() + ".windcharge", macewindchargeSlots);
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fAxe Kit")) {
for (int i = 0; i < inv.length; i++) {
ItemStack item = inv[i];
if (item != null) {
if (item.getType() == Material.DIAMOND_AXE) {
plugin.getConfig().set("kits.axe." + player.getUniqueId() + "axe.", i);
} else if (item.getType() == Material.DIAMOND_SWORD) {
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".sword", i);
} else if (item.getType() == Material.CROSSBOW) {
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".crossbow", i);
} else if (item.getType() == Material.BOW) {
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".bow", i);
} else if (item.getType() == Material.ARROW) {
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".arrow", i);
} else if (item.getType() == Material.SHIELD) {
plugin.getConfig().set("kits.axe." + player.getUniqueId() + ".shield", i);
}
}
}
} else if (gui.getItem(13).getItemMeta().getDisplayName().equals("§fDiamondSmp Kit")) {
diasmpwaterSlots = new ArrayList<>();
diasmpxpSlots = new ArrayList<>();
diasmpstrengthSlots = new ArrayList<>();
diasmpspeedSlots = new ArrayList<>();
diasmpfireresistanceSlots = new ArrayList<>();
diasmpgoldenappleSlots = new ArrayList<>();
for (int i = 0; i < inv.length; i++) {
ItemStack item = inv[i];
if (item != null) {
if (item.getType() == Material.DIAMOND_AXE) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".axe", i);
} else if (item.getType() == Material.DIAMOND_SWORD) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".sword", i);
} else if (item.getType() == Material.ENDER_PEARL) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".enderpearl", i);
} else if (item.getType() == Material.OAK_LOG) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".log", i);
} else if (item.getType() == Material.WATER_BUCKET) {
diasmpwaterSlots.add(i);
} else if (item.getType() == Material.GOLDEN_APPLE) {
diasmpgoldenappleSlots.add(i);
} else if (item.getType() == Material.COBWEB) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".cobweb", i);
} else if (item.getType() == Material.SPLASH_POTION) {
if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Strength")) {
diasmpstrengthSlots.add(i);
} else if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Swiftness")) {
diasmpspeedSlots.add(i);
} else if (item.getItemMeta().getDisplayName().equals("§fSplash Potion of Fire Resistance")) {
diasmpfireresistanceSlots.add(i);
}
} else if (item.getType() == Material.TOTEM_OF_UNDYING) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".totem", i);
} else if (item.getType() == Material.NETHERITE_PICKAXE) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".pickaxe", i);
} else if (item.getType() == Material.EXPERIENCE_BOTTLE) {
diasmpxpSlots.add(i);
} else if (item.getType() == Material.CHORUS_FRUIT) {
plugin.getConfig().set("kits.diasmp." + player.getUniqueId() + ".chorusfruit", i);
}
}
}
} }
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig(); plugin.reloadConfig();
player.sendMessage("§aSikeresen elmentetted a kitedet!"); player.sendMessage("§aSikeresen elmentetted a kitedet!");
player.closeInventory(); player.closeInventory();
} else if ((6 <= event.getSlot() && event.getSlot() <= 8) || (15 <= event.getSlot() && event.getSlot() <= 17) || (24 <= event.getSlot() && event.getSlot() <= 26)) { } else if ((6 <= event.getSlot() && event.getSlot() <= 8) || (15 <= event.getSlot() && event.getSlot() <= 17) || (24 <= event.getSlot() && event.getSlot() <= 26)) {
player.closeInventory(); player.closeInventory();
player.sendMessage("§cA kited nem került mentésre."); player.sendMessage("§cA kited nem került mentésre.");

View File

@@ -5,11 +5,12 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
public class PlayerDamegeListener implements Listener { public class LeaveCommandListener implements Listener {
private final Main plugin; private final Main plugin;
public PlayerDamegeListener(Main plugin) { public LeaveCommandListener(Main plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@@ -19,4 +20,10 @@ public class PlayerDamegeListener implements Listener {
plugin.getPlayers().put(player, damager); plugin.getPlayers().put(player, damager);
} }
} }
@EventHandler
public void onDeath(PlayerDeathEvent e) {
if (e.getPlayer().getKiller() != null) {
plugin.getPlayers().remove(e.getPlayer());
}
}
} }

View File

@@ -5,11 +5,13 @@ import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class BlockBreakListener implements Listener { public class RandomListener implements Listener {
private final Main plugin; private final Main plugin;
public BlockBreakListener(Main plugin) { public RandomListener(Main plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@@ -21,4 +23,16 @@ public class BlockBreakListener implements Listener {
} }
} }
} }
@EventHandler
public void onDeath(PlayerDeathEvent event) {
if (event.getPlayer() == event.getPlayer().getKiller()) {
new BukkitRunnable() {
@Override
public void run() {
event.getPlayer().chat("/leave");
}
}.runTaskLater(plugin, 10L);
}
}
} }

View File

@@ -3,9 +3,9 @@ package hu.jgj52.wolfFFA;
import hu.jgj52.wolfFFA.Commands.EditKitCommand; import hu.jgj52.wolfFFA.Commands.EditKitCommand;
import hu.jgj52.wolfFFA.Commands.LeaveCommand; import hu.jgj52.wolfFFA.Commands.LeaveCommand;
import hu.jgj52.wolfFFA.Commands.TpToFfaCommand; import hu.jgj52.wolfFFA.Commands.TpToFfaCommand;
import hu.jgj52.wolfFFA.Listeners.BlockBreakListener; import hu.jgj52.wolfFFA.Listeners.RandomListener;
import hu.jgj52.wolfFFA.Listeners.KitListener; import hu.jgj52.wolfFFA.Listeners.KitListener;
import hu.jgj52.wolfFFA.Listeners.PlayerDamegeListener; import hu.jgj52.wolfFFA.Listeners.LeaveCommandListener;
import hu.jgj52.wolfFFA.Utils.MapReset; import hu.jgj52.wolfFFA.Utils.MapReset;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@@ -29,8 +29,8 @@ public final class Main extends JavaPlugin {
getCommand("leave").setExecutor(new LeaveCommand(this)); getCommand("leave").setExecutor(new LeaveCommand(this));
getServer().getPluginManager().registerEvents(new KitListener(this), this); getServer().getPluginManager().registerEvents(new KitListener(this), this);
getServer().getPluginManager().registerEvents(new BlockBreakListener(this), this); getServer().getPluginManager().registerEvents(new RandomListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerDamegeListener(this), this); getServer().getPluginManager().registerEvents(new LeaveCommandListener(this), this);
this.mapReset = new MapReset(this); this.mapReset = new MapReset(this);
} }
@@ -45,10 +45,6 @@ public final class Main extends JavaPlugin {
return getPlugin(Main.class); return getPlugin(Main.class);
} }
public MapReset getMapResetManager() {
return this.mapReset;
}
public Map<Player, Player> getPlayers() { public Map<Player, Player> getPlayers() {
return this.players; return this.players;
} }

View File

@@ -0,0 +1,474 @@
package hu.jgj52.wolfFFA.Utils;
import hu.jgj52.wolfFFA.Main;
import org.bukkit.Material;
import org.bukkit.block.ShulkerBox;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
public class Kits {
private final Main plugin;
public Kits(Main plugin) {
this.plugin = plugin;
}
private int getItemSlot(String key, String kit, Player player) {
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
if (plugin.getConfig().contains(path)) {
try {
return plugin.getConfig().getInt(path);
} catch (NumberFormatException e) {
plugin.getLogger().warning("Invalid slot number in config for " + path);
}
}
return -1;
}
private @NotNull List<Integer> getItemSlotArray(String key, String kit, Player player) {
String path = "kits." + kit + "." + player.getUniqueId() + "." + key;
if (plugin.getConfig().contains(path)) {
List<Integer> slots = plugin.getConfig().getIntegerList(path);
if (!slots.isEmpty()) {
return slots;
} else {
plugin.getLogger().warning("Invalid or empty slot numbers in config for " + path);
}
}
return Collections.singletonList(-1);
}
public Inventory getSwordKit(Player player) {
PlayerInventory inv = player.getInventory();
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
helmet.addEnchantment(Enchantment.PROTECTION, 3);
chestplate.addEnchantment(Enchantment.PROTECTION, 3);
leggings.addEnchantment(Enchantment.PROTECTION, 3);
boots.addEnchantment(Enchantment.PROTECTION, 3);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
inv.setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
inv.setItem(getItemSlot("sword", "sword", player), sword);
return inv;
}
public Inventory getUhcKit(Player player) {
PlayerInventory inv = player.getInventory();
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack lava = new ItemStack(Material.LAVA_BUCKET);
ItemStack cobweb = new ItemStack(Material.COBWEB, 8);
ItemStack cobblestone = new ItemStack(Material.COBBLESTONE, 64);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 13);
ItemStack water = new ItemStack(Material.WATER_BUCKET);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 16);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack planks = new ItemStack(Material.OAK_PLANKS, 64);
ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
helmet.addEnchantment(Enchantment.PROTECTION, 2);
chestplate.addEnchantment(Enchantment.PROTECTION, 3);
leggings.addEnchantment(Enchantment.PROTECTION, 3);
boots.addEnchantment(Enchantment.PROTECTION, 3);
axe.addEnchantment(Enchantment.SHARPNESS, 1);
axe.addEnchantment(Enchantment.EFFICIENCY, 3);
sword.addEnchantment(Enchantment.SHARPNESS, 4);
crossbow.addEnchantment(Enchantment.PIERCING, 1);
bow.addEnchantment(Enchantment.POWER, 1);
pickaxe.addEnchantment(Enchantment.UNBREAKING,3);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 3);
inv.setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
inv.setItem(getItemSlot("axe", "uhc", player), axe);
inv.setItem(getItemSlot("sword", "uhc", player), sword);
for (int slot : getItemSlotArray("lava", "uhc", player)) {
inv.setItem(slot, lava);
}
inv.setItem(getItemSlot("cobweb", "uhc", player), cobweb);
inv.setItem(getItemSlot("cobblestone", "uhc", player), cobblestone);
inv.setItem(getItemSlot("goldenapple", "uhc", player), goldenapple);
for (int slot : getItemSlotArray("water", "uhc", player)) {
inv.setItem(slot, water);
}
inv.setItem(getItemSlot("crossbow", "uhc", player), crossbow);
inv.setItem(getItemSlot("bow", "uhc", player), bow);
inv.setItem(getItemSlot("arrow", "uhc", player), arrow);
for (int slot : getItemSlotArray("shield", "uhc", player)) {
inv.setItem(slot, shield);
}
inv.setItem(getItemSlot("planks", "uhc", player), planks);
inv.setItem(getItemSlot("pickaxe", "uhc", player), pickaxe);
return inv;
}
public Inventory getBoxCartKit(Player player) {
PlayerInventory inv = player.getInventory();
ItemStack helmet = new ItemStack(Material.NETHERITE_HELMET);
ItemStack chestplate = new ItemStack(Material.NETHERITE_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.NETHERITE_LEGGINGS);
ItemStack boots = new ItemStack(Material.NETHERITE_BOOTS);
ItemStack axe = new ItemStack(Material.NETHERITE_AXE);
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD);
ItemStack enderpearl = new ItemStack(Material.ENDER_PEARL, 16);
ItemStack rail = new ItemStack(Material.RAIL, 64);
ItemStack cart = new ItemStack(Material.TNT_MINECART);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 64);
ItemStack cobweb = new ItemStack(Material.COBWEB, 64);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 64);
ItemStack fireresistance = new ItemStack(Material.SPLASH_POTION);
ItemStack strength = new ItemStack(Material.SPLASH_POTION);
ItemStack speed = new ItemStack(Material.SPLASH_POTION);
ItemStack cherrylog = new ItemStack(Material.CHERRY_LOG, 64);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack flintandsteel = new ItemStack(Material.FLINT_AND_STEEL);
ItemStack totem = new ItemStack(Material.TOTEM_OF_UNDYING);
ItemStack pickaxe = new ItemStack(Material.NETHERITE_PICKAXE);
ItemStack shulker = new ItemStack(Material.RED_SHULKER_BOX);
helmet.addEnchantment(Enchantment.PROTECTION, 4);
helmet.addEnchantment(Enchantment.RESPIRATION, 3);
helmet.addEnchantment(Enchantment.UNBREAKING, 3);
helmet.addEnchantment(Enchantment.MENDING, 1);
chestplate.addEnchantment(Enchantment.PROTECTION, 4);
chestplate.addEnchantment(Enchantment.UNBREAKING, 3);
chestplate.addEnchantment(Enchantment.MENDING, 1);
leggings.addEnchantment(Enchantment.BLAST_PROTECTION, 4);
leggings.addEnchantment(Enchantment.UNBREAKING, 3);
leggings.addEnchantment(Enchantment.MENDING, 1);
boots.addEnchantment(Enchantment.FEATHER_FALLING, 4);
boots.addEnchantment(Enchantment.PROTECTION, 4);
boots.addEnchantment(Enchantment.UNBREAKING,3);
boots.addEnchantment(Enchantment.MENDING, 1);
sword.addEnchantment(Enchantment.SHARPNESS, 5);
sword.addEnchantment(Enchantment.SWEEPING_EDGE, 3);
sword.addEnchantment(Enchantment.FIRE_ASPECT, 2);
sword.addEnchantment(Enchantment.KNOCKBACK, 1);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
sword.addEnchantment(Enchantment.MENDING, 1);
axe.addEnchantment(Enchantment.SHARPNESS, 5);
axe.addEnchantment(Enchantment.EFFICIENCY, 5);
axe.addEnchantment(Enchantment.UNBREAKING, 3);
axe.addEnchantment(Enchantment.MENDING, 1);
bow.addEnchantment(Enchantment.POWER, 5);
bow.addEnchantment(Enchantment.PUNCH, 2);
bow.addEnchantment(Enchantment.FLAME, 1);
bow.addEnchantment(Enchantment.UNBREAKING,3);
bow.addEnchantment(Enchantment.MENDING, 1);
crossbow.addEnchantment(Enchantment.PIERCING, 4);
crossbow.addEnchantment(Enchantment.QUICK_CHARGE, 3);
crossbow.addEnchantment(Enchantment.UNBREAKING, 3);
crossbow.addEnchantment(Enchantment.MENDING, 1);
flintandsteel.addEnchantment(Enchantment.UNBREAKING, 3);
flintandsteel.addEnchantment(Enchantment.MENDING, 1);
shield.addEnchantment(Enchantment.UNBREAKING, 3);
shield.addEnchantment(Enchantment.MENDING, 1);
pickaxe.addEnchantment(Enchantment.UNBREAKING, 3);
pickaxe.addEnchantment(Enchantment.MENDING, 1);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 5);
PotionMeta fireresistancemeta = (PotionMeta) fireresistance.getItemMeta();
fireresistancemeta.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 9600, 0), true);
fireresistancemeta.setDisplayName("§fSplash Potion of Fire Resistance");
fireresistance.setItemMeta(fireresistancemeta);
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
strengthmeta.setDisplayName("§fSplash Potion of Strength");
strength.setItemMeta(strengthmeta);
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1800, 1), true);
speedmeta.setDisplayName("§fSplash Potion of Swiftness");
speed.setItemMeta(speedmeta);
BlockStateMeta shulkermeta = (BlockStateMeta) shulker.getItemMeta();
ShulkerBox shulkerbox = (ShulkerBox) shulkermeta.getBlockState();
Inventory shulkerinv = shulkerbox.getInventory();
for (int i = 0; i < 27; i++) {
shulkerinv.setItem(i, new ItemStack(Material.TNT_MINECART));
}
shulkermeta.setBlockState(shulkerbox);
shulker.setItemMeta(shulkermeta);
inv.setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
inv.setItem(getItemSlot("axe", "boxcart", player), axe);
inv.setItem(getItemSlot("sword", "boxcart", player), sword);
for (int slot : getItemSlotArray("enderpearl", "boxcart", player)) {
inv.setItem(slot, enderpearl);
}
inv.setItem(getItemSlot("rail", "boxcart", player), rail);
for (int slot : getItemSlotArray("cart", "boxcart", player)) {
inv.setItem(slot, cart);
}
inv.setItem(getItemSlot("goldenapple", "boxcart", player), goldenapple);
inv.setItem(getItemSlot("cobweb", "boxcart", player), cobweb);
inv.setItem(getItemSlot("shield", "boxcart", player), shield);
inv.setItem(getItemSlot("bow", "boxcart", player), bow);
inv.setItem(getItemSlot("arrow", "boxcart", player), arrow);
for (int slot : getItemSlotArray("fireresistance", "boxcart", player)) {
inv.setItem(slot, fireresistance);
}
for (int slot : getItemSlotArray("strength", "boxcart", player)) {
inv.setItem(slot, strength);
}
for (int slot : getItemSlotArray("speed", "boxcart", player)) {
inv.setItem(slot, speed);
}
inv.setItem(getItemSlot("cherrylog", "boxcart", player), cherrylog);
inv.setItem(getItemSlot("crossbow", "boxcart", player), crossbow);
inv.setItem(getItemSlot("flintandsteel", "boxcart", player), flintandsteel);
inv.setItem(getItemSlot("totem", "boxcart", player), totem);
inv.setItem(getItemSlot("pickaxe", "boxcart", player), pickaxe);
inv.setItem(getItemSlot("shulker", "boxcart", player), shulker);
return inv;
}
public Inventory getMaceKit(Player player) {
PlayerInventory inv = player.getInventory();
ItemStack helmet = new ItemStack(Material.NETHERITE_HELMET);
ItemStack chestplate = new ItemStack(Material.NETHERITE_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.NETHERITE_LEGGINGS);
ItemStack boots = new ItemStack(Material.NETHERITE_BOOTS);
ItemStack axe = new ItemStack(Material.NETHERITE_AXE);
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD);
ItemStack enderpearl = new ItemStack(Material.ENDER_PEARL, 16);
ItemStack shield = new ItemStack(Material.SHIELD);
ItemStack density = new ItemStack(Material.MACE);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 64);
ItemStack breach = new ItemStack(Material.MACE);
ItemStack windchare = new ItemStack(Material.WIND_CHARGE, 64);
ItemStack elytra = new ItemStack(Material.ELYTRA);
ItemStack totem = new ItemStack(Material.TOTEM_OF_UNDYING);
ItemStack jumpboost = new ItemStack(Material.POTION);
ItemStack strength = new ItemStack(Material.SPLASH_POTION);
ItemStack speed = new ItemStack(Material.SPLASH_POTION);
helmet.addEnchantment(Enchantment.PROTECTION, 4);
helmet.addEnchantment(Enchantment.UNBREAKING, 3);
helmet.addEnchantment(Enchantment.MENDING, 1);
chestplate.addEnchantment(Enchantment.PROTECTION, 4);
chestplate.addEnchantment(Enchantment.UNBREAKING, 3);
chestplate.addEnchantment(Enchantment.MENDING, 1);
leggings.addEnchantment(Enchantment.PROTECTION, 4);
leggings.addEnchantment(Enchantment.UNBREAKING, 3);
leggings.addEnchantment(Enchantment.MENDING, 1);
boots.addEnchantment(Enchantment.FEATHER_FALLING, 4);
boots.addEnchantment(Enchantment.PROTECTION, 4);
boots.addEnchantment(Enchantment.UNBREAKING,3);
boots.addEnchantment(Enchantment.MENDING, 1);
sword.addEnchantment(Enchantment.SHARPNESS, 5);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
sword.addEnchantment(Enchantment.MENDING, 1);
axe.addEnchantment(Enchantment.SHARPNESS, 5);
axe.addEnchantment(Enchantment.UNBREAKING, 3);
axe.addEnchantment(Enchantment.MENDING, 1);
shield.addEnchantment(Enchantment.UNBREAKING, 3);
shield.addEnchantment(Enchantment.MENDING, 1);
density.addEnchantment(Enchantment.WIND_BURST, 1);
density.addEnchantment(Enchantment.DENSITY, 5);
density.addEnchantment(Enchantment.UNBREAKING, 3);
density.addEnchantment(Enchantment.MENDING, 1);
breach.addEnchantment(Enchantment.BREACH, 4);
breach.addEnchantment(Enchantment.UNBREAKING, 3);
breach.addEnchantment(Enchantment.MENDING, 1);
PotionMeta jumpboostmeta = (PotionMeta) speed.getItemMeta();
jumpboostmeta.addCustomEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, 1800, 1), true);
jumpboostmeta.setDisplayName("§fPotion of Leaping");
jumpboost.setItemMeta(jumpboostmeta);
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
strengthmeta.setDisplayName("§fSplash Potion of Strength");
strength.setItemMeta(strengthmeta);
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1800, 1), true);
speedmeta.setDisplayName("§fSplash Potion of Swiftness");
speed.setItemMeta(speedmeta);
inv.setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
inv.setItem(getItemSlot("axe", "mace", player), axe);
inv.setItem(getItemSlot("sword", "mace", player), sword);
for (int slot : getItemSlotArray("enderpearl", "mace", player)) {
inv.setItem(slot, enderpearl);
}
inv.setItem(getItemSlot("shield", "mace", player), shield);
inv.setItem(getItemSlot("density", "mace", player), density);
for (int slot : getItemSlotArray("goldenapple", "mace", player)) {
inv.setItem(slot, goldenapple);
}
inv.setItem(getItemSlot("breach", "mace", player), breach);
for (int slot : getItemSlotArray("windcharge", "mace", player)) {
inv.setItem(slot, windchare);
}
inv.setItem(getItemSlot("elytra", "mace", player), elytra);
inv.setItem(getItemSlot("jumpboost", "mace", player), jumpboost);
for (int slot : getItemSlotArray("strength", "mace", player)) {
inv.setItem(slot, strength);
}
for (int slot : getItemSlotArray("speed", "mace", player)) {
inv.setItem(slot, speed);
}
for (int slot : getItemSlotArray("totem", "mace", player)) {
inv.setItem(slot, totem);
}
return inv;
}
public Inventory getAxeKit(Player player) {
PlayerInventory inv = player.getInventory();
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrow = new ItemStack(Material.ARROW, 6);
ItemStack shield = new ItemStack(Material.SHIELD);
inv.setItem(getItemSlot("axe", "axe", player), axe);
inv.setItem(getItemSlot("sword", "axe", player), sword);
inv.setItem(getItemSlot("crossbow", "axe", player), crossbow);
inv.setItem(getItemSlot("bow", "axe", player), bow);
inv.setItem(getItemSlot("arrow", "axe", player), arrow);
inv.setItem(getItemSlot("shield", "axe", player), shield);
return inv;
}
public Inventory getDiamondSmpKit(Player player) {
PlayerInventory inv = player.getInventory();
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack enderpearl = new ItemStack(Material.ENDER_PEARL, 16);
ItemStack log = new ItemStack(Material.OAK_LOG, 64);
ItemStack water = new ItemStack(Material.WATER_BUCKET);
ItemStack goldenapple = new ItemStack(Material.GOLDEN_APPLE, 64);
ItemStack cobweb = new ItemStack(Material.COBWEB, 64);
ItemStack strength = new ItemStack(Material.SPLASH_POTION);
ItemStack totem = new ItemStack(Material.TOTEM_OF_UNDYING);
ItemStack pickaxe = new ItemStack(Material.NETHERITE_PICKAXE);
ItemStack speed = new ItemStack(Material.SPLASH_POTION);
ItemStack fireresistance = new ItemStack(Material.SPLASH_POTION);
ItemStack xp = new ItemStack(Material.EXPERIENCE_BOTTLE, 64);
ItemStack chorusfruit = new ItemStack(Material.CHORUS_FRUIT, 64);
ItemStack shield = new ItemStack(Material.SHIELD);
helmet.addEnchantment(Enchantment.PROTECTION, 4);
helmet.addEnchantment(Enchantment.UNBREAKING, 3);
helmet.addEnchantment(Enchantment.MENDING, 1);
chestplate.addEnchantment(Enchantment.PROTECTION, 4);
chestplate.addEnchantment(Enchantment.UNBREAKING, 3);
chestplate.addEnchantment(Enchantment.MENDING, 1);
leggings.addEnchantment(Enchantment.PROTECTION, 4);
leggings.addEnchantment(Enchantment.SWIFT_SNEAK, 3);
leggings.addEnchantment(Enchantment.UNBREAKING, 3);
leggings.addEnchantment(Enchantment.MENDING, 1);
boots.addEnchantment(Enchantment.PROTECTION, 4);
boots.addEnchantment(Enchantment.FEATHER_FALLING, 4);
boots.addEnchantment(Enchantment.DEPTH_STRIDER, 3);
boots.addEnchantment(Enchantment.UNBREAKING, 3);
boots.addEnchantment(Enchantment.MENDING, 1);
axe.addEnchantment(Enchantment.SHARPNESS, 5);
axe.addEnchantment(Enchantment.UNBREAKING, 3);
sword.addEnchantment(Enchantment.SHARPNESS, 5);
sword.addEnchantment(Enchantment.FIRE_ASPECT, 2);
sword.addEnchantment(Enchantment.UNBREAKING, 3);
pickaxe.addEnchantment(Enchantment.SILK_TOUCH, 1);
pickaxe.addEnchantment(Enchantment.EFFICIENCY, 5);
pickaxe.addEnchantment(Enchantment.UNBREAKING, 3);
pickaxe.addEnchantment(Enchantment.MENDING, 1);
shield.addEnchantment(Enchantment.UNBREAKING, 3);
shield.addEnchantment(Enchantment.MENDING, 1);
PotionMeta fireresistancemeta = (PotionMeta) fireresistance.getItemMeta();
fireresistancemeta.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 9600, 0), true);
fireresistancemeta.setDisplayName("§fSplash Potion of Fire Resistance");
fireresistance.setItemMeta(fireresistancemeta);
PotionMeta strengthmeta = (PotionMeta) strength.getItemMeta();
strengthmeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 1800, 1), true);
strengthmeta.setDisplayName("§fSplash Potion of Strength");
strength.setItemMeta(strengthmeta);
PotionMeta speedmeta = (PotionMeta) speed.getItemMeta();
speedmeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 9600, 0), true);
speedmeta.setDisplayName("§fSplash Potion of Swiftness");
speed.setItemMeta(speedmeta);
inv.setArmorContents(new ItemStack[]{boots, leggings, chestplate, helmet});
inv.setItem(getItemSlot("axe", "diasmp", player), axe);
inv.setItem(getItemSlot("sword", "diasmp", player), sword);
inv.setItem(getItemSlot("enderpearl", "diasmp", player), enderpearl);
inv.setItem(getItemSlot("log", "diasmp", player), log);
for (int slot : getItemSlotArray("water", "diasmp", player)) {
inv.setItem(slot, water);
}
for (int slot : getItemSlotArray("goldenapple", "diasmp", player)) {
inv.setItem(slot, goldenapple);
}
inv.setItem(getItemSlot("cobweb", "diasmp", player), cobweb);
for (int slot : getItemSlotArray("strength", "diasmp", player)) {
inv.setItem(slot, strength);
}
inv.setItem(getItemSlot("totem", "diasmp", player), totem);
inv.setItem(getItemSlot("pickaxe", "diasmp", player), pickaxe);
for (int slot : getItemSlotArray("speed", "diasmp", player)) {
inv.setItem(slot, speed);
}
for (int slot : getItemSlotArray("fireresistance", "diasmp", player)) {
inv.setItem(slot, fireresistance);
}
for (int slot : getItemSlotArray("xp", "diasmp", player)) {
inv.setItem(slot, xp);
}
inv.setItem(getItemSlot("chorusfruit", "diasmp", player), chorusfruit);
inv.setItem(getItemSlot("shield", "diasmp", player), shield);
return inv;
}
}

View File

@@ -37,7 +37,8 @@ public class MapReset {
private static final long SCHEMATIC_PLACEMENT_DELAY = 60L; private static final long SCHEMATIC_PLACEMENT_DELAY = 60L;
private static final Set<EntityType> ENTITIES_TO_REMOVE = EnumSet.of( private static final Set<EntityType> ENTITIES_TO_REMOVE = EnumSet.of(
EntityType.TNT_MINECART, EntityType.TNT_MINECART,
EntityType.END_CRYSTAL EntityType.END_CRYSTAL,
EntityType.ITEM
); );
private static final List<SchematicPlacement> SCHEMATICS = Arrays.asList( private static final List<SchematicPlacement> SCHEMATICS = Arrays.asList(