File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
modules/RoyalCommands/src/main/java/org/royaldev/royalcommands/rcommands Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,13 @@ public void run() {
7474 if (pip == null ) continue ;
7575 if (pip .contains (ip )) {
7676 synchronized (hasIP ) {
77- hasIP .add (pcm .getString ("name" , op .getName ()) + ((partial ) ? MessageColor .POSITIVE + ": " + MessageColor .NEUTRAL + pip : "" ));
77+ String name = "" ;
78+ try {
79+ name = op .getName ();
80+ } catch (Exception e ) {
81+ name = op .getUniqueId ().toString ();
82+ }
83+ hasIP .add (pcm .getString ("name" , name ) + ((partial ) ? MessageColor .POSITIVE + ": " + MessageColor .NEUTRAL + pip : "" ));
7884 }
7985 }
8086 if (!alreadyPresent ) pcm .discard ();
Original file line number Diff line number Diff line change @@ -41,7 +41,12 @@ public void run() {
4141 int found = 0 ;
4242 cs .sendMessage (MessageColor .POSITIVE + "Search for " + MessageColor .NEUTRAL + search + MessageColor .POSITIVE + " started. This may take a while." );
4343 for (final OfflinePlayer op : ops ) {
44- if (op == null || op .getName () == null ) continue ;
44+ try {
45+ if (op == null || op .getName () == null ) continue ;
46+ } catch (Exception ex ) {
47+ cs .sendMessage (MessageColor .NEGATIVE + "Failed to read " + MessageColor .NEUTRAL + op .getUniqueId ());
48+ continue ;
49+ }
4550 if (!op .getName ().toLowerCase ().contains (search .toLowerCase ())) continue ;
4651 PlayerConfiguration pcm = PlayerConfigurationManager .getConfiguration (op );
4752 if (!pcm .exists ()) continue ;
You can’t perform that action at this time.
0 commit comments