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


Java Zombie.setCustomName方法代码示例

本文整理汇总了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.
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:22,代码来源:Pinata.java

示例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);
    }
}
 
开发者ID:Project-Coalesce,项目名称:UHC,代码行数:19,代码来源:JoinQuitHandlers.java

示例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);
}
 
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:19,代码来源:ZombieSpawner.java

示例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);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:15,代码来源:ZombiesModule.java

示例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;
}
 
开发者ID:DemigodsRPG,项目名称:Demigods3,代码行数:12,代码来源:Swarm.java

示例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));

}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:50,代码来源:NexusGuard.java


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