PlayerEvents.java 文件源码

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

项目:askygrid 作者:
/**
    * Places player back at their home on the grid if the setting is true
    * @param e
    */
   @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
   public void onPlayerRespawn(final PlayerRespawnEvent e) {
if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
}
if (!Settings.respawnAtHome) {
    return;
}
if (respawn.contains(e.getPlayer().getUniqueId())) {
    if (DEBUG)
    plugin.getLogger().info("DEBUG: found player to respawn");
    respawn.remove(e.getPlayer().getUniqueId());
    Location respawnLocation = plugin.getGrid().getSafeHomeLocation(e.getPlayer().getUniqueId(), 1);
    if (respawnLocation != null) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: Setting respawn location to " + respawnLocation);
    e.setRespawnLocation(respawnLocation);
    }
}
   }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号