Revert custom disguise api for MM compatibility
This commit is contained in:
parent
daf91304b8
commit
2ff7b7ab3f
@ -27,7 +27,7 @@ public class DisguiseAPI {
|
||||
private static int selfDisguiseId = ReflectionManager.getNewEntityId(true);
|
||||
|
||||
public static String getCustomDisguise(String disguiseName) {
|
||||
Map.Entry<DisguisePerm, String> entry = DisguiseConfig.getCustomDisguise(disguiseName);
|
||||
Map.Entry<DisguisePerm, String> entry = DisguiseConfig.getRawCustomDisguise(disguiseName);
|
||||
|
||||
if (entry == null)
|
||||
return null;
|
||||
|
@ -130,29 +130,48 @@ public class DisguiseConfig {
|
||||
explicitDisguisePermissions = explictDisguisePermission;
|
||||
}
|
||||
|
||||
public static Entry<DisguisePerm, Disguise> getParsedCustomDisguise(
|
||||
String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException {
|
||||
Entry<DisguisePerm, String> entry = getCustomDisguise(disguise);
|
||||
public static Entry<DisguisePerm, Disguise> getCustomDisguise(String disguise) {
|
||||
Entry<DisguisePerm, String> entry = getRawCustomDisguise(disguise);
|
||||
|
||||
return new HashMap.SimpleEntry(entry.getKey(), DisguiseParser.parseDisguise(entry.getValue()));
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new HashMap.SimpleEntry(entry.getKey(), DisguiseParser.parseDisguise(entry.getValue()));
|
||||
}
|
||||
catch (IllegalAccessException | InvocationTargetException | DisguiseParseException e) {
|
||||
DisguiseUtilities.getLogger().warning("Error when attempting to grab the custom disguise " + disguise);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Entry<DisguisePerm, Disguise> getParsedCustomDisguise(Entity target,
|
||||
public static Entry<DisguisePerm, Disguise> getCustomDisguise(Entity target,
|
||||
String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException {
|
||||
Entry<DisguisePerm, String> entry = getCustomDisguise(disguise);
|
||||
Entry<DisguisePerm, String> entry = getRawCustomDisguise(disguise);
|
||||
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HashMap.SimpleEntry(entry.getKey(),
|
||||
DisguiseParser.parseDisguise(Bukkit.getConsoleSender(), target, entry.getValue()));
|
||||
}
|
||||
|
||||
public static Entry<DisguisePerm, Disguise> getParsedCustomDisguise(CommandSender invoker, Entity target,
|
||||
public static Entry<DisguisePerm, Disguise> getCustomDisguise(CommandSender invoker, Entity target,
|
||||
String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException {
|
||||
Entry<DisguisePerm, String> entry = getCustomDisguise(disguise);
|
||||
Entry<DisguisePerm, String> entry = getRawCustomDisguise(disguise);
|
||||
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HashMap.SimpleEntry(entry.getKey(), DisguiseParser.parseDisguise(invoker, target, entry.getValue()));
|
||||
}
|
||||
|
||||
public static Entry<DisguisePerm, String> getCustomDisguise(String disguise) {
|
||||
public static Entry<DisguisePerm, String> getRawCustomDisguise(String disguise) {
|
||||
for (Entry<DisguisePerm, String> entry : customDisguises.entrySet()) {
|
||||
String name = entry.getKey().toReadable();
|
||||
|
||||
@ -383,7 +402,7 @@ public class DisguiseConfig {
|
||||
for (String key : section.getKeys(false)) {
|
||||
String toParse = section.getString(key);
|
||||
|
||||
if (getCustomDisguise(toParse) != null) {
|
||||
if (getRawCustomDisguise(toParse) != null) {
|
||||
DisguiseUtilities.getLogger()
|
||||
.severe("Cannot create the custom disguise '" + key + "' as there is a name conflict!");
|
||||
continue;
|
||||
|
@ -336,7 +336,7 @@ public class DisguiseParser {
|
||||
}
|
||||
} else {
|
||||
disguisePerm = getDisguisePerm(args[0]);
|
||||
Entry<DisguisePerm, String> customDisguise = DisguiseConfig.getCustomDisguise(args[0]);
|
||||
Entry<DisguisePerm, String> customDisguise = DisguiseConfig.getRawCustomDisguise(args[0]);
|
||||
|
||||
if (customDisguise != null) {
|
||||
args = DisguiseUtilities.split(customDisguise.getValue());
|
||||
|
Loading…
Reference in New Issue
Block a user