Advertisement
Guest User

Zuendung

a guest
Nov 17th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. if(cmd.getName().equalsIgnoreCase("test")) {
  2. if(args[0].equalsIgnoreCase("fire")) {
  3. World w = getServer().getWorld("world");
  4. Location loc = new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
  5. Creeper creeper = (Creeper) w.spawnEntity(loc, EntityType.CREEPER);
  6. creeper.setCustomName("§4Arrow Turret");
  7. creeper.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 10000000, 1000000000));
  8. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  9.  
  10. @Override
  11. public void run() {
  12.  
  13. Vector toTarget = p.getLocation().toVector().subtract(((Location) creeper).toVector());
  14. Vector vect = new Vector(toTarget.getX(), toTarget.getY(), toTarget.getZ());
  15. Vector direction = vect.multiply(3D);
  16.  
  17. Arrow a = w.spawnArrow(creeper.getEyeLocation(), direction, 10, 0);
  18. for(Player all : Bukkit.getOnlinePlayers()) {
  19. all.sendMessage("§cZündung");
  20. }
  21. }
  22.  
  23. }, 20, 20);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement