PlayerListener.java 文件源码

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

项目:NPlugins 作者:
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerPortalEnter(final PlayerPortalEvent event) {
    this.plugin.entering(this.getClass(), "onPlayerPortalEnter");

    final Location from = event.getFrom();
    final ChunkCoord coord = new ChunkCoord(from.getChunk());
    final Altar altar = this.plugin.getAltars().get(coord);
    if (altar != null) {
        this.plugin.debug("It's an Altar portal, cancel the event");
        final Location teleportLocation = altar.getCenterLocation().clone().toBukkitLocation().add(2.5, 1, 0.5);
        teleportLocation.setPitch(6f);
        teleportLocation.setYaw(90f);
        event.getPlayer().teleport(teleportLocation);
        event.setCancelled(true);
    }

    this.plugin.exiting(this.getClass(), "onPlayerPortalEnter");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号