1
0
This commit is contained in:
Lee
2024-04-05 21:43:32 +01:00
parent 0d329cfead
commit 872279a9c5
21 changed files with 162 additions and 109 deletions

View File

@ -14,6 +14,7 @@ import cc.fascinated.utils.Style;
import com.viaversion.viaversion.api.Via;
import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.EmbedBuilder;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -106,6 +107,20 @@ public class AccountManager extends Manager implements Listener {
log.info("Saved {}/{} accounts. ({}ms)", saved, ACCOUNTS.size(), System.currentTimeMillis() - before);
}
/**
* Deletes an account from the server.
* This will remove the account from memory and delete the account file.
*
* @param account the account to delete
*/
public void deleteAccount(Account account) {
account.getFile().delete();
ACCOUNTS.remove(account.getUuid());
account.getPlayer().kick(Component.text("Your account has been deleted. Please reconnect."));
log.info("Deleted account for {}", account.getUuid());
}
@Override
public Priority getPriority() {
return Priority.LOWEST;