Java Code Examples for org.bukkit.event.player.PlayerArmorStandManipulateEvent#setCancelled()
The following examples show how to use
org.bukkit.event.player.PlayerArmorStandManipulateEvent#setCancelled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArmorStandListener.java From CloudNet with Apache License 2.0 | 6 votes |
@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() .getUniqueId() .equals(value.getDisplayMessage() .getClass() .getMethod("getUniqueId") .invoke(value.getDisplayMessage())); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e1) { return false; } } }); if (mob != null) { e.setCancelled(true); } }
Example 2
Source File: LWCPlayerListener.java From Modern-LWC with MIT License | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent e) { Entity entity = e.getRightClicked(); if (plugin.getLWC().isProtectable(e.getRightClicked().getType())) { int A = 50000 + entity.getUniqueId().hashCode(); LWC lwc = LWC.getInstance(); Protection protection = lwc.getPhysicalDatabase().loadProtection(entity.getWorld().getName(), A, A, A); Player p = e.getPlayer(); boolean canAccess = lwc.canAccessProtection(p, protection); if (onPlayerEntityInteract(p, entity, e.isCancelled())) { e.setCancelled(true); } if (protection != null) { if (canAccess) return; e.setCancelled(true); } } }
Example 3
Source File: DisplayProtectionListener.java From QuickShop-Reremake with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void player(PlayerArmorStandManipulateEvent event) { if (!DisplayItem.checkIsGuardItemStack(event.getArmorStandItem())) { return; } if (DisplayItem.getNowUsing() != DisplayType.REALITEM) { return; } event.setCancelled(true); Util.inventoryCheck(event.getPlayer().getInventory()); sendAlert( "[DisplayGuard] Player " + event.getPlayer().getName() + " trying mainipulate armorstand contains displayItem."); }
Example 4
Source File: RegionInteractListener.java From NovaGuilds with GNU General Public License v3.0 | 5 votes |
/** * 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); } }
Example 5
Source File: QuestItemHandler.java From BetonQuest with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onArmorStandEquip(final PlayerArmorStandManipulateEvent event) { if (event.getPlayer().getGameMode() == GameMode.CREATIVE) { return; } final ItemStack item = event.getPlayerItem(); final String playerID = PlayerConverter.getID(event.getPlayer()); if (item != null && (Journal.isJournal(playerID, item) || Utils.isQuestItem(item))) { event.setCancelled(true); } }
Example 6
Source File: BukkitPlotListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@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); } } } }