本文整理匯總了Java中org.bukkit.entity.Zombie.setCustomName方法的典型用法代碼示例。如果您正苦於以下問題:Java Zombie.setCustomName方法的具體用法?Java Zombie.setCustomName怎麽用?Java Zombie.setCustomName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.Zombie
的用法示例。
在下文中一共展示了Zombie.setCustomName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: spawnZombie
import org.bukkit.entity.Zombie; //導入方法依賴的package包/類
private void spawnZombie() {
Location center = new Location(Parties.getPartyWorld(), -74.5, 76, 30);
Zombie z = center.getWorld().spawn(Utils.scatter(center, 4, 0, 4), Zombie.class);
z.setCustomNameVisible(true);
z.setCustomName(ChatColor.RED + "Piñata");
z.getEquipment().setHelmet(ItemManager.createSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZn"
+ "QubmV0L3RleHR1cmUvM2IyNTI2NmQ0MGNlY2Q5M2QwNTMxNTZlNGE0YTc4NDE0MGQwMzQyNTVjNzIxY2MzNzVkMWMzNjQ4MzQyYjZmZCJ9fX0",
"Pinata Skull", "He doesn't want to party anymore."));
z.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
z.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
z.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
z.getEquipment().setItemInMainHand(ItemManager.createItem(Material.STICK, ChatColor.RED + "Pinata Bat", ChatColor.DARK_PURPLE + "Stop hitting me!"));
z.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40);
z.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(.4F);
z.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(6);
z.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(1);
z.setSilent(true);
z.setGlowing(true);
getScheduler().runTaskLater(z::remove, 1200L); // Remove zombie in 1 minute.
}
示例2: leave
import org.bukkit.entity.Zombie; //導入方法依賴的package包/類
@EventHandler
public void leave(final PlayerQuitEvent event) {
if(GameState.current() != GameState.LOBBY && event.getPlayer().getGameMode() != GameMode.SPECTATOR){
event.setQuitMessage(colour("&6" + event.getPlayer().getName() + " has quit! " +
"They have " + UHC.getInstance().getMainConfig().getDisconnectGracePeriodSeconds() + "s to reconnect."));
bukkitRunnable(() -> disqualified(event.getPlayer().getUniqueId(), event.getPlayer().getName(),
event.getPlayer().getLocation(), event.getPlayer().getInventory())).runTaskLater(UHC.getInstance(),
TimeUnit.MILLISECONDS.convert(UHC.getInstance().getMainConfig().getDisconnectGracePeriodSeconds(), TimeUnit.SECONDS));
//Zombie Spawning
Zombie zombie = (Zombie) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.ZOMBIE);
zombie.setCustomName(event.getPlayer().getName());
zombie.setCustomNameVisible(true);
//TODO Make no AI and invulnerable cough cough Proxi cough cough
deadRepresentatives.put(event.getPlayer().getUniqueId(), zombie);
}
}
示例3: applyNameplate
import org.bukkit.entity.Zombie; //導入方法依賴的package包/類
public static void applyNameplate(Zombie z, double currentHealth, double maxHealth) {
if (!Config.useNameplates) return;
if (!RUtils.isInInfectedWorld(z)) return;
final SurvivorsZombie cz = getSurvivorsZombie(z);
if (cz == null) return;
int level = cz.getLevel();
if (level < 1) level = 1;
if (level > 7) level = 7;
String format = Config.nameplateFormat;
format = format.replace("{currenthealth}", df.format(currentHealth));
format = format.replace("{maxhealth}", df.format(maxHealth));
format = format.replace("{currenthearts}", df.format(currentHealth / 2D));
format = format.replace("{maxhearts}", df.format(maxHealth / 2D));
format = format.replace("{level}", String.valueOf(level));
if (format.length() > 32) format = format.substring(0, 32);
z.setCustomName(format);
z.setCustomNameVisible(Config.nameplateAlwaysVisible);
}
示例4: onEntityDeath
import org.bukkit.entity.Zombie; //導入方法依賴的package包/類
/**
* When a player is dead, spawn a zombie
*
* @param event Event
*/
@EventHandler
public void onEntityDeath(PlayerDeathEvent event)
{
Zombie zombie = (Zombie)event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.ZOMBIE);
zombie.setCustomNameVisible(true);
zombie.setCustomName(event.getEntity().getCustomName());
event.getEntity().getActivePotionEffects().forEach(zombie::addPotionEffect);
}
示例5: spawnZombie
import org.bukkit.entity.Zombie; //導入方法依賴的package包/類
public static boolean spawnZombie(DemigodsCharacter character, LivingEntity target) {
Location spawnLocation = character.getCurrentLocation().clone();
if (DemigodsServer.isRunningSpigot())
Spigots.playParticle(spawnLocation, Effect.EXPLOSION_HUGE, 1, 1, 1, 1F, 5, 300);
Zombie zombie = (Zombie) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
zombie.addPotionEffects(Sets.newHashSet(new PotionEffect(PotionEffectType.SPEED, 999, 5, false), new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 999, 5, false), new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999, 1, false), new PotionEffect(PotionEffectType.JUMP, 999, 5, false), new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999, 2, false)));
zombie.setCustomName(character.getName() + "'s Minion");
zombie.setCustomNameVisible(true);
zombie.setTarget(target);
return true;
}
示例6: spawn
import org.bukkit.entity.Zombie; //導入方法依賴的package包/類
@Override
public void spawn() {
switch (type) {
case SKELETON:
Skeleton s = getLocation().getWorld().spawn(this.getLocation(), Skeleton.class);
s.setCustomName(ChatColor.RED + "Nexus Wachter");
s.setCustomNameVisible(true);
this.entity = s;
KDFEntity ke = new KDFEntity(entity);
HashMap<Enchantment, Integer> bowE = new HashMap<Enchantment, Integer>();
bowE.put(Enchantment.ARROW_DAMAGE, 5);
bowE.put(Enchantment.ARROW_FIRE, 1);
bowE.put(Enchantment.ARROW_KNOCKBACK, 2);
ke.setItem(EnumItemSlot.MAINHAND,
Item.getInstance().getItem(Material.BOW, ChatColor.RED + "Nexus Wachter Boog", 1, bowE, true));
ke.setItem(EnumItemSlot.OFFHAND,
Item.getInstance().getItem(Material.SHIELD, ChatColor.RED + "Nexus Wachter Schild", 1));
break;
case ZOMBIE:
Zombie z = getLocation().getWorld().spawn(this.getLocation(), Zombie.class);
z.setCustomName(ChatColor.RED + "Nexus Wachter");
z.setCustomNameVisible(true);
this.entity = z;
KDFEntity kez = new KDFEntity(entity);
HashMap<Enchantment, Integer> swordE = new HashMap<Enchantment, Integer>();
swordE.put(Enchantment.DAMAGE_ALL, 5);
swordE.put(Enchantment.FIRE_ASPECT, 2);
swordE.put(Enchantment.KNOCKBACK, 3);
kez.setItem(EnumItemSlot.MAINHAND,
Item.getInstance().getItem(Material.BOW, ChatColor.RED + "Nexus Wachter Zwaard", 1, swordE, true));
kez.setItem(EnumItemSlot.OFFHAND,
Item.getInstance().getItem(Material.SHIELD, ChatColor.RED + "Nexus Wachter Schild", 1));
break;
}
KDFEntity armor = new KDFEntity(entity);
HashMap<Enchantment, Integer> armorE = new HashMap<Enchantment, Integer>();
armorE.put(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
armorE.put(Enchantment.DURABILITY, 3);
armorE.put(Enchantment.THORNS, 3);
armor.setItem(EnumItemSlot.FEET, Item.getInstance().getItem(Material.DIAMOND_BOOTS,
ChatColor.RED + "Wachter's Schoenen", 1, armorE, true));
armor.setItem(EnumItemSlot.LEGS, Item.getInstance().getItem(Material.DIAMOND_LEGGINGS,
ChatColor.RED + "Wachter's Broek", 1, armorE, true));
armor.setItem(EnumItemSlot.CHEST, Item.getInstance().getItem(Material.DIAMOND_CHESTPLATE,
ChatColor.RED + "Wachter's Kuras", 1, armorE, true));
armor.setItem(EnumItemSlot.HEAD,
Item.getInstance().getItem(Material.DIAMOND_HELMET, ChatColor.RED + "Wachter's Helm", 1, armorE, true));
}