Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Location[] circleFrom(Location l){
- List<Location> returnList = new ArrayList<Location>();
- for(int x = 2; x>=-2; x--){
- for(int z = 2; z>=-2; z--){
- for(int y = 0; y>=1; y++){
- if(!(Math.abs(z)==1&&x==0)||!(Math.abs(x)==1&&z==0)||x!=z){
- returnList.add(new Location(l.getWorld(), l.getX()-x, l.getY()+y, l.getZ()-z));
- }
- }
- }
- }
- return returnList.toArray(new Location[returnList.size()]);
- }
- @EventHandler
- public void gandalf(PlayerInteractEvent e) {
- if(e.getAction()!=Action.RIGHT_CLICK_AIR||e.getAction()!=Action.RIGHT_CLICK_BLOCK)return;
- Player p = e.getPlayer();
- Action a = e.getAction();
- if (p.getItemInHand().getType() == Material.STICK) {
- Location location=p.getLocation();
- for(int i = 0; i<circleFrom(location).length; i++){
- Location l = circleFrom(location)[i];
- Material changeTo = Material.SPONGE;
- new BukkitRunnable(){
- public void run(){
- l.getBlock().setType(changeTo);
- }
- }.runTaskLater(this, i*2);//i*20 = (i) seconds
- }
- new BukkitRunnable(){
- public void run(){
- for(Location l : circleFrom(location)){
- l.getBlock().setType(Material.AIR);
- }
- }.runTaskLater(this, 3.8);//2 seconds + 18 blocks that each takes 0.1
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement