diff --git a/build.gradle.kts b/build.gradle.kts index 9f6b89a..740304c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ plugins { group = "me.ShermansWorld" -version = "1.27.2" +version = "1.29.0" description = "" val mainPackage = "${project.group}.${rootProject.name}" @@ -211,4 +211,4 @@ else project.version = if (versionArg.first().equals('v', true)) versionArg.substring(1) else - versionArg.uppercase() \ No newline at end of file + versionArg.uppercase() diff --git a/src/main/java/me/ShermansWorld/AlathraExtras/AlathraExtras.java b/src/main/java/me/ShermansWorld/AlathraExtras/AlathraExtras.java index 998e514..25e6d8d 100644 --- a/src/main/java/me/ShermansWorld/AlathraExtras/AlathraExtras.java +++ b/src/main/java/me/ShermansWorld/AlathraExtras/AlathraExtras.java @@ -17,7 +17,6 @@ import me.ShermansWorld.AlathraExtras.funny.FreeOpCommand; import me.ShermansWorld.AlathraExtras.funny.HeadScourgeListener; import me.ShermansWorld.AlathraExtras.halloween.CandyEatListener; -import me.ShermansWorld.AlathraExtras.items.ItemConverter; import me.ShermansWorld.AlathraExtras.items.ItemUseListener; import me.ShermansWorld.AlathraExtras.chat.joinleavemessages.JoinLeaveMessages; import me.ShermansWorld.AlathraExtras.metrics.MetricsManager; @@ -170,7 +169,6 @@ public void onEnable() { this.getServer().getPluginManager().registerEvents(new FarmingListener(), this); // this.getServer().getPluginManager().registerEvents(new BookEventsListener(), this); // This is broken do not enable unless you have confirmed its working. - this.getServer().getPluginManager().registerEvents(new ItemConverter(), this); this.getServer().getPluginManager().registerEvents(new TownyMenu(), this); this.getServer().getPluginManager().registerEvents(new CauldronRecipesListener(), this); diff --git a/src/main/java/me/ShermansWorld/AlathraExtras/crafting/CraftingRecipes.java b/src/main/java/me/ShermansWorld/AlathraExtras/crafting/CraftingRecipes.java index 7f9ebcb..d3c43b0 100644 --- a/src/main/java/me/ShermansWorld/AlathraExtras/crafting/CraftingRecipes.java +++ b/src/main/java/me/ShermansWorld/AlathraExtras/crafting/CraftingRecipes.java @@ -394,9 +394,8 @@ public static void strawHatRecipe() { NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), AlathraExtras.getInstance().getName() + "straw_hat"); ShapedRecipe strawHatRecipe = new ShapedRecipe(key, strawHat); - strawHatRecipe.shape("@@@", "@#@", "$ $"); + strawHatRecipe.shape("@@@", "@ @", "$ $"); strawHatRecipe.setIngredient('@', Material.WHEAT); - strawHatRecipe.setIngredient('#', Material.LEATHER_HELMET); strawHatRecipe.setIngredient('$', Material.STRING); AlathraExtras.getInstance().getServer().addRecipe(strawHatRecipe); } @@ -502,6 +501,125 @@ public static void caneRecipe() { AlathraExtras.getInstance().getServer().addRecipe(caneRecipe); } + public static void scepterRecipe() { + ItemStack scepter = new ItemStack(Material.STICK); + ItemMeta scepterMeta = scepter.getItemMeta(); + scepterMeta.displayName(ColorParser.of("Ruler's Scepter").build()); + scepterMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + scepterMeta.setCustomModelData(202); + scepter.setItemMeta(scepterMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "scepter"); + ShapedRecipe scepterRecipe = new ShapedRecipe(key, scepter); + scepterRecipe.shape("@# ", "$%$", " ^%"); + scepterRecipe.setIngredient('@', Material.AMETHYST_SHARD); + scepterRecipe.setIngredient('#', Material.LAPIS_LAZULI); + scepterRecipe.setIngredient('$', Material.REDSTONE); + scepterRecipe.setIngredient('%', Material.GOLD_INGOT); + scepterRecipe.setIngredient('^', Material.EMERALD); + AlathraExtras.getInstance().getServer().addRecipe(scepterRecipe); + } + + public static void wizardStaffRecipe() { + ItemStack wizardStaff = new ItemStack(Material.STICK); + ItemMeta wizardStaffMeta = wizardStaff.getItemMeta(); + wizardStaffMeta.displayName(ColorParser.of("Wizard's Staff").build()); + wizardStaffMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + wizardStaffMeta.setCustomModelData(203); + wizardStaff.setItemMeta(wizardStaffMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "wizardStaff"); + ShapedRecipe wizardStaffRecipe = new ShapedRecipe(key, wizardStaff); + wizardStaffRecipe.shape(" @@", " #@", " @"); + wizardStaffRecipe.setIngredient('@', Material.STICK); + wizardStaffRecipe.setIngredient('#', Material.LAPIS_BLOCK); + AlathraExtras.getInstance().getServer().addRecipe(wizardStaffRecipe); + } + + public static void tophatRecipe() { + ItemStack tophat = new ItemStack(Material.CARVED_PUMPKIN); + ItemMeta tophatMeta = tophat.getItemMeta(); + tophatMeta.displayName(ColorParser.of("Gentleman's Pride").build()); + tophatMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + tophatMeta.setCustomModelData(207); + tophat.setItemMeta(tophatMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "tophat"); + ShapedRecipe tophatRecipe = new ShapedRecipe(key, tophat); + tophatRecipe.shape(" @ ", " # ", "$$$"); + tophatRecipe.setIngredient('@', Material.BLACK_WOOL); + tophatRecipe.setIngredient('#', Material.WHITE_WOOL); + tophatRecipe.setIngredient('$', Material.BLACK_CARPET); + AlathraExtras.getInstance().getServer().addRecipe(tophatRecipe); + } + + public static void hornedHelmetRecipe() { + ItemStack hornedHelmet = new ItemStack(Material.CARVED_PUMPKIN); + ItemMeta hornedHelmetMeta = hornedHelmet.getItemMeta(); + hornedHelmetMeta.displayName(ColorParser.of("Horned Helmet").build()); + hornedHelmetMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + hornedHelmetMeta.setCustomModelData(208); + hornedHelmet.setItemMeta(hornedHelmetMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "hornedHelmet"); + ShapedRecipe hornedHelmetRecipe = new ShapedRecipe(key, hornedHelmet); + hornedHelmetRecipe.shape("@ @", "$#$", "$ $"); + hornedHelmetRecipe.setIngredient('@', Material.BONE); + hornedHelmetRecipe.setIngredient('#', Material.IRON_INGOT); + hornedHelmetRecipe.setIngredient('$', Material.LEATHER); + AlathraExtras.getInstance().getServer().addRecipe(hornedHelmetRecipe); + } + + public static void mustacheRecipe() { + ItemStack mustache = new ItemStack(Material.CARVED_PUMPKIN); + ItemMeta mustacheMeta = mustache.getItemMeta(); + mustacheMeta.displayName(ColorParser.of("Mighty Stache").build()); + mustacheMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + mustacheMeta.setCustomModelData(209); + mustache.setItemMeta(mustacheMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "mustache"); + ShapedRecipe mustacheRecipe = new ShapedRecipe(key, mustache); + mustacheRecipe.shape(" ", "@@@", "@ @"); + mustacheRecipe.setIngredient('@', Material.BLACK_WOOL); + AlathraExtras.getInstance().getServer().addRecipe(mustacheRecipe); + } + + public static void crownRecipe() { + ItemStack crown = new ItemStack(Material.CARVED_PUMPKIN); + ItemMeta crownMeta = crown.getItemMeta(); + crownMeta.displayName(ColorParser.of("Ruler's Crown").build()); + crownMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + crownMeta.setCustomModelData(210); + crown.setItemMeta(crownMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "crown"); + ShapedRecipe crownRecipe = new ShapedRecipe(key, crown); + crownRecipe.shape("@ @", "###", "$%^"); + crownRecipe.setIngredient('@', Material.GOLD_INGOT); + crownRecipe.setIngredient('#', Material.GOLD_BLOCK); + crownRecipe.setIngredient('$', Material.LAPIS_LAZULI); + crownRecipe.setIngredient('%', Material.REDSTONE); + crownRecipe.setIngredient('^', Material.EMERALD); + AlathraExtras.getInstance().getServer().addRecipe(crownRecipe); + } + + public static void wreathRecipe() { + ItemStack wreath = new ItemStack(Material.CARVED_PUMPKIN); + ItemMeta wreathMeta = wreath.getItemMeta(); + wreathMeta.displayName(ColorParser.of("Wreath of Suns").build()); + wreathMeta.lore(List.of(ColorParser.of("Alathran Accessory").build())); + wreathMeta.setCustomModelData(211); + wreath.setItemMeta(wreathMeta); + NamespacedKey key = new NamespacedKey(AlathraExtras.getInstance(), + AlathraExtras.getInstance().getName() + "wreath"); + ShapedRecipe wreathRecipe = new ShapedRecipe(key, wreath); + wreathRecipe.shape("@#@", "# #", "@#@"); + wreathRecipe.setIngredient('@', Material.VINE); + wreathRecipe.setIngredient('#', Material.SUNFLOWER); + AlathraExtras.getInstance().getServer().addRecipe(wreathRecipe); + } + public static void registerAllCraftingRecipes() { saddleRecipe(); charcoalBlock(); @@ -537,5 +655,12 @@ public static void registerAllCraftingRecipes() { greenHatRecipe(); watchRecipe(); caneRecipe(); + scepterRecipe(); + wizardStaffRecipe(); + tophatRecipe(); + hornedHelmetRecipe(); + mustacheRecipe(); + crownRecipe(); + wreathRecipe(); } } diff --git a/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemConverter.java b/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemConverter.java deleted file mode 100644 index 7780bea..0000000 --- a/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemConverter.java +++ /dev/null @@ -1,153 +0,0 @@ -package me.ShermansWorld.AlathraExtras.items; - -import org.bukkit.Bukkit; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; - -public class ItemConverter implements Listener { - /** - * Used for converting older item stacks to new ones since NBT data changed and - * broke some items when the server was updated from 1.20.1 to 1.20.4. - * - * This listener makes it so when a player opens a container with the old items - * it will replace the item with the new version, if detected. - */ - - // Alathran ores - String oldPlatinum = "ItemStack{COPPER_INGOT x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"dark_aqua\",\"text\":\"Platinum\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=3}}"; - String oldPlatinum2 = "ItemStack{COPPER_INGOT x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"dark_aqua\",\"text\":\"Platinum\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=3, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZeAIyEksycwrzWUAALGXIoYcAAAA}}"; - String oldSilver = "ItemStack{COPPER_INGOT x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"gray\",\"text\":\"Silver\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=4}}"; - String oldSilver2 = "ItemStack{COPPER_INGOT x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"gray\",\"text\":\"Silver\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=4, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZWALzswpSy1iAAB/RFAdGgAAAA==}}"; - String oldTungsten = "ItemStack{COPPER_INGOT x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"dark_gray\",\"text\":\"Tungsten\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=2}}"; - String oldTungsten2 = "ItemStack{COPPER_INGOT x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"dark_gray\",\"text\":\"Tungsten\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=2, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZeAIKc1LLy5JzWMAAAokz+kcAAAA}}"; - - // Pouches - String oldCarrotPouch = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gold\",\"text\":\"Carrot Pouch\"}],\"text\":\"\"}, custom-model-data=14701}}"; - String oldBeetrootPouch = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_red\",\"text\":\"Beetroot Pouch\"}],\"text\":\"\"}, custom-model-data=14700}}"; - String oldPotatoPouch = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"yellow\",\"text\":\"Potato Pouch\"}],\"text\":\"\"}, custom-model-data=14713}}"; - - // Nether heart - String oldNetherHeart = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"dark_red\",\"text\":\"Nether Heart\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=14801}}"; - String oldNetherHeart2 = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"bold\":true,\"italic\":false,\"color\":\"dark_red\",\"text\":\"Nether Heart\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=14801, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZeDxSy3JSC2K90hNLCphAAAcY4rIIAAAAA==}}"; - - // Runes - String forestRune = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_green\",\"text\":\"Forest Rune\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14616}}"; - String mountainRune = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"Mountain Rune\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14617}}"; - String tropicalRune = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"yellow\",\"text\":\"Tropical Rune\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14618}}"; - String tundraRune = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_aqua\",\"text\":\"Tundra Rune\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14619}}"; - - // Regional resources - String abyssalStone = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"Abyssal Stone\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14600}}"; - String ancientWood = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gold\",\"text\":\"Ancient Wood\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14601}}"; - String baerSteel = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"aqua\",\"text\":\"Baer Steel\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14602}}"; - String blessedOpal = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"yellow\",\"text\":\"Blessed Opal\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14603}}"; - String elustone = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_aqua\",\"text\":\"Elustone\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14604}}"; - String fyada = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"aqua\",\"text\":\"Fyada\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14605}}"; - String luminousBismuth = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_purple\",\"text\":\"Luminous Bismuth\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14606}}"; - String magikite = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"blue\",\"text\":\"Magikite\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14607}}"; - String quicksilver = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"Quicksilver\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14608}}"; - String roseQuartz = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"light_purple\",\"text\":\"Rose Quartz\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14609}}"; - String rotwud = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_red\",\"text\":\"Rotwud\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14610}}"; - String saelz = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"light_purple\",\"text\":\"Saelz\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14611}}"; - String solarGold = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gold\",\"text\":\"Solar Gold\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14612}}"; - String tetracide = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"red\",\"text\":\"Tetracide\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14613}}"; - String velotite = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_green\",\"text\":\"Velotite\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14614}}"; - String wildCitrine = "ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"extra\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gold\",\"text\":\"Wild Citrine\"}],\"text\":\"\"}, lore=[{\"extra\":[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}],\"text\":\"\"}], custom-model-data=14615}}"; - - // Meats - String rawBoarMeat = "ItemStack{PORKCHOP x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"italic\":true,\"color\":\"white\",\"text\":\"Boar Meat\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=2800, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZeB0yk8sivdNTSxhAACHaniQHQAAAA==}}"; - String rawElephantMeat = "ItemStack{BEEF x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"italic\":false,\"color\":\"white\",\"text\":\"Raw Elephant Meat\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=2800, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZeB1zUktyEjMK4n3TU0sYQAAEWqiTyEAAAA=}}"; - String rawSharkMeat = "ItemStack{COD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"italic\":false,\"color\":\"white\",\"text\":\"Raw Shark Meat\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=2800, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZeAKzkgsyo73TU0sYQAAzF8rZh4AAAA=}}"; - String rawVenison = "ItemStack{MUTTON x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={\"italic\":false,\"color\":\"white\",\"text\":\"Raw Venison\"}, lore=[{\"bold\":true,\"italic\":false,\"color\":\"green\",\"text\":\"Alathran Item\"}], custom-model-data=2800, internal=H4sIAAAAAAAA/+NiYOBg4PaNDPHwdI4PiQxwZWAPS83LLM7PYwAAJnwUvxsAAAA=}}"; - - @EventHandler - public void onInventoryOpen(InventoryOpenEvent event) { - ItemStack[] storageContents = event.getInventory().getStorageContents(); - for (int i = 0; i < storageContents.length; i++) { - int amount; - if (storageContents[i] == null) { - continue; - } else { - amount = storageContents[i].getAmount(); - } - - if (storageContents[i].asOne().toString().equals(oldPlatinum) - || storageContents[i].asOne().toString().equals(oldPlatinum2)) { - replaceItem(event.getInventory(), Items.getPlatinum(), i, amount); - } else if (storageContents[i].asOne().toString().equals(oldSilver) - || storageContents[i].asOne().toString().equals(oldSilver2)) { - replaceItem(event.getInventory(), Items.getSilver(), i, amount); - } else if (storageContents[i].asOne().toString().equals(oldTungsten) - || storageContents[i].asOne().toString().equals(oldTungsten2)) { - replaceItem(event.getInventory(), Items.getPlatinum(), i, amount); - } else if (storageContents[i].asOne().toString().equals(oldCarrotPouch)) { - replaceItem(event.getInventory(), Items.getCarrotPouch(), i, amount); - } else if (storageContents[i].asOne().toString().equals(oldBeetrootPouch)) { - replaceItem(event.getInventory(), Items.getBeetrootPouch(), i, amount); - } else if (storageContents[i].asOne().toString().equals(oldPotatoPouch)) { - replaceItem(event.getInventory(), Items.getPotatoPouch(), i, amount); - } else if (storageContents[i].asOne().toString().equals(oldNetherHeart) - || storageContents[i].asOne().toString().equals(oldNetherHeart2)) { - replaceItem(event.getInventory(), Items.getNetherHeart(), i, amount); - } else if (storageContents[i].asOne().toString().equals(forestRune)) { - replaceItem(event.getInventory(), CustomResources.getForestRune(), i, amount); - } else if (storageContents[i].asOne().toString().equals(mountainRune)) { - replaceItem(event.getInventory(), CustomResources.getMountainRune(), i, amount); - } else if (storageContents[i].asOne().toString().equals(tropicalRune)) { - replaceItem(event.getInventory(), CustomResources.getTropicalRune(), i, amount); - } else if (storageContents[i].asOne().toString().equals(tundraRune)) { - replaceItem(event.getInventory(), CustomResources.getTundraRune(), i, amount); - } else if (storageContents[i].asOne().toString().equals(abyssalStone)) { - replaceItem(event.getInventory(), CustomResources.getAbyssalStone(), i, amount); - } else if (storageContents[i].asOne().toString().equals(ancientWood)) { - replaceItem(event.getInventory(), CustomResources.getAncientWood(), i, amount); - } else if (storageContents[i].asOne().toString().equals(baerSteel)) { - replaceItem(event.getInventory(), CustomResources.getBaerSteel(), i, amount); - } else if (storageContents[i].asOne().toString().equals(blessedOpal)) { - replaceItem(event.getInventory(), CustomResources.getBlessedOpal(), i, amount); - } else if (storageContents[i].asOne().toString().equals(elustone)) { - replaceItem(event.getInventory(), CustomResources.getElustone(), i, amount); - } else if (storageContents[i].asOne().toString().equals(fyada)) { - replaceItem(event.getInventory(), CustomResources.getFyada(), i, amount); - } else if (storageContents[i].asOne().toString().equals(luminousBismuth)) { - replaceItem(event.getInventory(), CustomResources.getLuminousBismuth(), i, amount); - } else if (storageContents[i].asOne().toString().equals(magikite)) { - replaceItem(event.getInventory(), CustomResources.getMagikite(), i, amount); - } else if (storageContents[i].asOne().toString().equals(quicksilver)) { - replaceItem(event.getInventory(), CustomResources.getQuicksilver(), i, amount); - } else if (storageContents[i].asOne().toString().equals(roseQuartz)) { - replaceItem(event.getInventory(), CustomResources.getRoseQuartz(), i, amount); - } else if (storageContents[i].asOne().toString().equals(rotwud)) { - replaceItem(event.getInventory(), CustomResources.getRotwud(), i, amount); - } else if (storageContents[i].asOne().toString().equals(saelz)) { - replaceItem(event.getInventory(), CustomResources.getSaelz(), i, amount); - } else if (storageContents[i].asOne().toString().equals(solarGold)) { - replaceItem(event.getInventory(), CustomResources.getSolarGold(), i, amount); - } else if (storageContents[i].asOne().toString().equals(tetracide)) { - replaceItem(event.getInventory(), CustomResources.getTetracide(), i, amount); - } else if (storageContents[i].asOne().toString().equals(velotite)) { - replaceItem(event.getInventory(), CustomResources.getVelotite(), i, amount); - } else if (storageContents[i].asOne().toString().equals(wildCitrine)) { - replaceItem(event.getInventory(), CustomResources.getWildCitrine(), i, amount); - } else if (storageContents[i].asOne().toString().equals(rawBoarMeat)) { - replaceItem(event.getInventory(), Items.getRawBoarMeat(), i, amount); - } else if (storageContents[i].asOne().toString().equals(rawElephantMeat)) { - replaceItem(event.getInventory(), Items.getRawElephantMeat(), i, amount); - } else if (storageContents[i].asOne().toString().equals(rawSharkMeat)) { - replaceItem(event.getInventory(), Items.getRawSharkMeat(), i, amount); - } else if (storageContents[i].asOne().toString().equals(rawVenison)) { - replaceItem(event.getInventory(), Items.getRawVenison(), i, amount); - } else { - //Bukkit.broadcastMessage(storageContents[i].asOne().toString()); - } - } - } - - private void replaceItem(Inventory inventory, ItemStack item, int slot, int amount) { - item.setAmount(amount); - inventory.setItem(slot, item); - } -} diff --git a/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemUseListener.java b/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemUseListener.java index f30b925..8a27765 100644 --- a/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemUseListener.java +++ b/src/main/java/me/ShermansWorld/AlathraExtras/items/ItemUseListener.java @@ -111,8 +111,8 @@ public void alathraAccessoriesHats(BlockPlaceEvent e) { boolean cancel = false; if (item.hasItemMeta()) { cancel = switch (item.getItemMeta().getCustomModelData()) { - case 201, 202, 203, 204, 205, 206, 207 -> true; - default -> cancel; + case 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211 -> true; + default -> false; }; if (cancel) { e.setCancelled(true);