mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
63 lines
2.8 KiB
Diff
63 lines
2.8 KiB
Diff
From 7c6dd6ade69d77f64cb90966d4da8e0314f723c3 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 fe59b75..936d6c6 100644
|
|
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
@@ -19,7 +19,7 @@ public class PersistentCollection {
|
|
|
|
private final IDataManager b;
|
|
protected Map<String, PersistentBase> a = Maps.newHashMap();
|
|
- private final List<PersistentBase> c = Lists.newArrayList();
|
|
+ public final List<PersistentBase> c = Lists.newArrayList(); // Spigot
|
|
private final 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 cfd3871..42aeede 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1109,6 +1109,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.k.remove( entity );
|
|
+ for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.i.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 2daedbe..fc5edab 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldMap.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldMap.java
|
|
@@ -25,7 +25,7 @@ public class WorldMap extends PersistentBase {
|
|
public byte scale;
|
|
public byte[] colors = new byte[16384];
|
|
public List<WorldMap.WorldMapHumanTracker> i = Lists.newArrayList();
|
|
- private final Map<EntityHuman, WorldMap.WorldMapHumanTracker> k = Maps.newHashMap();
|
|
+ public final Map<EntityHuman, WorldMap.WorldMapHumanTracker> k = Maps.newHashMap(); // Spigot private -> public
|
|
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
|
|
|
// CraftBukkit start
|
|
--
|
|
2.9.3
|
|
|