diff --git a/src/main/java/hu/jgj52/wolfFFA/Commands/EditKitCommand.java b/src/main/java/hu/jgj52/wolfFFA/Commands/EditKitCommand.java new file mode 100644 index 0000000..03fb045 --- /dev/null +++ b/src/main/java/hu/jgj52/wolfFFA/Commands/EditKitCommand.java @@ -0,0 +1,154 @@ +package hu.jgj52.wolfFFA.Commands; + +import hu.jgj52.wolfFFA.WolfFFA; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +public class EditKitCommand implements CommandExecutor, TabCompleter { + private final WolfFFA plugin; + + public EditKitCommand(WolfFFA plugin) { + this.plugin = plugin; + } + + @Override + public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { + if (cmds.hasPermission("wolfffa.command.editkit")) { + if (cmds instanceof Player player) { + if (args.length > 0) { + Inventory gui = Bukkit.createInventory(null, 45, "Kit Edit"); + + ItemStack saveKit = new ItemStack(Material.PLAYER_HEAD); + SkullMeta saveMeta = (SkullMeta) saveKit.getItemMeta(); + + ItemStack info = new ItemStack(Material.PLAYER_HEAD); + SkullMeta infoMeta = (SkullMeta) info.getItemMeta(); + + if (saveMeta != null) { + saveMeta.setDisplayName("§aSave"); + saveKit.setItemMeta(saveMeta); + } + + if (infoMeta != null) { + infoMeta.setDisplayName("§aInformáció"); + infoMeta.setLore(Collections.singletonList("§5A 4. sor a hotbar, 5. sor 1. iteme az offhand.")); + info.setItemMeta(infoMeta); + } + + gui.setItem(37, info); + gui.setItem(44, saveKit); + switch (args[0]) { + case "sword": + ItemStack swordsword = new ItemStack(Material.DIAMOND_SWORD); + swordsword.addEnchantment(Enchantment.UNBREAKING, 3); + + gui.setItem(27, swordsword); + + player.openInventory(gui); + break; + case "uhc": + ItemStack uhchelmet = new ItemStack(Material.DIAMOND_HELMET); + ItemStack uhcchestplate = new ItemStack(Material.DIAMOND_CHESTPLATE); + ItemStack uhcleggings = new ItemStack(Material.DIAMOND_LEGGINGS); + ItemStack uhcboots = new ItemStack(Material.DIAMOND_BOOTS); + ItemStack uhcaxe = new ItemStack(Material.DIAMOND_AXE); + ItemStack uhcsword = new ItemStack(Material.DIAMOND_SWORD); + ItemStack uhclava = 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 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 uhcplanks = new ItemStack(Material.OAK_PLANKS, 64); + ItemStack uhcpickaxe = new ItemStack(Material.DIAMOND_PICKAXE); + + + uhchelmet.addEnchantment(Enchantment.PROTECTION, 2); + uhcchestplate.addEnchantment(Enchantment.PROTECTION, 3); + uhcleggings.addEnchantment(Enchantment.PROTECTION, 3); + uhcboots.addEnchantment(Enchantment.PROTECTION, 3); + uhcaxe.addEnchantment(Enchantment.SHARPNESS, 1); + uhcaxe.addEnchantment(Enchantment.EFFICIENCY, 3); + uhcsword.addEnchantment(Enchantment.SHARPNESS, 4); + uhccrossbow.addEnchantment(Enchantment.PIERCING, 1); + uhcbow.addEnchantment(Enchantment.POWER, 1); + uhcpickaxe.addEnchantment(Enchantment.UNBREAKING,3); + uhcpickaxe.addEnchantment(Enchantment.EFFICIENCY, 3); + + gui.setItem(27, uhcaxe); + gui.setItem(28, uhcsword); + gui.setItem(29, uhclava); + gui.setItem(30, uhccobweb); + gui.setItem(31, uhccobblestone); + gui.setItem(32, uhcgoldenapple); + gui.setItem(33, uhcwater); + gui.setItem(34, uhccrossbow); + gui.setItem(35, uhcbow); + gui.setItem(36, uhcshield); + gui.setItem(0, uhcarrow); + gui.setItem(4, uhcshield); + gui.setItem(8, uhcplanks); + gui.setItem(11, uhcpickaxe); + gui.setItem(12, uhclava); + gui.setItem(13, uhcwater); + gui.setItem(14, uhcwater); + gui.setItem(15, uhcwater); + + player.openInventory(gui); + break; + default: + player.sendMessage("§cNincs ilyen FFA típus!"); + break; + } + } + } + } + return true; + } + + @Override + public @Nullable List onTabComplete(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { + return List.of(); + } +} +/* + Inventory gui = Bukkit.createInventory(null, 45, "Sword Kit"); + + ItemStack saveKit = new ItemStack(Material.PLAYER_HEAD); + SkullMeta saveMeta = (SkullMeta) saveKit.getItemMeta(); + + ItemStack info = new ItemStack(Material.PLAYER_HEAD); + SkullMeta infoMeta = (SkullMeta) info.getItemMeta(); + + if (saveMeta != null) { + saveMeta.setDisplayName("§aSave"); + saveKit.setItemMeta(saveMeta); + } + + if (infoMeta != null) { + infoMeta.setDisplayName("§aInformáció"); + infoMeta.setLore(Collections.singletonList("§5A 4. sor a hotbar, 5. sor 1. iteme az offhand.")); + } + + gui.setItem(44, saveKit); + + player.openInventory(gui); + break; + */ \ No newline at end of file diff --git a/src/main/java/hu/jgj52/wolfFFA/Commands/WolfFfaCommand.java b/src/main/java/hu/jgj52/wolfFFA/Commands/TpToFfaCommand.java similarity index 94% rename from src/main/java/hu/jgj52/wolfFFA/Commands/WolfFfaCommand.java rename to src/main/java/hu/jgj52/wolfFFA/Commands/TpToFfaCommand.java index 2eea80b..a8e7030 100644 --- a/src/main/java/hu/jgj52/wolfFFA/Commands/WolfFfaCommand.java +++ b/src/main/java/hu/jgj52/wolfFFA/Commands/TpToFfaCommand.java @@ -18,16 +18,16 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class WolfFfaCommand implements CommandExecutor, TabCompleter { +public class TpToFfaCommand implements CommandExecutor, TabCompleter { private final WolfFFA plugin; - public WolfFfaCommand(WolfFFA plugin) { + public TpToFfaCommand(WolfFFA plugin) { this.plugin = plugin; } - private int getItem(String key, String kittype, Player player) { - String path = "kits." + kittype + "." + player.getUniqueId() + "." + key; + private int getItem(String key, String kit, Player player) { + String path = "kits." + kit + "." + player.getUniqueId() + "." + key; if (plugin.getConfig().contains(path)) { try { @@ -40,15 +40,13 @@ public class WolfFfaCommand implements CommandExecutor, TabCompleter { return -1; } - private boolean checkItem(String key, String kittype, Player player) { - String path = "kits." + kittype + "." + player.getUniqueId() + "." + key; - - return plugin.getConfig().getBoolean(path, false); + private boolean checkItem(String key, String kit, Player player) { + String path = "kits." + kit + "." + player.getUniqueId() + "." + key; + player.sendMessage("Slot: " + plugin.getConfig().get(path)); + return plugin.getConfig().get(path) != null ? true : false; } - - @Override public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { if (cmds.hasPermission("wolfffa.admin.tptoffa")) { diff --git a/src/main/java/hu/jgj52/wolfFFA/Commands/WolfFfaReloadCommand.java b/src/main/java/hu/jgj52/wolfFFA/Commands/WolfFfaReloadCommand.java deleted file mode 100644 index 1abfd14..0000000 --- a/src/main/java/hu/jgj52/wolfFFA/Commands/WolfFfaReloadCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -package hu.jgj52.wolfFFA.Commands; - -import hu.jgj52.wolfFFA.WolfFFA; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; - -public class WolfFfaReloadCommand implements CommandExecutor { - private final WolfFFA plugin; - - public WolfFfaReloadCommand(WolfFFA plugin) { - this.plugin = plugin; - } - - - @Override - public boolean onCommand(@NotNull CommandSender cmds, @NotNull Command command, @NotNull String s, @NotNull String[] args) { - if (cmds.hasPermission("wolfffa.admin.reload")) { - plugin.reloadConfig(); - cmds.sendMessage("§aKész!"); - } - return true; - } -} diff --git a/src/main/java/hu/jgj52/wolfFFA/WolfFFA.java b/src/main/java/hu/jgj52/wolfFFA/WolfFFA.java index 387a8a8..92c1f33 100644 --- a/src/main/java/hu/jgj52/wolfFFA/WolfFFA.java +++ b/src/main/java/hu/jgj52/wolfFFA/WolfFFA.java @@ -1,7 +1,7 @@ package hu.jgj52.wolfFFA; -import hu.jgj52.wolfFFA.Commands.WolfFfaCommand; -import hu.jgj52.wolfFFA.Commands.WolfFfaReloadCommand; +import hu.jgj52.wolfFFA.Commands.EditKitCommand; +import hu.jgj52.wolfFFA.Commands.TpToFfaCommand; import org.bukkit.plugin.java.JavaPlugin; public final class WolfFFA extends JavaPlugin { @@ -11,8 +11,8 @@ public final class WolfFFA extends JavaPlugin { // Plugin startup logic getConfig().options().copyDefaults(true); - getCommand("tptoffa").setExecutor(new WolfFfaCommand(this)); - getCommand("wolfffareload").setExecutor(new WolfFfaReloadCommand(this)); + getCommand("tptoffa").setExecutor(new TpToFfaCommand(this)); + getCommand("editkit").setExecutor(new EditKitCommand(this)); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 701f0de..17b2ce1 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -6,6 +6,6 @@ commands: tptoffa: permission: wolfffa.admin.tptoffa usage: /tptoffa - wolfffareload: - permission: wolffa.admin.reload - usage: /wolfffareload \ No newline at end of file + editkit: + permission: wolfffa.command.editkit + usage: /editkit \ No newline at end of file diff --git a/target/WolfFFA-1.0.jar b/target/WolfFFA-1.0.jar index e1dff94..3393200 100644 Binary files a/target/WolfFFA-1.0.jar and b/target/WolfFFA-1.0.jar differ diff --git a/target/classes/hu/jgj52/wolfFFA/Commands/WolfFfaCommand.class b/target/classes/hu/jgj52/wolfFFA/Commands/WolfFfaCommand.class deleted file mode 100644 index 3722688..0000000 Binary files a/target/classes/hu/jgj52/wolfFFA/Commands/WolfFfaCommand.class and /dev/null differ diff --git a/target/original-WolfFFA-1.0.jar b/target/original-WolfFFA-1.0.jar index b646411..7cfc35e 100644 Binary files a/target/original-WolfFFA-1.0.jar and b/target/original-WolfFFA-1.0.jar differ