Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onMobSpawn(CreatureSpawnEvent e) {
- Location location = e.getLocation();
- double distanceFromSpawnX = Objects.requireNonNull(Bukkit.getWorld("PLUGINNAAM")).getSpawnLocation().getX() - e.getLocation().getX();
- double distanceFromSpawnZ = Objects.requireNonNull(Bukkit.getWorld("PLUGINNAAM")).getSpawnLocation().getZ() - e.getLocation().getZ();
- double combinedDistanceFromSpawn = distanceFromSpawnX + distanceFromSpawnZ;
- double distanceFromSpawn = Math.abs(combinedDistanceFromSpawn);
- // if (e.getEntity() instanceof IronGolem) {
- // IronGolem ironGolem = (IronGolem) e.getEntity();
- // String block1 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 3, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
- // String block2 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 2, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
- // String block3 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 1, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
- // String block4 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 0, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
- // String blocks = block1 + ", " + block2 + ", " + block3 + ", " + block4;
- //
- // if (teamBlocks.containsKey(blocks)) {
- // Integer team = teamBlocks.get(blocks);
- // String[] flags = teamFlags.get(team).split(",");
- // String dungeon = flags[7].split("=")[1];
- //
- // if (dungeon.equals("true")) {
- // ironGolem.playEffect(EntityEffect.ENTITY_POOF);
- // ironGolem.setCustomName(ChatColor.DARK_RED + "Zombie Boss");
- // ironGolem.setCustomNameVisible(false);
- //
- // Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(PLUGINNAAM.instance, new Runnable() {
- // public void run() {
- // for (Entity entity : e.getEntity().getNearbyEntities(15, 5, 15)) {
- // if (entity instanceof Player) {
- // Bukkit.createBossBar(NamespacedKey.minecraft("0"), ChatColor.RED + "Zombie Boss", BarColor.RED, BarStyle.SOLID);
- // double ironGolemHealth = ironGolem.getHealth() / 20;
- // Objects.requireNonNull(Objects.requireNonNull(Bukkit.getBossBar(NamespacedKey.minecraft("0")))).setProgress(ironGolemHealth);
- // Objects.requireNonNull(Bukkit.getBossBar(NamespacedKey.minecraft("0"))).addPlayer(Objects.requireNonNull(((Player) entity).getPlayer()));
- //
- // if (Objects.requireNonNull(((Player) entity).getPlayer()).getGameMode().equals(GameMode.SURVIVAL)) {
- // ((IronGolem) e.getEntity()).setTarget(((LivingEntity) entity));
- // }
- //
- // if (!Objects.requireNonNull(((Player) entity).getPlayer()).getGameMode().equals(GameMode.SURVIVAL)) {
- // ((IronGolem) e.getEntity()).setTarget(null);
- // }
- // }
- // }
- // }
- // }, 0L, 5L);
- // } else {
- // e.setCancelled(true);
- // }
- // } else {
- // e.setCancelled(true);
- // }
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement