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


Java Entity.remove方法代码示例

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


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

示例1: onHit

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onHit(EntityDamageEvent event)
{
	if(event.isCancelled()) return;
	Entity hitTarget = event.getEntity();
	if(hitTarget != null && hitTarget instanceof ArmorStand && hitTarget.getCustomName() == "Chair")
		// Chair entity is immune to damage.
		event.setCancelled(true);
	else if(hitTarget != null && hitTarget instanceof Player && hitTarget.getVehicle() != null)
	{
		// Let players stand up if receiving damage.
		Entity vehicle = hitTarget.getVehicle();
		if(vehicle != null && vehicle instanceof ArmorStand && vehicle.getCustomName() == "Chair")
			vehicle.remove();
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:17,代码来源:Chairs.java

示例2: onMobDeath

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void onMobDeath(EntityDeathEvent event) {
	if(event.getEntity() instanceof Entity){
		Entity e = (Entity) event.getEntity();
		if(e.hasMetadata("challenge")){
			event.getDrops().clear();
			String[] meta = e.getMetadata("challenge").get(0).asString().split(", ");
			final String player = meta[1];
			plugin.getChallenges().addKill(Bukkit.getPlayer(player));
			Bukkit.getPlayer(player).setLevel(plugin.getChallenges().getKillsLeft(Bukkit.getPlayer(player)));
			if(e.getType().equals(EntityType.MAGMA_CUBE) || e.getType().equals(EntityType.SLIME)) {
				e.remove();
			}
			if(plugin.getChallenges().getKillsLeft(Bukkit.getPlayer(player)) == 0){
				plugin.getChallenges().finishChallenge(Bukkit.getPlayer(player), false);
			}
		}
	}
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:20,代码来源:ChallengeListener.java

示例3: removeBlock

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public void removeBlock(BlockBreakEvent e) {
		for (Entity en : e.getBlock().getWorld().getEntities()) {
			if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().add(-0.5, 0, -0.5).equals(e.getBlock().getLocation())) {
				en.remove();
				en.getWorld().getBlockAt(en.getLocation().add(-0.5, 0, -0.5)).setType(Material.AIR);
				
				ItemStack block = new ItemStack(Material.MONSTER_EGG, 1);
				
				ItemMeta bmeta = block.getItemMeta();
				
				bmeta.setDisplayName(name);
				
				block.setItemMeta(bmeta);
				
				if (e.getPlayer() != null && e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
					e.getPlayer().getInventory().addItem(block);
				} else {
					e.getBlock().getWorld().dropItemNaturally(en.getLocation().add(-0.5, 0, -0.5), block);
				}
			}
		}
	//}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:24,代码来源:CustomBlock.java

示例4: CheckCrowd

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void CheckCrowd(ChunkLoadEvent evt) {
	if (ConfigOptimize.NoCrowdedEntityenable) {
		Chunk chunk = evt.getChunk();
		Entity[] entities = chunk.getEntities();

		for (Entity e : entities) {
			EntityType type = e.getType();
			int count = 0;
			if (ConfigOptimize.NoCrowdedEntityTypeList.contains("*")
					|| ConfigOptimize.NoCrowdedEntityTypeList.contains(type.name())) {
				count++;
				if (count > ConfigOptimize.NoCrowdedEntityPerChunkLimit && e.getType() != EntityType.PLAYER) {
					e.remove();
				}
			}
		}
	}
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:20,代码来源:NoCrowdEntity.java

示例5: onSpawn

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void onSpawn(CreatureSpawnEvent event) {
	if (ConfigOptimize.NoCrowdedEntityenable) {
		Chunk chunk = event.getEntity().getLocation().getChunk();
		Entity[] entities = chunk.getEntities();

		for (Entity e : entities) {
			EntityType type = e.getType();
			int count = 0;
			if (ConfigOptimize.NoCrowdedEntityTypeList.contains("*")
					|| ConfigOptimize.NoCrowdedEntityTypeList.contains(type.name())) {
				count++;
				if (count > ConfigOptimize.NoCrowdedEntityPerChunkLimit && e.getType() != EntityType.PLAYER) {
					e.remove();
				}
			}
		}
	}
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:20,代码来源:NoCrowdEntity.java

示例6: onPlace

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlace(BlockPlaceEvent e) {
	if (!cm.isAntiPlaceDoorDupe) {
		return;
	}
	// 判断手里的物品是否为门
	if (e.getItemInHand().getType() == Material.WOOD_DOOR || e.getItemInHand().getType() == Material.IRON_DOOR) {
		// 清理所在区块的甘蔗掉落物
		for (Entity entity : e.getPlayer().getLocation().getChunk().getEntities()) {
			if (entity instanceof Item) {
				Material itemType = ((Item) entity).getItemStack().getType();
				if (itemType == Material.SUGAR_CANE || itemType == Material.CACTUS) {
					entity.remove();
				}
			}
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:19,代码来源:AntiPlaceDoorDupe.java

示例7: start

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@Override
public void start() {
    worldName = getPhase().getFeature(MapFeature.class).getWorld().getName();

    if (removeExisting) {
        for (Entity entity : getPhase().getFeature(MapFeature.class).getWorld().getEntities()) {
            if (blacklist.length != 0) {
                if (Arrays.stream(blacklist).anyMatch(m -> m.equals(entity.getType()))) {
                    entity.remove();
                }
            } else if (whitelist.length != 0) {
                if (Arrays.stream(whitelist).noneMatch(m -> m.equals(entity.getType()))) {
                    entity.remove();
                }
            } else {
                entity.remove();
            }
        }
    }
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:21,代码来源:MobFeature.java

示例8: onCommand

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
	if (command.getName().equalsIgnoreCase("hbike")) {
		Player player = (Player) sender;
		if (args[0].equals("create")) {
			create(player.getLocation()).setPassenger(player);
		}
		else if (args[0].equals("destroy")) {
			for (Entity ent : player.getNearbyEntities(0.2, 0.2, 0.2)) {
				if (ent.getCustomName() != null && ent.getCustomName().equals("HoverBike")) {
					ent.remove();
					return true;
				}
			}
		}
			
		return true;
	}
	
	return false;
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:22,代码来源:HoverBike.java

示例9: removeLabel

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public static void removeLabel(Item item) {
    if (itemLabels.containsKey(item.getUniqueId())) {
        Entity e = itemLabels.remove(item.getUniqueId());
        if (e != null)
            e.remove();
        e = null;
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:9,代码来源:DropManager.java

示例10: loadMap

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public void loadMap() {
	Chat.log(Prefix.LOG_WORLDS + "Generating world: " + worldName + "...");
	
	WorldCreator wc = new WorldCreator(worldName);
	wc.createWorld();
	
	getWorld().setAutoSave(false);
	getWorld().setKeepSpawnInMemory(false);
	getWorld().setFullTime(6000);
	
	for (Entity e : getWorld().getEntities())
		if (e instanceof Player == false)
			e.remove();
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:15,代码来源:Map.java

示例11: onSpec

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void onSpec(PlayerAliveStatusEvent e) {
    if (e.isAlive()) {
        return;
    }

    Entity entity = e.getPlayer().getVehicle();

    if (entity != null) {
        entity.eject();
        entity.remove();
    }
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:14,代码来源:HorseRaceGame.java

示例12: killNextCommand

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
private void killNextCommand(Player sender) {
    double distance = 100;
    Entity nearest = null;
    for (final Entity entity : sender.getLocation().getChunk().getEntities()) {
        if (!(entity instanceof Player) && sender.getLocation().distance(entity.getLocation()) < distance) {
            distance = sender.getLocation().distance(entity.getLocation());
            nearest = entity;
        }
    }
    if (nearest != null) {
        nearest.remove();
        sender.sendMessage(Config.getInstance().getPrefix() + "" + ChatColor.GREEN + "You removed entity " + nearest.getType() + '.');
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:15,代码来源:PetBlockCommandExecutor.java

示例13: endGame

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public void endGame() {
	gameState = GameState.ENDING;
	if (SkyWarsReloaded.getCfg().bungeeEnabled()&& !shutdown) {
		BungeeUtil.sendSignUpdateRequest(this);
	}
	if (SkyWarsReloaded.getCfg().signJoinMode() && !shutdown) {
		SkyWarsReloaded.getGC().updateSign(gameNumber);
	}
	for (GamePlayer gplayer: getPlayers()) {
		deletePlayer(gplayer, false, false);
	}
	if (SkyWarsReloaded.getCfg().spectatingEnabled()) {
		for (GamePlayer gPlayer: getSpectators()) {
			removeSpectator(gPlayer);
		}
	}
	for (Player player: mapWorld.getPlayers()) {
		if (player != null) {
			player.teleport(SkyWarsReloaded.getCfg().getSpawn(), TeleportCause.PLUGIN);
		}
	}
	
	for (Entity entity: mapWorld.getEntities()) {
		if (entity != null) {
			entity.remove();
		}
	}
	if (!SkyWarsReloaded.getCfg().spectatingEnabled() && !shutdown) {
			SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
				@Override
				public void run() {
					deleteGame();
				}
			}, 20 * SkyWarsReloaded.getCfg().getTimeAfterGame());
	} else {
		deleteGame();
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:39,代码来源:Game.java

示例14: chunkUnloadClearBullets

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
/**
 * This eliminates pending bullets on chunk unload
 * 
 * @param event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void chunkUnloadClearBullets(ChunkUnloadEvent event) {
	if (event.getChunk() == null) return;
	Entity[] entities = event.getChunk().getEntities();
	for (Entity e : entities) {
		if (inFlightBullets.containsKey(e.getUniqueId())) {
			inFlightBullets.remove(e.getUniqueId());
			travelPaths.remove(e.getUniqueId());
			e.remove();
		}
	}
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:18,代码来源:Guns.java

示例15: run

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@Override
public void run() {
    for (final World world : Bukkit.getWorlds()) {
        for (final Entity entity : world.getEntities()) {
            if (BallListener.this.isDeadBall(entity)) {
                entity.remove();
            }
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:11,代码来源:BallListener.java


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