Advertisement
Cool_boy21

Untitled

May 10th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public ArmorStand addStand(Location loc, GameTeam team) {
  2. Collection<Entity> near = loc.add(0, 1, 0).getWorld().getNearbyEntities(loc, 2, 2, 2);
  3. boolean nearStand = false;
  4. for (Entity st : near) {
  5. if (st instanceof ArmorStand && st.getName().startsWith("Турель")) {
  6. nearStand = true;
  7. }
  8. }
  9. if (!nearStand) {
  10. ArmorStand turret = (ArmorStand) loc.getWorld().spawnEntity(loc.add(0.5, 1, 0.5), EntityType.ARMOR_STAND);
  11. turret.getEquipment().setHelmet(new ItemStack(Material.DISPENSER, 1));
  12. turret.setSmall(true);
  13. turret.setInvulnerable(true);
  14. turret.setCustomName("Турель");
  15. turret.setGravity(false);
  16. turret.setCustomNameVisible(true);
  17. turret.setMetadata("turret", new FixedMetadataValue(plugin, true));
  18. turret.setMetadata("lived", new FixedMetadataValue(plugin, 0));
  19. turret.setMetadata("type", new FixedMetadataValue(plugin, "normal"));
  20. team.addTurret(turret);
  21. stands.add(turret);
  22. return turret;
  23. }
  24. return;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement