MinusKube / SmartInvs

Advanced Inventory API for your Minecraft Bukkit plugins.
https://minuskube.gitbook.io/smartinvs/
Apache License 2.0
262 stars 65 forks source link

Smart Inventory usage Detection #141

Closed dniym closed 3 years ago

dniym commented 4 years ago

Hi! I am trying to detect the use of a smart inventory by a third party plugin. I can determine if the plugin is using your library easy enough, but when im trying to check if an inventory is a smart inventory I am getting an error:

[code] if (IllegalStack.hasSmartInv() && inv.getPlayer() instanceof Player) { Player p = (Player) inv.getPlayer();

        InventoryManager sm = SmartInvsPlugin.manager();
        if(SmartInvsPlugin.manager() != null) 
        {
            if(p == null)
                System.out.println("Warning:  Player was null on inventory open...");

            if(sm.getInventory(p) != null) {
                System.out.println("DEBUG: found a smart inv");
                return true;
            } else {
                System.out.println("DEBUG: Was not a smart inv");
            }
        }  else {
              System.out.println("DEBUG:  WARNING manager() was null!");
    }

    }[/code]

what happens is this code never executes because the manager() is null.. Is there anything special I need to do to get the manager? I do not have the plugin or the code where the SmartInventory is created, I had hoped that I could just detect smartInv's then be able to determine if the inventory that was open was a smartInv's GUI so that I can make my plugin ignore any GUI created by this plugin.

MinusKube commented 4 years ago

That means the plugin is providing it's own InventoryManager, I guess you must check this plugin's code to see how they store their InventoryManager instance, and how to retrieve it.

portlek commented 4 years ago

Bukkit.getServer().getPluginManager().getPlugin("SmartInvs") ?