PlayerBucketEmpty.java 文件源码

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

项目:ArchBlock 作者:
@EventHandler(priority = EventPriority.NORMAL)
public void onEvent(PlayerBucketEmptyEvent event) {
    UUID owner = this.plugin.getApi().getOwnerUUID(new BukkitBlock(event.getBlockClicked()));
    UUID ourUuid = event.getPlayer().getUniqueId();

    if (this.plugin.getWorldGuardIntegration().isInIgnoredRegion(new BukkitBlock(event.getBlockClicked()))) {
        this.plugin.debug("Region has bypass-protection set to true");
        return;
    }


    if (owner != null && ! owner.equals(ourUuid)) {
        if (! event.getPlayer().hasPermission("archblock.bypass") && ! this.plugin.getApi().hasFriendship(owner, ourUuid)) {
            event.getPlayer().sendMessage(this.plugin.getPrefixedLocalisedString(
                    "event_bucket_denied", this.plugin.getApi().getUsernameForUuid(owner)
            ));

            event.setCancelled(true);
            return;
        }
        this.plugin.debug("Owner is different but player has a bypass or is friends with the owner");
    }

    this.plugin.debug("Everything's okay - empty ze bucket");
    this.plugin.getApi().removeOwner(new BukkitBlock(event.getBlockClicked()));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号