Folia support
This commit is contained in:
parent
8932c71173
commit
a7888c0c67
@ -78,7 +78,8 @@ public class RegisterAdminCommand implements ExecutableCommand {
|
||||
final Player player = bukkitService.getPlayerExact(playerName);
|
||||
if (player != null) {
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() ->
|
||||
player.kickPlayer(commonService.retrieveSingleMessage(player, MessageKey.KICK_FOR_ADMIN_REGISTER)));
|
||||
// AuthMeReReloaded - Folia compatibility
|
||||
bukkitService.runTaskIfFolia(player, () -> player.kickPlayer(commonService.retrieveSingleMessage(player, MessageKey.KICK_FOR_ADMIN_REGISTER))));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -45,34 +45,31 @@ public class SetEmailCommand implements ExecutableCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
bukkitService.runTaskOptionallyAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Validate the user
|
||||
PlayerAuth auth = dataSource.getAuth(playerName);
|
||||
if (auth == null) {
|
||||
commonService.send(sender, MessageKey.UNKNOWN_USER);
|
||||
return;
|
||||
} else if (!validationService.isEmailFreeForRegistration(playerEmail, sender)) {
|
||||
commonService.send(sender, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the email address
|
||||
auth.setEmail(playerEmail);
|
||||
if (!dataSource.updateEmail(auth)) {
|
||||
commonService.send(sender, MessageKey.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the player cache
|
||||
if (playerCache.getAuth(playerName) != null) {
|
||||
playerCache.updatePlayer(auth);
|
||||
}
|
||||
|
||||
// Show a status message
|
||||
commonService.send(sender, MessageKey.EMAIL_CHANGED_SUCCESS);
|
||||
bukkitService.runTaskOptionallyAsync(() -> { // AuthMeReReloaded - Folia compatibility
|
||||
// Validate the user
|
||||
PlayerAuth auth = dataSource.getAuth(playerName);
|
||||
if (auth == null) {
|
||||
commonService.send(sender, MessageKey.UNKNOWN_USER);
|
||||
return;
|
||||
} else if (!validationService.isEmailFreeForRegistration(playerEmail, sender)) {
|
||||
commonService.send(sender, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the email address
|
||||
auth.setEmail(playerEmail);
|
||||
if (!dataSource.updateEmail(auth)) {
|
||||
commonService.send(sender, MessageKey.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the player cache
|
||||
if (playerCache.getAuth(playerName) != null) {
|
||||
playerCache.updatePlayer(auth);
|
||||
}
|
||||
|
||||
// Show a status message
|
||||
commonService.send(sender, MessageKey.EMAIL_CHANGED_SUCCESS);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ public class TempbanManager implements SettingsDependent, HasCleanup {
|
||||
long newTime = expires.getTime() + (length * MILLIS_PER_MINUTE);
|
||||
expires.setTime(newTime);
|
||||
|
||||
bukkitService.scheduleSyncDelayedTask(() -> {
|
||||
bukkitService.runTask(player,() -> { // AuthMeReReloaded - Folia compatibility
|
||||
if (customCommand.isEmpty()) {
|
||||
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
||||
player.kickPlayer(reason);
|
||||
|
||||
@ -139,7 +139,8 @@ public class OnJoinVerifier implements Reloadable {
|
||||
}
|
||||
Player nonVipPlayer = generateKickPlayer(onlinePlayers);
|
||||
if (nonVipPlayer != null) {
|
||||
nonVipPlayer.kickPlayer(messages.retrieveSingle(player, MessageKey.KICK_FOR_VIP));
|
||||
// AuthMeReReloaded - Folia compatibility
|
||||
bukkitService.runTaskIfFolia(nonVipPlayer, () -> nonVipPlayer.kickPlayer(messages.retrieveSingle(player, MessageKey.KICK_FOR_VIP)));
|
||||
event.allow();
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@ -320,7 +320,8 @@ public class PlayerListener implements Listener{
|
||||
final Player player = event.getPlayer();
|
||||
if (!quickCommandsProtectionManager.isAllowed(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
player.kickPlayer(messages.retrieveSingle(player, MessageKey.QUICK_COMMAND_PROTECTION_KICK));
|
||||
bukkitService.runTaskIfFolia(player, () -> player.kickPlayer(messages.retrieveSingle(player, MessageKey.QUICK_COMMAND_PROTECTION_KICK)));
|
||||
// AuthMeReReloaded - Folia compatibility
|
||||
return;
|
||||
}
|
||||
if (listenerService.shouldCancelEvent(player)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user