mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
64 lines
2.7 KiB
Diff
64 lines
2.7 KiB
Diff
From 1fa81343f01c5002f45dbed000823fc7942d650f Mon Sep 17 00:00:00 2001
|
|
From: md_5 <git@md-5.net>
|
|
Date: Fri, 8 Aug 2014 19:57:03 +1000
|
|
Subject: [PATCH] Plug WorldMap Memory Leak
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
index c29e3f7..6f013eb 100644
|
|
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
@@ -18,7 +18,7 @@ public class PersistentCollection {
|
|
|
|
private IDataManager b;
|
|
protected Map<String, PersistentBase> a = Maps.newHashMap();
|
|
- private List<PersistentBase> c = Lists.newArrayList();
|
|
+ public List<PersistentBase> c = Lists.newArrayList(); // Spigot
|
|
private Map<String, Short> d = Maps.newHashMap();
|
|
|
|
public PersistentCollection(IDataManager idatamanager) {
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index d7847c5..8ad0aa2 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1032,6 +1032,23 @@ public abstract class World implements IBlockAccess {
|
|
entity.die();
|
|
if (entity instanceof EntityHuman) {
|
|
this.players.remove(entity);
|
|
+ // Spigot start
|
|
+ for ( Object o : worldMaps.c )
|
|
+ {
|
|
+ if ( o instanceof WorldMap )
|
|
+ {
|
|
+ WorldMap map = (WorldMap) o;
|
|
+ map.j.remove( entity );
|
|
+ for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.h.iterator(); iter.hasNext(); )
|
|
+ {
|
|
+ if ( iter.next().trackee == entity )
|
|
+ {
|
|
+ iter.remove();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
this.everyoneSleeping();
|
|
this.c(entity);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
|
|
index bf53fe5..d0d7c9d 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldMap.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldMap.java
|
|
@@ -23,7 +23,7 @@ public class WorldMap extends PersistentBase {
|
|
public byte scale;
|
|
public byte[] colors = new byte[16384];
|
|
public List<WorldMap.WorldMapHumanTracker> h = Lists.newArrayList();
|
|
- private Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap();
|
|
+ public Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap(); // Spigot
|
|
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
|
|
|
// CraftBukkit start
|
|
--
|
|
2.5.0
|
|
|