Add the modify disguises quotes, and translate colorcodes
This commit is contained in:
parent
94fa3f0a1d
commit
51b4d806ae
@ -60,7 +60,7 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
try {
|
try {
|
||||||
DisguiseParser
|
DisguiseParser
|
||||||
.callMethods(sender, disguise, getPermissions(sender).get(new DisguisePerm(disguise.getType())),
|
.callMethods(sender, disguise, getPermissions(sender).get(new DisguisePerm(disguise.getType())),
|
||||||
new ArrayList<String>(), args);
|
new ArrayList<String>(), DisguiseParser.split(StringUtils.join(args)));
|
||||||
}
|
}
|
||||||
catch (DisguiseParseException ex) {
|
catch (DisguiseParseException ex) {
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
|
@ -2,11 +2,11 @@ package me.libraryaddict.disguise.commands;
|
|||||||
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
|
import me.libraryaddict.disguise.utilities.DisguiseParser;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
import me.libraryaddict.disguise.utilities.DisguiseParser.DisguisePerm;
|
||||||
import me.libraryaddict.disguise.utilities.LibsMsg;
|
import me.libraryaddict.disguise.utilities.LibsMsg;
|
||||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers;
|
||||||
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
import me.libraryaddict.disguise.utilities.ReflectionFlagWatchers.ParamInfo;
|
||||||
import me.libraryaddict.disguise.utilities.TranslateType;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -41,7 +41,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
|||||||
|
|
||||||
// TODO Validate if any disguises have this arg
|
// 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()));
|
sender.sendMessage(LibsMsg.DMODIFYENT_CLICK.get(DisguiseConfig.getDisguiseEntityExpire()));
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,7 +72,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
DisguiseParser.callMethods(sender, disguise, map.get(new DisguisePerm(disguise.getType())),
|
DisguiseParser.callMethods(sender, disguise, map.get(new DisguisePerm(disguise.getType())),
|
||||||
new ArrayList<String>(), newArgs);
|
new ArrayList<String>(), DisguiseParser.split(StringUtils.join(newArgs)));
|
||||||
}
|
}
|
||||||
catch (DisguiseParseException ex) {
|
catch (DisguiseParseException ex) {
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
|
@ -149,7 +149,7 @@ public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
DisguiseParser.callMethods(sender, disguise, map.get(new DisguisePerm(disguise.getType())),
|
DisguiseParser.callMethods(sender, disguise, map.get(new DisguisePerm(disguise.getType())),
|
||||||
new ArrayList<String>(), newArgs);
|
new ArrayList<String>(), DisguiseParser.split(StringUtils.join(newArgs)));
|
||||||
modifiedDisguises++;
|
modifiedDisguises++;
|
||||||
}
|
}
|
||||||
catch (DisguiseParseException ex) {
|
catch (DisguiseParseException ex) {
|
||||||
|
@ -439,7 +439,7 @@ public class DisguiseParser {
|
|||||||
* Splits a string while respecting quotes
|
* Splits a string while respecting quotes
|
||||||
*/
|
*/
|
||||||
public static String[] split(String string) {
|
public static String[] split(String string) {
|
||||||
return string.split(" (?=\")|(?<=\")\\s");
|
return ChatColor.translateAlternateColorCodes('&', string).split(" (?=\")|(?<=\")\\s");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user