geforkt von Mirrors/Paper
954c898c28
This was useful when plugins first started upgrading to uuid because each plugin would implement their own way for grabbing uuid's from mojang. Because none of them shared the result they would quickly hit the limits on the api causing the conversion to either fail or pause for long periods of time. The global api cache was a (very hacky) way to force all plugins to share a cache but caused a few issues with plugins that expected a full implementation of the HTTPURLConnection. Due to the fact that most servers/plugins have updated now it seems to be a good time to remove this as its usefulness mostly has expired.
129 Zeilen
5.0 KiB
Diff
129 Zeilen
5.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <git@md-5.net>
|
|
Date: Sun, 21 Sep 2014 10:06:01 +1000
|
|
Subject: [PATCH] Fix Some Memory Leaks
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/EnchantmentManager.java
|
|
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
|
|
@@ -0,0 +0,0 @@ public class EnchantmentManager {
|
|
if (entity instanceof EntityHuman) {
|
|
a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz());
|
|
}
|
|
-
|
|
+ // Spigot start
|
|
+ d.b = null;
|
|
+ d.a = null;
|
|
+ // Spigot end
|
|
}
|
|
|
|
public static void b(EntityLiving entityliving, Entity entity) {
|
|
@@ -0,0 +0,0 @@ public class EnchantmentManager {
|
|
if (entityliving instanceof EntityHuman) {
|
|
a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz());
|
|
}
|
|
-
|
|
+ // Spigot start
|
|
+ e.a = null;
|
|
+ e.b = null;
|
|
+ // Spigot end
|
|
}
|
|
|
|
public static int a(EntityLiving entityliving) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -0,0 +0,0 @@
|
|
package net.minecraft.server;
|
|
|
|
+import java.lang.ref.WeakReference; // Spigot
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
protected NavigationAbstract navigation;
|
|
public PathfinderGoalSelector goalSelector; // PAIL protected final to public
|
|
public PathfinderGoalSelector targetSelector; // PAIL protected final to public
|
|
- private EntityLiving goalTarget;
|
|
+ private WeakReference<EntityLiving> goalTarget = new WeakReference<EntityLiving>(null);
|
|
private EntitySenses bi;
|
|
private ItemStack[] equipment = new ItemStack[5];
|
|
public float[] dropChances = new float[5];
|
|
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
}
|
|
|
|
public EntityLiving getGoalTarget() {
|
|
- return this.goalTarget;
|
|
+ return this.goalTarget.get(); // Spigot
|
|
}
|
|
|
|
public void setGoalTarget(EntityLiving entityliving) {
|
|
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
entityliving = null;
|
|
}
|
|
}
|
|
- this.goalTarget = entityliving;
|
|
+ this.goalTarget = new WeakReference<EntityLiving>(entityliving); // Spigot
|
|
// CraftBukkit end
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
public void close(IChatBaseComponent ichatbasecomponent) {
|
|
// Spigot Start
|
|
this.preparing = false;
|
|
+ this.h.clear();
|
|
// Spigot End
|
|
if (this.i.isOpen()) {
|
|
this.i.close(); // We can't wait as this may be called from an event loop.
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java
|
|
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
|
public class PathfinderGoalSwell extends PathfinderGoal {
|
|
|
|
EntityCreeper a;
|
|
- EntityLiving b;
|
|
+ // EntityLiving b; // Spigot
|
|
|
|
public PathfinderGoalSwell(EntityCreeper entitycreeper) {
|
|
this.a = entitycreeper;
|
|
@@ -0,0 +0,0 @@ public class PathfinderGoalSwell extends PathfinderGoal {
|
|
|
|
public void c() {
|
|
this.a.getNavigation().n();
|
|
- this.b = this.a.getGoalTarget();
|
|
+ // this.b = this.a.getGoalTarget(); // Spigot
|
|
}
|
|
|
|
public void d() {
|
|
- this.b = null;
|
|
+ // this.b = null; // Spigot
|
|
}
|
|
|
|
public void e() {
|
|
- if (this.b == null) {
|
|
+ // Spigot start
|
|
+ EntityLiving b = this.a.getGoalTarget();
|
|
+ if (b == null) {
|
|
this.a.a(-1);
|
|
- } else if (this.a.h(this.b) > 49.0D) {
|
|
+ } else if (this.a.h(b) > 49.0D) {
|
|
this.a.a(-1);
|
|
- } else if (!this.a.getEntitySenses().a(this.b)) {
|
|
+ } else if (!this.a.getEntitySenses().a(b)) {
|
|
this.a.a(-1);
|
|
} else {
|
|
this.a.a(1);
|
|
}
|
|
+ // Spigot end
|
|
}
|
|
}
|
|
--
|