Solved openInventory() method problem

Discussion in 'Plugin Development' started by amatokus, Aug 19, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    amatokus

    Hi all.
    I'm posting this because I think the openInventory() method for bukkit 1.7.9 R0.2 is broken,

    I'm using it perfectly(I think so) but throws an error with no reason. This makes my event restart (InventoryOpenEvent) until the server overloads.

    If you guys could help me would be great.

    Here is my code:

    Code:
    @EventHandler
        public void onChestOpenEvent(InventoryOpenEvent event){
            Player player = getServer().getPlayer(event.getPlayer().getName().toString());
            player.sendMessage("event works");
            Block block = event.getPlayer().getTargetBlock(null,100);
            if(event.getPlayer().hasPermission("moneychest.use")){
                player.sendMessage("has permission");
                if(block.getType().equals(Material.CHEST)){
                    player.sendMessage("is chest");
                    if(isDoubleChest(block) == true){
                        player.sendMessage("is double chest");
                        Location loc = getDoubleChestLocation(block);
                        if(cfile.getList("money_chests").contains(loc.toString())){
                            player.sendMessage("is in chest list");
                        event.getPlayer().openInventory(Bukkit.createInventory(event.getPlayer(), 54, "Money chest"));
                        }
                    }else{
                        player.sendMessage("is single chest");
                        Location loc = block.getLocation();
                        if(cfile.getList("money_chests").contains(loc.toString())){
                            player.sendMessage("is in chest list");
                        event.getPlayer().openInventory(Bukkit.createInventory(event.getPlayer(), 54, "Money chest"));
                        }
                    }
    
                }
            }else{
                event.setCancelled(true);
                player.sendMessage(announcement + "You are not allowed to open this chest.");
                }
        }

    and there is the error (also looping since event is looping with error until overload):

    Code:
    me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:237) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
    [19:49:10 WARN]: Can't keep up! Did the system time change, or is the server ove
    rloaded? Running 6029ms behind, skipping 120 tick(s)
    >
    Line n°237 is:

    Code:
    event.getPlayer().openInventory(Bukkit.createInventory(event.getPlayer(), 54, "Money chest"));
     
  2. Offline

    finalblade1234

    In the error it says you're using an R3 craftbukkit server. but at the top you say you're using R2 bukkit, perhaps something changed between the updates. Try using the same builds. (I'm probably wrong though :/)
     
  3. Offline

    amatokus

    @finalblade1234 I tried to put a brand new craftbukkit 1.7.9 - R0.2 in. Same error. :/
     
  4. Offline

    Synapz

    @amatokus Try to set the first paramter of Bukki#createInventory() to null instead of event.getPlayer()
     
  5. Offline

    amatokus

    @Synapz Changed to null, having the same problem.

    By the way, when I decompose the line like so:
    Code:
    event
    .getPlayer()
    .openInventory(
    Bukkit
    .createInventory(
    event.
    getPlayer()
    , 54
    , "Money chest"
    ));
    The error line is the one with .openInventory(

    EDIT: I have the impression this happens because I right click a chest. I can see during 0.1 second my inventory but then I see the chest inventory :/ Maybe there is a way not to open the chest but still having the animation?

    EDIT: I did event.getView().close(); I can now see my inventory BUT the plugin is throwing me infinite errors!!!!! It's not stoping! still on the same line, I think I read cannot cast ????.CraftPlayer to ???.Inventory
     
    Last edited: Aug 19, 2015
  6. Offline

    CraftCreeper6

    @amatokus
    That's not quite how it works. Well, you can't cast CraftPlayer to an inventory, an inventory isn't a CraftPlayer, is it?
     
  7. Offline

    amatokus

  8. Offline

    CraftCreeper6

    @amatokus
    Set the owner to null? Just as a try.
     
  9. Offline

    amatokus

  10. Offline

    CraftCreeper6

    @amatokus
    Create the inventory first as an Object, then open it.
     
  11. Offline

    amatokus

    @CraftCreeper6 Doesn't change anything :/, but still thank you for helping :)
     
  12. Offline

    Synapz

    @amatokus
    You use event.getPlayer().openInventory(...) why suddenly do that when you have a player reference you set?
    Worth a shot, try to use player.openInventory(...) instead. I honestly dont see anything else that can be wrong, also show me your imports?
     
  13. Offline

    amatokus

    @Synapz Still not working.

    Here are my imports:

    Code:
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.logging.Logger;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.block.Block;
    import org.bukkit.block.BlockFace;
    import org.bukkit.block.Chest;
    import org.bukkit.block.DoubleChest;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.InvalidConfigurationException;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.configuration.file.YamlConfiguration;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;
    import org.bukkit.event.inventory.InventoryCloseEvent;
    import org.bukkit.event.inventory.InventoryOpenEvent;
    import org.bukkit.event.inventory.InventoryType;
    import org.bukkit.inventory.DoubleChestInventory;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.RegisteredServiceProvider;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.event.EventHandler;
    import org.bukkit.Location;
     
  14. Offline

    megamichiel

    @amatokus
    Would u mind showing the whole stacktrace? Because what you sent isn't all
     
  15. Offline

    amatokus

    @megamichiel It will be impossible for me to show the full stacktrace because the event is looping an error, but I'll give you as much as I can when I could!

    I can only copy this:
    Code:
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
    [13:23:10 ERROR]: Could not pass event InventoryCloseEvent to MoneyChest v0.1
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:294) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.handleInventor
    yCloseEvent(CraftEventFactory.java:721) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-
    9-gaceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.closeInventory(EntityPlayer
    .java:816) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.closeInventory
    (CraftHumanEntity.java:323) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b
    3091jnks]
            at org.bukkit.inventory.InventoryView.close(InventoryView.java:194) ~[cr
    aftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:240) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callInventoryO
    penEvent(CraftEventFactory.java:598) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-g
    aceeb44-b3091jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.openContainer(EntityPlayer.
    java:627) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity.openInventory(
    CraftHumanEntity.java:193) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3
    091jnks]
            at me.amatokus8669.plugin.moneychest.MoneyChest.onChestOpenEvent(MoneyCh
    est.java:239) ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gaceeb44-b3091jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-9-gace
    @megamichiel

    Line 239 is player.openInventory(inventory);

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 11, 2016
  16. Offline

    megamichiel

    @amatokus
    Well, I believe the thing causing it is when you open a chest inventory, it opens another inventory, but you are still looking at a chest, so you open another inventory and it loops forever.
     
  17. Offline

    amatokus

    @megamichiel solved by replacing the inventoryopenevent by playerinteractevent and checking if block is chest then canceling event.
     
Thread Status:
Not open for further replies.

Share This Page