Skip to content

Commit

Permalink
feat: added bm.command.unmuteip.own & bm.command.unbanip.own permissions
Browse files Browse the repository at this point in the history
Part of #965
  • Loading branch information
confuser committed Mar 6, 2022
1 parent 2b9d5e0 commit 6a2b668
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public boolean onCommand(final CommonSender sender, CommandParser originalParser
IpBanData ban = getPlugin().getIpBanStorage().getBan(ip);
PlayerData actor = sender.getData();

if (!actor.getUUID().equals(ban.getActor().getUUID()) && !sender.hasPermission("bm.exempt.override.banip")
&& sender.hasPermission("bm.command.unbanip.own")) {
Message.get("unbanip.error.notOwn").set("ip", ipStr).sendTo(sender);
return;
}

boolean unbanned;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ public boolean onCommand(final CommonSender sender, CommandParser parser) {
}

IpMuteData mute = getPlugin().getIpMuteStorage().getMute(ip);

final PlayerData actor = sender.getData();

if (actor == null) return;
if (!actor.getUUID().equals(mute.getActor().getUUID()) && !sender.hasPermission("bm.exempt.override.muteip")
&& sender.hasPermission("bm.command.unmuteip.own")) {
Message.get("unmuteip.error.notOwn").set("ip", ipStr).sendTo(sender);
return;
}


boolean unmuted;

Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ messages:
notify: '&6[ip] has been unbanned by [actor]'
error:
noExists: '&c[ip] is not banned'
notOwn: '&c[ip] was not banned by you, unable to unban'

unbanipall:
notify: '&6[ip] will be unbanned by [actor]'
Expand Down

0 comments on commit 6a2b668

Please sign in to comment.