package me.xgafg20.LavaGenerator; import org.bukkit.Bukkit; import org.bukkit.ChatColor; 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.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener{ public void onEnable() { getServer().getConsoleSender().sendMessage("[LavaGenerator]" + ChatColor.GREEN +" Plugin Run shode ast!"); this.getServer().getPluginManager().registerEvents(this, this); } public void onDisable() { } @EventHandler public void onPlayerInteract(PlayerInteractEvent e) { Block block = e.getClickedBlock(); Player p = e.getPlayer(); Action action = e.getAction(); Material gethand = p.getInventory().getItemInMainHand().getType(); PlayerInventory inventory = e.getPlayer().getInventory(); if (action == Action.RIGHT_CLICK_BLOCK && block.getType() == Material.OBSIDIAN && gethand == Material.BUCKET) { block.setType(Material.AIR); inventory.removeItem(new ItemStack[] { new ItemStack(Material.BUCKET, 1) }); p.getInventory().addItem(new ItemStack[] { new ItemStack(Material.LAVA_BUCKET, 1) }); p.playSound(p.getLocation(),Sound.BLOCK_LAVA_POP ,3, 3); p.spawnParticle(Particle.FLAME,block.getLocation().add(0.5D, 0.5D, 0.5D),40,0.2,0.2,0.2,0.07); e.setCancelled(true); Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { @Override public void run() { // TODO Auto-generated method stub } }, 5*20); } } }