本文整理汇总了Java中org.bukkit.entity.Giant.setCustomName方法的典型用法代码示例。如果您正苦于以下问题:Java Giant.setCustomName方法的具体用法?Java Giant.setCustomName怎么用?Java Giant.setCustomName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Giant
的用法示例。
在下文中一共展示了Giant.setCustomName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spawnGrinchGiant
import org.bukkit.entity.Giant; //导入方法依赖的package包/类
public static void spawnGrinchGiant(final Player p, final Block b){
final Location bLoc = b.getLocation();
final World w = p.getWorld();
final Giant g = (Giant)w.spawnEntity(bLoc, EntityType.GIANT);
g.setCanPickupItems(false);
g.setCustomName(ChatColor.GREEN + "The Grinch!");
g.setRemoveWhenFarAway(false);
g.setMaxHealth(200.0);
g.setHealth(200.0);
g.setTarget((LivingEntity)p);
g.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1000000, 1000000));
final int id = plugin.getServer().getScheduler().runTaskTimer(plugin, new Runnable() {
public void run() {
final Arrow arrow = ((LivingEntity) g).launchProjectile(Arrow.class);
arrow.setShooter(((LivingEntity) g));
if(!(arrow.isOnGround()) || arrow.isDead() == false || arrow.isValid() == true){
arrow.getWorld().playEffect(arrow.getLocation(), Effect.STEP_SOUND, Material.EMERALD_BLOCK);
arrow.getWorld().playEffect(arrow.getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK);
}
}
}, 1L, 1L).getTaskId();
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
public void run() {
if (spawnedGrinch == 0){
plugin.getServer().getScheduler().cancelTask(id);
}
}
}, 0, 20L);
}
示例2: bossGiant
import org.bukkit.entity.Giant; //导入方法依赖的package包/类
public void bossGiant() {
Giant giant = (Giant) l.getWorld().spawnEntity(l, EntityType.GIANT);
giant.setMaxHealth(1500);
giant.setHealth(giant.getMaxHealth());
giant.setCustomName("Zombie Gigante");
giant.teleport(l);
}