import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { public void onEnable(){ Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler public void onInventoryClose(InventoryCloseEvent e) { Bukkit.broadcastMessage("Closed!"); e.getPlayer().teleport(new Location(e.getPlayer().getWorld(), 0, 100, 0)); } @EventHandler public void onBlockPlace(BlockPlaceEvent e){ Inventory menu = Bukkit.createInventory(null, InventoryType.CHEST, "Title"); for(int i = 11; i < 16; i++) { menu.setItem(i, new ItemStack(Material.WOOL, 1)); } e.getPlayer().openInventory(menu); } }
After placing a block and closing the custom inventory, "Closed" is continously broadcasted until the server shuts itself down. While mostly silent, under some circumstances a humongous stacktrace showed up instead of a server shutdown. This error log as well as the compiled code are attached.