本文整理汇总了Java中org.bukkit.entity.Giant类的典型用法代码示例。如果您正苦于以下问题:Java Giant类的具体用法?Java Giant怎么用?Java Giant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Giant类属于org.bukkit.entity包,在下文中一共展示了Giant类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMobDie
import org.bukkit.entity.Giant; //导入依赖的package包/类
@EventHandler
public void onMobDie(EntityDeathEvent e){
AllItems items = new AllItems();
Location l = e.getEntity().getLocation();
World w = l.getWorld();
e.getDrops().clear();
e.setDroppedExp(0);
if (e.getEntity() instanceof Zombie){
if (new Random().nextInt(5) >= 3){
w.dropItemNaturally(l, new ItemMaker(Material.EMERALD).setAmount(new Random().nextInt(4) + 1).build());
if (new Random().nextBoolean()){
w.dropItemNaturally(l, items.weapons.get(new Random().nextInt(items.weapons.size())));
} else {
w.dropItemNaturally(l, items.health.get(new Random().nextInt(items.health.size())));
}
}
}
if (e.getEntity() instanceof Giant){
if (new Random().nextInt(5) > 3){
w.dropItemNaturally(l, new ItemMaker(Material.NETHER_STAR).setAmount(new Random().nextInt(4) + 1).build());
}
}
}
示例2: onGrinchArrowHitPlayer
import org.bukkit.entity.Giant; //导入依赖的package包/类
@EventHandler
public void onGrinchArrowHitPlayer(EntityDamageByEntityEvent e){
Entity e1 = e.getEntity();
Entity d1 = e.getDamager();
if(e.getEntity().getWorld().getName() != "Christmas"){
return;
}
if(e1 instanceof Player && d1 instanceof Arrow){
if(((Arrow)d1).getShooter() instanceof Giant){
Player hurt = (Player) e1;
hurt.setFireTicks(hurt.getFireTicks() + 20);
}
}
}
示例3: onPlayerDamage
import org.bukkit.entity.Giant; //导入依赖的package包/类
@EventHandler
public void onPlayerDamage(final EntityDamageByEntityEvent e) {
World w = e.getEntity().getWorld();
if(e.getEntity().getWorld().getName() != "Christmas"){
return;
}
if (e.getEntity() instanceof Giant) {
if (e.getDamager() instanceof Player) {
final Player p = (Player) e.getDamager();
if(p.getLocation().subtract(0,1,0).getBlock().getType() == Material.AIR){
e.setCancelled(true);
Location ALoc = new Location(p.getLocation().getWorld(),p.getLocation().getX(), w.getHighestBlockYAt(p.getLocation()), p.getLocation().getZ(), p.getLocation().getYaw(), p.getLocation().getPitch());
p.teleport(ALoc);
}else{
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
e.getEntity().getWorld().createExplosion(e.getEntity().getLocation(), 10.0F);
}
},20 * 2);
}
}else{
e.setCancelled(true);
}
}
}
示例4: onDamage
import org.bukkit.entity.Giant; //导入依赖的package包/类
@EventHandler
void onDamage(EntityDamageByEntityEvent e) {
if (Metodos.boss == null) return;
if (e.getEntity() == Metodos.boss) {
((Giant)Metodos.boss).setCustomName(Main.getInstance().getConfig().getString("BossName").replace("&", "§").replace("{vida}", String.valueOf(((Giant) Metodos.boss).getHealth())).replace("<3", "♥").replace("{max}", String.valueOf(Main.getInstance().getConfig().getInt("BossHealth"))));
e.setDamage((int) (e.getDamage() * 1.3));
}
}
示例5: 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);
}
示例6: giantAttacks
import org.bukkit.entity.Giant; //导入依赖的package包/类
public static void giantAttacks(Giant boss, Player damager){
int attack = r.nextInt(8);
List<Player> near = new ArrayList<>();
boss.getNearbyEntities(7, 7, 7).forEach(en -> {
if (en instanceof Player) {
near.add((Player) en);
}
});
switch (attack){
case 0:
near.forEach(p -> {
if (!p.equals(damager)) {
p.getWorld().strikeLightningEffect(p.getLocation());
p.damage(0.5);
if (r.nextBoolean()) p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 40, 0));
if (r.nextBoolean()) p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 30, 0));
}
});
damager.getWorld().strikeLightningEffect(damager.getLocation());
damager.damage(0.5);
if (r.nextBoolean()) damager.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 40, 0));
if (r.nextBoolean()) damager.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 30, 0));
break;
case 1:
ArrayList<Location> locs = Utils.getCircle(boss.getEyeLocation(), 7, 30);
locs.forEach(l -> { //Change Color
ParticleEffect.REDSTONE.display(new ParticleEffect.OrdinaryColor(100, 60, 50), l, 50);
ParticleEffect.REDSTONE.display(new ParticleEffect.OrdinaryColor(200, 60, 50), l.subtract(0, 7, 0), 50);
});
near.forEach(p -> {
if (!p.equals(damager)) {
ParticleEffect.EXPLOSION_NORMAL.display(new Vector(0, 0, 0), 4, p.getLocation(), 50);
p.damage(0.5);
}
});
ParticleEffect.EXPLOSION_NORMAL.display(new Vector(0, 0, 0), 4, damager.getLocation(), 50);
damager.damage(0.5);
break;
case 2:
if (boss.getHealth() + 20 >= boss.getMaxHealth()) boss.setHealth(boss.getMaxHealth());
boss.setHealth(boss.getHealth() + 20);
break;
default:
break;
}
}
示例7: giantAttacks
import org.bukkit.entity.Giant; //导入依赖的package包/类
public static void giantAttacks(Giant boss, Player damager){
int attack = r.nextInt(8);
List<Player> near = new ArrayList<>();
boss.getNearbyEntities(7, 7, 7).forEach(en -> {
if (en instanceof Player) {
near.add((Player) en);
}
});
switch (attack){
case 0:
near.forEach(p -> {
if (!p.equals(damager)) {
p.getWorld().strikeLightningEffect(p.getLocation());
plugin.getHealth().damage(TOA.getPlayer(p), 10);
if (r.nextBoolean()) p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 40, 0));
if (r.nextBoolean()) p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 30, 0));
}
});
damager.getWorld().strikeLightningEffect(damager.getLocation());
plugin.getHealth().damage(TOA.getPlayer(damager), 20);
if (r.nextBoolean()) damager.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 40, 0));
if (r.nextBoolean()) damager.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 30, 0));
break;
case 1:
ArrayList<Location> locs = Utils.getCircle(boss.getEyeLocation(), 7, 30);
locs.forEach(l -> {
ParticleEffect.REDSTONE.sendColor(plugin.getServer().getOnlinePlayers(), l, Color.fromBGR(100, 60, 50));
ParticleEffect.REDSTONE.sendColor(plugin.getServer().getOnlinePlayers(), l.subtract(0, 7, 0), Color.fromBGR(200, 60, 50));
});
near.forEach(p -> {
if (!p.equals(damager)) {
ParticleEffect.EXPLOSION_NORMAL.send(plugin.getServer().getOnlinePlayers(), p.getLocation(), 0, 0, 0, 1, 10);
plugin.getHealth().damage(TOA.getPlayer(p), 30);
}
});
ParticleEffect.EXPLOSION_NORMAL.send(plugin.getServer().getOnlinePlayers(), damager.getLocation(), 0, 0, 0, 1, 10);
plugin.getHealth().damage(TOA.getPlayer(damager), 30);
break;
case 2:
if (boss.getHealth() + 20 >= boss.getMaxHealth()) boss.setHealth(boss.getMaxHealth());
boss.setHealth(boss.getHealth() + 20);
break;
default:
break;
}
}
示例8: getBossHealth
import org.bukkit.entity.Giant; //导入依赖的package包/类
public static int getBossHealth() {
if (boss == null) {
return 0;
}
return ((Giant) boss).getHealth();
}
示例9: onBossDeath
import org.bukkit.entity.Giant; //导入依赖的package包/类
@EventHandler
void onBossDeath(EntityDeathEvent e) {
if (e.getEntity().getKiller() instanceof Player && e.getEntity() instanceof Giant && isAcontecendo()) {
setGanhador(e.getEntity().getKiller());
}
}
示例10: 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);
}