Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. @EventHandler
  2. public void onMobSpawn(CreatureSpawnEvent e) {
  3. Location location = e.getLocation();
  4. double distanceFromSpawnX = Objects.requireNonNull(Bukkit.getWorld("PLUGINNAAM")).getSpawnLocation().getX() - e.getLocation().getX();
  5. double distanceFromSpawnZ = Objects.requireNonNull(Bukkit.getWorld("PLUGINNAAM")).getSpawnLocation().getZ() - e.getLocation().getZ();
  6. double combinedDistanceFromSpawn = distanceFromSpawnX + distanceFromSpawnZ;
  7. double distanceFromSpawn = Math.abs(combinedDistanceFromSpawn);
  8.  
  9. // if (e.getEntity() instanceof IronGolem) {
  10. // IronGolem ironGolem = (IronGolem) e.getEntity();
  11. // String block1 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 3, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
  12. // String block2 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 2, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
  13. // String block3 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 1, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
  14. // String block4 = ironGolem.getWorld().getBlockAt(ironGolem.getLocation().getBlockX(), 0, ironGolem.getLocation().getBlockZ()).getType().toString().replace("Material.", "");
  15. // String blocks = block1 + ", " + block2 + ", " + block3 + ", " + block4;
  16. //
  17. // if (teamBlocks.containsKey(blocks)) {
  18. // Integer team = teamBlocks.get(blocks);
  19. // String[] flags = teamFlags.get(team).split(",");
  20. // String dungeon = flags[7].split("=")[1];
  21. //
  22. // if (dungeon.equals("true")) {
  23. // ironGolem.playEffect(EntityEffect.ENTITY_POOF);
  24. // ironGolem.setCustomName(ChatColor.DARK_RED + "Zombie Boss");
  25. // ironGolem.setCustomNameVisible(false);
  26. //
  27. // Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(PLUGINNAAM.instance, new Runnable() {
  28. // public void run() {
  29. // for (Entity entity : e.getEntity().getNearbyEntities(15, 5, 15)) {
  30. // if (entity instanceof Player) {
  31. // Bukkit.createBossBar(NamespacedKey.minecraft("0"), ChatColor.RED + "Zombie Boss", BarColor.RED, BarStyle.SOLID);
  32. // double ironGolemHealth = ironGolem.getHealth() / 20;
  33. // Objects.requireNonNull(Objects.requireNonNull(Bukkit.getBossBar(NamespacedKey.minecraft("0")))).setProgress(ironGolemHealth);
  34. // Objects.requireNonNull(Bukkit.getBossBar(NamespacedKey.minecraft("0"))).addPlayer(Objects.requireNonNull(((Player) entity).getPlayer()));
  35. //
  36. // if (Objects.requireNonNull(((Player) entity).getPlayer()).getGameMode().equals(GameMode.SURVIVAL)) {
  37. // ((IronGolem) e.getEntity()).setTarget(((LivingEntity) entity));
  38. // }
  39. //
  40. // if (!Objects.requireNonNull(((Player) entity).getPlayer()).getGameMode().equals(GameMode.SURVIVAL)) {
  41. // ((IronGolem) e.getEntity()).setTarget(null);
  42. // }
  43. // }
  44. // }
  45. // }
  46. // }, 0L, 5L);
  47. // } else {
  48. // e.setCancelled(true);
  49. // }
  50. // } else {
  51. // e.setCancelled(true);
  52. // }
  53. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement