Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1. @EventHandler
  2.     public void onPlayerMove(PlayerMoveEvent ev) {
  3.         Location loc = new Location(Bukkit.getServer().getWorld(cfg.getString("Blocks.block_1.loc.world")),
  4.                 cfg.getInt("Blocks.block_1.loc.X"),
  5.                 cfg.getInt("Blocks.block_1.loc.Y"),
  6.                 cfg.getInt("Blocks.block_1.loc.Z"));
  7.             if (checkLoc(ev.getPlayer().getLocation(), loc, 11)); {
  8.                 double radius = 11;
  9.                 List<Entity> near = loc.getWorld().getEntities();
  10.                 for(Entity e : near) {
  11.                 int countNear = near.size();
  12.                 if(e.getLocation().distance(loc) <= radius && countNear <= 4) {
  13.                     Player p = ev.getPlayer();
  14.                     Random random = new Random();
  15.                     loc.add(random.nextInt(6), 4, random.nextInt(6));
  16.                     Skeleton w = p.getWorld().spawn(loc, Skeleton.class);
  17.                     w.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(3);
  18.                     w.setMaxHealth(70);
  19.                     w.setHealth(70);
  20.                     w.setCustomName(ChatColor.DARK_PURPLE + "Страж Центру");
  21.                     w.setCustomNameVisible(true);
  22.                     w.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
  23.                     w.getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD));
  24.                     w.setLastDamage(6);
  25.                 }
  26.            
  27.                 }
  28.                        
  29.             }
  30.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement