Skip to content

Commit

Permalink
fix (commands) permissoon usage is now effective
Browse files Browse the repository at this point in the history
EdouardCourty committed Dec 23, 2020
1 parent 301776f commit 0b604fe
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -50,7 +50,11 @@ public static void handle(EffectPlayerCommand effectPlayerCommand) throws Player
boolean isFeedingHimself = isSentByPlayer && player.getName().equals(sender.getName());

// The sender does not has the right permissions for what he's trying to do.
if (isSentByPlayer && ((!playerCanSelfFeed && isFeedingHimself) || (!playerCanFeedOthers && !isFeedingHimself))) {
if (
isSentByPlayer && // Server does not need permission to execute the command
((!playerCanSelfFeed && isFeedingHimself && needPermissionToFeedSelf) ||
(!playerCanFeedOthers && !isFeedingHimself && needPermissionToFeedOthers))
) {
throw new PlayerHasNoPermissionException();
}

Original file line number Diff line number Diff line change
@@ -46,7 +46,11 @@ public static void handle(EffectPlayerCommand effectPlayerCommand) throws Player
boolean isHealingHimself = isSentByPlayer && player.getName().equals(sender.getName());

// The sender does not has the right permissions for what he's trying to do.
if (isSentByPlayer && ((!playerCanSelfHeal && isHealingHimself) || (!playerCanHealOthers && !isHealingHimself))) {
if (
isSentByPlayer && // Server does not need permission to execute the command
((!playerCanSelfHeal && isHealingHimself && needPermissionToHealSelf) ||
(!playerCanHealOthers && !isHealingHimself && needPermissionToHealOthers))
) {
throw new PlayerHasNoPermissionException();
}

0 comments on commit 0b604fe

Please sign in to comment.