PlaceBucket.java 文件源码

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

项目:buildinggame 作者:
/**
    * Handles placement of water and lava buckets
    *
    * @param e an event representing a player emptying a bucket
    * @see PlayerBucketEmptyEvent
    * @since 2.1.0
    */
@EventHandler
public static void onBucketEmpty(PlayerBucketEmptyEvent e) {
    Player player = e.getPlayer();
       Arena arena = ArenaManager.getInstance().getArena(player);

       if (arena == null)
        return;

    Plot plot = arena.getPlot(player);

    if (plot.getGamePlayer(player).getGamePlayerType() == GamePlayerType.SPECTATOR) {
        MessageManager.getInstance().send(player, ChatColor.RED + "Spectators can't build");
        e.setCancelled(true);
        return;
    }

    if (!plot.getBoundary().isInside(e.getBlockClicked().getRelative(e.getBlockFace()).getLocation())) {
        e.setCancelled(true);
        MessageManager.getInstance().send(player, ChatColor.RED + "You can't place blocks outside your plot");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号