java类org.bukkit.event.player.PlayerArmorStandManipulateEvent的实例源码

ArmorStandListener.java 文件源码 项目:CloudNet 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void handle(PlayerArmorStandManipulateEvent e)
{
    MobSelector.MobImpl mob = CollectionWrapper.filter(MobSelector.getInstance().getMobs().values(), new Acceptable<MobSelector.MobImpl>() {
        @Override
        public boolean isAccepted(MobSelector.MobImpl value)
        {
            try
            {
                return e.getRightClicked().getEntityId() == (int) value.getDisplayMessage().getClass().getMethod("getEntityId").invoke(value.getDisplayMessage());
            } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e1)
            {
                return false;
            }
        }
    });
    if (mob != null)
    {
        e.setCancelled(true);
    }
}
EntityClick_Listener.java 文件源码 项目:Achtbaan 阅读 22 收藏 0 点赞 0 评论 0
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
    if(e.getRightClicked() instanceof ArmorStand){
        ArmorStand clickedA = (ArmorStand) e.getRightClicked();
        if(clickedA.getPassenger() == null){
            ArrayList<Location> all_main_seats = new ArrayList<Location>();
            for(attractie att : Main.r.Attracties.values()){
                for(ArmorStand a : att.getMainSeats())
                {
                    all_main_seats.add(a.getLocation());
                }
            }
            if(all_main_seats.contains(clickedA.getLocation())){
                e.setCancelled(true);
            }
        }
    }
}
BuildEventListener.java 文件源码 项目:KingdomFactions 阅读 20 收藏 0 点赞 0 评论 0
@EventHandler
public void onArmorStandManupulation(PlayerArmorStandManipulateEvent e) {
    KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
    if(p.isVanished()) return;
    if(e.isCancelled()) return;
    if(e.getRightClicked() == null) return;
    if(!p.canBuild(e.getRightClicked().getLocation())) {
        e.setCancelled(!ProtectionModule.getInstance().tryInfluence(p, 200));
    } 
}
EntityClick_Listener.java 文件源码 项目:Achtbaan 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
    if(e.getRightClicked() instanceof ArmorStand){
        ArmorStand clickedA = (ArmorStand) e.getRightClicked();
        if(clickedA.getPassenger() == null){
            ArrayList<ArmorStand> all_main_seats = new ArrayList<ArmorStand>();
            for(Rollercoaster att : Main.r.Attracties.values()){
                all_main_seats.addAll(att.getMainSeats());
            }
            if(all_main_seats.contains(clickedA)){
                e.setCancelled(true);
            }
        }
    }
}
EntityClick_Listener.java 文件源码 项目:Achtbaan 阅读 22 收藏 0 点赞 0 评论 0
@EventHandler
public void ArmorStandGreef(PlayerArmorStandManipulateEvent e){
    if(e.getRightClicked() instanceof ArmorStand){
        ArmorStand clickedA = (ArmorStand) e.getRightClicked();
        if(clickedA.getPassenger() == null){
            ArrayList<ArmorStand> all_main_seats = new ArrayList<ArmorStand>();
            for(attractie att : Main.r.Attracties.values()){
                all_main_seats.addAll(att.getMainSeats());
            }
            if(all_main_seats.contains(clickedA)){
                e.setCancelled(true);
            }
        }
    }
}
ShopInteractListener.java 文件源码 项目:ShopChest 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler(ignoreCancelled = true)
public void onPlayerManipulateArmorStand(PlayerArmorStandManipulateEvent e) {
    // When clicking an armor stand with an armor item, the armor stand will take it.
    // As a hologram consists of armor stands, they would also take the item.
    ArmorStand armorStand = e.getRightClicked();
    if (Hologram.isPartOfHologram(armorStand)) {
        e.setCancelled(true);
    }
}
RegionInteractListener.java 文件源码 项目:NovaGuilds 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Handles editing items on an ArmorStand
 *
 * @param event The event
 */
@EventHandler
public void onPlayerManipulateArmorStand(PlayerArmorStandManipulateEvent event) {
    Player player = event.getPlayer();
    NovaPlayer nPlayer = PlayerManager.getPlayer(player);
    Location location = event.getRightClicked().getLocation();

    if(RegionManager.get(location) != null
            && (!plugin.getRegionManager().canInteract(player, location) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.INTERACT)))) {
        event.setCancelled(true);
        Message.CHAT_REGION_DENY_INTERACT.send(player);
    }
}
BukkitPlotListener.java 文件源码 项目:PlotMe-Core 阅读 22 收藏 0 点赞 0 评论 0
@EventHandler
public void onArmorStand(PlayerArmorStandManipulateEvent event) {
    Location location = BukkitUtil.adapt(event.getRightClicked().getLocation());

    if (manager.isPlotWorld(location)) {
        if (event.getPlayer().hasPermission(PermissionNames.ADMIN_BUILDANYWHERE)) {
            return;
        }

        Plot plot = manager.getPlot(location);

        if (plot == null) {
            event.getPlayer().sendMessage(api.C("CannotBuild"));
            event.setCancelled(true);
        } else {
            if (plot.getOwnerId().equals(event.getPlayer().getUniqueId())) {
                return;
            }
            Optional<Plot.AccessLevel> member = plot.isMember(event.getPlayer().getUniqueId());
            if (member.isPresent()) {
                if (member.get().equals(Plot.AccessLevel.TRUSTED) && !api.getServerBridge().getOfflinePlayer(plot.getOwnerId()).isOnline()) {
                    event.getPlayer().sendMessage(api.C("CannotBuild"));
                    event.setCancelled(true);
                } else if (api.isPlotLocked(plot.getId())) {
                    event.getPlayer().sendMessage(api.C("PlotLocked"));
                    event.setCancelled(true);
                }
            } else {
                event.getPlayer().sendMessage(api.C("CannotBuild"));
                event.setCancelled(true);
            }
        }
    }
}
EntityProtectionBreakListener.java 文件源码 项目:CraftoPlugin 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler
public void onArmorStandManip(final PlayerArmorStandManipulateEvent event) {
    debug("PlayerArmorStandManipulateEvent(" + event.getPlayer().getName() + ", " + event.getRightClicked().getType() + ", "
            + event.getArmorStandItem().getType() + ", " + event.getPlayerItem() + ")");

    final ArmorStand entity = event.getRightClicked();
    if (!canInteract(entity, event.getPlayer())) { debug("CANCELLED!"); event.setCancelled(true); }
    else { debug("ALLOWED!"); }
}
EntityArmorStand.java 文件源码 项目:SpigotSource 阅读 70 收藏 0 点赞 0 评论 0
private void a(EntityHuman entityhuman, EnumItemSlot enumitemslot, @Nullable ItemStack itemstack, EnumHand enumhand) {
    ItemStack itemstack1 = this.getEquipment(enumitemslot);

    if (itemstack1 == null || (this.bA & 1 << enumitemslot.c() + 8) == 0) {
        if (itemstack1 != null || (this.bA & 1 << enumitemslot.c() + 16) == 0) {
            ItemStack itemstack2;
            // CraftBukkit start
            org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
            org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack);

            Player player = (Player) entityhuman.getBukkitEntity();
            ArmorStand self = (ArmorStand) this.getBukkitEntity();

            EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
            PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
            this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);

            if (armorStandManipulateEvent.isCancelled()) {
                return;
            }
            // CraftBukkit end

            if (entityhuman.abilities.canInstantlyBuild && (itemstack1 == null || itemstack1.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack != null) {
                itemstack2 = itemstack.cloneItemStack();
                itemstack2.count = 1;
                this.setSlot(enumitemslot, itemstack2);
            } else if (itemstack != null && itemstack.count > 1) {
                if (itemstack1 == null) {
                    itemstack2 = itemstack.cloneItemStack();
                    itemstack2.count = 1;
                    this.setSlot(enumitemslot, itemstack2);
                    --itemstack.count;
                }
            } else {
                this.setSlot(enumitemslot, itemstack);
                entityhuman.a(enumhand, itemstack1);
            }
        }
    }
}
EnvironmentManager.java 文件源码 项目:ZentrelaRPG 阅读 37 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
    event.setCancelled(true);
}
Freeze.java 文件源码 项目:Arcadia-Spigot 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void onEntityManipulate(PlayerArmorStandManipulateEvent event) {
    if(event.getRightClicked().getUniqueId() == entity.getUniqueId())
        event.setCancelled(true);
}
EventFilterMatchModule.java 文件源码 项目:ProjectAres 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onArmorStandInteract(final PlayerArmorStandManipulateEvent event) {
    cancelUnlessInteracting(event, event.getPlayer());
}
EntityEditionListener.java 文件源码 项目:Hub 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler
public void onArmorStandEdit(PlayerArmorStandManipulateEvent event)
{
    if (!this.canDoAction(event.getPlayer()))
        event.setCancelled(true);
}
EntityProtectionListener.java 文件源码 项目:FactionsXL 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
    forbidIfInProtectedTerritory(event.getPlayer(), event.getRightClicked(), event, EQUIP);
}
ArmorStands.java 文件源码 项目:Kineticraft 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler(ignoreCancelled = true)
public void onArmorStand(PlayerArmorStandManipulateEvent evt) {
    evt.setCancelled(MetadataManager.hasMetadata(evt.getRightClicked(), "noModify"));
}
ClaimAnimation.java 文件源码 项目:GhostScavengerHunt 阅读 21 收藏 0 点赞 0 评论 0
@EventHandler
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
    if(event.getRightClicked().getUniqueId() == armorStand.getUniqueId())
        event.setCancelled(true);
}
SoundMuffler.java 文件源码 项目:SoundMuffler 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler
public void on(PlayerArmorStandManipulateEvent event) {
    if ("SoundMuffler".equals(event.getRightClicked().getCustomName())) {
        event.setCancelled(true);
    }
}
LotsListener.java 文件源码 项目:Peacecraft 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
    this.onPlayerInteractEntity(event);
}


问题


面经


文章

微信
公众号

扫码关注公众号