PlayerEvents.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:acidisland 作者:
/**
 * Prevents visitors from using commands on islands, like /spawner
 * @param e
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onVisitorCommand(final PlayerCommandPreprocessEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("Visitor command " + e.getEventName() + ": " + e.getMessage());
    }
    if (!IslandGuard.inWorld(e.getPlayer()) || e.getPlayer().isOp()
            || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
            || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getPlayer().getLocation())) {
        //plugin.getLogger().info("player is not in world or op etc.");
        return;
    }
    // Check banned commands
    //plugin.getLogger().info(Settings.visitorCommandBlockList.toString());
    String[] args = e.getMessage().substring(1).toLowerCase().split(" ");
    if (Settings.visitorCommandBlockList.contains(args[0])) {
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号