fix: 修复指令执行时可能导致的权限问题
This commit is contained in:
@@ -14,7 +14,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -391,7 +390,6 @@ public final class CoreBukkitUtils {
|
||||
command = PlaceholderAPI.setPlaceholders(player, command);
|
||||
}
|
||||
String[] split = command.split(":", 2);
|
||||
try {
|
||||
switch (split[0]) {
|
||||
case "player": {
|
||||
Bukkit.dispatchCommand(player, split[1]);
|
||||
@@ -404,8 +402,11 @@ public final class CoreBukkitUtils {
|
||||
case "op": {
|
||||
boolean op = player.isOp();
|
||||
player.setOp(true);
|
||||
try {
|
||||
Bukkit.dispatchCommand(player, split[1]);
|
||||
} finally {
|
||||
player.setOp(op);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -413,9 +414,6 @@ public final class CoreBukkitUtils {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (CommandException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
Reference in New Issue
Block a user