@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVisitorDrop(final PlayerDropItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!Util.inWorld(e.getPlayer())) { return; } Island island = plugin.getIslands().getIslandAt(e.getItemDrop().getLocation()); if ((island != null && island.getFlag(SettingsFlag.ITEM_DROP)) || e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getIslands().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) { return; } Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected")); e.setCancelled(true); }
@EventHandler public void onCraft(PlayerDropItemEvent e) { //e.getPlayer().sendMessage(e.getItemDrop().getItemStack().toString()); /*for (CustomCraftingRecipe r : recipes) { //if (r.ncon.equals("ground")) { ArrayList<Item> items = new ArrayList<Item>(); items.add(e.getItemDrop()); for (Entity it : e.getItemDrop().getNearbyEntities(5, 5, 5)) { if (it instanceof Item) { items.add((Item) it); } } e.getPlayer().sendMessage(String.valueOf(items.size())); //} }*/ }
@EventHandler public void onPlayerDropItem(PlayerDropItemEvent event) { if(this.ignoreNextDropEvent) { this.ignoreNextDropEvent = false; } else { // If the ignore flag is clear, this drop was caused by something other than // an inventory click (e.g. drop key, death, etc), so an event has not yet been fired int initialQuantity = event.getItemDrop().getItemStack().getAmount(); ItemStack stack = event.getItemDrop().getItemStack(); PlayerItemTransferEvent transferEvent = new PlayerItemTransferEvent(event, ItemTransferEvent.Type.DROP, event.getPlayer(), Optional.of(new InventorySlot(event.getPlayer().getInventory())), Optional.empty(), stack, event.getItemDrop(), initialQuantity, event.getPlayer().getOpenInventory().getCursor()); this.callEvent(transferEvent); if(!transferEvent.isCancelled() && transferEvent.getQuantity() < initialQuantity) { int diff = initialQuantity - transferEvent.getQuantity(); stack.setAmount(stack.getAmount() - diff); stack = stack.clone(); stack.setAmount(diff); event.getPlayer().getInventory().addItem(stack); } } }
@EventHandler public void on(PlayerDropItemEvent event) { ItemStack item = event.getItemDrop().getItemStack(); if (item == null) { return; } if (!item.hasItemMeta() || !item.getItemMeta().hasDisplayName()) { return; } String name = item.getItemMeta().getDisplayName(); if (name.equals("§4§lBlocked Slot")) { event.setCancelled(true); } }
@EventHandler public void onDrop(PlayerDropItemEvent e) { Player p = e.getPlayer(); if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Disable")) { if (!ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.World.All_World")) { if (WorldUtils.getWItemDrop().contains(p.getWorld().getName())) { if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Bypass")) { if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.drop")) { e.setCancelled(true); } } else { e.setCancelled(true); } } } else { if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Bypass")) { if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.drop")) { e.setCancelled(true); } } else { e.setCancelled(true); } } } }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) void onPlayerDropItem(PlayerDropItemEvent event) { Player player = event.getPlayer(); if(!player.isSneaking() && PhantomAdmin.instance.isInvisible(player)) { event.setCancelled(true); PlayerData data = PlayerData.FromPlayer(player); if(!data.gotItemDropInfo) { PhantomAdmin.sendMessage(player, TextMode.Warn, Messages.NoItemDropWhileInvisible); data.gotItemDropInfo = true; } return; } }
@EventHandler public void onItemDrop(PlayerDropItemEvent event) { System.out.println("Item drop"); Item item = event.getItemDrop(); ItemStack stack = item.getItemStack(); Location location = item.getLocation(); Player player = event.getPlayer(); String playerName = player == null ? "null" : player.getName(); DropItemObsel obsel = new DropItemObsel( new Date().getTime(), stack.getType().toString(), stack.getAmount(), stack.getData().getData(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getWorld().getName(), playerName); JSONObselManager.getInstance().addObsel(obsel); }
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true) public void StopDrops(PlayerDropItemEvent event) { Player player = event.getPlayer(); Item item = event.getItemDrop(); if(item != null) { ItemStack stack = item.getItemStack(); if(stack != null) { if(KitUtils.isSoulbound(stack)) { player.playSound(player.getLocation(), Sound.BLAZE_HIT, 1.0F, 0.3F); event.getItemDrop().remove(); } } } }
public static void load(CSCoreLib plugin) { if (ReflectionUtils.getVersion().startsWith("v1_9_")) { plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin); } else if (ReflectionUtils.getVersion().startsWith("v1_10_")) { plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin); } else if (ReflectionUtils.getVersion().startsWith("v1_11_")) { plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin); } else if (ReflectionUtils.getVersion().startsWith("v1_12_")) { plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin); } plugin.getServer().getPluginManager().registerEvents(new Listener() { @EventHandler public void onDrop(PlayerDropItemEvent e) { if (opening.contains(e.getPlayer().getUniqueId())) e.setCancelled(true); } }, plugin); }
@EventHandler public void onInventoryChange(PlayerDropItemEvent e) { if (this.participants == null) { return; } if (state) { return; } if (!e.isCancelled() && e.getItemDrop().getItemStack().getType() == itemType) { for (QuestPlayer qp : participants.getParticipants()) { if (qp.getPlayer().getUniqueId().equals(e.getPlayer().getUniqueId())) { final Requirement req = this; Bukkit.getScheduler().runTaskLater(QuestManagerPlugin.questManagerPlugin, req::update, 1); } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerDrop(final PlayerDropItemEvent event) { final PlayerStat stat = PlayerStat.ITEMS_DROPPED; // Get player final Player player = event.getPlayer(); // Do general check if (!plugin.doGeneralCheck(player, stat)) return; // Update value to new stat. plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid", player.getUniqueId().toString(), "value", event.getItemDrop().getItemStack().getAmount(), "world", player.getWorld().getName(), "item", event.getItemDrop().getItemStack().getType().toString())); }
public void coinCheck(PlayerDropItemEvent event){ int LocationX = event.getItemDrop().getLocation().getBlockX(); if (coinDropper.equalsIgnoreCase(event.getPlayer().getDisplayName()) && (LocationX == coinLocationX)){ Location pitDropModifier = new Location(worldPit,pit.getBlockX(),pit.getBlockY()+3,pit.getBlockZ()); Location Fireworks = new Location(worldPit,pit.getBlockX(),pit.getBlockY()+6,pit.getBlockZ()); ItemStack Diamonds = new ItemStack(Material.DIAMOND); Diamonds.setAmount(40); int RandomProbability = (int)(Math.random()*100); if (RandomProbability<50){ event.getPlayer().sendMessage("§6"+LuckyBlocksMainController.instance.language.getString("LUCKY_THIS_TIME")); worldPit.dropItemNaturally(pitDropModifier,Diamonds); for (int i=0;i<5;i++) homeFireworks(Fireworks,worldPit);} else{ TNTPrimed TNT = (TNTPrimed) event.getPlayer().getWorld().spawnEntity(pitDropModifier,EntityType.PRIMED_TNT); TNT.setYield(50); TNT.setFuseTicks(10); } event.getItemDrop().remove(); } else{ event.getPlayer().sendMessage(LuckyBlocksMainController.instance.language.getString("DROP_IT_CLOSER")); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerDropItem(PlayerDropItemEvent event) { if (!event.isCancelled() && TeamUtils.getTeamByPlayer(event.getPlayer()) != null && event.getItemDrop().getItemStack().getType().equals(Material.WOOL)) { for (TeamModule team : TeamUtils.getTeams()) { if (!team.isObserver() && TeamUtils.getTeamByPlayer(event.getPlayer()) != team) { for (GameObjective obj : TeamUtils.getShownObjectives(team)) { if (obj instanceof WoolObjective && event.getItemDrop().getItemStack().getData().getData() == ((WoolObjective) obj).getColor().getData()) { if (!items.containsKey(event.getPlayer())) { items.put(event.getPlayer(), new ArrayList<Item>()); } List<Item> list = items.get(event.getPlayer()); list.add(event.getItemDrop()); items.put(event.getPlayer(), list); } } } } } }
@EventHandler public void onPlayerDropItem(PlayerDropItemEvent e) { Player p = e.getPlayer(); if (e.getItemDrop().getItemStack().getItemMeta().hasLore()) { if (e.getItemDrop().getItemStack().getItemMeta().getLore().get(0) .equals("Fury") || e.getItemDrop().getItemStack().getItemMeta().getLore() .get(0).equals("Sheild") || e.getItemDrop().getItemStack().getItemMeta().getLore() .get(0).equals("Sprint") || e.getItemDrop().getItemStack().getItemMeta().getLore() .get(0).equals("Regen")) { e.setCancelled(true); p.sendMessage(ChatColor.DARK_RED + "You can't drop this item!"); } } }
@EventHandler public void onDrop(PlayerDropItemEvent die) { Player p = die.getPlayer(); Game g = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(p); if (g == null) { return; } if (g.getState() != GameState.WAITING) { if (g.isSpectator(p)) { die.setCancelled(true); } return; } die.setCancelled(true); }
@EventHandler public void onDrop(PlayerDropItemEvent event) { Player p = event.getPlayer(); Game g = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(p); if (g == null) { return; } if (g.getState() == GameState.RUNNING && event.getItemDrop().getItemStack().getItemMeta().getDisplayName() != null && event.getItemDrop().getItemStack().getItemMeta().getDisplayName() .equals(BedwarsRel._l("ingame.specials.warp-powder.cancel"))) { event.setCancelled(true); } }
@EventHandler public void onDropItem(PlayerDropItemEvent e) { if (Main.WaitingPlayers.contains(e.getPlayer()) || Main.PlayingPlayers.contains(e.getPlayer())) { if (!(e.getPlayer().hasPermission("cod.dropitem"))) { e.setCancelled(true); } } if (CreateArenaCommand.creatingArena.get(e.getPlayer()) == true) { e.setCancelled(true); } if (CreateGunCommand.gunBuilder.get(e.getPlayer()) == true) { if (CreateGunCommand.gunBuilderStep.get(e.getPlayer()) >= 7) { e.setCancelled(true); return; } } }
@EventHandler(ignoreCancelled = true) public void onItemDrop(PlayerDropItemEvent event) { if (!cratesPlus.getConfigHandler().isDisableKeySwapping()) return; String title; ItemStack item = event.getItemDrop().getItemStack(); for (Map.Entry<String, Crate> crate : cratesPlus.getConfigHandler().getCrates().entrySet()) { if (!(crate.getValue() instanceof KeyCrate)) { continue; } KeyCrate keyCrate = (KeyCrate) crate.getValue(); Key key = keyCrate.getKey(); if (key == null) continue; title = key.getName(); if (item.hasItemMeta() && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains(title)) { event.getPlayer().sendMessage(cratesPlus.getPluginPrefix() + cratesPlus.getMessageHandler().getMessage("Cant Drop", event.getPlayer(), crate.getValue(), null)); event.setCancelled(true); return; } } }
@EventHandler(priority = EventPriority.HIGHEST) public void onDropEvent(PlayerDropItemEvent event) { if (event.isCancelled() || event.getPlayer() == null) { return; } Player player = event.getPlayer(); if (!plugin.isSkyWorld(player.getWorld())) { return; } if (!visitorsCanDrop && !plugin.playerIsOnIsland(player) && !plugin.playerIsInSpawn(player)) { event.setCancelled(true); plugin.notifyPlayer(player, tr("\u00a7eVisitors can't drop items!")); return; } addDropInfo(player, event.getItemDrop().getItemStack()); }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVisitorDrop(final PlayerDropItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } Island island = plugin.getGrid().getIslandAt(e.getItemDrop().getLocation()); if ((island != null && island.getIgsFlag(SettingsFlag.VISITOR_ITEM_DROP)) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) { return; } Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected); e.setCancelled(true); }
/** * On player drop item. * * @param event * the event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerDropItem(PlayerDropItemEvent event) { Player player = event.getPlayer(); IPlayerConfEntry entry = playerConf.get(player); if (entry != null && !entry.isAdminMod()) { IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea( player.getLocation()); if (!checkPermission(land, event.getPlayer(), PermissionList.DROP.getPermissionType())) { messagePermission(player); event.setCancelled(true); } } }
/** * Checks if player has proper permission to drop items. * * @param event that triggers listener. */ @EventHandler(priority = EventPriority.LOW) private void DropItem(PlayerDropItemEvent event) { Player player = event.getPlayer(); // Drop item check. if (player != null && !player.hasPermission("antibuild.bypass")) { if (!player.hasPermission("antibuild.dropitems")) { event.setCancelled(true); PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoDropItemsMessage(), player); } } // // World Check // if (!event.isCancelled() && plugin.isUsingLock()) { // if (plugin.isLockedWorld(player.getWorld().getName()) // && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock // .bypass" + // "." + player.getWorld().getName())) { // event.setCancelled(true); // messageHandler(plugin.getLockedWorldMessage(), player); // } // } }
@EventHandler public void onDrop(PlayerDropItemEvent event) { BytecraftPlayer player = plugin.getPlayer(event.getPlayer()); Location loc = player.getLocation(); ZoneWorld world = plugin.getWorld(loc.getWorld()); Zone zone = world.findZone(loc); if(zone == null)return; if(zone.hasFlag(Flag.CREATIVE)){ event.setCancelled(true); player.sendMessage(ChatColor.RED + "You can't drop items in a creative zone."); } }
@EventHandler(priority=EventPriority.HIGHEST) private void onPlayerDropItem(PlayerDropItemEvent event) { IArenaPlayer player = ArenaPlayer.get(event.getPlayer()); if (player == null) return; IArena arena = player.getArena(); if (arena == null) return; IContextSettings settings = player.getContextSettings(); if (settings == null) return; if (settings.isSharingEnabled()) return; event.setCancelled(true); }
@EventHandler public void onItemDrop(PlayerDropItemEvent event) { RacerHandler racerHandler = plugin.getRacerHandler(); Racer racer = racerHandler.getRacer(event.getPlayer()); for (Powerup powerup : plugin.getPowerupsRegistry().getPowerups()) { if (powerup.getItem().getType() == event.getItemDrop().getItemStack().getType() && powerup.getItem().getDurability() == event.getItemDrop().getItemStack().getDurability() && !racer.inventoryIsSpinning()) { powerup.doOnDrop(racerHandler.getRacer(event.getPlayer()), event.getItemDrop()); if (powerup.cancelledEvents().contains(Powerup.ActionType.DROP) || powerup.cancelledEvents().contains(Powerup.ActionType.ALL)) { event.setCancelled(true); } else { event.getItemDrop().setMetadata("whoDropped", new FixedMetadataValue(plugin, event.getPlayer().getUniqueId().toString())); } return; } else if (racer.inventoryIsSpinning()) { event.setCancelled(true); } } }
@EventHandler(priority = EventPriority.HIGHEST) public void onDrop(final PlayerDropItemEvent event) { final ItemStack stack = event.getItemDrop().getItemStack(); final String world = WorldFinder.getWorld(event.getPlayer(), WorldVariant.BALANCE); Optional<TNECurrency> currency = TNE.manager().currencyManager().currencyFromItem(world, stack); currency.ifPresent((cur)->{ UUID id = IDFinder.getID(event.getPlayer()); TNE.saveManager().addSkip(id); Bukkit.getScheduler().runTaskLaterAsynchronously(TNE.instance(), new Runnable() { @Override public void run() { TNEAccount account = TNE.manager().getAccount(id); account.setHoldings(world, cur.name(), ItemCalculations.getCurrencyItems(account, cur)); TNE.manager().addAccount(account); TNE.saveManager().removeSkip(id); } }, 5L); }); }
@EventHandler public void onPlayerDropItemStack(PlayerDropItemEvent event) { if (Utils.getRod(event.getItemDrop().getItemStack()) != null && event.getItemDrop().getItemStack().getAmount() > 1) { ItemStack top = new ItemStack(event.getItemDrop().getItemStack()); ItemStack bottom = new ItemStack(event.getItemDrop().getItemStack()); top.setAmount(1); bottom.setAmount(bottom.getAmount() - 1); Rod.setUses(bottom, Utils.getRod(bottom).getUses()); Vector vect = event.getItemDrop().getVelocity(); int ticks = event.getItemDrop().getTicksLived(); event.getItemDrop().remove(); Item topItem = event.getItemDrop().getWorld().dropItem(event.getItemDrop().getLocation(), top); Item botItem = event.getItemDrop().getWorld().dropItem(event.getItemDrop().getLocation(), bottom); topItem.setVelocity(vect); botItem.setVelocity(vect); topItem.setTicksLived(ticks); botItem.setTicksLived(ticks); } }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerDropItem(PlayerDropItemEvent event) { Player pl = event.getPlayer(); if (pl != null) { if (plugin.isInArena(pl)) { if (plugin.getArena(pl).type.equals("Hunger")) { event.setCancelled(false); } else { event.setCancelled(true); } } } }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerDropItem(final PlayerDropItemEvent event) { final Player user = event.getPlayer(); final ItemStack item = event.getItemDrop().getItemStack(); if (antib.getSettings().getData().isDisableUse() && !Permissions.BUILD.isAuthorized(user)) { return; } { if (!Permissions.DROP.isAuthorized(user, item.getType(), item.getData())) { event.setCancelled(true); user.getPlayer().updateInventory(); if (antib.getSettings().getData().isWarnOnBuildDisallow()) { user.sendMessage(_("§4You are not permitted to drop§c {0}§4.", item.getType().toString())); } } } }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerDropItem(PlayerDropItemEvent event) { Item dropped = event.getItemDrop(); GunPlayer gp = plugin.getGunPlayer(event.getPlayer()); ItemStack lastHold = gp.getLastHeldItem(); if (lastHold != null) { Gun gun = gp.getGun(dropped.getItemStack()); if (gun != null) { if (lastHold.getType() == dropped.getItemStack().getType()) { if (gun.isHasClip() && gun.isChanged() && gun.isReloadGunOnDrop()) { gun.reloadGun(); event.setCancelled(true); } } } } }
@EventHandler public void onPlayerDropItem(PlayerDropItemEvent event) { try { ExchangeRule[] rules = ExchangeRule.parseBulkRuleBlock(event.getItemDrop().getItemStack()); Item drop = event.getItemDrop(); for(ExchangeRule rule : rules) { ItemStack item = rule.toItemStack(); Item ruleDrop = drop.getWorld().dropItem(drop.getLocation(), item); ruleDrop.setVelocity(drop.getVelocity()); } drop.remove(); } catch (ExchangeRuleParseException e) { } }
@EventHandler public void onPlayerDropItem(final PlayerDropItemEvent ev) { if (ev.getPlayer().hasMetadata("itemtrader-exit-timestamp")) { List<MetadataValue> timestamps = ev.getPlayer().getMetadata("itemtrader-exit-timestamp"); long timestamp = Long.MIN_VALUE; for (MetadataValue value : timestamps) { if (value.getOwningPlugin().equals(plugin)) timestamp = value.asLong(); } ev.getPlayer().removeMetadata("itemtrader-exit-timestamp", plugin); if (System.currentTimeMillis() <= timestamp + 1000L) { ev.setCancelled(true); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @SuppressWarnings("deprecation") @Override public void run() { ev.getPlayer().updateInventory(); } }, 1); } } }
@EventHandler public void onDrop(PlayerDropItemEvent event) { if (isSoulbound(event.getItemDrop().getItemStack())) { event.getPlayer().sendMessage(ChatColor.RED + "You cannot drop Soulbound items!"); event.setCancelled(true); } }
@EventHandler(priority = EventPriority.LOWEST) public void onDrop(PlayerDropItemEvent evt) { if(ConfigPatch.fixDupeDropItem){ Player player = evt.getPlayer(); if (AzurePlayerList.contains(player) && player.isDead()) evt.setCancelled(true); } }
public void onItemDrop(PlayerDropItemEvent e) { if(Variables.backpack.containsKey(e.getPlayer().getUniqueId())) { ItemStack item = e.getItemDrop().getItemStack(); SlimefunItem sfItem = SlimefunItem.getByItem(item); if(sfItem instanceof SlimefunBackpack) e.setCancelled(true); } }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerDropItem(final PlayerDropItemEvent event) { match.player(event.getPlayer()).ifPresent(player -> { if(!player.canInteract()) { if(player.isSpawned()) { // If player is spawned (but frozen), force them to keep the item event.setCancelled(true); } else { // If player is observing, just destroy the item event.getItemDrop().remove(); } } }); }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onDropItem(PlayerDropItemEvent event) { if(isLocked(event.getItemDrop().getItemStack())) { event.setCancelled(true); sendLockWarning(event.getPlayer()); } else if(isUnshareable(event.getItemDrop().getItemStack())) { event.getItemDrop().remove(); } }