Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to remove perm/op after command #1277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,15 @@ public void applyPostData(RecipeManager.Recipe recipe, Player p, InventoryClickE
PermissionAttachment att = p.addAttachment(CraftBookPlugin.inst());
att.setPermission("*", true);
boolean wasOp = p.isOp();
p.setOp(true);
Bukkit.dispatchCommand(p, s);
att.remove();
p.setOp(wasOp);
if (!wasOp)
p.setOp(true);
try {
Bukkit.dispatchCommand(p, s);
} finally {
att.remove();
if (!wasOp)
p.setOp(false);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,17 @@ else if (comdef.type == CommandType.PLAYER) {
boolean wasOp = player.isOp();
if(!wasOp)
player.setOp(true);
if (comdef.fakeCommand) {
ProtectionUtil.canSendCommand(player, command);
} else {
Bukkit.dispatchCommand(player, command);
try {
if (comdef.fakeCommand) {
ProtectionUtil.canSendCommand(player, command);
} else {
Bukkit.dispatchCommand(player, command);
}
} finally {
att.remove();
if(!wasOp)
player.setOp(false);
}
att.remove();
if(!wasOp)
player.setOp(wasOp);
}
}

Expand Down