Only show silent punishments to staff (#68)

This commit is contained in:
cswhite2000 2018-01-08 19:44:11 -08:00 committed by GitHub
parent 1276a6d578
commit 7b32649e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -123,7 +123,11 @@ public class PunishmentEnforcer implements Enableable, MessageListener {
public boolean viewable(CommandSender sender, Punishment punishment, boolean announced) {
if(viewByIdentity(sender, punishment)) {
if(announced) {
return viewByType(sender, punishment) && viewBySetting(sender, punishment) && viewByIdentity(sender, punishment) && viewByRecord(sender, punishment);
return viewByType(sender, punishment)
&& viewBySetting(sender, punishment)
&& viewByIdentity(sender, punishment)
&& viewByRecord(sender, punishment)
&& viewBySilent(sender, punishment);
} else {
return viewByLookup(sender, punishment);
}
@ -171,4 +175,7 @@ public class PunishmentEnforcer implements Enableable, MessageListener {
return sender.hasPermission(punishment.stale() ? LOOK_UP_STALE : LOOK_UP);
}
private boolean viewBySilent(CommandSender sender, Punishment punishment) {
return !punishment.silent() || sender.hasPermission(Permissions.STAFF);
}
}