From 51b4d806aefd9910b3be4cc4b8a4d7631966e191 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 9 Dec 2017 08:58:48 +1300 Subject: [PATCH] Add the modify disguises quotes, and translate colorcodes --- .../disguise/commands/DisguiseModifyCommand.java | 2 +- .../disguise/commands/DisguiseModifyEntityCommand.java | 5 +++-- .../disguise/commands/DisguiseModifyPlayerCommand.java | 2 +- .../disguise/commands/DisguiseModifyRadiusCommand.java | 2 +- src/me/libraryaddict/disguise/utilities/DisguiseParser.java | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/me/libraryaddict/disguise/commands/DisguiseModifyCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseModifyCommand.java index ae33c414..92970e86 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseModifyCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseModifyCommand.java @@ -60,7 +60,7 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom try { DisguiseParser .callMethods(sender, disguise, getPermissions(sender).get(new DisguisePerm(disguise.getType())), - new ArrayList(), args); + new ArrayList(), DisguiseParser.split(StringUtils.join(args))); } catch (DisguiseParseException ex) { if (ex.getMessage() != null) { diff --git a/src/me/libraryaddict/disguise/commands/DisguiseModifyEntityCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseModifyEntityCommand.java index b64c103d..689eb7b7 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseModifyEntityCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseModifyEntityCommand.java @@ -2,11 +2,11 @@ package me.libraryaddict.disguise.commands; import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.LibsDisguises; +import me.libraryaddict.disguise.utilities.DisguiseParser; import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm; import me.libraryaddict.disguise.utilities.LibsMsg; import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers; import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo; -import me.libraryaddict.disguise.utilities.TranslateType; import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -41,7 +41,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements // TODO Validate if any disguises have this arg - LibsDisguises.getInstance().getListener().setDisguiseModify(sender.getName(), args); + LibsDisguises.getInstance().getListener().setDisguiseModify(sender.getName(), DisguiseParser + .split(StringUtils.join(args))); sender.sendMessage(LibsMsg.DMODIFYENT_CLICK.get(DisguiseConfig.getDisguiseEntityExpire())); return true; diff --git a/src/me/libraryaddict/disguise/commands/DisguiseModifyPlayerCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseModifyPlayerCommand.java index 86332a17..74c361d3 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseModifyPlayerCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseModifyPlayerCommand.java @@ -72,7 +72,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements try { DisguiseParser.callMethods(sender, disguise, map.get(new DisguisePerm(disguise.getType())), - new ArrayList(), newArgs); + new ArrayList(), DisguiseParser.split(StringUtils.join(newArgs))); } catch (DisguiseParseException ex) { if (ex.getMessage() != null) { diff --git a/src/me/libraryaddict/disguise/commands/DisguiseModifyRadiusCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseModifyRadiusCommand.java index f0b4d9c8..13263177 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseModifyRadiusCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseModifyRadiusCommand.java @@ -149,7 +149,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements try { DisguiseParser.callMethods(sender, disguise, map.get(new DisguisePerm(disguise.getType())), - new ArrayList(), newArgs); + new ArrayList(), DisguiseParser.split(StringUtils.join(newArgs))); modifiedDisguises++; } catch (DisguiseParseException ex) { diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseParser.java b/src/me/libraryaddict/disguise/utilities/DisguiseParser.java index 83421334..c5c2e4f6 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseParser.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseParser.java @@ -439,7 +439,7 @@ public class DisguiseParser { * Splits a string while respecting quotes */ public static String[] split(String string) { - return string.split(" (?=\")|(?<=\")\\s"); + return ChatColor.translateAlternateColorCodes('&', string).split(" (?=\")|(?<=\")\\s"); } /**