package com.spokeplatforms;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Mains extends JavaPlugin implements Listener{
public void onEnable(){
Bukkit.getPluginManager().registerEvents(this, this);
}
public void onDisable(){
//no.
}
@EventHandler
public void onInteract(PlayerInteractEvent e) throws InterruptedException{
long s = 250;
if(e.getAction().equals(Action.LEFT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.LEFT_CLICK_BLOCK)) return;
if(!(e.getClickedBlock().getType() == Material.BEDROCK)) return;
int X = e.getClickedBlock().getX();
int Y = e.getClickedBlock().getY();
int Z = e.getClickedBlock().getZ();
Player p = e.getPlayer();
Block core = e.getClickedBlock();
Block b1 = p.getWorld().getBlockAt(X-1, Y, Z);
Block b2 = p.getWorld().getBlockAt(X+1, Y, Z);
Block b3 = p.getWorld().getBlockAt(X, Y, Z-1);
Block b4 = p.getWorld().getBlockAt(X, Y, Z+1);
Block b5 = p.getWorld().getBlockAt(X-2, Y, Z);
Block b6 = p.getWorld().getBlockAt(X+2, Y, Z);
Block b7 = p.getWorld().getBlockAt(X, Y, Z-2);
Block b8 = p.getWorld().getBlockAt(X, Y, Z+2);
Block b9 = p.getWorld().getBlockAt(X-1, Y, Z-1);
Block ba = p.getWorld().getBlockAt(X-1, Y, Z+1);
Block bb = p.getWorld().getBlockAt(X+1, Y, Z-1);
Block bc = p.getWorld().getBlockAt(X+1, Y, Z+1);
core.setType(Material.GLOWSTONE);
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(this, new Runnable() {
@Override
public void run() {
//Thread.sleep(s);
b1.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b1.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
b2.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b2.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
b3.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b3.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
b4.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b4.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
//Thread.sleep(s);
b5.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b5.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
b6.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b6.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
b7.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b7.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
b8.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b8.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
//Thread.sleep(s);
b9.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, b9.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
ba.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, ba.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
bb.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, bb.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
bc.setType(Material.GLASS);
p.spawnParticle(Particle.CLOUD, bc.getLocation(), 3);
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 3F, 0.5F);
//Thread.sleep(s);
}
}, 1 * 20);
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(this, new Runnable() {
@Override
public void run() {
p.playSound(core.getLocation(), Sound.BLOCK_GLASS_BREAK, 10F, 0.1F);
b1.setType(Material.AIR);
b2.setType(Material.AIR);
b3.setType(Material.AIR);
b4.setType(Material.AIR);
b5.setType(Material.AIR);
b6.setType(Material.AIR);
b7.setType(Material.AIR);
b8.setType(Material.AIR);
b9.setType(Material.AIR);
ba.setType(Material.AIR);
bb.setType(Material.AIR);
bc.setType(Material.AIR);
p.spawnParticle(Particle.CLOUD, core.getLocation(), 100);
return;
}
}, 8 * 20);
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(this, new Runnable() {
public void run() {
core.setType(Material.BEDROCK);
}
}, 10 * 20);
return;
}
}