diff --git a/src/main/java/com/craftaro/ultimatekits/UltimateKits.java b/src/main/java/com/craftaro/ultimatekits/UltimateKits.java index 7bad85e..c25249f 100644 --- a/src/main/java/com/craftaro/ultimatekits/UltimateKits.java +++ b/src/main/java/com/craftaro/ultimatekits/UltimateKits.java @@ -399,11 +399,11 @@ public class UltimateKits extends SongodaPlugin { case "{RIGHT-CLICK}": if (kitType == KitType.CRATE) { - lines.add(getLocale().getMessage("interface.hologram.crate").getMessage()); + lines.add(getLocale().getMessage("interface.hologram.crate").toText()); break; } if (kit.getLink() != null) { - lines.add(getLocale().getMessage("interface.hologram.buylink").getMessage()); + lines.add(getLocale().getMessage("interface.hologram.buylink").toText()); break; } if (kit.getPrice() != 0) { @@ -411,19 +411,19 @@ public class UltimateKits extends SongodaPlugin { .processPlaceholder("price", kit.getPrice() != 0 ? NumberUtils.formatNumber(kit.getPrice()) : getLocale().getMessage("general.type.free").getMessage()) - .getMessage()); + .toText()); } break; case "{LEFT-CLICK}": if (kitType == KitType.CLAIM) { - lines.add(getLocale().getMessage("interface.hologram.daily").getMessage()); + lines.add(getLocale().getMessage("interface.hologram.daily").toText()); break; } if (kit.getLink() == null && kit.getPrice() == 0) { - lines.add(getLocale().getMessage("interface.hologram.previewonly").getMessage()); + lines.add(getLocale().getMessage("interface.hologram.previewonly").toText()); } else { - lines.add(getLocale().getMessage("interface.hologram.preview").getMessage()); + lines.add(getLocale().getMessage("interface.hologram.preview").toText()); } break; diff --git a/src/main/java/com/craftaro/ultimatekits/crate/Crate.java b/src/main/java/com/craftaro/ultimatekits/crate/Crate.java index 2e4bb97..31de314 100644 --- a/src/main/java/com/craftaro/ultimatekits/crate/Crate.java +++ b/src/main/java/com/craftaro/ultimatekits/crate/Crate.java @@ -45,7 +45,7 @@ public class Crate { meta.setDisplayName(plugin.getLocale().getMessage("interface.crate.title") .processPlaceholder("kit", kitName) .processPlaceholder("crate", this.name) - .getMessage()); + .toText()); meta.addEnchant(Enchantment.DURABILITY, 1, true); @@ -56,7 +56,7 @@ public class Crate { String desc1 = plugin.getLocale().getMessage("interface.crate.description1") .processPlaceholder("kit", kitName) .processPlaceholder("crate", this.name) - .getMessage(); + .toText(); if (kitName.equals("Any")) { desc1 = desc1.replaceAll("\\[.*?]", ""); @@ -69,19 +69,19 @@ public class Crate { lore.add(plugin.getLocale().getMessage("interface.crate.description2") .processPlaceholder("kit", kitName) .processPlaceholder("crate", this.name) - .getMessage()); + .toText()); } else { lore.add(plugin.getLocale().getMessage("interface.crate.description3") .processPlaceholder("kit", kitName) .processPlaceholder("crate", this.name) - .getMessage()); + .toText()); } if (this.kitAmount > 1) { lore.add(plugin.getLocale().getMessage("interface.crate.description4") .processPlaceholder("amt", this.kitAmount) .processPlaceholder("kit", kitName) .processPlaceholder("crate", this.name) - .getMessage()); + .toText()); } meta.setLore(lore); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/BlockEditorGui.java b/src/main/java/com/craftaro/ultimatekits/gui/BlockEditorGui.java index 420d4ef..a169e0f 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/BlockEditorGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/BlockEditorGui.java @@ -35,7 +35,7 @@ public class BlockEditorGui extends Gui { // kit type setButton(1, 2, GuiUtils.createButtonItem(XMaterial.COMPARATOR, - plugin.getLocale().getMessage("interface.kitblock.switchtype").getMessage(), + plugin.getLocale().getMessage("interface.kitblock.switchtype").toText(), kitTypeLore(plugin)), ClickType.LEFT, event -> { @@ -57,15 +57,15 @@ public class BlockEditorGui extends Gui { // decor options setButton(1, 4, GuiUtils.createButtonItem(XMaterial.POPPY, - plugin.getLocale().getMessage("interface.kitblock.decor").getMessage(), - plugin.getLocale().getMessage("interface.kitblock.decorlore").getMessage().split("\\|")), + plugin.getLocale().getMessage("interface.kitblock.decor").toText(), + plugin.getLocale().getMessage("interface.kitblock.decorlore").toText().split("\\|")), ClickType.LEFT, event -> event.manager.showGUI(event.player, new KitDecorOptionsGui(plugin, kitBlockData, this))); // edit setButton(1, 6, GuiUtils.createButtonItem(XMaterial.DIAMOND_PICKAXE, - plugin.getLocale().getMessage("interface.kitblock.edit").getMessage(), - plugin.getLocale().getMessage("interface.kitblock.editlore").getMessage().split("\\|")), + plugin.getLocale().getMessage("interface.kitblock.edit").toText(), + plugin.getLocale().getMessage("interface.kitblock.editlore").toText().split("\\|")), ClickType.LEFT, event -> { this.guiManager.showGUI(event.player, new KitEditorGui(UltimateKits.getInstance(), event.player, kitBlockData.getKit(), this)); @@ -74,7 +74,7 @@ public class BlockEditorGui extends Gui { } private List kitTypeLore(UltimateKits plugin) { - String[] type = plugin.getLocale().getMessage("interface.kitblock.switchtypelore").getMessage().split("\\|"); + String[] type = plugin.getLocale().getMessage("interface.kitblock.switchtypelore").toText().split("\\|"); return Arrays.asList( type[0], (this.kitBlockData.getType() == KitType.PREVIEW ? ChatColor.GOLD : ChatColor.GRAY) + (type.length > 1 ? type[1] : "Preview"), diff --git a/src/main/java/com/craftaro/ultimatekits/gui/CategorySelectorGui.java b/src/main/java/com/craftaro/ultimatekits/gui/CategorySelectorGui.java index e3a2d38..075231c 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/CategorySelectorGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/CategorySelectorGui.java @@ -41,7 +41,7 @@ public class CategorySelectorGui extends Gui { setItem(0, 4, GuiUtils.createButtonItem(XMaterial.BOOK, plugin.getLocale().getMessage("interface.categoryselector.details") - .processPlaceholder("player", player.getName()).getMessage().split("\\|"))); + .processPlaceholder("player", player.getName()).toText().split("\\|"))); if (!glassless) { setButton(this.rows - 1, 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR), @@ -79,7 +79,7 @@ public class CategorySelectorGui extends Gui { setButton(i, GuiUtils.createButtonItem(XMaterial.matchXMaterial(category.getMaterial()), TextUtils.formatText(category.getName()), "", - plugin.getLocale().getMessage("interface.categoryselector.view").getMessage()), + plugin.getLocale().getMessage("interface.categoryselector.view").toText()), event -> { this.guiManager.showGUI(player, new KitSelectorGui(plugin, player, category)); }); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/KitDecorOptionsGui.java b/src/main/java/com/craftaro/ultimatekits/gui/KitDecorOptionsGui.java index e637f9f..16ac9cd 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/KitDecorOptionsGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/KitDecorOptionsGui.java @@ -36,12 +36,12 @@ public class KitDecorOptionsGui extends Gui { ClickType.LEFT, event -> event.player.closeInventory()); - final String enableLore = plugin.getLocale().getMessage("interface.kitdecor.settingon").getMessage(); - final String disableLore = plugin.getLocale().getMessage("interface.kitdecor.settingoff").getMessage(); + final String enableLore = plugin.getLocale().getMessage("interface.kitdecor.settingon").toText(); + final String disableLore = plugin.getLocale().getMessage("interface.kitdecor.settingoff").toText(); // Hologram setButton(1, 1, GuiUtils.createButtonItem(XMaterial.NAME_TAG, - plugin.getLocale().getMessage("interface.kitdecor.hologram").getMessage(), + plugin.getLocale().getMessage("interface.kitdecor.hologram").toText(), kitBlockData.showHologram() ? enableLore : disableLore), event -> { kitBlockData.setShowHologram(!kitBlockData.showHologram()); @@ -51,7 +51,7 @@ public class KitDecorOptionsGui extends Gui { // Particle effects setButton(1, 3, GuiUtils.createButtonItem(XMaterial.POTION, - plugin.getLocale().getMessage("interface.kitdecor.particle").getMessage(), + plugin.getLocale().getMessage("interface.kitdecor.particle").toText(), kitBlockData.hasParticles() ? enableLore : disableLore), event -> { kitBlockData.setHasParticles(!kitBlockData.hasParticles()); @@ -60,7 +60,7 @@ public class KitDecorOptionsGui extends Gui { // Item Display setButton(1, 5, GuiUtils.createButtonItem(XMaterial.DIAMOND, - plugin.getLocale().getMessage("interface.kitdecor.display").getMessage(), + plugin.getLocale().getMessage("interface.kitdecor.display").toText(), kitBlockData.isDisplayingItems() ? enableLore : disableLore), event -> { plugin.removeHologram(kitBlockData); @@ -71,10 +71,10 @@ public class KitDecorOptionsGui extends Gui { // Item Display Override setButton(1, 7, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : XMaterial.BEACON.parseItem(), - plugin.getLocale().getMessage("interface.kitdecor.displayone").getMessage(), + plugin.getLocale().getMessage("interface.kitdecor.displayone").toText(), plugin.getLocale().getMessage("interface.kitdecor.displayonelore") .processPlaceholder("enabled", kitBlockData.isItemOverride() ? enableLore : disableLore) - .getMessage().split("\\|")), + .toText().split("\\|")), event -> { kitBlockData.setItemOverride(!kitBlockData.isItemOverride()); updateItemLore(event.slot, kitBlockData.isItemOverride() ? enableLore : disableLore); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/KitEditorGui.java b/src/main/java/com/craftaro/ultimatekits/gui/KitEditorGui.java index 39f5554..186c01d 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/KitEditorGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/KitEditorGui.java @@ -89,7 +89,7 @@ public class KitEditorGui extends DoubleGui { plugin.getLocale().getMessage("interface.kiteditor.info") .processPlaceholder("kit", kit.getKey()) .processPlaceholder("perm", "ultimatekits.claim." + kit.getKey().toLowerCase()) - .getMessage().split("\\|")) + .toText().split("\\|")) ); saveItemsInstance(); @@ -155,14 +155,14 @@ public class KitEditorGui extends DoubleGui { setUnlockedRange(4, 1, 4, 7); item = GuiUtils.createButtonItem(XMaterial.PAPER, - this.plugin.getLocale().getMessage("interface.kiteditor.itemediting").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.itemeditinglore").getMessage().split("\\|")); + this.plugin.getLocale().getMessage("interface.kiteditor.itemediting").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.itemeditinglore").toText().split("\\|")); } else { this.unlockedCells.clear(); item = GuiUtils.createButtonItem(XMaterial.PAPER, - this.plugin.getLocale().getMessage("interface.kiteditor.itemmoving").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.itemmovinglore").getMessage().split("\\|")); + this.plugin.getLocale().getMessage("interface.kiteditor.itemmoving").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.itemmovinglore").toText().split("\\|")); } setButton(48, item, @@ -175,11 +175,11 @@ public class KitEditorGui extends DoubleGui { ItemStack item2; item2 = this.isInInventory ? GuiUtils.createButtonItem(XMaterial.ITEM_FRAME, - this.plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctions").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctionslore").getMessage().split("\\|")) + this.plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctions").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctionslore").toText().split("\\|")) : GuiUtils.createButtonItem(XMaterial.ITEM_FRAME, - this.plugin.getLocale().getMessage("interface.kiteditor.switchtoinventory").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.switchtoinventorylore").getMessage().split("\\|")); + this.plugin.getLocale().getMessage("interface.kiteditor.switchtoinventory").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.switchtoinventorylore").toText().split("\\|")); setButton(50, item2, event -> { @@ -217,32 +217,32 @@ public class KitEditorGui extends DoubleGui { private void setInvItems() { setPlayerButton(0, GuiUtils.createButtonItem(XMaterial.REDSTONE_TORCH, - this.plugin.getLocale().getMessage("interface.kiteditor.generaloptions").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.generaloptionslore").getMessage().split("\\|")), + this.plugin.getLocale().getMessage("interface.kiteditor.generaloptions").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.generaloptionslore").toText().split("\\|")), (event) -> { this.player.closeInventory(); this.guiManager.showGUI(this.player, new KitGeneralOptionsGui(this.plugin, this.player, this.kit, this.back)); }); setPlayerButton(1, GuiUtils.createButtonItem(XMaterial.EMERALD, - this.plugin.getLocale().getMessage("interface.kiteditor.sellingoptions").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.sellingoptionslore").getMessage().split("\\|")), + this.plugin.getLocale().getMessage("interface.kiteditor.sellingoptions").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.sellingoptionslore").toText().split("\\|")), (event) -> { this.player.closeInventory(); this.guiManager.showGUI(this.player, new KitSellingOptionsGui(this.plugin, this.player, this.kit, this.back)); }); setPlayerButton(3, GuiUtils.createButtonItem(XMaterial.ITEM_FRAME, - this.plugin.getLocale().getMessage("interface.kiteditor.guioptions").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.guioptionslore").getMessage().split("\\|")), + this.plugin.getLocale().getMessage("interface.kiteditor.guioptions").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.guioptionslore").toText().split("\\|")), (event) -> { this.player.closeInventory(); this.guiManager.showGUI(this.player, new KitGuiOptionsGui(this.plugin, this.player, this.kit, this.back)); }); setPlayerButton(4, GuiUtils.createButtonItem(XMaterial.PAPER, - this.plugin.getLocale().getMessage("interface.kiteditor.addcommand").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.addcommandlore").getMessage().split("\\|")), + this.plugin.getLocale().getMessage("interface.kiteditor.addcommand").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.addcommandlore").toText().split("\\|")), (event) -> { event.gui.exit(); ChatPrompt.showPrompt(event.manager.getPlugin(), event.player, "Enter a command for this kit:", response -> { @@ -259,11 +259,11 @@ public class KitEditorGui extends DoubleGui { index += 30; } meta.setLore(lore); - meta.setDisplayName(this.plugin.getLocale().getMessage("general.type.command").getMessage()); + meta.setDisplayName(this.plugin.getLocale().getMessage("general.type.command").toText()); parseStack.setItemMeta(meta); this.plugin.getLocale().newMessage(this.plugin.getLocale().getMessage("interface.kiteditor.addcommandok") - .processPlaceholder("command", msg).getMessage()) + .processPlaceholder("command", msg).toText()) .sendPrefixedMessage(this.player); this.inventory.addItem(parseStack); @@ -278,8 +278,8 @@ public class KitEditorGui extends DoubleGui { }); setPlayerButton(5, GuiUtils.createButtonItem(XMaterial.SUNFLOWER, - this.plugin.getLocale().getMessage("interface.kiteditor.addeconomy").getMessage(), - this.plugin.getLocale().getMessage("interface.kiteditor.addeconomylore").getMessage().split("\\|")), + this.plugin.getLocale().getMessage("interface.kiteditor.addeconomy").toText(), + this.plugin.getLocale().getMessage("interface.kiteditor.addeconomylore").toText().split("\\|")), (event) -> { AnvilGui gui = new AnvilGui(this.player, this); gui.setTitle(this.plugin.getLocale().getMessage("interface.kiteditor.addeconomyprompt").getMessage()); @@ -297,7 +297,7 @@ public class KitEditorGui extends DoubleGui { index += 30; } meta.setLore(lore); - meta.setDisplayName(this.plugin.getLocale().getMessage("general.type.money").getMessage()); + meta.setDisplayName(this.plugin.getLocale().getMessage("general.type.money").toText()); parseStack.setItemMeta(meta); this.plugin.getLocale().getMessage("interface.kiteditor.addeconomyok").processPlaceholder("amount", msg.trim()) @@ -311,9 +311,9 @@ public class KitEditorGui extends DoubleGui { }); setPlayerButton(7, GuiUtils.createButtonItem(XMaterial.SHEEP_SPAWN_EGG, - this.plugin.getLocale().getMessage("interface.kiteditor.clone").getMessage(), + this.plugin.getLocale().getMessage("interface.kiteditor.clone").toText(), this.plugin.getLocale().getMessage("interface.kiteditor.clonelore") - .getMessage().split("\\|")), + .toText().split("\\|")), (event) -> { AnvilGui gui = new AnvilGui(this.player, this); gui.setTitle("Enter a new kit name"); @@ -339,10 +339,10 @@ public class KitEditorGui extends DoubleGui { }); setPlayerButton(8, GuiUtils.createButtonItem(XMaterial.CHEST, - this.plugin.getLocale().getMessage("interface.kiteditor.animation").getMessage(), + this.plugin.getLocale().getMessage("interface.kiteditor.animation").toText(), this.plugin.getLocale().getMessage("interface.kiteditor.animationlore") .processPlaceholder("animation", this.kit.getKitAnimation().name()) - .getMessage().split("\\|")), + .toText().split("\\|")), (event) -> { if (this.kit.getKitAnimation() == KitAnimation.NONE) { this.kit.setKitAnimation(KitAnimation.ROULETTE); @@ -470,14 +470,14 @@ public class KitEditorGui extends DoubleGui { itemLore = new ArrayList<>(); } itemLore.add(TextUtils.formatText("&8----")); - itemLore.add(ChatColor.GRAY + this.plugin.getLocale().getMessage("general.type.chance").getMessage().replaceFirst("^" + ChatColor.RESET, "") + itemLore.add(ChatColor.GRAY + this.plugin.getLocale().getMessage("general.type.chance").toText().replaceFirst("^" + ChatColor.RESET, "") + ": " + ChatColor.GOLD + item.getChance() + "%"); //TODO use a placeholder message in locales if (this.isInFunction) { itemLore.addAll(Arrays.asList(this.plugin.getLocale().getMessage("interface.kiteditor.itemfunctionlore") .processPlaceholder("item", item.getDisplayItem() == null ? "" : item.getDisplayItem().name()) .processPlaceholder("name", item.getDisplayName()) .processPlaceholder("lore", item.getDisplayLore()) - .getMessage().split("\\|"))); + .toText().split("\\|"))); } meta.setLore(itemLore); is.setItemMeta(meta); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/KitGeneralOptionsGui.java b/src/main/java/com/craftaro/ultimatekits/gui/KitGeneralOptionsGui.java index d758b21..aac0b1b 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/KitGeneralOptionsGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/KitGeneralOptionsGui.java @@ -37,9 +37,9 @@ public class KitGeneralOptionsGui extends Gui { // edit delay setButton(1, 2, GuiUtils.createButtonItem(XMaterial.CLOCK, - plugin.getLocale().getMessage("interface.kitoptions.delay").getMessage(), + plugin.getLocale().getMessage("interface.kitoptions.delay").toText(), plugin.getLocale().getMessage("interface.kitoptions.delaylore") - .processPlaceholder("delay", kit.getDelay()).getMessage().split("\\|")), + .processPlaceholder("delay", kit.getDelay()).toText().split("\\|")), event -> { AnvilGui gui = new AnvilGui(event.player, this); gui.setTitle(plugin.getLocale().getMessage("interface.kitoptions.delayprompt").getMessage()); @@ -48,7 +48,7 @@ public class KitGeneralOptionsGui extends Gui { try { kit.setDelay(Integer.parseInt(msg)); updateItemLore(event.slot, plugin.getLocale().getMessage("interface.kitoptions.delaylore") - .processPlaceholder("delay", kit.getDelay()).getMessage().split("\\|")); + .processPlaceholder("delay", kit.getDelay()).toText().split("\\|")); aevent.player.closeInventory(); return; } catch (NumberFormatException e) { @@ -61,9 +61,9 @@ public class KitGeneralOptionsGui extends Gui { // edit category setButton(1, 4, GuiUtils.createButtonItem(XMaterial.BOOK, - plugin.getLocale().getMessage("interface.kitoptions.category").getMessage(), + plugin.getLocale().getMessage("interface.kitoptions.category").toText(), plugin.getLocale().getMessage("interface.kitoptions.categorylore") - .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).getMessage().split("\\|")), + .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).toText().split("\\|")), event -> { if (event.clickType == ClickType.LEFT) { AnvilGui gui = new AnvilGui(event.player, this); @@ -74,7 +74,7 @@ public class KitGeneralOptionsGui extends Gui { if (category != null) { kit.setCategory(category); updateItemLore(event.slot, plugin.getLocale().getMessage("interface.kitoptions.categorylore") - .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).getMessage().split("\\|")); + .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).toText().split("\\|")); aevent.player.closeInventory(); return; } @@ -85,14 +85,14 @@ public class KitGeneralOptionsGui extends Gui { } else if (event.clickType == ClickType.RIGHT) { kit.setCategory(null); updateItemLore(event.slot, plugin.getLocale().getMessage("interface.kitoptions.categorylore") - .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).getMessage().split("\\|")); + .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).toText().split("\\|")); } }); // delete setButton(1, 6, GuiUtils.createButtonItem(XMaterial.TNT, - plugin.getLocale().getMessage("interface.kitoptions.destroy").getMessage(), - plugin.getLocale().getMessage("interface.kitoptions.destroylore").getMessage().split("\\|")), + plugin.getLocale().getMessage("interface.kitoptions.destroy").toText(), + plugin.getLocale().getMessage("interface.kitoptions.destroylore").toText().split("\\|")), event -> { AnvilGui gui = new AnvilGui(event.player); gui.setTitle(plugin.getLocale().getMessage("interface.kitoptions.destroyprompt").processPlaceholder("kit", kit.getKey()).getMessage()); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/KitGuiOptionsGui.java b/src/main/java/com/craftaro/ultimatekits/gui/KitGuiOptionsGui.java index 18526df..d7f4dfc 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/KitGuiOptionsGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/KitGuiOptionsGui.java @@ -49,12 +49,12 @@ public class KitGuiOptionsGui extends Gui { private void paint() { // set hologram title setButton(1, 2, GuiUtils.createButtonItem(XMaterial.NAME_TAG, - this.plugin.getLocale().getMessage("interface.kitguioptions.holo").getMessage(), + this.plugin.getLocale().getMessage("interface.kitguioptions.holo").toText(), this.plugin.getLocale().getMessage("interface.kitguioptions.hololore") .processPlaceholder("onoff", this.kit.getTitle() != null ? this.plugin.getLocale().getMessage("interface.kitguioptions.holoon").processPlaceholder("title", this.kit.getTitle()).getMessage() : this.plugin.getLocale().getMessage("interface.kitguioptions.holooff").getMessage() - ).getMessage().split("\\|")), + ).toText().split("\\|")), ClickType.LEFT, event -> { AnvilGui gui = new AnvilGui(event.player, this); @@ -82,13 +82,13 @@ public class KitGuiOptionsGui extends Gui { }); setButton(1, 4, GuiUtils.createButtonItem(this.kit.getDisplayItem() != null ? this.kit.getDisplayItem() : XMaterial.BEACON.parseItem(), - this.plugin.getLocale().getMessage("interface.kitguioptions.item").getMessage(), + this.plugin.getLocale().getMessage("interface.kitguioptions.item").toText(), this.plugin.getLocale().getMessage("interface.kitguioptions.itemlore") .processPlaceholder("onoff", this.kit.getDisplayItem() != null ? this.plugin.getLocale().getMessage("interface.kitguioptions.itemon") .processPlaceholder("item", this.kit.getDisplayItem().toString()).getMessage() : this.plugin.getLocale().getMessage("interface.kitguioptions.itemoff").getMessage() - ).getMessage().split("\\|")), + ).toText().split("\\|")), ClickType.LEFT, event -> { ItemStack is = this.player.getItemInHand(); @@ -108,11 +108,11 @@ public class KitGuiOptionsGui extends Gui { }); setButton(1, 6, GuiUtils.createButtonItem(XMaterial.COAL, - this.plugin.getLocale().getMessage("interface.kitguioptions.hide").getMessage(), + this.plugin.getLocale().getMessage("interface.kitguioptions.hide").toText(), this.plugin.getLocale().getMessage("interface.kitguioptions.hidelore") .processPlaceholder("onoff", this.plugin.getLocale().getMessage( this.kit.isHidden() ? "interface.kitguioptions.hideon" : "interface.kitguioptions.hideoff").getMessage() - ).getMessage().split("\\|")), + ).toText().split("\\|")), ClickType.LEFT, event -> { this.kit.setHidden(!this.kit.isHidden()); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/KitSelectorGui.java b/src/main/java/com/craftaro/ultimatekits/gui/KitSelectorGui.java index 2095f60..ee40b1e 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/KitSelectorGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/KitSelectorGui.java @@ -52,7 +52,7 @@ public class KitSelectorGui extends Gui { setItem(0, 4, GuiUtils.createButtonItem(XMaterial.BOOK, plugin.getLocale().getMessage("interface.selector.details") - .processPlaceholder("player", player.getName()).getMessage().split("\\|"))); + .processPlaceholder("player", player.getName()).toText().split("\\|"))); if (this.pages > 1) { this.setNextPage(this.rows - 1, 5, GuiUtils.createButtonItem(ItemUtils.getCustomHead("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"), @@ -146,7 +146,7 @@ public class KitSelectorGui extends Gui { String kitTitle = kit.getTitle() != null ? ChatColor.translateAlternateColorCodes('&', kit.getTitle()) : this.plugin.getLocale().getMessage("interface.selector.kit") - .processPlaceholder("kit", TextUtils.formatText(kitItem, true)).getMessage(); + .processPlaceholder("kit", TextUtils.formatText(kitItem, true)).toText(); setButton(row, col, GuiUtils.createButtonItem( kit.getDisplayItem() != null ? kit.getDisplayItem() : XMaterial.ENCHANTED_BOOK.parseItem(), kitTitle, @@ -179,14 +179,14 @@ public class KitSelectorGui extends Gui { if (kit.getPrice() != 0) { lore.add(this.plugin.getLocale().getMessage("interface.selector.aboutkitprice") .processPlaceholder("price", String.valueOf(kit.getPrice())) - .getMessage()); + .toText()); } else if (kit.getLink() != null) { - lore.add(this.plugin.getLocale().getMessage("general.type.link").getMessage()); + lore.add(this.plugin.getLocale().getMessage("general.type.link").toText()); } if (!this.kitsmode) { - if (!this.plugin.getLocale().getMessage("interface.selector.aboutkit").getMessage().trim().equals("")) { - String[] parts = this.plugin.getLocale().getMessage("interface.selector.aboutkit").getMessage().split("\\|"); + if (!this.plugin.getLocale().getMessage("interface.selector.aboutkit").toText().trim().equals("")) { + String[] parts = this.plugin.getLocale().getMessage("interface.selector.aboutkit").toText().split("\\|"); lore.add(""); for (String line : parts) { lore.add(ChatColor.translateAlternateColorCodes('&', line)); @@ -194,33 +194,33 @@ public class KitSelectorGui extends Gui { } if (kit.hasPermissionToClaim(this.player)) { if (kit.getNextUse(this.player) == -1) { - lore.add(this.plugin.getLocale().getMessage("event.claim.once").getMessage()); + lore.add(this.plugin.getLocale().getMessage("event.claim.once").toText()); } else if (kit.getNextUse(this.player) > 0) { - if (!this.plugin.getLocale().getMessage("event.claim.wait").getMessage().trim().equals("")) { + if (!this.plugin.getLocale().getMessage("event.claim.wait").toText().trim().equals("")) { lore.add(this.plugin.getLocale().getMessage("event.claim.wait") .processPlaceholder("time", TimeUtils.makeReadable(kit.getNextUse(this.player))) - .getMessage()); + .toText()); } - } else if (!this.plugin.getLocale().getMessage("event.claim.ready").getMessage().trim().equals("")) { - lore.add(this.plugin.getLocale().getMessage("event.claim.ready").getMessage()); + } else if (!this.plugin.getLocale().getMessage("event.claim.ready").toText().trim().equals("")) { + lore.add(this.plugin.getLocale().getMessage("event.claim.ready").toText()); } } else { - lore.add(this.plugin.getLocale().getMessage("event.claim.noaccess").getMessage()); + lore.add(this.plugin.getLocale().getMessage("event.claim.noaccess").toText()); } lore.add(""); - lore.add(this.plugin.getLocale().getMessage("interface.selector.leftpreview").getMessage()); + lore.add(this.plugin.getLocale().getMessage("interface.selector.leftpreview").toText()); if (kit.hasPermissionToClaim(this.player)) { - lore.add(this.plugin.getLocale().getMessage("interface.selector.rightclaim").getMessage()); + lore.add(this.plugin.getLocale().getMessage("interface.selector.rightclaim").toText()); } else if (kit.getPrice() != 0 || kit.getLink() != null) { - lore.add(this.plugin.getLocale().getMessage("interface.selector.rightbuy").getMessage()); + lore.add(this.plugin.getLocale().getMessage("interface.selector.rightbuy").toText()); } if (this.player.hasPermission("ultimatekits.admin")) { lore.add(""); - lore.add(this.plugin.getLocale().getMessage("interface.selector.adminlore").getMessage()); + lore.add(this.plugin.getLocale().getMessage("interface.selector.adminlore").toText()); } } else { - lore.addAll(Arrays.asList(this.plugin.getLocale().getMessage("interface.selector.editlore").getMessage().split("\\|"))); + lore.addAll(Arrays.asList(this.plugin.getLocale().getMessage("interface.selector.editlore").toText().split("\\|"))); } return lore; } diff --git a/src/main/java/com/craftaro/ultimatekits/gui/KitSellingOptionsGui.java b/src/main/java/com/craftaro/ultimatekits/gui/KitSellingOptionsGui.java index 4984f9e..6143986 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/KitSellingOptionsGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/KitSellingOptionsGui.java @@ -47,11 +47,11 @@ public class KitSellingOptionsGui extends Gui { private void paint() { // remove sale setButton(1, 2, GuiUtils.createButtonItem(XMaterial.BARRIER, - this.plugin.getLocale().getMessage("interface.kitsell.nosell").getMessage(), + this.plugin.getLocale().getMessage("interface.kitsell.nosell").toText(), this.plugin.getLocale().getMessage("interface.kitsell.noselllore") .processPlaceholder("onoff", this.plugin.getLocale().getMessage( - this.kit.getPrice() != 0 || this.kit.getLink() != null ? "interface.kitsell.nosellon" : "interface.kitsell.noselloff").getMessage() - ).getMessage().split("\\|")), + this.kit.getPrice() != 0 || this.kit.getLink() != null ? "interface.kitsell.nosellon" : "interface.kitsell.noselloff").toText() + ).toText().split("\\|")), event -> { this.kit.setPrice(0); this.kit.setLink(null); @@ -60,12 +60,12 @@ public class KitSellingOptionsGui extends Gui { // kit link setButton(1, 4, GuiUtils.createButtonItem(XMaterial.PAPER, - this.plugin.getLocale().getMessage("interface.kitsell.link").getMessage(), + this.plugin.getLocale().getMessage("interface.kitsell.link").toText(), this.plugin.getLocale().getMessage("interface.kitsell.linklore") .processPlaceholder("onoff", - this.kit.getLink() != null ? this.plugin.getLocale().getMessage("interface.kitsell.linkon").processPlaceholder("kit", this.kit.getLink()).getMessage() - : this.plugin.getLocale().getMessage("interface.kitsell.linkoff").getMessage() - ).getMessage().split("\\|")), + this.kit.getLink() != null ? this.plugin.getLocale().getMessage("interface.kitsell.linkon").processPlaceholder("kit", this.kit.getLink()).toText() + : this.plugin.getLocale().getMessage("interface.kitsell.linkoff").toText() + ).toText().split("\\|")), event -> { AnvilGui gui = new AnvilGui(event.player, this); gui.setTitle(this.plugin.getLocale().getMessage("interface.kitsell.linkprompt").getMessage()); @@ -86,13 +86,13 @@ public class KitSellingOptionsGui extends Gui { // kit price setButton(1, 6, GuiUtils.createButtonItem(XMaterial.SUNFLOWER, - this.plugin.getLocale().getMessage("interface.kitsell.price").getMessage(), + this.plugin.getLocale().getMessage("interface.kitsell.price").toText(), this.plugin.getLocale().getMessage("interface.kitsell.pricelore") .processPlaceholder("onoff", this.kit.getPrice() != 0 ? this.plugin.getLocale().getMessage("interface.kitsell.priceon") - .processPlaceholder("price", this.kit.getPrice()).getMessage() - : this.plugin.getLocale().getMessage("interface.kitsell.priceoff").getMessage() - ).getMessage().split("\\|")), + .processPlaceholder("price", this.kit.getPrice()).toText() + : this.plugin.getLocale().getMessage("interface.kitsell.priceoff").toText() + ).toText().split("\\|")), event -> { if (!EconomyManager.isEnabled()) { this.plugin.getLocale().getMessage("interface.kitsell.pricenoeco").sendPrefixedMessage(event.player); diff --git a/src/main/java/com/craftaro/ultimatekits/gui/PreviewKitGui.java b/src/main/java/com/craftaro/ultimatekits/gui/PreviewKitGui.java index f0a7b3b..fa7260e 100644 --- a/src/main/java/com/craftaro/ultimatekits/gui/PreviewKitGui.java +++ b/src/main/java/com/craftaro/ultimatekits/gui/PreviewKitGui.java @@ -106,7 +106,7 @@ public class PreviewKitGui extends Gui { // purchase button if (buyable) { setButton(this.rows - 1, 4, GuiUtils.createButtonItem(Settings.BUY_ICON.getMaterial(XMaterial.EMERALD), - plugin.getLocale().getMessage("interface.button.buynow").getMessage(), + plugin.getLocale().getMessage("interface.button.buynow").toText(), getBuyLore()), event -> { exit(); @@ -182,7 +182,7 @@ public class PreviewKitGui extends Gui { ArrayList lore = new ArrayList<>(); if (this.kit.hasPermissionToClaim(this.player)) { lore.add(this.plugin.getLocale().getMessage("interface.button.clickeco") - .processPlaceholder("price", "0").getMessage()); + .processPlaceholder("price", "0").toText()); if (this.player.isOp()) { lore.add(""); lore.add(ChatColor.GRAY + "This is free because"); @@ -192,7 +192,7 @@ public class PreviewKitGui extends Gui { } } else { lore.add(this.plugin.getLocale().getMessage("interface.button.clickeco") - .processPlaceholder("price", NumberUtils.formatNumber(this.kit.getPrice())).getMessage()); + .processPlaceholder("price", NumberUtils.formatNumber(this.kit.getPrice())).toText()); } if (this.kit.getDelay() != 0 && this.player.isOp()) { lore.add(""); diff --git a/src/main/java/com/craftaro/ultimatekits/key/Key.java b/src/main/java/com/craftaro/ultimatekits/key/Key.java index a142c87..77bf248 100644 --- a/src/main/java/com/craftaro/ultimatekits/key/Key.java +++ b/src/main/java/com/craftaro/ultimatekits/key/Key.java @@ -38,11 +38,11 @@ public class Key { item.setAmount(amount); String kitName = kit != null ? TextUtils.formatText(kit.getName(), true) - : plugin.getLocale().getMessage("general.type.any").getMessage(); + : plugin.getLocale().getMessage("general.type.any").toText(); ItemMeta meta = item.getItemMeta(); meta.setDisplayName(plugin.getLocale().getMessage("interface.key.title") - .processPlaceholder("kit", kitName).getMessage()); + .processPlaceholder("kit", kitName).toText()); if (this.enchanted) { ItemUtils.addGlow(item); @@ -50,10 +50,10 @@ public class Key { List lore = new ArrayList<>(); lore.add(plugin.getLocale().getMessage("interface.key.name") - .processPlaceholder("name", this.name).getMessage()); + .processPlaceholder("name", this.name).toText()); String desc1 = plugin.getLocale().getMessage("interface.key.description1") - .processPlaceholder("kit", kitName).getMessage(); + .processPlaceholder("kit", kitName).toText(); if (kit == null) { desc1 = desc1.replaceAll("\\[.*?\\]", ""); @@ -63,13 +63,13 @@ public class Key { lore.add(desc1); if (this.amount == -1) { - lore.add(plugin.getLocale().getMessage("interface.key.description2").getMessage()); + lore.add(plugin.getLocale().getMessage("interface.key.description2").toText()); } else { - lore.add(plugin.getLocale().getMessage("interface.key.description3").getMessage()); + lore.add(plugin.getLocale().getMessage("interface.key.description3").toText()); } if (this.kitAmount > 1) { lore.add(plugin.getLocale().getMessage("interface.key.description4") - .processPlaceholder("amt", this.kitAmount).getMessage()); + .processPlaceholder("amt", this.kitAmount).toText()); } meta.setLore(lore); diff --git a/src/main/java/com/craftaro/ultimatekits/kit/KitItem.java b/src/main/java/com/craftaro/ultimatekits/kit/KitItem.java index 9089029..1342604 100644 --- a/src/main/java/com/craftaro/ultimatekits/kit/KitItem.java +++ b/src/main/java/com/craftaro/ultimatekits/kit/KitItem.java @@ -230,7 +230,7 @@ public class KitItem implements Cloneable { if (!lore.isEmpty()) { lore.addFirst(""); } - lore.addFirst(ChatColor.GRAY + UltimateKits.getInstance().getLocale().getMessage("general.type.chance").getMessage() + ": " + ChatColor.GOLD + (this.chance == 0 ? 100 : this.chance) + "%"); + lore.addFirst(ChatColor.GRAY + UltimateKits.getInstance().getLocale().getMessage("general.type.chance").toText() + ": " + ChatColor.GOLD + (this.chance == 0 ? 100 : this.chance) + "%"); meta.setLore(new ArrayList<>(lore)); } diff --git a/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentCommand.java b/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentCommand.java index c444ea7..79691f3 100644 --- a/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentCommand.java +++ b/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentCommand.java @@ -1,5 +1,6 @@ package com.craftaro.ultimatekits.kit.type; +import com.craftaro.core.chat.AdventureUtils; import com.craftaro.ultimatekits.UltimateKits; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -36,8 +37,8 @@ public class KitContentCommand implements KitContent { lore.add(ChatColor.GREEN + (index == 0 ? "/" : "") + ChatColor.GREEN + this.command.substring(index, Math.min(index + 30, this.command.length()))); index += 30; } - meta.setLore(lore); - meta.setDisplayName(UltimateKits.getInstance().getLocale().getMessage("general.type.command").getMessage()); + AdventureUtils.formatItemLore(stack, lore); + AdventureUtils.formatItemName(stack, UltimateKits.getInstance().getLocale().getMessage("general.type.command").getMessage()); stack.setItemMeta(meta); return stack; } diff --git a/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentEconomy.java b/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentEconomy.java index 0eeaf8a..c657a9c 100644 --- a/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentEconomy.java +++ b/src/main/java/com/craftaro/ultimatekits/kit/type/KitContentEconomy.java @@ -1,5 +1,6 @@ package com.craftaro.ultimatekits.kit.type; +import com.craftaro.core.chat.AdventureUtils; import com.craftaro.core.hooks.EconomyManager; import com.craftaro.core.utils.NumberUtils; import com.craftaro.ultimatekits.UltimateKits; @@ -39,8 +40,8 @@ public class KitContentEconomy implements KitContent { lore.add(ChatColor.GREEN + (index == 0 ? UltimateKits.getInstance().getConfig().getString("Main.Currency Symbol") : "") + ChatColor.GREEN + String.valueOf(this.amount).substring(index, Math.min(index + 30, String.valueOf(this.amount).length()))); index += 30; } - meta.setLore(lore); - meta.setDisplayName(UltimateKits.getInstance().getLocale().getMessage("general.type.money").getMessage()); + AdventureUtils.formatItemLore(parseStack, lore); + AdventureUtils.formatItemName(parseStack, UltimateKits.getInstance().getLocale().getMessage("general.type.money").getMessage()); parseStack.setItemMeta(meta); return parseStack; }