Java 类org.bukkit.event.player.PlayerDropItemEvent 实例源码

项目:bskyblock    文件:VisitorGuard.java   
@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);
}
项目:SuperiorCraft    文件:CustomCrafting.java   
@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()));
        //}
    }*/
}
项目:ProjectAres    文件:ItemTransferListener.java   
@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);
        }
    }
}
项目:NineSlots    文件:ClickListener.java   
@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);
    }
}
项目:UltimateSpawn    文件:BasicFeatures.java   
@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);
            }
        }
    }
}
项目:SuperiorCraft    文件:CustomCrafting.java   
@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()));
        //}
    }*/
}
项目:PhantomAdmin    文件:PAEventHandler.java   
@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;
    }
}
项目:Minetrace    文件:MinetraceListener.java   
@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);
}
项目:AnnihilationPro    文件:KitLoading.java   
@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();
            }
        }
    }
}
项目:CS-CoreLib    文件:CustomBookOverlay.java   
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);
}
项目:QuestManager    文件:DeliverRequirement.java   
@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);
            }

        }
    }
}
项目:Statz    文件:ItemsDroppedListener.java   
@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()));

}
项目:LuckyBlocksBukkit    文件:LuckyBlocksActionController.java   
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"));
        }
}
项目:LuckyBlocksBukkit    文件:LuckyBlocksActionController.java   
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"));
        }
}
项目:Cardinal-Plus    文件:Snowflakes.java   
@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);
                    }
                }
            }
        }
    }
}
项目:MythsOfCreation    文件:ItemDropListener.java   
@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!");
        }
    }
}
项目:BedwarsRel    文件:PlayerListener.java   
@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);
}
项目:BedwarsRel    文件:WarpPowderListener.java   
@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);
  }

}
项目:COD-Warfare    文件:Listeners.java   
@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;
        }
    }
}
项目:CratesPlus    文件:BlockListeners.java   
@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;
        }
    }

}
项目:uSkyBlock    文件:ItemDropEvents.java   
@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());
}
项目:acidisland    文件:PlayerEvents.java   
@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);
}
项目:Factoid    文件:PlayerListener.java   
/**
 * 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);
        }
    }
}
项目:askyblock    文件:PlayerEvents.java   
@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);
}
项目:AntiBuild    文件:ItemDrop.java   
/**
     * 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);
//            }
//        }

    }
项目:Bytecraft    文件:ZoneListener.java   
@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.");
    }
}
项目:PV-Star    文件:SharingListener.java   
@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);
}
项目:Equestrian-Dash    文件:PlayerDropItemListener.java   
@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);
        }
    }
}
项目:TNE-Bukkit    文件:PlayerListener.java   
@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);
  });
}
项目:RodsTwo    文件:ItemListener.java   
@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);
    }
}
项目:UltimateArena    文件:PlayerListener.java   
@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);
            }
        }
    }
}
项目:Essentials    文件:EssentialsAntiBuildListener.java   
@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()));
            }
        }
    }
}
项目:SwornGuns    文件:PlayerListener.java   
@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);
                }
            }
        }
    }
}
项目:ItemExchange    文件:ItemExchangeListener.java   
@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) {
    }
}
项目:itemtrader    文件:PlayerListener.java   
@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);
        }
    }
}
项目:ZentrelaRPG    文件:ItemManager.java   
@EventHandler
public void onDrop(PlayerDropItemEvent event) {
    if (isSoulbound(event.getItemDrop().getItemStack())) {
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot drop Soulbound items!");
        event.setCancelled(true);
    }
}
项目:EscapeLag    文件:AntiDupeDropItem.java   
@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);
    }
}
项目:Slimefun4-Chinese-Version    文件:BackpackListener.java   
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);
    }
}
项目:ProjectAres    文件:EventFilterMatchModule.java   
@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();
            }
        }
    });
}
项目:ProjectAres    文件:ItemSharingAndLockingListener.java   
@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();
    }
}