IslandGuard.java 文件源码

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

项目:bskyblock 作者:
@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (Util.inWorld(e.getPlayer())) {
        // This permission bypasses protection
        if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        Island island = plugin.getIslands().getProtectedIslandAt(e.getBlockClicked().getLocation());
        if (island != null) {
            if (island.getMembers().contains(e.getPlayer().getUniqueId())) {
                return;
            }
            if (island.getFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
                return;
            }
            if (island.getFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
                return;
            }
            if (island.getFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
                return;
            }
            if (island.getFlag(SettingsFlag.BUCKET)) {
                return;
            }
        } else {
            // Null
            if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) {
                return;
            }
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号