Don't search unknown players by default

This shouldn't be needed in any of the internal usage of the event
 and could lead to unexpected network lookups.
This commit is contained in:
Phoenix616 2021-11-17 14:03:51 +01:00
parent 02dd167024
commit f9a0bf90a3
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ public class AccountQueryEvent extends Event {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final String name; private final String name;
private Account account = null; private Account account = null;
private boolean searchOfflinePlayers = true; private boolean searchOfflinePlayers = false;
public AccountQueryEvent(String name) { public AccountQueryEvent(String name) {
this.name = name; this.name = name;
@ -38,7 +38,8 @@ public class AccountQueryEvent extends Event {
} }
/** /**
* Set whether or not offline player data should be searched (too) * Set whether or not offline player data should be searched (too).
* This could lead to network lookups if the player by the name never joined the server!
* @param searchOfflinePlayers Whether or not offline player data should be searched (too) * @param searchOfflinePlayers Whether or not offline player data should be searched (too)
*/ */
public void searchOfflinePlayers(boolean searchOfflinePlayers) { public void searchOfflinePlayers(boolean searchOfflinePlayers) {

View File

@ -277,7 +277,6 @@ public class NameManager implements Listener {
} }
AccountQueryEvent queryEvent = new AccountQueryEvent(name); AccountQueryEvent queryEvent = new AccountQueryEvent(name);
queryEvent.searchOfflinePlayers(false);
ChestShop.callEvent(queryEvent); ChestShop.callEvent(queryEvent);
Account account = queryEvent.getAccount(); Account account = queryEvent.getAccount();
if (account == null) { if (account == null) {