PlayerEvents.java 文件源码

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

项目:acidisland 作者:
/**
 * Prevents teleporting when falling based on setting by stopping commands
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerCommandPreprocessEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!IslandGuard.inWorld(e.getPlayer()) || Settings.allowTeleportWhenFalling || e.getPlayer().isOp()
            || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)
            || plugin.getPlayers().isInTeleport(e.getPlayer().getUniqueId())) {
        return;
    }
    // Check commands
    // plugin.getLogger().info("DEBUG: falling command: '" +
    // e.getMessage().substring(1).toLowerCase() + "'");
    if (isFalling(e.getPlayer().getUniqueId()) && (Settings.fallingCommandBlockList.contains("*") || Settings.fallingCommandBlockList.contains(e.getMessage().substring(1).toLowerCase()))) {
        // Sorry you are going to die
        Util.sendMessage(e.getPlayer(), plugin.myLocale(e.getPlayer().getUniqueId()).errorNoPermission); 
        Util.sendMessage(e.getPlayer(), plugin.myLocale(e.getPlayer().getUniqueId()).islandcannotTeleport);
        e.setCancelled(true);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号