Im making a nuke plugin and I need to delay a tnt explosion. I already have the Bukkit runnable to delay but I dont know how to trigger the explosion. Here is what I have: Code: package me.xXMaTTHDXx.Nuke; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Arrow; 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.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; public class Nuke extends JavaPlugin implements Listener{ public static Nuke plugin; public final Logger logger = Logger.getLogger("Minecraft"); public FileConfiguration config; public List<String> cooldown = new ArrayList<String>(); @Override public void onDisable(){ PluginDescriptionFile pdfFile = this.getDescription(); this.logger.info(pdfFile.getName() +"version" + pdfFile.getVersion() + "is now disabled"); } @Override public void onEnable(){ PluginDescriptionFile pdfFile = this.getDescription(); this.logger.info(pdfFile.getName() +"version" + pdfFile.getVersion() + "is now enabled"); getServer().getPluginManager().registerEvents(this, this); config = this.getConfig(); getConfig().options().copyDefaults(true); saveDefaultConfig(); ShapedRecipe Nuke = new ShapedRecipe(new ItemStack(Material.TNT, 1)); Nuke.shape("NSN", "NSN", "NSN"); Nuke.setIngredient('N', Material.TNT); Nuke.setIngredient('S', Material.SULPHUR); getServer().addRecipe(Nuke); } @EventHandler public void onClick(PlayerInteractEvent event){ Player p = event.getPlayer(); Block b = event.getClickedBlock(); ShapedRecipe Nuke = new ShapedRecipe(new ItemStack(Material.TNT, 1)); if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)){ if(b == Nuke){ new BukkitRunnable(){ @Override public void run(){ }}.runTaskLater(this, 4*20); } } } }
You can use this: Code: world.createExplosion(location, 1); I think the "1" value is the size of the explosion.
xXMaTTHDXx yea, but that isn't a big deal. just make a: Code: Location location = event.getClickedBlock().GetLocation(); World world = player.getWorld(); world.createExplosion(location, 1); Hope this helps! (This is the first time helping someone so sorry if i'm making a mistake)