diff options
author | Petr Ilin <hevav@hevav.dev> | 2022-03-28 14:48:28 +0300 |
---|---|---|
committer | Petr Ilin <hevav@hevav.dev> | 2022-03-28 14:48:28 +0300 |
commit | 2fa4a044911eb6ef61832d41b0c3dd07a16598b4 (patch) | |
tree | 28c3c0d869c1443313a22a32120059348df94f5d | |
parent | 146b5fa741ca9fd589eb08402e4918bfffe3e13a (diff) | |
download | LimboAuth-2fa4a044911eb6ef61832d41b0c3dd07a16598b4.tar.gz LimboAuth-2fa4a044911eb6ef61832d41b0c3dd07a16598b4.tar.bz2 LimboAuth-2fa4a044911eb6ef61832d41b0c3dd07a16598b4.zip |
Events fixes, more events
3 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java b/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java index 0811007..3c23bbf 100644 --- a/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java +++ b/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java @@ -26,6 +26,7 @@ import java.sql.SQLException; import java.util.Locale; import net.elytrium.limboauth.LimboAuth; import net.elytrium.limboauth.Settings; +import net.elytrium.limboauth.event.AuthUnregisterEvent; import net.elytrium.limboauth.handler.AuthSessionHandler; import net.elytrium.limboauth.model.RegisteredPlayer; import net.kyori.adventure.text.Component; @@ -77,6 +78,7 @@ public class UnregisterCommand implements SimpleCommand { source.sendMessage(this.crackedCommand); } else if (AuthSessionHandler.checkPassword(args[0], player, this.playerDao)) { try { + this.plugin.getServer().getEventManager().fireAndForget(new AuthUnregisterEvent(username)); this.playerDao.deleteById(username.toLowerCase(Locale.ROOT)); this.plugin.removePlayerFromCache(username); ((Player) source).disconnect(this.successful); diff --git a/src/main/java/net/elytrium/limboauth/event/AuthUnregisterEvent.java b/src/main/java/net/elytrium/limboauth/event/AuthUnregisterEvent.java new file mode 100644 index 0000000..7450479 --- /dev/null +++ b/src/main/java/net/elytrium/limboauth/event/AuthUnregisterEvent.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 Elytrium + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.elytrium.limboauth.event; + +public class AuthUnregisterEvent { + + private final String nickname; + + public AuthUnregisterEvent(String nickname) { + this.nickname = nickname; + } + + public String getNickname() { + return this.nickname; + } + +} diff --git a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java index 43895f2..13200d0 100644 --- a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java +++ b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java @@ -332,6 +332,9 @@ public class AuthSessionHandler implements LimboSessionHandler { if (event.getResult() == TaskEvent.Result.CANCEL) { this.proxyPlayer.disconnect(event.getReason()); + return; + } else if (event.getResult() == TaskEvent.Result.WAIT) { + return; } this.plugin.cacheAuthUser(this.proxyPlayer); |