File tree Expand file tree Collapse file tree
type.generic/src/main/java/net/swofty/type/generic Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public void registerUsage(MinestomCommand command) {
3434 String [] message = context .get (messageArgument );
3535 HypixelPlayer player = (HypixelPlayer ) sender ;
3636
37- @ Nullable UUID targetUUID = resolveUUID (playerName );
37+ @ Nullable UUID targetUUID = HypixelDataHandler . getPotentialUUIDFromName (playerName );
3838 if (targetUUID == null ) {
3939 player .sendMessage ("§cCan't find a player by the name of '" + playerName + "'" );
4040 return ;
@@ -52,15 +52,4 @@ public void registerUsage(MinestomCommand command) {
5252 target .sendMessage ("§dFrom " + ourName + "§7: " + String .join (" " , message ));
5353 }, playerArgument , messageArgument );
5454 }
55-
56- private @ Nullable UUID resolveUUID (String name ) {
57- // First, try online players (case-insensitive)
58- for (HypixelPlayer online : HypixelGenericLoader .getLoadedPlayers ()) {
59- if (online .getUsername ().equalsIgnoreCase (name )) {
60- return online .getUuid ();
61- }
62- }
63- // Fallback to stored data lookup
64- return HypixelDataHandler .getPotentialUUIDFromName (name );
65- }
6655}
Original file line number Diff line number Diff line change @@ -149,8 +149,12 @@ public static String getPotentialIGNFromUUID(UUID uuid) {
149149 return handler .get (Data .IGN , DatapointString .class ).getValue ();
150150 }
151151
152+ @ Blocking
152153 public static @ Nullable UUID getPotentialUUIDFromName (String name ) throws RuntimeException {
153- Document doc = UserDatabase .collection .find (new Document ("ignLowercase" , "\" " + name .toLowerCase () + "\" " )).first ();
154+ Document doc = UserDatabase .collection .find (
155+ new Document ("ignLowercase" , "\" " + name .toLowerCase () + "\" " )
156+ ).first ();
157+
154158 if (doc == null )
155159 return null ;
156160 return UUID .fromString (doc .getString ("_id" ));
You can’t perform that action at this time.
0 commit comments