PlayerEvents_1_8.java 文件源码

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

项目:PlotSquared-Chinese 作者:
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInteract(final PlayerInteractAtEntityEvent e) {
    Entity entity = e.getRightClicked();
    if (!(entity instanceof ArmorStand)) {
        return;
    }
    final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
    String world = l.getWorld();
    if (!PlotSquared.isPlotWorld(world)) {
        return;
    }
    Plot plot = MainUtil.getPlot(l);
    PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
    if (plot == null) {
        if (!MainUtil.isPlotArea(l)) {
            return;
        }
        if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
            MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
            e.setCancelled(true);
        }
    }
    else {
        if (!plot.hasOwner()) {
            if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
                MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
                e.setCancelled(true);
            }
        }
        else {
            final UUID uuid = pp.getUUID();
            if (!plot.isAdded(uuid)) {
                if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
                    e.setCancelled(true);
                }
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号