forked from kaboomserver/extras
Attempt to catch broken command blocks
This commit is contained in:
parent
3a0946054d
commit
1e4a8b4fdb
1 changed files with 11 additions and 0 deletions
|
@ -21,6 +21,8 @@ import org.bukkit.block.BlockFace;
|
|||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.data.Levelled;
|
||||
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -633,6 +635,15 @@ class Events implements Listener {
|
|||
final String[] arr = event.getCommand().split(" ");
|
||||
final String command = event.getCommand();
|
||||
|
||||
if (event.getSender() instanceof BlockCommandSender) {
|
||||
try {
|
||||
((BlockCommandSender)event.getSender()).getBlock().getState();
|
||||
} catch (Exception exception) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) {
|
||||
event.setCancelled(true);
|
||||
} else if (("minecraft:gamerule".equals(arr[0].toLowerCase()) ||
|
||||
|
|
Loading…
Reference in a new issue