當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。