Skip to content

Commit

Permalink
Reset more world to workaround memleak (#1388)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Herrera <[email protected]>
  • Loading branch information
Pablete1234 authored Aug 19, 2024
1 parent b9c7a14 commit 7b8e381
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ public boolean canMineBlock(BlockMaterialData blockMaterial, Player player) {

@Override
public void resetDimension(World world) {
var nmsWorld = ((CraftWorld) world).getHandle();
try {
((CraftWorld) world).getHandle().dimension = 11;
nmsWorld.dimension = 11;
} catch (IllegalAccessError e) {

Field worldServerField = ReflectionUtils.getField(CraftWorld.class, "world");
Expand All @@ -182,6 +183,8 @@ public void resetDimension(World world) {
// No-op, newer version of Java have disabled modifying final fields
}
}

nmsWorld.craftingManager.lastCraftView = null;
}

@Override
Expand Down

0 comments on commit 7b8e381

Please sign in to comment.