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


Java Entity.getCustomName方法代码示例

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


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

示例1: checkChair

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
private List<ArmorStand> checkChair(ArmorStand drop)
{
	List<ArmorStand> drops = new ArrayList<ArmorStand>();
	
	// Check for already existing chair items.
	for(Entity e : drop.getNearbyEntities(0.5, 0.5, 0.5))
	{
		if(e != null && e instanceof ArmorStand && e.getCustomName() == "Chair")
		{
			if(e.getPassengers().isEmpty())
				e.remove();
			else
				drops.add(drop);
		}
	}
	
	if(!drops.isEmpty())
		return drops;
	
	return null;
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:22,代码来源:Chairs.java

示例2: removeBlock

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@Override
public void removeBlock(BlockBreakEvent e) {
		if (e.getPlayer() == null) {return;}
		for (Entity en : e.getPlayer().getNearbyEntities(10, 10, 10)) {
			System.out.println("Removal has Begun");
			if (en.getCustomName() != null && en.getCustomName().equals(getName()) && /*en.getLocation().add(-0.5, 0, -0.5).equals(e.getBlock().getLocation())*/ en.getLocation().distance(e.getBlock().getLocation()) < 2) {
				for (Entity ent : en.getNearbyEntities(0.5, 0.5, 0.5)) {
					if (ent.getCustomName().equals("CustomBlock")) {
						ent.remove();
						break;
					}
				}
				en.remove();
				//en.getWorld().getBlockAt(en.getLocation().add(-0.5, 0, -0.5)).setType(Material.AIR);
				if (e.getPlayer() != null && e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
					e.getPlayer().getInventory().addItem(getItem());
				} else {
					e.getBlock().getWorld().dropItemNaturally(en.getLocation().add(-0.5, 0, -0.5), getItem());
				}
				
				return;
			}
		}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:25,代码来源:CustomTexturedBlock.java

示例3: getArmorStand

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public static ArmorStand getArmorStand(Block hopper)
{
    Location l = new Location(hopper.getWorld(), (double)hopper.getX() + 0.5D, hopper.getY(), (double)hopper.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    hologram.setCustomNameVisible(false);
    hologram.setCustomName(null);
    return hologram;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:18,代码来源:AutoBreeder.java

示例4: onBlockBreak

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent event)
{
	if(event.isCancelled()) return;
	if(Survival.allowedBlocks.contains(event.getBlock().getType()))
	{
		ArmorStand drop = dropSeat(event.getBlock(), (Stairs)event.getBlock().getState().getData());
		
		for(Entity e : drop.getNearbyEntities(0.5, 0.5, 0.5))
		{
			if(e != null && e instanceof ArmorStand && e.getCustomName() == "Chair")
				e.remove();
		}
		
		drop.remove();
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:18,代码来源:Chairs.java

示例5: getArmorStand

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public static ArmorStand getArmorStand(Block hopper, boolean createIfNoneFound) {
	Location l = new Location(hopper.getWorld(), hopper.getX() + 0.5, hopper.getY() + offset, hopper.getZ() + 0.5);
	
	for (Entity n: l.getChunk().getEntities()) {
		if (n instanceof ArmorStand) {
			if (n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.4D) return (ArmorStand) n;
		}
	}

	if (!createIfNoneFound) {
		return null;
	}
	
	ArmorStand hologram = ArmorStandFactory.createHidden(l);
	hologram.setCustomNameVisible(false);
	hologram.setCustomName(null);
	return hologram;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:19,代码来源:InfusedHopper.java

示例6: onPlayerMoveEvent

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void onPlayerMoveEvent(PlayerMoveEvent e) {
	for (Entity en : e.getPlayer().getWorld().getEntities()) {
		if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().distance(e.getTo()) <= 1) {
			Location l = en.getLocation();
			//e.getPlayer().sendMessage(getPlayerDirection(e.getPlayer()));
			if (getPlayerDirection(e.getPlayer()).equals("north")) {
				l.add(-1.2, 0, 0);	
			}
			else if (getPlayerDirection(e.getPlayer()).equals("south")) {
				l.add(1.2, 0, 0);	
			}
			else if (getPlayerDirection(e.getPlayer()).equals("east")) {
				l.add(0, 0, -1.2);	
			}
			else if (getPlayerDirection(e.getPlayer()).equals("west")) {
				l.add(0, 0, 1.2);	
			}
			else {
				l = e.getPlayer().getLocation();
			}
			l.setDirection(e.getPlayer().getLocation().getDirection());
			e.setTo(l);
		}
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:27,代码来源:GhostBlock.java

示例7: 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

示例8: getBlockByName

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public static ArrayList<Entity> getBlockByName(String name, Entity e) {
	ArrayList<Entity> r = new ArrayList<Entity>();
	
	for (Entity en : e.getWorld().getEntities()) {
		if (en.getCustomName() != null && en.getCustomName().equals(name)) {
			r.add(en);
		}
	}
	
	return r;
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:12,代码来源:CustomBlock.java

示例9: isDeadBall

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
private boolean isDeadBall(Entity entity) {
    if (!this.isBall(entity)) {
        if (entity instanceof ArmorStand) {
            final ArmorStand stand = (ArmorStand) entity;
            final int xidentifier = (int) stand.getBodyPose().getZ();
            final int identifier = (int) stand.getRightArmPose().getX();
            if (xidentifier == 2777 && identifier == 2777) {
                return true;
            }
        } else if (entity instanceof Rabbit && entity.getCustomName() != null && entity.getCustomName().equals("MyBallsIdentifier")) {
            return true;
        }
    }
    return false;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:16,代码来源:BallListener.java

示例10: EntityInfo

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public EntityInfo(Entity entity, @Nullable ParticipantState owner) {
    super(owner);
    this.entityType = entity.getType();
    this.entityClass = entity.getClass();
    this.customName = entity.getCustomName();
    this.nameKey = NMSHacks.getTranslationKey(entity);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:EntityInfo.java

示例11: getArmorStand

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
private static ArmorStand getArmorStand(Block b)
{
    Location l = new Location(b.getWorld(), (double)b.getX() + 0.5D, (float)b.getY() - 0.7F, (double)b.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() != null && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    return hologram;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:16,代码来源:CargoHologram.java

示例12: findItem

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public static Item findItem(Block b) {
	for (Entity n: b.getChunk().getEntities()) {
		if (n instanceof Item) {
			if (b.getLocation().add(0.5, 1.2, 0.5).distanceSquared(n.getLocation()) < 0.5D && n.getCustomName() != null) return (Item) n;
		}
	}
	return null;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:9,代码来源:AncientAltarListener.java

示例13: onInteract

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@EventHandler
public void onInteract(PlayerInteractEvent e) {
	if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
		//System.out.println("A");
		for (Entity en : e.getPlayer().getWorld().getEntities()) {
			if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().add(-0.5, 0, -0.5).equals(e.getClickedBlock().getLocation())) {
				Location l = e.getClickedBlock().getLocation();
				l.add(0, -1, 0);
				en.getWorld().getBlockAt(l).breakNaturally();
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:15,代码来源:BlockBreaker.java

示例14: loop

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
public void loop() {
	for (Player p : Bukkit.getOnlinePlayers()) {
		for (Entity bl : p.getNearbyEntities(0.24, 2, 0.24)) {
			if (bl.getCustomName() != null && bl.getCustomName().equals(getName())) {
				for (Entity ent : p.getNearbyEntities(0.2, 0.2, 0.2)) {
					if (ent.getCustomName() != null && ent.getCustomName().equals("HoverBike")) {
						for (String tag : ent.getScoreboardTags()) {
							if (tag.startsWith("speed:") && Integer.valueOf(tag.split(":")[1]) > 18) {
								Police.create(p.getLocation().add(-10, 2, -10), p);
								p.sendMessage("&6[Warning] Don't go past stops!".replace('&', '�'));
								p.sendMessage("&9[Police] Pull over!".replace('&', '�'));
								
								for (Entity pli : p.getNearbyEntities(50, 50, 50)) {
									if (pli.getCustomName() != null && pli.getCustomName().equals("Officer")) {
										((PigZombie) pli).setTarget(p);
									}
								}
							}
							else {
								if (!ent.getScoreboardTags().contains("stopcooldown")) {
									((Pig) ent).removePotionEffect(PotionEffectType.SPEED);
									((Pig) ent).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 255, true, false));
									((Pig) ent).setVelocity(new Vector(0, 0, 0));
								} else {
									ent.getScoreboardTags().remove("stopcooldown");
								}
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:35,代码来源:StopBlock.java

示例15: removeBlock

import org.bukkit.entity.Entity; //导入方法依赖的package包/类
@Override
public void removeBlock(BlockBreakEvent e) {
		for (Entity en : e.getPlayer().getWorld().getEntities()) {
			if (en.getCustomName() != null && en.getCustomName().equals("flag") && en.getLocation().add(-0.5, 0, -0.5).equals(e.getBlock().getLocation())) {
				en.remove();
				e.getPlayer().sendMessage(ChatColor.GRAY + "Flag removed");
			}
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:10,代码来源:Flag.java


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