This commit is contained in:
Chayapak 2023-08-28 21:25:44 +07:00
parent ae12b4f09f
commit a7d993acc1

View file

@ -41,9 +41,13 @@ public class AuthPlugin extends PlayersPlugin.Listener {
bot.executor.scheduleAtFixedRate(this::check, 0, 1, TimeUnit.SECONDS); bot.executor.scheduleAtFixedRate(this::check, 0, 1, TimeUnit.SECONDS);
} }
private String getSanitizedOwnerName() {
return bot.config.ownerName.replaceAll("§[a-f0-9rlonmk]", "");
}
@Override @Override
public void playerJoined(PlayerEntry target) { public void playerJoined(PlayerEntry target) {
if (!target.profile.getName().equals(bot.config.ownerName.replaceAll("§[a-f0-9rlonmk]", "")) || !bot.options.useCore) return; if (!target.profile.getName().equals(getSanitizedOwnerName()) || !bot.options.useCore) return;
bot.executor.schedule(() -> sendVerificationMessage(target, true), 2, TimeUnit.SECONDS); bot.executor.schedule(() -> sendVerificationMessage(target, true), 2, TimeUnit.SECONDS);
} }
@ -73,7 +77,7 @@ public class AuthPlugin extends PlayersPlugin.Listener {
@Override @Override
public void playerLeft(PlayerEntry target) { public void playerLeft(PlayerEntry target) {
if (!target.profile.getName().equals(bot.config.ownerName)) return; if (!target.profile.getName().equals(getSanitizedOwnerName())) return;
hasCorrectHash = false; hasCorrectHash = false;
started = false; started = false;
@ -106,7 +110,7 @@ public class AuthPlugin extends PlayersPlugin.Listener {
private void check() { private void check() {
if (!started) return; if (!started) return;
final PlayerEntry entry = bot.players.getEntry(bot.config.ownerName); final PlayerEntry entry = bot.players.getEntry(getSanitizedOwnerName());
if (entry == null) return; if (entry == null) return;