Read below for more info
Added /grabskin - Grabs a skin from file, url or existing player and saves as a new skin name Added /copydisguise - Outputs the current disguise or a specific uuid/player disguise to a usable string Added /savedisguise - Saves a disguise to custom disguises (disguises.yml) for future use, accepts skin files, urls and existing players Using MineSkin.org API Now generates Skins folder with info inside Added addGameProfile, addCustomDisguise and parseToString to DisguiseAPI Added different checks to gameprofiles Added new messages for the new features Fixed disguise parser to string handling quotes and skins wrong Fixed disguise parser to string not replacing colors back to the & Changed itemstack params to parse to a simpler item if possible
This commit is contained in:
@@ -114,6 +114,13 @@ public class DisguiseParser {
|
||||
}
|
||||
|
||||
public static String parseToString(Disguise disguise) {
|
||||
return parseToString(disguise, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not outputting skin information is not garanteed to display the correct player name
|
||||
*/
|
||||
public static String parseToString(Disguise disguise, boolean outputSkinData) {
|
||||
try {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
@@ -153,10 +160,25 @@ public class DisguiseParser {
|
||||
ourValue = null;
|
||||
}
|
||||
|
||||
// If its the same as default, continue
|
||||
if (!m.isAnnotationPresent(RandomDefaultValue.class) &&
|
||||
Objects.deepEquals(entry.getValue(), ourValue)) {
|
||||
continue;
|
||||
if (m.getName().equals("setSkin") && !outputSkinData) {
|
||||
PlayerDisguise pDisg = (PlayerDisguise) disguise;
|
||||
ourValue = pDisg.getName();
|
||||
|
||||
if (pDisg.getSkin() != null) {
|
||||
ourValue = pDisg.getSkin();
|
||||
} else if (pDisg.getGameProfile() != null && pDisg.getGameProfile().getName() != null) {
|
||||
ourValue = pDisg.getGameProfile().getName();
|
||||
}
|
||||
|
||||
if (ourValue.equals(pDisg.getName())) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// If its the same as default, continue
|
||||
if (!m.isAnnotationPresent(RandomDefaultValue.class) &&
|
||||
Objects.deepEquals(entry.getValue(), ourValue)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(" ").append(m.getName());
|
||||
@@ -170,9 +192,7 @@ public class DisguiseParser {
|
||||
if (ourValue != null) {
|
||||
valueString = ParamInfoManager.getParamInfo(ourValue.getClass()).toString(ourValue);
|
||||
|
||||
if (valueString.contains(" ") || valueString.contains("\"")) {
|
||||
valueString = "\"" + valueString.replace("\\", "\\\\").replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
valueString = DisguiseUtilities.quote(valueString);
|
||||
} else {
|
||||
valueString = "null";
|
||||
}
|
||||
|
Reference in New Issue
Block a user