Removed unnecessary code
This commit is contained in:
parent
d9ed69eecd
commit
04b57fc8ea
3 changed files with 7 additions and 20 deletions
|
@ -7,7 +7,6 @@ import lol.pyr.znpcsplus.skin.descriptor.NameFetchingDescriptor;
|
||||||
import lol.pyr.znpcsplus.skin.descriptor.MirrorDescriptor;
|
import lol.pyr.znpcsplus.skin.descriptor.MirrorDescriptor;
|
||||||
import lol.pyr.znpcsplus.skin.descriptor.PrefetchedDescriptor;
|
import lol.pyr.znpcsplus.skin.descriptor.PrefetchedDescriptor;
|
||||||
import lol.pyr.znpcsplus.skin.descriptor.UUIDFetchingDescriptor;
|
import lol.pyr.znpcsplus.skin.descriptor.UUIDFetchingDescriptor;
|
||||||
import lol.pyr.znpcsplus.util.UUIDUtil;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -25,9 +24,13 @@ public interface BaseSkinDescriptor extends SkinDescriptor {
|
||||||
static BaseSkinDescriptor deserialize(MojangSkinCache skinCache, String str) {
|
static BaseSkinDescriptor deserialize(MojangSkinCache skinCache, String str) {
|
||||||
String[] arr = str.split(";");
|
String[] arr = str.split(";");
|
||||||
if (arr[0].equalsIgnoreCase("mirror")) return new MirrorDescriptor(skinCache);
|
if (arr[0].equalsIgnoreCase("mirror")) return new MirrorDescriptor(skinCache);
|
||||||
else if (arr[0].equalsIgnoreCase("fetching")) {
|
else if (arr[0].equalsIgnoreCase("fetching-uuid")) {
|
||||||
String value = String.join(";", Arrays.copyOfRange(arr, 1, arr.length));
|
String value = String.join(";", Arrays.copyOfRange(arr, 1, arr.length));
|
||||||
return UUIDUtil.isUUID(value) ? new UUIDFetchingDescriptor(skinCache, UUID.fromString(value)) : new NameFetchingDescriptor(skinCache, value);
|
return new UUIDFetchingDescriptor(skinCache, UUID.fromString(value));
|
||||||
|
}
|
||||||
|
else if(arr[0].equalsIgnoreCase("fetching")) {
|
||||||
|
String value = String.join(";", Arrays.copyOfRange(arr, 1, arr.length));
|
||||||
|
return new NameFetchingDescriptor(skinCache, value);
|
||||||
}
|
}
|
||||||
else if (arr[0].equalsIgnoreCase("prefetched")) {
|
else if (arr[0].equalsIgnoreCase("prefetched")) {
|
||||||
List<TextureProperty> properties = new ArrayList<>();
|
List<TextureProperty> properties = new ArrayList<>();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class UUIDFetchingDescriptor implements BaseSkinDescriptor, SkinDescripto
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String serialize() {
|
public String serialize() {
|
||||||
return "fetching;" + uuid.toString();
|
return "fetching-uuid;" + uuid.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package lol.pyr.znpcsplus.util;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public final class UUIDUtil {
|
|
||||||
|
|
||||||
|
|
||||||
public final static Pattern UUID_REGEX =
|
|
||||||
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]{12}$");
|
|
||||||
|
|
||||||
public static boolean isUUID(String uuid) {
|
|
||||||
return UUID_REGEX.matcher(uuid).matches();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue