Fake Inventories - Easily create fake inventories that players can interact with

This is a discussion topic for the Ore project, Fake Inventories. View the full project on Ore for downloads and more information.


Fake Inventories

This plugin is a developer library that allow other plugins to create fake inventories.

Due to technical limitations, this works by placing a fake chest near the player (only the player who will see the inventory will see it, the chest is not real), and forcing the player to open it by game packets.

The content of the chest is define by the plugin that is using it.

Author SupremeMortal
Note I’m not a maintainer of the plugin but I can help if you have issues using it with PowerNukkit.
License GNU v3.0
Source code GitHub - CloudburstMC/FakeInventories: Create fake inventories
Issue Tracker Issues · CloudburstMC/FakeInventories · GitHub
Compatiblity Tested without problems on PowerNukkit 1.6.0.0-PN-SNAPSHOT
Requirements None

Usage

plugin.yml:

depend:
 - FakeInventories

YourPlugin.java

    public void onEnable() {
        RegisteredServiceProvider<FakeInventories> provider = getServer().getServiceManager().getProvider(FakeInventories.class);
        
        if (provider == null || provider.getProvider() == null) {
            this.getServer().getPluginManager().disablePlugin(this);
        }
        
        ...
    }

Maven Dependency

    <repositories>
        <repository>
            <id>nukkitx-repo</id>
            <url>https://repo.nukkitx.com/snapshot/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.nukkitx</groupId>
            <artifactId>fakeinventories</artifactId>
            <version>1.0.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

I have Seen Issues with Fakeinventorys
In Nukkit, all works great but all Plugins Like "Invsee, Enderchest, Auction, Craft (You can find all at Cloudburst) have Problems with DataPacketSendEvent.

A new version has been released for Fake Inventories, it is available for download here.


Create fake inventories

m[1;31mERROR[m[m] Das Event "cn.nukkit.event.server.DataPacketSendEvent" konnte nicht zu "FakeInventories v1.0.3": null in Zeile com.nukkitx.fakeinventories.FakeInventoriesListener weitergegeben werden
cn.nukkit.utils.EventException: null
  at cn.nukkit.plugin.MethodEventExecutor.execute(MethodEventExecutor.java:35) ~[nukkit-stable.jar:?]
  at cn.nukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:60) ~[nukkit-stable.jar:?]
  at cn.nukkit.plugin.PluginManager.callEvent(PluginManager.java:572) ~[nukkit-stable.jar:?]
  at cn.nukkit.Player.dataPacket(Player.java:1171) ~[nukkit-stable.jar:?]
  at com.nukkitx.fakeinventories.inventory.FakeInventory.lambda$onClose$0(FakeInventory.java:94) ~[?:?]
  at cn.nukkit.scheduler.TaskHandler.run(TaskHandler.java:100) [nukkit-stable.jar:?]
  at cn.nukkit.scheduler.ServerScheduler.runTasks(ServerScheduler.java:298) [nukkit-stable.jar:?]
  at cn.nukkit.scheduler.ServerScheduler.mainThreadHeartbeat(ServerScheduler.java:279) [nukkit-stable.jar:?]
  at cn.nukkit.Server.tick(Server.java:1371) [nukkit-stable.jar:?]
  at cn.nukkit.Server.tickProcessor(Server.java:1146) [nukkit-stable.jar:?]
  at cn.nukkit.Server.start(Server.java:1106) [nukkit-stable.jar:?]
  at cn.nukkit.Server.(Server.java:778) [nukkit-stable.jar:?]
  at cn.nukkit.Nukkit.main(Nukkit.java:200) [nukkit-stable.jar:?]
Caused by: java.lang.IllegalAccessError: tried to access field com.nukkitx.fakeinventories.inventory.FakeInventory.open from class com.nukkitx.fakeinventories.inventory.FakeInventories
  at com.nukkitx.fakeinventories.inventory.FakeInventories.getFakeInventoryPositions(FakeInventories.java:11) ~[?:?]
  at com.nukkitx.fakeinventories.FakeInventoriesListener.onPacketSend(FakeInventoriesListener.java:32) ~[?:?]
  at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) ~[?:?]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
  at cn.nukkit.plugin.MethodEventExecutor.execute(MethodEventExecutor.java:30) ~[nukkit-stable.jar:?]

I actually tested it with Auction in the test.powernukkit.org server and I couldn’t find problems. I’m goining to test with others

For me, i have Run the Command and the Error happens.

Which java version are you using?

I use Java 8 for it.
…

Looks like you are using a broken version of FakeInventories in your server, check if you haven’t added it more than once or multiple versions of it in the plugin folder.

If you are sure that it is not added more than once, then I’m going to need the plugin list to try to find which one is inserting the broken class com/nukkitx/fakeinventories/inventory/FakeInventory.class in its jar file.

I use the Last available Version of Fakeinventorys.
Please Check DMs at Discord for Plugin List.

Have you tried to use the jar provided in this release?

I read the DM but I’m afraid I won’t be able to check all plugins there because the plugin list is very large, so I suggest you to create a temporary test server adding only FakeInventories and Auction and check if it works, if it works, then add some more plugins, restart and check if Auction still works, if it stopped working, then remove some of the added plugins and recheck until you find the offending plugin.

I have tried this now.
Same Error.

Clean Server works without Errors.

I think that one of your plugins is incorrectly adding an old version of FakeInventory contents to itself.

You can:

  • Try to find it by doing the instruction that I said above
  • Or open jar by jar with 7-Zip or any ZIP file viewer and find which one have the file com/nukkitx/fakeinventories/inventory/FakeInventory.class in it

But this Error happens in all Plugins with Fakeinventorys Depend.
All Other Plugins doenst have this in Code.
In can try it.
Whoar xd

Yes, the plugin that is adding the old version of FakeInventories to it is breaking all other plugins that uses this lib.

Do you happen to be using this plugin?

Or this other one?

The first one (v0.0.5) is including FakeInventories to itself and can one of the offenders.

I use the First one
And all Other Plugins by Leon Like Craft, Enderchest

I confirmed that the first one breaks FakeInventories, I reproduced the issue when I installed it and tried to use Auction, you can fix it by opening its jar and deleting the com folder.

I think the Plugin Author should do this.
Because all Plugins have this Issue

So I checked Leon plugins and these plugins breaks FakeInventories because they are embedding the plugin to itself:

All others from him seems to be fine.

To fix the enderchest plugin, do the same, open it and remove the com folder.
image
image