forked from SteamWar/SteamWar
Improve PunishmentCommand Permissions
This commit is contained in:
@@ -181,7 +181,7 @@ public class PunishmentCommand {
|
||||
private final Punishment.PunishmentType punishmentType;
|
||||
|
||||
private PunishCommand(String command, Punishment.PunishmentType punishmentType) {
|
||||
super(command, UserPerm.TEAM);
|
||||
super(command, punishmentType.getUserPerm());
|
||||
this.command = command;
|
||||
this.punishmentType = punishmentType;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class PunishmentCommand {
|
||||
@Register
|
||||
public void genericCommand(Chatter sender, @Mapper("toPunish") String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE_REASON") String... message) {
|
||||
SteamwarUser punisher = sender.user();
|
||||
if (punishmentType.isNeedsAdmin() && !punisher.hasPerm(UserPerm.MODERATION))
|
||||
if (!punisher.hasPerm(punishmentType.getUserPerm()))
|
||||
return;
|
||||
|
||||
SteamwarUser target = unsafeUser(sender, toPunish);
|
||||
@@ -246,14 +246,15 @@ public class PunishmentCommand {
|
||||
private final Punishment.PunishmentType punishmentType;
|
||||
|
||||
private UnpunishCommand(String command, Punishment.PunishmentType punishmentType) {
|
||||
super(command, UserPerm.TEAM);
|
||||
super(command, punishmentType.getUserPerm());
|
||||
this.command = command;
|
||||
this.punishmentType = punishmentType;
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Chatter sender, @ErrorMessage("UNKNOWN_PLAYER") SteamwarUser target) {
|
||||
if (punishmentType.isNeedsAdmin() && !sender.user().hasPerm(UserPerm.MODERATION))
|
||||
SteamwarUser punisher = sender.user();
|
||||
if (!punisher.hasPerm(punishmentType.getUserPerm()))
|
||||
return;
|
||||
|
||||
if (!target.isPunished(punishmentType)) {
|
||||
|
||||
Reference in New Issue
Block a user