Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Boolean blocks == false;
  2. Player tracked = null;
  3. public void spawnBlocks(Player p) {
  4. blocks == true;
  5. Location l = p.getWorld.getLocation;
  6. tracked = p;
  7. double x = l.getX();
  8. double y = l.gety();
  9. double z = l.getz();
  10.  
  11. for (int i = 1; i < 5; i++) {
  12.  
  13. Random rand = new Random();
  14. double xval = rand.nextDouble((x + 5) - (x - 5)) + 1) + (x - 5);
  15. double yval = rand.nextDouble((y + 5) - (y - 5)) + 1) + (y - 5);
  16. Location rand = new Location(p.getWorld, xval, yval, z + 10);
  17. Byte blockData = 0x0;
  18. p.getWorld().spawnFallingBlock(rand, Material.Bedrock, blockData);
  19. }
  20. @EventHandler
  21. public void blockHit(EntityChangeBlockEvent e) {
  22. if (!blocks) {
  23. return;
  24. }
  25. Location pl = tracked.getPlayer;
  26. Location bl = e.getBlock.getWorld.getLocation;
  27. if (pl.equals(bl)) {
  28. pl.setHealth(5);
  29. }
  30. e.setCancelled(true);
  31. blocks == false;
  32. tracked == null;
  33. }
  34.  
  35. System.out.println("Hello, World");
  36. double z = 15;
  37. int minx = 140;
  38. int maxx = 160;
  39. int miny = 140;
  40.  
  41. int maxy = 160;
  42. for (int i = 0; i < 5; i++) {
  43. System.out.println("Hello, World");
  44. Random rand = new Random();
  45. int xval = rand.nextInt((maxx - minx) + 1) + minx;
  46. int yval = rand.nextInt((maxy - miny) + 1) + miny;
  47. System.out.println("Point: " + i + " Location: " + xval + "," + yval + "," + z+10);
  48. double xva = (double) xval;
  49. System.out.println(xva);
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement