/**
* Prevents players from using commands like /spawner
* @param e
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerCommand(final PlayerCommandPreprocessEvent e) {
if (DEBUG) {
plugin.getLogger().info("Player command " + e.getEventName() + ": " + e.getMessage());
}
if (e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bannedcommands")) {
return;
}
// Check world
if (!inASkyGridWorld(e.getPlayer().getWorld())) {
return;
}
// Check banned commands
//plugin.getLogger().info(Settings.visitorCommandBlockList.toString());
String[] args = e.getMessage().substring(1).toLowerCase().split(" ");
if (Settings.bannedCommandList.contains(args[0])) {
e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).errorNoPermission);
e.setCancelled(true);
}
}
PlayerEvents.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:askygrid
作者:
评论列表
文章目录