当前位置: 首页>>代码示例>>Java>>正文


Java PlayerDropItemEvent类代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerDropItemEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerDropItemEvent类的具体用法?Java PlayerDropItemEvent怎么用?Java PlayerDropItemEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlayerDropItemEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerDropItemEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onVisitorDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:18,代码来源:VisitorGuard.java

示例2: onCraft

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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()));
		//}
	}*/
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:17,代码来源:CustomCrafting.java

示例3: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:26,代码来源:ItemTransferListener.java

示例4: on

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:LeonTG,项目名称:NineSlots,代码行数:19,代码来源:ClickListener.java

示例5: onDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
            }
		}
    }
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:27,代码来源:BasicFeatures.java

示例6: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:BigScary,项目名称:PhantomAdmin,代码行数:17,代码来源:PAEventHandler.java

示例7: onItemDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:Lyon1-Asterix,项目名称:Minetrace,代码行数:23,代码来源:MinetraceListener.java

示例8: StopDrops

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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();
		    }
	    }
    }
}
 
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:19,代码来源:KitLoading.java

示例9: load

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
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);
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:24,代码来源:CustomBookOverlay.java

示例10: onInventoryChange

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
			}
		
		}
	}
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:20,代码来源:DeliverRequirement.java

示例11: onPlayerDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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()));

}
 
开发者ID:Staartvin,项目名称:Statz,代码行数:18,代码来源:ItemsDroppedListener.java

示例12: coinCheck

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
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"));
        }
}
 
开发者ID:josegrobles,项目名称:LuckyBlocksBukkit,代码行数:24,代码来源:LuckyBlocksActionController.java

示例13: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
                    }
                }
            }
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:20,代码来源:Snowflakes.java

示例14: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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!");
		}
	}
}
 
开发者ID:ckm499,项目名称:MythsOfCreation,代码行数:18,代码来源:ItemDropListener.java

示例15: onDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:19,代码来源:PlayerListener.java


注:本文中的org.bukkit.event.player.PlayerDropItemEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。