Added the ability to set skin blob with command.
Skin blob can be fetched from https://sessionserver.mojang.com/session/minecraft/profile/<TRIMMED UUID>?unsigned=false
This commit is contained in:
parent
f498867d5c
commit
acc21a6d6e
@ -6,7 +6,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -20,6 +23,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
|
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
@ -35,10 +42,8 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|||||||
*/
|
*/
|
||||||
public abstract class BaseDisguiseCommand implements CommandExecutor
|
public abstract class BaseDisguiseCommand implements CommandExecutor
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DisguiseParseException extends Exception
|
public class DisguiseParseException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1276971370793124510L;
|
private static final long serialVersionUID = 1276971370793124510L;
|
||||||
|
|
||||||
public DisguiseParseException()
|
public DisguiseParseException()
|
||||||
@ -55,11 +60,14 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
protected ArrayList<String> getAllowedDisguises(HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> hashMap)
|
protected ArrayList<String> getAllowedDisguises(HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> hashMap)
|
||||||
{
|
{
|
||||||
ArrayList<String> allowedDisguises = new ArrayList<>();
|
ArrayList<String> allowedDisguises = new ArrayList<>();
|
||||||
|
|
||||||
for (DisguiseType type : hashMap.keySet())
|
for (DisguiseType type : hashMap.keySet())
|
||||||
{
|
{
|
||||||
allowedDisguises.add(type.toReadable().replace(" ", "_"));
|
allowedDisguises.add(type.toReadable().replace(" ", "_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(allowedDisguises, String.CASE_INSENSITIVE_ORDER);
|
Collections.sort(allowedDisguises, String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
return allowedDisguises;
|
return allowedDisguises;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,13 +87,17 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
case FISHING_HOOK:
|
case FISHING_HOOK:
|
||||||
case DROPPED_ITEM:
|
case DROPPED_ITEM:
|
||||||
HashMap<String, Boolean> returns = new HashMap<>();
|
HashMap<String, Boolean> returns = new HashMap<>();
|
||||||
|
|
||||||
String beginning = "libsdisguises.options." + getClass().getSimpleName().toLowerCase().replace("command", "") + ".";
|
String beginning = "libsdisguises.options." + getClass().getSimpleName().toLowerCase().replace("command", "") + ".";
|
||||||
|
|
||||||
for (PermissionAttachmentInfo permission : sender.getEffectivePermissions())
|
for (PermissionAttachmentInfo permission : sender.getEffectivePermissions())
|
||||||
{
|
{
|
||||||
String lowerPerm = permission.getPermission().toLowerCase();
|
String lowerPerm = permission.getPermission().toLowerCase();
|
||||||
|
|
||||||
if (lowerPerm.startsWith(beginning))
|
if (lowerPerm.startsWith(beginning))
|
||||||
{
|
{
|
||||||
String[] split = lowerPerm.substring(beginning.length()).split("\\.");
|
String[] split = lowerPerm.substring(beginning.length()).split("\\.");
|
||||||
|
|
||||||
if (split.length > 1)
|
if (split.length > 1)
|
||||||
{
|
{
|
||||||
if (split[0].replace("_", "").equals(type.name().toLowerCase().replace("_", "")))
|
if (split[0].replace("_", "").equals(type.name().toLowerCase().replace("_", "")))
|
||||||
@ -98,6 +110,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return returns;
|
return returns;
|
||||||
default:
|
default:
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
@ -107,8 +120,10 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
protected Method[] getDisguiseWatcherMethods(Class<? extends FlagWatcher> watcherClass)
|
protected Method[] getDisguiseWatcherMethods(Class<? extends FlagWatcher> watcherClass)
|
||||||
{
|
{
|
||||||
Method[] methods = watcherClass.getMethods();
|
Method[] methods = watcherClass.getMethods();
|
||||||
|
|
||||||
methods = Arrays.copyOf(methods, methods.length + 4);
|
methods = Arrays.copyOf(methods, methods.length + 4);
|
||||||
int i = 4;
|
int i = 4;
|
||||||
|
|
||||||
for (String methodName : new String[]
|
for (String methodName : new String[]
|
||||||
{
|
{
|
||||||
"setViewSelfDisguise", "setHideHeldItemFromSelf", "setHideArmorFromSelf", "setHearSelfDisguise"
|
"setViewSelfDisguise", "setHideHeldItemFromSelf", "setHideArmorFromSelf", "setHearSelfDisguise"
|
||||||
@ -123,6 +138,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
ex.printStackTrace(System.out);
|
ex.printStackTrace(System.out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return methods;
|
return methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,10 +164,12 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
perms.put(perm, permission.getValue());
|
perms.put(perm, permission.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!perms.containsKey(permissionNode + "*") && sender.hasPermission(permissionNode + "*"))
|
if (!perms.containsKey(permissionNode + "*") && sender.hasPermission(permissionNode + "*"))
|
||||||
{
|
{
|
||||||
perms.put(permissionNode + "*", true);
|
perms.put(permissionNode + "*", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!perms.containsKey(permissionNode + "*.*") && sender.hasPermission(permissionNode + "*.*"))
|
if (!perms.containsKey(permissionNode + "*.*") && sender.hasPermission(permissionNode + "*.*"))
|
||||||
{
|
{
|
||||||
perms.put(permissionNode + "*.*", true);
|
perms.put(permissionNode + "*.*", true);
|
||||||
@ -162,8 +180,10 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
if (perms.get(perm))
|
if (perms.get(perm))
|
||||||
{
|
{
|
||||||
perm = perm.substring(permissionNode.length());
|
perm = perm.substring(permissionNode.length());
|
||||||
|
|
||||||
String disguiseType = perm.split("\\.")[0];
|
String disguiseType = perm.split("\\.")[0];
|
||||||
DisguiseType dType = null;
|
DisguiseType dType = null;
|
||||||
|
|
||||||
for (DisguiseType t : DisguiseType.values())
|
for (DisguiseType t : DisguiseType.values())
|
||||||
{
|
{
|
||||||
if (t.name().replace("_", "").equalsIgnoreCase(disguiseType.replace("_", "")))
|
if (t.name().replace("_", "").equalsIgnoreCase(disguiseType.replace("_", "")))
|
||||||
@ -175,6 +195,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
if (dType != null)
|
if (dType != null)
|
||||||
{
|
{
|
||||||
HashMap<ArrayList<String>, Boolean> list;
|
HashMap<ArrayList<String>, Boolean> list;
|
||||||
|
|
||||||
if (singleDisguises.containsKey(dType))
|
if (singleDisguises.containsKey(dType))
|
||||||
{
|
{
|
||||||
list = singleDisguises.get(dType);
|
list = singleDisguises.get(dType);
|
||||||
@ -184,6 +205,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
list = new HashMap<>();
|
list = new HashMap<>();
|
||||||
singleDisguises.put(dType, list);
|
singleDisguises.put(dType, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<ArrayList<String>, Boolean> map1 = getOptions(perm);
|
HashMap<ArrayList<String>, Boolean> map1 = getOptions(perm);
|
||||||
list.put(map1.keySet().iterator().next(), map1.values().iterator().next());
|
list.put(map1.keySet().iterator().next(), map1.values().iterator().next());
|
||||||
}
|
}
|
||||||
@ -193,6 +215,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
{
|
{
|
||||||
HashMap<ArrayList<String>, Boolean> options = null;
|
HashMap<ArrayList<String>, Boolean> options = null;
|
||||||
Class entityClass = type.getEntityClass();
|
Class entityClass = type.getEntityClass();
|
||||||
|
|
||||||
if (disguiseType.equals("mob"))
|
if (disguiseType.equals("mob"))
|
||||||
{
|
{
|
||||||
if (type.isMob())
|
if (type.isMob())
|
||||||
@ -447,6 +470,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DisguiseType disguiseType = null;
|
DisguiseType disguiseType = null;
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("p"))
|
if (args[0].equalsIgnoreCase("p"))
|
||||||
{
|
{
|
||||||
disguiseType = DisguiseType.PLAYER;
|
disguiseType = DisguiseType.PLAYER;
|
||||||
@ -467,20 +491,26 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
throw new DisguiseParseException(
|
throw new DisguiseParseException(
|
||||||
ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0] + ChatColor.RED + " doesn't exist!");
|
ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0] + ChatColor.RED + " doesn't exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disguiseType.isUnknown())
|
if (disguiseType.isUnknown())
|
||||||
{
|
{
|
||||||
throw new DisguiseParseException(ChatColor.RED + "Error! You cannot disguise as " + ChatColor.GREEN + "Unknown!");
|
throw new DisguiseParseException(ChatColor.RED + "Error! You cannot disguise as " + ChatColor.GREEN + "Unknown!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disguiseType.getEntityType() == null)
|
if (disguiseType.getEntityType() == null)
|
||||||
{
|
{
|
||||||
throw new DisguiseParseException(ChatColor.RED + "Error! This version of minecraft does not have that disguise!");
|
throw new DisguiseParseException(ChatColor.RED + "Error! This version of minecraft does not have that disguise!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!map.containsKey(disguiseType))
|
if (!map.containsKey(disguiseType))
|
||||||
{
|
{
|
||||||
throw new DisguiseParseException(ChatColor.RED + "You are forbidden to use this disguise.");
|
throw new DisguiseParseException(ChatColor.RED + "You are forbidden to use this disguise.");
|
||||||
}
|
}
|
||||||
|
|
||||||
optionPermissions = map.get(disguiseType);
|
optionPermissions = map.get(disguiseType);
|
||||||
|
|
||||||
HashMap<String, Boolean> disguiseOptions = this.getDisguisePermission(sender, disguiseType);
|
HashMap<String, Boolean> disguiseOptions = this.getDisguisePermission(sender, disguiseType);
|
||||||
|
|
||||||
if (disguiseType.isPlayer())
|
if (disguiseType.isPlayer())
|
||||||
{
|
{
|
||||||
// If he is doing a player disguise
|
// If he is doing a player disguise
|
||||||
@ -496,7 +526,9 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
{
|
{
|
||||||
throw new DisguiseParseException(ChatColor.RED + "Error! You don't have permission to use that name!");
|
throw new DisguiseParseException(ChatColor.RED + "Error! You don't have permission to use that name!");
|
||||||
}
|
}
|
||||||
|
|
||||||
args[1] = args[1].replace("\\_", " ");
|
args[1] = args[1].replace("\\_", " ");
|
||||||
|
|
||||||
// Construct the player disguise
|
// Construct the player disguise
|
||||||
disguise = new PlayerDisguise(ChatColor.translateAlternateColorCodes('&', args[1]));
|
disguise = new PlayerDisguise(ChatColor.translateAlternateColorCodes('&', args[1]));
|
||||||
toSkip++;
|
toSkip++;
|
||||||
@ -643,7 +675,9 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
String[] newArgs = new String[args.length - toSkip];
|
String[] newArgs = new String[args.length - toSkip];
|
||||||
System.arraycopy(args, toSkip, newArgs, 0, args.length - toSkip);
|
System.arraycopy(args, toSkip, newArgs, 0, args.length - toSkip);
|
||||||
args = newArgs;
|
args = newArgs;
|
||||||
|
|
||||||
Method[] methods = this.getDisguiseWatcherMethods(disguise.getWatcher().getClass());
|
Method[] methods = this.getDisguiseWatcherMethods(disguise.getWatcher().getClass());
|
||||||
|
|
||||||
for (int i = 0; i < args.length; i += 2)
|
for (int i = 0; i < args.length; i += 2)
|
||||||
{
|
{
|
||||||
String methodName = args[i];
|
String methodName = args[i];
|
||||||
@ -652,20 +686,24 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
Object value = null;
|
Object value = null;
|
||||||
DisguiseParseException storedEx = null;
|
DisguiseParseException storedEx = null;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (c < methods.length)
|
while (c < methods.length)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Entry<Method, Integer> entry = getMethod(methods, methodName, c);
|
Entry<Method, Integer> entry = getMethod(methods, methodName, c);
|
||||||
|
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
methodToUse = entry.getKey();
|
methodToUse = entry.getKey();
|
||||||
c = entry.getValue();
|
c = entry.getValue();
|
||||||
methodName = methodToUse.getName();
|
methodName = methodToUse.getName();
|
||||||
Class<?>[] types = methodToUse.getParameterTypes();
|
Class<?>[] types = methodToUse.getParameterTypes();
|
||||||
Class param = types[0];
|
Class param = types[0];
|
||||||
|
|
||||||
if (valueString != null)
|
if (valueString != null)
|
||||||
{
|
{
|
||||||
if (int.class == param)
|
if (int.class == param)
|
||||||
@ -680,6 +718,55 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
throw parseToException("number", valueString, methodName);
|
throw parseToException("number", valueString, methodName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (WrappedGameProfile.class == param && valueString.length() > 20)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Map<String, Object> response = new Gson().fromJson(valueString, Map.class);
|
||||||
|
|
||||||
|
String id = (String) response.get("id");
|
||||||
|
|
||||||
|
if (!id.contains("-"))
|
||||||
|
{
|
||||||
|
id = Pattern
|
||||||
|
.compile(
|
||||||
|
"([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)")
|
||||||
|
.matcher(id).replaceFirst("$1-$2-$3-$4-$5");
|
||||||
|
}
|
||||||
|
|
||||||
|
WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.fromString(id),
|
||||||
|
(String) response.get("name"));
|
||||||
|
|
||||||
|
if (response.containsKey("properties"))
|
||||||
|
{
|
||||||
|
ArrayList<Map<String, String>> properties = (ArrayList) response.get("properties");
|
||||||
|
|
||||||
|
for (Map<String, String> s : properties)
|
||||||
|
{
|
||||||
|
String gName = null;
|
||||||
|
String gValue = null;
|
||||||
|
String gSigned = null;
|
||||||
|
|
||||||
|
if (s.containsKey("name"))
|
||||||
|
gName = s.get("name");
|
||||||
|
|
||||||
|
if (s.containsKey("value"))
|
||||||
|
gValue = s.get("value");
|
||||||
|
|
||||||
|
if (s.containsKey("signature"))
|
||||||
|
gSigned = s.get("signature");
|
||||||
|
|
||||||
|
gameProfile.getProperties().put(gName, new WrappedSignedProperty(gName, gValue, gSigned));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
value = gameProfile;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw parseToException("gameprofile", valueString, methodName);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (float.class == param || double.class == param)
|
else if (float.class == param || double.class == param)
|
||||||
{
|
{
|
||||||
// Parse to number
|
// Parse to number
|
||||||
@ -702,6 +789,9 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
}
|
}
|
||||||
else if (param == String.class)
|
else if (param == String.class)
|
||||||
{
|
{
|
||||||
|
if (methodName.equalsIgnoreCase("setskin") && valueString.length() > 20)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Parse to string
|
// Parse to string
|
||||||
value = ChatColor.translateAlternateColorCodes('&', valueString);
|
value = ChatColor.translateAlternateColorCodes('&', valueString);
|
||||||
}
|
}
|
||||||
@ -733,7 +823,9 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
{
|
{
|
||||||
// Parse to itemstack array
|
// Parse to itemstack array
|
||||||
ItemStack[] items = new ItemStack[4];
|
ItemStack[] items = new ItemStack[4];
|
||||||
|
|
||||||
String[] split = valueString.split(",");
|
String[] split = valueString.split(",");
|
||||||
|
|
||||||
if (split.length == 4)
|
if (split.length == 4)
|
||||||
{
|
{
|
||||||
for (int a = 0; a < 4; a++)
|
for (int a = 0; a < 4; a++)
|
||||||
@ -754,6 +846,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
throw parseToException("item ID,ID,ID,ID" + ChatColor.RED + " or " + ChatColor.GREEN
|
throw parseToException("item ID,ID,ID,ID" + ChatColor.RED + " or " + ChatColor.GREEN
|
||||||
+ "ID:Data,ID:Data,ID:Data,ID:Data combo", valueString, methodName);
|
+ "ID:Data,ID:Data,ID:Data,ID:Data combo", valueString, methodName);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = items;
|
value = items;
|
||||||
}
|
}
|
||||||
else if (param.getSimpleName().equals("Color"))
|
else if (param.getSimpleName().equals("Color"))
|
||||||
@ -805,7 +898,9 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
else if (param == int[].class)
|
else if (param == int[].class)
|
||||||
{
|
{
|
||||||
String[] split = valueString.split(",");
|
String[] split = valueString.split(",");
|
||||||
|
|
||||||
int[] values = new int[split.length];
|
int[] values = new int[split.length];
|
||||||
|
|
||||||
for (int b = 0; b < values.length; b++)
|
for (int b = 0; b < values.length; b++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -817,6 +912,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
throw parseToException("Number,Number,Number...", valueString, methodName);
|
throw parseToException("Number,Number,Number...", valueString, methodName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = values;
|
value = values;
|
||||||
}
|
}
|
||||||
else if (param == BlockFace.class)
|
else if (param == BlockFace.class)
|
||||||
@ -824,10 +920,12 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
BlockFace face = BlockFace.valueOf(valueString.toUpperCase());
|
BlockFace face = BlockFace.valueOf(valueString.toUpperCase());
|
||||||
|
|
||||||
if (face.ordinal() > 4)
|
if (face.ordinal() > 4)
|
||||||
{
|
{
|
||||||
throw new DisguiseParseException();
|
throw new DisguiseParseException();
|
||||||
}
|
}
|
||||||
|
|
||||||
value = face;
|
value = face;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -845,6 +943,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
.equalsIgnoreCase(valueString.replace("_", "").replace(" ", "")))
|
.equalsIgnoreCase(valueString.replace("_", "").replace(" ", "")))
|
||||||
{
|
{
|
||||||
value = type;
|
value = type;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -859,6 +958,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == null && boolean.class == param)
|
if (value == null && boolean.class == param)
|
||||||
{
|
{
|
||||||
if (valueString == null)
|
if (valueString == null)
|
||||||
@ -887,6 +987,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != null)
|
if (value != null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -266,11 +266,6 @@ public class PlayerDisguise extends TargetedDisguise
|
|||||||
|
|
||||||
setSkin(gameProfile);
|
setSkin(gameProfile);
|
||||||
|
|
||||||
if (!gameProfile.getProperties().isEmpty() && DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this))
|
|
||||||
{
|
|
||||||
DisguiseUtilities.refreshTrackers(PlayerDisguise.this);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentLookup = null;
|
currentLookup = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -303,12 +298,16 @@ public class PlayerDisguise extends TargetedDisguise
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LibsDisguises.getInstance().getConfig().getBoolean("ContactMojangServers", true))
|
Validate.notEmpty(gameProfile.getName(), "Name must be set");
|
||||||
{
|
|
||||||
Validate.notEmpty(gameProfile.getName(), "Name must be set");
|
|
||||||
|
|
||||||
this.skinToUse = gameProfile.getName();
|
currentLookup = null;
|
||||||
this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(null, getName(), gameProfile);
|
|
||||||
|
this.skinToUse = gameProfile.getName();
|
||||||
|
this.gameProfile = ReflectionManager.getGameProfileWithThisSkin(null, getName(), gameProfile);
|
||||||
|
|
||||||
|
if (DisguiseUtilities.isDisguiseInUse(this))
|
||||||
|
{
|
||||||
|
DisguiseUtilities.refreshTrackers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -35,8 +35,8 @@ import org.bukkit.scoreboard.Team.Option;
|
|||||||
import org.bukkit.scoreboard.Team.OptionStatus;
|
import org.bukkit.scoreboard.Team.OptionStatus;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType.Play.Server;
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.PacketType.Play.Server;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
@ -731,63 +731,66 @@ public class DisguiseUtilities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add null so that if this is called again. I already know I'm doing something about it
|
if (contactMojang)
|
||||||
gameProfiles.put(playerName, null);
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(libsDisguises, new Runnable()
|
|
||||||
{
|
{
|
||||||
@Override
|
// Add null so that if this is called again. I already know I'm doing something about it
|
||||||
public void run()
|
gameProfiles.put(playerName, null);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(libsDisguises, new Runnable()
|
||||||
{
|
{
|
||||||
try
|
@Override
|
||||||
|
public void run()
|
||||||
{
|
{
|
||||||
final WrappedGameProfile gameProfile = lookupGameProfile(origName);
|
try
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(libsDisguises, new Runnable()
|
|
||||||
{
|
{
|
||||||
@Override
|
final WrappedGameProfile gameProfile = lookupGameProfile(origName);
|
||||||
public void run()
|
|
||||||
|
Bukkit.getScheduler().runTask(libsDisguises, new Runnable()
|
||||||
{
|
{
|
||||||
if (gameProfile.getProperties().isEmpty())
|
@Override
|
||||||
|
public void run()
|
||||||
{
|
{
|
||||||
return;
|
if (gameProfile.getProperties().isEmpty())
|
||||||
}
|
|
||||||
|
|
||||||
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null)
|
|
||||||
{
|
|
||||||
gameProfiles.put(playerName, gameProfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (runnables.containsKey(playerName))
|
|
||||||
{
|
|
||||||
for (Object obj : runnables.remove(playerName))
|
|
||||||
{
|
{
|
||||||
if (obj instanceof Runnable)
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null)
|
||||||
|
{
|
||||||
|
gameProfiles.put(playerName, gameProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runnables.containsKey(playerName))
|
||||||
|
{
|
||||||
|
for (Object obj : runnables.remove(playerName))
|
||||||
{
|
{
|
||||||
((Runnable) obj).run();
|
if (obj instanceof Runnable)
|
||||||
}
|
{
|
||||||
else if (obj instanceof LibsProfileLookup)
|
((Runnable) obj).run();
|
||||||
{
|
}
|
||||||
((LibsProfileLookup) obj).onLookup(gameProfile);
|
else if (obj instanceof LibsProfileLookup)
|
||||||
|
{
|
||||||
|
((LibsProfileLookup) obj).onLookup(gameProfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null)
|
|
||||||
{
|
|
||||||
gameProfiles.remove(playerName);
|
|
||||||
getAddedByPlugins().remove(playerName);
|
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null)
|
||||||
|
{
|
||||||
|
gameProfiles.remove(playerName);
|
||||||
|
getAddedByPlugins().remove(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
System.out.print(
|
System.out.print("[LibsDisguises] Error when fetching " + playerName + "'s uuid from mojang: "
|
||||||
"[LibsDisguises] Error when fetching " + playerName + "'s uuid from mojang: " + e.getMessage());
|
+ e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user