本文整理汇总了Java中org.bukkit.entity.LivingEntity.setCustomNameVisible方法的典型用法代码示例。如果您正苦于以下问题:Java LivingEntity.setCustomNameVisible方法的具体用法?Java LivingEntity.setCustomNameVisible怎么用?Java LivingEntity.setCustomNameVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.LivingEntity
的用法示例。
在下文中一共展示了LivingEntity.setCustomNameVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spawnCompanion
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns a random companion for the player with a random name at the location given
* @param player
* @param location
*/
protected void spawnCompanion(Player player, Location location) {
// Older versions of the server require custom names to only apply to Living Entities
//Bukkit.getLogger().info("DEBUG: spawning compantion at " + location);
if (!islandCompanion.isEmpty() && location != null) {
Random rand = new Random();
int randomNum = rand.nextInt(islandCompanion.size());
EntityType type = islandCompanion.get(randomNum);
if (type != null) {
LivingEntity companion = (LivingEntity) location.getWorld().spawnEntity(location, type);
if (!companionNames.isEmpty()) {
randomNum = rand.nextInt(companionNames.size());
String name = companionNames.get(randomNum).replace("[player]", player.getName());
//plugin.getLogger().info("DEBUG: name is " + name);
companion.setCustomName(name);
companion.setCustomNameVisible(true);
}
}
}
}
示例2: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_8_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例3: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_8_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例4: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_9_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例5: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_9_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例6: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_9_R2.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例7: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_9_R2.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例8: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_10_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例9: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_10_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例10: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_12_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例11: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_12_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例12: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_11_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例13: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_11_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例14: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_8_R3.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}
示例15: spawn
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
/**
* Spawns the entity at the given location
*
* @param mLocation location
*/
@Override
public void spawn(Object mLocation) {
final Location location = (Location) mLocation;
final LivingEntity entity = (LivingEntity) this.getEntity();
final net.minecraft.server.v1_8_R3.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
this.setPosition(location.getX(), location.getY(), location.getZ());
mcWorld.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
entity.setMetadata("keep", this.getKeepField());
entity.setCustomNameVisible(false);
entity.setCustomName("PetBlockIdentifier");
}