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


Java Item.remove方法代码示例

本文整理汇总了Java中org.bukkit.entity.Item.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Item.remove方法的具体用法?Java Item.remove怎么用?Java Item.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Item的用法示例。


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

示例1: checkPedestal

import org.bukkit.entity.Item; //导入方法依赖的package包/类
private void checkPedestal(Block pedestal)
{
    Item item = AncientAltarListener.findItem(pedestal);
    if(item == null)
    {
        abort();
    } else
    {
        particles.add(pedestal.getLocation().add(0.5D, 1.5D, 0.5D));
        items.add(AncientAltarListener.fixItemStack(item.getItemStack(), item.getCustomName()));
        pedestal.getWorld().playSound(pedestal.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 5F, 2.0F);
        try
        {
            ParticleEffect.ENCHANTMENT_TABLE.display(pedestal.getLocation().add(0.5D, 1.5D, 0.5D), 0.3F, 0.2F, 0.3F, 0.0F, 16);
            ParticleEffect.CRIT_MAGIC.display(pedestal.getLocation().add(0.5D, 1.5D, 0.5D), 0.3F, 0.2F, 0.3F, 0.0F, 8);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        item.remove();
        pedestal.removeMetadata("item_placed", SlimefunStartup.instance);
    }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:25,代码来源:RitualAnimation.java

示例2: run

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@Override
public void run() {
    for(Item item : Bukkit.getWorlds().get(0).getEntitiesByClass(Item.class)) {
        if(item.getItemStack().getType() != Material.GHAST_TEAR) continue;
        UUID skip = Gizmos.gunGizmo.items.get(item);

        for(Entity entity : item.getNearbyEntities(0.5d, 0.5d, 0.5d)) {
            if(entity instanceof Player && !entity.getUniqueId().equals(skip)) {
                Player player = (Player) entity;
                if(player.hasPermission("gizmo.immunity")) continue;
                player.damage(0d, item);
                Gizmos.gunGizmo.gifts.add(player.getUniqueId());
                item.remove();
                break;
            }
        }

        if(item.getTicksLived() >= 6000) item.remove();
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:21,代码来源:GunGizmo.java

示例3: craft

import org.bukkit.entity.Item; //导入方法依赖的package包/类
public boolean craft(Player crafter) {
	// TODO Block crafting operation when not allowed for player
	String spell = getSpell();
	if (spell != null) {
		ItemStack tome = SpellTome.getSpellTome(spell, crafter);
		Location spawnLoc = block.getLocation().add(0.5, 1.5, 0.5);
		spawnLoc.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, spawnLoc, 40);
		for (Entry<Item, BukkitRunnable> entry : items.entrySet()) {
			Item item = entry.getKey();
			item.remove();
			entry.getValue().cancel();
		}
		book.setCustomNameVisible(false);
		new BukkitRunnable() {
			public void run() {
				book.setItemStack(tome);
				book.setGlowing(false);
				book.setPickupDelay(0);
				book.getWorld().playSound(book.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
			}
		}.runTaskLater(MystiCraft.getInstance(), 32);
		return true;
	} else {
		return false;
	}
}
 
开发者ID:mcardy,项目名称:MystiCraft,代码行数:27,代码来源:CraftingOperation.java

示例4: run

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@Override
public void run(Game game) {
    final Arena arena = game.getArena();
    if (this.rate == Spawnrate.NONE)
        return;
    if (this.bumper <= 0) {
        if (game.getPlayers().isEmpty()) {
            this.clearGroundItems();
            this.bumper = 40;
            return;
        }
        for (final Item item : this.getLDroppedItems().keySet().toArray(new Item[this.getLDroppedItems().size()])) {
            if (item.isDead() || item.getTicksLived() > 1000) {
                item.remove();
                this.getLDroppedItems().remove(item);
            }
        }
        if (this.getRandom().nextInt(100) < this.rate.getSpawnChance()) {
            if (this.getLDroppedItems().size() < this.rate.getMaxAmount()) {
                this.spawnRandomItem(arena);
            }
        }
        this.bumper = 40;
    }
    this.bumper--;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:27,代码来源:ItemSpawner.java

示例5: onPickup

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
    public void onPickup(PlayerPickupItemEvent e){
        Item item = e.getItem();
        if(item.getCustomName()!=null) {
            String name = ChatColor.stripColor(item.getCustomName());
//		if(name!=null && ChatColor.stripColor(language.get("nameSyntax")).replace("{money}", "").equals(name.replaceAll(regex, ""))){
            e.setCancelled(true);
            String money = plugin.getMoney(name);
            Player p = e.getPlayer();
            if (p.hasPermission("PickupMoney.pickup")) {
                item.remove();
                float amount = Float.parseFloat(money);
                if(plugin.pickupMulti.containsKey(p.getUniqueId())) amount*=plugin.pickupMulti.get(p.getUniqueId());
                plugin.giveMoney(amount, p);
                p.sendMessage(plugin.language.get("pickup").replace("{money}", String.valueOf(amount)));
                if (plugin.fc.getBoolean("sound.enable")) {
                    p.getLocation().getWorld().playSound(p.getLocation(), Sound.valueOf(plugin.fc.getString("sound.type"))
                            , (float) plugin.fc.getDouble("sound.volumn")
                            , (float) plugin.fc.getDouble("sound.pitch"));
                }
            }
//		}
        }
    }
 
开发者ID:KickVN,项目名称:PickupMoney,代码行数:25,代码来源:MainListener.java

示例6: checkPedestal

import org.bukkit.entity.Item; //导入方法依赖的package包/类
private void checkPedestal(Block pedestal) {
	Item item = AncientAltarListener.findItem(pedestal);
	if (item == null) abort();
	else {
		particles.add(pedestal.getLocation().add(0.5, 1.5, 0.5));
		items.add(AncientAltarListener.fixItemStack(item.getItemStack(), item.getCustomName()));
		pedestal.getWorld().playSound(pedestal.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 5F, 2F);
		
		try {
			ParticleEffect.ENCHANTMENT_TABLE.display(pedestal.getLocation().add(0.5, 1.5, 0.5), 0.3F, 0.2F, 0.3F, 0, 16);
			ParticleEffect.CRIT_MAGIC.display(pedestal.getLocation().add(0.5, 1.5, 0.5), 0.3F, 0.2F, 0.3F, 0, 8);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		item.remove();
		pedestal.removeMetadata("item_placed", SlimefunStartup.instance);
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:20,代码来源:RitualAnimation.java

示例7: onItemPickup

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
	Game bw = io.github.bedwarsrel.BedwarsRel.Main.getInstance()
			.getGameManager().getGameOfPlayer(e.getPlayer());
	if (bw == null) {
		return;
	}
	if (!Config.isGameEnabledXP(bw.getName())) {
		return;
	}
	Player p = e.getPlayer();
	Item entity = e.getItem();
	ItemStack stack = entity.getItemStack();
	int count = Res.convertResToXP(stack);
	if (count == 0) {
		return;
	}
	e.setCancelled(true);
	XPManager.addXP(bw.getName(), p, count);
	p.playSound(p.getLocation(),
			SoundMachine.get("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"),
			10.0F, 1.0F);
	if (!Config.Message.equals("")) {
		ActionBarUtils.sendActionBar(p,
				Config.Message.replaceAll("%xp%", Integer.toString(count)));
		/*
		 * if (!ActionBarUtils.works) {
		 * p.sendMessage(Config.Message.replaceAll("%xp%",
		 * Integer.toString(count))); }
		 */
	}
	entity.remove();
}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:34,代码来源:NewEventListeners.java

示例8: onItemPickup

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
	Game bw = io.github.yannici.bedwars.Main.getInstance().getGameManager()
			.getGameOfPlayer(e.getPlayer());
	if (bw == null) {
		return;
	}
	if (!Config.isGameEnabledXP(bw.getName())) {
		return;
	}
	Player p = e.getPlayer();
	Item entity = e.getItem();
	ItemStack stack = entity.getItemStack();
	int count = Res.convertResToXP(stack);
	if (count == 0) {
		return;
	}
	e.setCancelled(true);
	XPManager.addXP(bw.getName(), p, count);
	p.playSound(p.getLocation(),
			SoundMachine.get("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"),
			10.0F, 1.0F);
	if (!Config.Message.equals("")) {
		ActionBarUtils.sendActionBar(p,
				Config.Message.replaceAll("%xp%", Integer.toString(count)));
		/*
		 * if (!ActionBarUtils.works) {
		 * p.sendMessage(Config.Message.replaceAll("%xp%",
		 * Integer.toString(count))); }
		 */
	}
	entity.remove();
}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:34,代码来源:OldEventListeners.java

示例9: onDrop

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler
public void onDrop(ItemSpawnEvent event)
{
	if(event.isCancelled()) return;
	final Item itemDrop = event.getEntity();
	if(itemDrop.getItemStack().getType() == Material.BOWL)
	{
	    final Runnable task = new Runnable()
	    {
	    	public void run()
	    	{
	    		if(itemDrop.getItemStack().getAmount() != 1) return;
	    		Location itemLocation = itemDrop.getLocation();
	    		if(itemLocation.getBlock().getType() == Material.WATER || itemLocation.getBlock().getType() == Material.STATIONARY_WATER)
	    		{
	    			itemDrop.remove();
	    			
	    	      	ItemStack i_beetroot = new ItemStack(Material.BEETROOT_SOUP, 1);
	    	      	ItemMeta beetrootMeta= i_beetroot.getItemMeta();
	    	      	beetrootMeta.setDisplayName(ChatColor.RESET + Survival.instance.Words.get("Water Bowl"));
	    	      	i_beetroot.setItemMeta(beetrootMeta);
	    	      	
	    			itemDrop.getWorld().dropItem(itemLocation, i_beetroot);
	    		}
            }
	    };
	    
	    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, task, 20L);
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:31,代码来源:WaterBowl.java

示例10: clear

import org.bukkit.entity.Item; //导入方法依赖的package包/类
public void clear(boolean doDrop) {
	for (Entry<Item, BukkitRunnable> entry : items.entrySet()) {
		Item item = entry.getKey();
		if (doDrop) {
			item.getWorld().dropItemNaturally(item.getLocation(), item.getItemStack()).setPickupDelay(0);
		}
		item.remove();
		entry.getValue().cancel();
	}
	
	if (doDrop)
		book.getWorld().dropItemNaturally(book.getLocation(), book.getItemStack()).setPickupDelay(0);
	book.remove();
}
 
开发者ID:mcardy,项目名称:MystiCraft,代码行数:15,代码来源:CraftingOperation.java

示例11: clearGroundItems

import org.bukkit.entity.Item; //导入方法依赖的package包/类
public void clearGroundItems() {
    for (final Item item : this.getLDroppedItems().keySet()) {
        if (!item.isDead())
            item.remove();
    }
    this.getLDroppedItems().clear();
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:8,代码来源:ItemSpawner.java

示例12: onPlayerDrop

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL)
public void onPlayerDrop(PlayerDropItemEvent event) {
    Item item = event.getItemDrop();
    if (isSubclaimWand(item.getItemStack())) {
        item.remove();
        plugin.getClaimHandler().clearClaimSelection(event.getPlayer());
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:SubclaimWandListener.java

示例13: onPlayerPickup

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL)
public void onPlayerPickup(PlayerPickupItemEvent event) {
    Item item = event.getItem();
    if (isSubclaimWand(item.getItemStack())) {
        item.remove();
        plugin.getClaimHandler().clearClaimSelection(event.getPlayer());
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:SubclaimWandListener.java

示例14: onPlayerDrop

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL)
public void onPlayerDrop(PlayerDropItemEvent event) {
    Item item = event.getItemDrop();
    if (isClaimingWand(item.getItemStack())) {
        item.remove();
        plugin.getClaimHandler().clearClaimSelection(event.getPlayer());
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:ClaimWandListener.java

示例15: onPlayerPickup

import org.bukkit.entity.Item; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = false, priority = EventPriority.NORMAL)
public void onPlayerPickup(PlayerPickupItemEvent event) {
    Item item = event.getItem();
    if (isClaimingWand(item.getItemStack())) {
        item.remove();
        plugin.getClaimHandler().clearClaimSelection(event.getPlayer());
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:ClaimWandListener.java


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