Remove worlds from WorldBorder when unloaded tol prevent memory leak, Closes #1923
This commit is contained in:
parent
1b689802a4
commit
15a1d4cf0d
2 changed files with 48 additions and 2 deletions
|
@ -1,7 +1,28 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java
|
||||
@@ -51,19 +51,22 @@
|
||||
});
|
||||
@@ -11,13 +11,14 @@
|
||||
public class WorldServerMulti extends WorldServer
|
||||
{
|
||||
private WorldServer field_175743_a;
|
||||
+ private IBorderListener borderListener;
|
||||
private static final String __OBFID = "CL_00001430";
|
||||
|
||||
public WorldServerMulti(MinecraftServer p_i45923_1_, ISaveHandler p_i45923_2_, int p_i45923_3_, WorldServer p_i45923_4_, Profiler p_i45923_5_)
|
||||
{
|
||||
super(p_i45923_1_, p_i45923_2_, new DerivedWorldInfo(p_i45923_4_.func_72912_H()), p_i45923_3_, p_i45923_5_);
|
||||
this.field_175743_a = p_i45923_4_;
|
||||
- p_i45923_4_.func_175723_af().func_177737_a(new IBorderListener()
|
||||
+ this.borderListener = new IBorderListener()
|
||||
{
|
||||
private static final String __OBFID = "CL_00002273";
|
||||
public void func_177694_a(WorldBorder p_177694_1_, double p_177694_2_)
|
||||
@@ -48,22 +49,26 @@
|
||||
{
|
||||
WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_);
|
||||
}
|
||||
- });
|
||||
+ };
|
||||
+ this.field_175743_a.func_175723_af().func_177737_a(this.borderListener);
|
||||
}
|
||||
|
||||
- protected void func_73042_a() throws MinecraftException {}
|
||||
|
@ -26,3 +47,16 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -73,4 +78,12 @@
|
||||
|
||||
return this;
|
||||
}
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public void func_73041_k()
|
||||
+ {
|
||||
+ super.func_73041_k();
|
||||
+ this.field_175743_a.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak.
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java
|
||||
@@ -293,4 +293,9 @@
|
||||
iborderlistener.func_177690_b(this, p_177747_1_);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public void removeListener(IBorderListener listener)
|
||||
+ {
|
||||
+ this.field_177758_a.remove(listener);
|
||||
+ }
|
||||
}
|
Loading…
Reference in a new issue