PlayerEvents.java 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号