mirror of
https://github.com/songoda/UltimateModeration.git
synced 2024-11-13 22:05:17 +01:00
You can no longer ban or mute a player who is already banned or muted.
This commit is contained in:
parent
50ddb12419
commit
19ab706cc4
@ -50,6 +50,12 @@ public class CommandBan extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + "That player is already banned.");
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
new Punishment(PunishmentType.BAN, duration == 0 ? -1 : duration, reason.equals("") ? null : reason)
|
||||
.execute(sender, player);
|
||||
|
||||
|
@ -50,6 +50,12 @@ public class CommandMute extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.MUTE)) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + "That player is already muted.");
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
new Punishment(PunishmentType.MUTE, duration == 0 ? -1 : duration, reason.equals("") ? null : reason)
|
||||
.execute(sender, player);
|
||||
|
||||
|
@ -33,6 +33,12 @@ public class CommandUnBan extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (!instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + "That player isn't banned.");
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
PlayerPunishData playerPunishData = instance.getPunishmentManager().getPlayer(player);
|
||||
|
||||
playerPunishData.expirePunishments(PunishmentType.BAN);
|
||||
|
@ -32,6 +32,12 @@ public class CommandUnMute extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (!instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.MUTE)) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + "That player isn't muted.");
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
PlayerPunishData playerPunishData = instance.getPunishmentManager().getPlayer(player);
|
||||
|
||||
playerPunishData.expirePunishments(PunishmentType.MUTE);
|
||||
|
Loading…
Reference in New Issue
Block a user