diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java index fa768423..07145b78 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDJson.java @@ -96,7 +96,7 @@ public class LDJson implements LDCommand { int start = 0; int msg = 1; - ComponentBuilder builder = new ComponentBuilder("").append(TextComponent.fromLegacyText(prefix.get())); + ComponentBuilder builder = new ComponentBuilder("").append(prefix.getBase()); while (start < string.length()) { int end = Math.min(256, string.length() - start); @@ -106,17 +106,17 @@ public class LDJson implements LDCommand { builder.append(" "); if (string.length() <= 256) { - builder.append(TextComponent.fromLegacyText(LibsMsg.CLICK_TO_COPY_DATA.get())); + builder.append(LibsMsg.CLICK_TO_COPY_DATA.getBase()); } else { builder.reset(); - builder.append(TextComponent.fromLegacyText(LibsMsg.CLICK_COPY.get(msg))); + builder.append(LibsMsg.CLICK_COPY.getBase(msg)); } start += end; builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub)); builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ComponentBuilder(LibsMsg.CLICK_TO_COPY_HOVER.get() + (string.length() <= 256 ? "" : " " + msg)) + new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append((string.length() <= 256 ? "" : " " + msg)) .create())); msg += 1; } diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java index 8dc175be..84ad3cb5 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDMetaInfo.java @@ -48,7 +48,7 @@ public class LDMetaInfo implements LDCommand { names.sort(String::compareToIgnoreCase); // if (NmsVersion.v1_13.isSupported()) { - ComponentBuilder builder = new ComponentBuilder("").append(TextComponent.fromLegacyText(LibsMsg.META_VALUES.get())); + ComponentBuilder builder = new ComponentBuilder("").append(LibsMsg.META_VALUES.getBase()); Iterator itel = names.iterator(); @@ -57,10 +57,10 @@ public class LDMetaInfo implements LDCommand { builder.append(TextComponent.fromLegacyText(name)); builder.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/libsdisguises metainfo " + name)); - builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(LibsMsg.META_CLICK_SHOW.get(name)))); + builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, LibsMsg.META_CLICK_SHOW.getBase(name))); if (itel.hasNext()) { - builder.append(TextComponent.fromLegacyText(LibsMsg.META_VALUE_SEPERATOR.get())); + builder.append(LibsMsg.META_VALUE_SEPERATOR.getBase()); } } diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java index 4bd80f43..15a76483 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/CopyDisguiseCommand.java @@ -33,7 +33,9 @@ public class CopyDisguiseCommand implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String s, String[] args) { if (sender instanceof Player && !sender.isOp() && (!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) { - sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!"); + sender.sendMessage(ChatColor.RED + + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for " + + "non-admin usage!"); return true; } @@ -51,8 +53,7 @@ public class CopyDisguiseCommand implements CommandExecutor { if (args[0].contains("-")) { try { target = Bukkit.getEntity(UUID.fromString(args[0])); - } - catch (Exception ignored) { + } catch (Exception ignored) { } } } @@ -67,8 +68,7 @@ public class CopyDisguiseCommand implements CommandExecutor { if (disguise == null) { LibsDisguises.getInstance().getListener() - .addInteraction(sender.getName(), new CopyDisguiseInteraction(this), - DisguiseConfig.getDisguiseEntityExpire()); + .addInteraction(sender.getName(), new CopyDisguiseInteraction(this), DisguiseConfig.getDisguiseEntityExpire()); LibsMsg.DISGUISECOPY_INTERACT.send(sender, DisguiseConfig.getDisguiseEntityExpire()); return true; @@ -79,8 +79,7 @@ public class CopyDisguiseCommand implements CommandExecutor { sendMessage(sender, LibsMsg.CLICK_TO_COPY, LibsMsg.COPY_DISGUISE_NO_COPY, disguiseString, false); if (disguise instanceof PlayerDisguise) { - sendMessage(sender, LibsMsg.CLICK_TO_COPY_WITH_SKIN, LibsMsg.CLICK_TO_COPY_WITH_SKIN_NO_COPY, - DisguiseParser.parseToString(disguise), true); + sendMessage(sender, LibsMsg.CLICK_TO_COPY_WITH_SKIN, LibsMsg.CLICK_TO_COPY_WITH_SKIN_NO_COPY, DisguiseParser.parseToString(disguise), true); } DisguiseUtilities.setCopyDisguiseCommandUsed(); @@ -94,7 +93,7 @@ public class CopyDisguiseCommand implements CommandExecutor { return; }*/ - ComponentBuilder builder = new ComponentBuilder("").append(TextComponent.fromLegacyText(msg.get())).append(" "); + ComponentBuilder builder = new ComponentBuilder("").append(msg.getBase()).append(" "); if (string.length() > 256 || forceAbbrev) { String[] split = DisguiseUtilities.split(string); @@ -136,18 +135,17 @@ public class CopyDisguiseCommand implements CommandExecutor { sections++; - builder.append(TextComponent.fromLegacyText(LibsMsg.CLICK_COPY.get(sections))); + builder.append(LibsMsg.CLICK_COPY.getBase(sections)); builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, current.toString())); builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ComponentBuilder(LibsMsg.CLICK_TO_COPY_HOVER.get() + " " + sections).create())); + new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append(" " + sections).create())); current = new StringBuilder(); } } else { - builder.append(TextComponent.fromLegacyText(LibsMsg.CLICK_COPY.get(string))); + builder.append(LibsMsg.CLICK_COPY.getBase(string)); builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, string)); - builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ComponentBuilder(LibsMsg.CLICK_TO_COPY_HOVER.get()).create())); + builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, LibsMsg.CLICK_TO_COPY_HOVER.getBase())); } sender.spigot().sendMessage(builder.create()); diff --git a/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java b/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java index 8e0ef9d9..6f64f94b 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java +++ b/src/main/java/me/libraryaddict/disguise/commands/utils/GrabSkinCommand.java @@ -123,7 +123,7 @@ public class GrabSkinCommand implements CommandExecutor { int msg = 1; //if (NmsVersion.v1_13.isSupported()) { - ComponentBuilder builder = new ComponentBuilder("").append(TextComponent.fromLegacyText(LibsMsg.CLICK_TO_COPY.get())); + ComponentBuilder builder = new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY.getBase()); while (start < string.length()) { int end = Math.min(256, string.length() - start); @@ -133,16 +133,17 @@ public class GrabSkinCommand implements CommandExecutor { builder.append(" "); if (string.length() <= 256) { - builder.append(TextComponent.fromLegacyText(LibsMsg.CLICK_TO_COPY_DATA.get())); + builder.append(LibsMsg.CLICK_TO_COPY_DATA.getBase()); } else { builder.reset(); - builder.append(TextComponent.fromLegacyText(LibsMsg.CLICK_COPY.get(msg))); + builder.append(LibsMsg.CLICK_COPY.getBase(msg)); } start += end; builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub)); - builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(LibsMsg.CLICK_TO_COPY_HOVER.get() + " " + msg).create())); + builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append(" " + msg).create())); msg += 1; } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index bbb6acde..b7eca9ff 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -358,8 +358,7 @@ public abstract class Disguise { removeBossBar(); - BossBar bar = Bukkit.createBossBar(getBossBar(), - BaseComponent.toLegacyText(DisguiseUtilities.getColoredChat(LibsMsg.ACTION_BAR_MESSAGE.get(getDisguiseName()))), getBossBarColor(), + BossBar bar = Bukkit.createBossBar(getBossBar(), BaseComponent.toLegacyText(LibsMsg.ACTION_BAR_MESSAGE.getBase(getDisguiseName())), getBossBarColor(), getBossBarStyle()); bar.setProgress(1); bar.addPlayer((Player) getEntity()); @@ -378,7 +377,7 @@ public abstract class Disguise { protected void doActionBar() { if (getNotifyBar() == DisguiseConfig.NotifyBar.ACTION_BAR && getEntity() instanceof Player && !getEntity().hasPermission("libsdisguises.noactionbar") && DisguiseAPI.getDisguise(getEntity()) == Disguise.this) { - ((Player) getEntity()).spigot().sendMessage(ChatMessageType.ACTION_BAR, LibsMsg.ACTION_BAR_MESSAGE.getChat(getDisguiseName())); + ((Player) getEntity()).spigot().sendMessage(ChatMessageType.ACTION_BAR, LibsMsg.ACTION_BAR_MESSAGE.getBase(getDisguiseName())); } if (isDynamicName()) { diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 39a097cf..ad03edaa 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -2496,7 +2496,7 @@ public class DisguiseUtilities { } public static void sendMessage(CommandSender sender, LibsMsg msg, Object... args) { - BaseComponent[] components = msg.getChat(args); + BaseComponent[] components = msg.getBase(args); if (components.length > 0) { sender.spigot().sendMessage(components); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java b/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java index cec73b14..1a5fa736 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/translations/LibsMsg.java @@ -316,16 +316,15 @@ public enum LibsMsg { return string; } - public BaseComponent[] getChat(Object... strings) { - String string = get(strings); - - return DisguiseUtilities.getColoredChat(string); - } - public void send(CommandSender player, Object... strings) { DisguiseUtilities.sendMessage(player, this, strings); } + @Deprecated + public BaseComponent[] getBase(Object... strings) { + return DisguiseUtilities.getColoredChat(get(strings)); + } + @Deprecated public String get(Object... strings) { int matches = StringUtils.countMatches(getRaw(), "%s");