onInventoryClose How to? - Bukkit Contribution

Discussion in 'Plugin Development' started by rodey, Jul 6, 2011.

Thread Status:
Not open for further replies.
  1. Hi,

    I can't figure out how to use the onInventoryClose()
    Can someone help me...


    Code:
    plugin.getServer().getPluginManager().registerEvent(Event.Type.INVENTORY_CLOSE, this, Event.Priority.Normal, plugin);
    
    public void onInventoryClose(InventoryCloseEvent event) {
        log.info("Inventory Closed");
    }
    
     
  2. Offline

    ItsHarry

    That's a good question O_O. Have no idea
     
  3. Offline

    Jaker232

    For that type, I'd rather do
    Code:
    pm.registerEvent(Event.Type.INVENTORY_CLOSE, PlayerListener, Event.Priority.Normal, this);
    and in PlayerListener at the bottom,

    Code:
        public void onInventoryClose() {
            // bla bla bla
        }
    Replace "// bla bla bla" with the code. You won't need to return true, because that's for Booleans.
     
  4. I get an error that INVENTORY_CLOSE isn't supported, but got Bukkit Contribution running on the server...

    Code:
    date?): Event INVENTORY_CLOSE is not supported
    java.lang.IllegalArgumentException: Event INVENTORY_CLOSE is not supported
            at org.bukkit.plugin.java.JavaPluginLoader.createExecutor(JavaPluginLoad
    er.java:839)
            at org.bukkit.plugin.RegisteredListener.<init>(RegisteredListener.java:2
    6)
            at org.bukkit.plugin.SimplePluginManager.registerEvent(SimplePluginManag
    er.java:360)
            at nl.rodey.personalchest.pchestMain.onEnable(pchestMain.java:35)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:126)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:857)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:264)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:151)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:136
    )
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:271)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:148)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
     
  5. Offline

    Jaker232

    I guess I got the outdated event.

    Try doing INVENTORY_ and see any suggestions.
     
Thread Status:
Not open for further replies.

Share This Page