Multiple Block Menus are created for the same Location in some worlds
Mooy1 opened this issue ยท 2 comments
๐ Description (REQUIRED)
On Server startup, BlockMenus created in custom/other plugins's worlds are created twice. The first one is the one that actually gets stored, the second one can cause problems for code which overrides newInstance() in BlockMenuPreset. This doesn't cause any problems for Slimefun from what i've tested, but can and has affected Addons which use newInstance().
I found it by adding this method to InventoryBlock to see when it occurs
@OverRide
public void newInstance(@nonnull BlockMenu menu, @nonnull Block b) {
System.out.println("NEW INSTANCE " + menu + menu.getLocation());
}
This results in the following with 1 Auto Enchanter in world, and 1 Auto Enchanter in bskyblock_world_nether
[00:20:24 INFO]: NEW INSTANCE me.mrCookieSlime.Slimefun.api.inventory.BlockMenu@5dbf1608Location{world=CraftWorld{name=world},x=-63989.0,y=68.0,z=70355.0,pitch=0.0,yaw=0.0}
[00:20:24 INFO]: NEW INSTANCE me.mrCookieSlime.Slimefun.api.inventory.BlockMenu@78c30b07Location{world=CraftWorld{name=bskyblock_world_nether},x=-7997.0,y=69.0,z=8802.0,pitch=0.0,yaw=0.0}
[00:20:24 INFO]: NEW INSTANCE me.mrCookieSlime.Slimefun.api.inventory.BlockMenu@39877c72Location{world=CraftWorld{name=bskyblock_world_nether},x=-7997.0,y=69.0,z=8802.0,pitch=0.0,yaw=0.0}
The second and third logs are the same location, but different BlockMenus.
Somewhere something in Slimefun is creating a BlockMenu for a location that already had one.
๐ Steps to reproduce the Issue (REQUIRED)
- Add a custom world, for example with a skyblock plugin
- Place a block with an inventory
- Restart server
๐ก Expected behavior (REQUIRED)
There should only be 1 BlockMenu created per location on startup
๐ Server Log
๐ /error-reports/ Folder
none
๐งญ Environment (REQUIRED)
- Server software: Purpur
- Minecraft version: 1.16.5
- Slimefun version: Dev 881 + 1 debug method
have you done any innvestigation into the cause of this or just seen that it happens?