Slimefun

Slimefun

3M Downloads

Multiple Block Menus are created for the same Location in some worlds

Mooy1 opened this issue ยท 2 comments

commented

๐Ÿ“ 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)

  1. Add a custom world, for example with a skyblock plugin
  2. Place a block with an inventory
  3. Restart server

๐Ÿ’ก Expected behavior (REQUIRED)

There should only be 1 BlockMenu created per location on startup

๐Ÿ“œ Server Log

https://pastebin.com/ML10Td6h

๐Ÿ“‚ /error-reports/ Folder

none

๐Ÿงญ Environment (REQUIRED)

  • Server software: Purpur
  • Minecraft version: 1.16.5
  • Slimefun version: Dev 881 + 1 debug method
commented

have you done any innvestigation into the cause of this or just seen that it happens?

commented

I looked through the code a bit I havent found where it happens yet.