diff --git a/common/src/main/java/me/confuser/banmanager/common/commands/UnbanIpCommand.java b/common/src/main/java/me/confuser/banmanager/common/commands/UnbanIpCommand.java index 3e45e236..1018071f 100644 --- a/common/src/main/java/me/confuser/banmanager/common/commands/UnbanIpCommand.java +++ b/common/src/main/java/me/confuser/banmanager/common/commands/UnbanIpCommand.java @@ -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 { diff --git a/common/src/main/java/me/confuser/banmanager/common/commands/UnmuteIpCommand.java b/common/src/main/java/me/confuser/banmanager/common/commands/UnmuteIpCommand.java index 6aa255e5..5bb9aa59 100644 --- a/common/src/main/java/me/confuser/banmanager/common/commands/UnmuteIpCommand.java +++ b/common/src/main/java/me/confuser/banmanager/common/commands/UnmuteIpCommand.java @@ -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; diff --git a/common/src/main/resources/messages.yml b/common/src/main/resources/messages.yml index 011775a1..5e2ce1af 100644 --- a/common/src/main/resources/messages.yml +++ b/common/src/main/resources/messages.yml @@ -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]'