Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

Commit 2e371b4

Browse files
author
Zach Brown
committed
Make input handling always resolve UUIDs first
Only trigger entity handling if the input value cannot be parsed as a UUID.
1 parent 5c14356 commit 2e371b4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/java/com/destroystokyo/debuggery/reflection/formatters/InputFormatter.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,17 @@ private static Object getTypeForClass(Class clazz, String input, @Nullable Comma
8888
}
8989

9090
private static UUID getUUID(String input, CommandSender sender) throws InputException {
91-
if (sender instanceof Player) {
92-
Player player = (Player) sender;
93-
94-
Entity entity = getEntity(input, sender);
95-
if (entity != null) {
96-
return entity.getUniqueId();
97-
}
98-
}
99-
10091
try {
10192
return UUID.fromString(input);
10293
} catch (IllegalArgumentException ex) {
94+
if (sender instanceof Player) {
95+
Entity entity = getEntity(input, sender);
96+
97+
if (entity != null) {
98+
return entity.getUniqueId();
99+
}
100+
}
101+
103102
throw new InputException(ex);
104103
}
105104
}

0 commit comments

Comments
 (0)