Hi! I'm currently developing a MMO-plugin and most of it is doing good. I have a ice wand which is supposed to freeze players when they are hit, but i don't really know where to start. I believe i need a for-loop and loop through every block around the player, but my math is really, really terrible. I only need the for-loop, as saving the blocks to a hashmap is no problem. Are there any snippets anyone wants to share? Thanks
This returns a cube around a location. Have fun Code:java public static Location[] getCube(Location l, int rad) { HashSet<Location> list = new HashSet<Location>(); for (int i = -rad; i <= rad; i++) { for (int y = -rad; y <= rad; y++) { list.add(l.clone().add(-rad, y, i)); list.add(l.clone().add(rad, y, i)); list.add(l.clone().add(y, -rad, i)); list.add(l.clone().add(y, rad, i)); list.add(l.clone().add(i, y, -rad)); list.add(l.clone().add(i, y, rad)); } } return list.toArray(new Location[list.size()]); } You'll need to use the block.setType(Material) method, and a delayed task for setting the type back to the original.