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);
|
final Player player = bukkitService.getPlayerExact(playerName);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() ->
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bukkitService.runTaskOptionallyAsync(new Runnable() {
|
bukkitService.runTaskOptionallyAsync(() -> { // AuthMeReReloaded - Folia compatibility
|
||||||
@Override
|
// Validate the user
|
||||||
public void run() {
|
PlayerAuth auth = dataSource.getAuth(playerName);
|
||||||
// Validate the user
|
if (auth == null) {
|
||||||
PlayerAuth auth = dataSource.getAuth(playerName);
|
commonService.send(sender, MessageKey.UNKNOWN_USER);
|
||||||
if (auth == null) {
|
return;
|
||||||
commonService.send(sender, MessageKey.UNKNOWN_USER);
|
} else if (!validationService.isEmailFreeForRegistration(playerEmail, sender)) {
|
||||||
return;
|
commonService.send(sender, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||||
} else if (!validationService.isEmailFreeForRegistration(playerEmail, sender)) {
|
return;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
long newTime = expires.getTime() + (length * MILLIS_PER_MINUTE);
|
||||||
expires.setTime(newTime);
|
expires.setTime(newTime);
|
||||||
|
|
||||||
bukkitService.scheduleSyncDelayedTask(() -> {
|
bukkitService.runTask(player,() -> { // AuthMeReReloaded - Folia compatibility
|
||||||
if (customCommand.isEmpty()) {
|
if (customCommand.isEmpty()) {
|
||||||
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
||||||
player.kickPlayer(reason);
|
player.kickPlayer(reason);
|
||||||
|
|||||||
@ -139,7 +139,8 @@ public class OnJoinVerifier implements Reloadable {
|
|||||||
}
|
}
|
||||||
Player nonVipPlayer = generateKickPlayer(onlinePlayers);
|
Player nonVipPlayer = generateKickPlayer(onlinePlayers);
|
||||||
if (nonVipPlayer != null) {
|
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();
|
event.allow();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -320,7 +320,8 @@ public class PlayerListener implements Listener{
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (!quickCommandsProtectionManager.isAllowed(player.getName())) {
|
if (!quickCommandsProtectionManager.isAllowed(player.getName())) {
|
||||||
event.setCancelled(true);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (listenerService.shouldCancelEvent(player)) {
|
if (listenerService.shouldCancelEvent(player)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user