Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Boolean blocks == false;
- Player tracked = null;
- public void spawnBlocks(Player p) {
- blocks == true;
- Location l = p.getWorld.getLocation;
- tracked = p;
- double x = l.getX();
- double y = l.gety();
- double z = l.getz();
- for (int i = 1; i < 5; i++) {
- Random rand = new Random();
- double xval = rand.nextDouble((x + 5) - (x - 5)) + 1) + (x - 5);
- double yval = rand.nextDouble((y + 5) - (y - 5)) + 1) + (y - 5);
- Location rand = new Location(p.getWorld, xval, yval, z + 10);
- Byte blockData = 0x0;
- p.getWorld().spawnFallingBlock(rand, Material.Bedrock, blockData);
- }
- @EventHandler
- public void blockHit(EntityChangeBlockEvent e) {
- if (!blocks) {
- return;
- }
- Location pl = tracked.getPlayer;
- Location bl = e.getBlock.getWorld.getLocation;
- if (pl.equals(bl)) {
- pl.setHealth(5);
- }
- e.setCancelled(true);
- blocks == false;
- tracked == null;
- }
- System.out.println("Hello, World");
- double z = 15;
- int minx = 140;
- int maxx = 160;
- int miny = 140;
- int maxy = 160;
- for (int i = 0; i < 5; i++) {
- System.out.println("Hello, World");
- Random rand = new Random();
- int xval = rand.nextInt((maxx - minx) + 1) + minx;
- int yval = rand.nextInt((maxy - miny) + 1) + miny;
- System.out.println("Point: " + i + " Location: " + xval + "," + yval + "," + z+10);
- double xva = (double) xval;
- System.out.println(xva);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement