13
0
geforkt von Mirrors/Paper

Update from upstream SpigotMC

Upstream Merge (Bukkit + CraftBukkit) SpigotMC/Spigot@da20125dab
Plug WorldMap Memory Leak SpigotMC/Spigot@da20125dab
Dieser Commit ist enthalten in:
Zach Brown 2014-08-08 17:15:42 -05:00
Ursprung 86f789adb4
Commit 8e365012c0
11 geänderte Dateien mit 305 neuen und 22 gelöschten Zeilen

2
Bukkit

@ -1 +1 @@
Subproject commit d3ab9468c3aed2a06c280bf6c9cea5108c736dcc
Subproject commit 8d5b4c1e9acc499377da0d807e7ca2245d5c3bdf

@ -1 +1 @@
Subproject commit a04b586418538c428d0e464df3e2a1f3b06889fd
Subproject commit 0b2ed13a5d24fd9620f8b03c1bf888e3eccd715e

Datei anzeigen

@ -1,4 +1,4 @@
From a90b1cb99b9ac53325dddf8490e0b76efa7e9a80 Mon Sep 17 00:00:00 2001
From 645d13c15b1480736d76e62ed2c6f900e1167214 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports
@ -2558,6 +2558,197 @@ index 0000000..f6d7b2b
+ this.a((PacketPlayOutListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
new file mode 100644
index 0000000..4684e89
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -0,0 +1,185 @@
+package net.minecraft.server;
+
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class PersistentCollection {
+
+ private IDataManager a;
+ private Map b = new HashMap();
+ private List c = new ArrayList();
+ private Map d = new HashMap();
+
+ public PersistentCollection(IDataManager idatamanager) {
+ this.a = idatamanager;
+ this.b();
+ }
+
+ public PersistentBase get(Class oclass, String s) {
+ PersistentBase persistentbase = (PersistentBase) this.b.get(s);
+
+ if (persistentbase != null) {
+ return persistentbase;
+ } else {
+ if (this.a != null) {
+ try {
+ File file1 = this.a.getDataFile(s);
+
+ if (file1 != null && file1.exists()) {
+ try {
+ persistentbase = (PersistentBase) oclass.getConstructor(new Class[] { String.class}).newInstance(new Object[] { s});
+ } catch (Exception exception) {
+ throw new RuntimeException("Failed to instantiate " + oclass.toString(), exception);
+ }
+
+ FileInputStream fileinputstream = new FileInputStream(file1);
+ NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a((InputStream) fileinputstream);
+
+ fileinputstream.close();
+ persistentbase.a(nbttagcompound.getCompound("data"));
+ }
+ } catch (Exception exception1) {
+ exception1.printStackTrace();
+ }
+ }
+
+ if (persistentbase != null) {
+ this.b.put(s, persistentbase);
+ this.c.add(persistentbase);
+ }
+
+ return persistentbase;
+ }
+ }
+
+ public void a(String s, PersistentBase persistentbase) {
+ if (persistentbase == null) {
+ throw new RuntimeException("Can\'t set null data");
+ } else {
+ if (this.b.containsKey(s)) {
+ this.c.remove(this.b.remove(s));
+ }
+
+ this.b.put(s, persistentbase);
+ this.c.add(persistentbase);
+ }
+ }
+
+ public void a() {
+ for (int i = 0; i < this.c.size(); ++i) {
+ PersistentBase persistentbase = (PersistentBase) this.c.get(i);
+
+ if (persistentbase.d()) {
+ this.a(persistentbase);
+ persistentbase.a(false);
+ }
+ }
+ }
+
+ private void a(PersistentBase persistentbase) {
+ if (this.a != null) {
+ try {
+ File file1 = this.a.getDataFile(persistentbase.id);
+
+ if (file1 != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ persistentbase.b(nbttagcompound);
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+
+ nbttagcompound1.set("data", nbttagcompound);
+ FileOutputStream fileoutputstream = new FileOutputStream(file1);
+
+ NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) fileoutputstream);
+ fileoutputstream.close();
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ }
+
+ private void b() {
+ try {
+ this.d.clear();
+ if (this.a == null) {
+ return;
+ }
+
+ File file1 = this.a.getDataFile("idcounts");
+
+ if (file1 != null && file1.exists()) {
+ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));
+ NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream);
+
+ datainputstream.close();
+ Iterator iterator = nbttagcompound.c().iterator();
+
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ NBTBase nbtbase = nbttagcompound.get(s);
+
+ if (nbtbase instanceof NBTTagShort) {
+ NBTTagShort nbttagshort = (NBTTagShort) nbtbase;
+ short short1 = nbttagshort.e();
+
+ this.d.put(s, Short.valueOf(short1));
+ }
+ }
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+
+ public int a(String s) {
+ Short oshort = (Short) this.d.get(s);
+
+ if (oshort == null) {
+ oshort = Short.valueOf((short) 0);
+ } else {
+ oshort = Short.valueOf((short) (oshort.shortValue() + 1));
+ }
+
+ this.d.put(s, oshort);
+ if (this.a == null) {
+ return oshort.shortValue();
+ } else {
+ try {
+ File file1 = this.a.getDataFile("idcounts");
+
+ if (file1 != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ Iterator iterator = this.d.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ String s1 = (String) iterator.next();
+ short short1 = ((Short) this.d.get(s1)).shortValue();
+
+ nbttagcompound.setShort(s1, short1);
+ }
+
+ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1));
+
+ NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);
+ dataoutputstream.close();
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ return oshort.shortValue();
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
new file mode 100644
index 0000000..900ed68

Datei anzeigen

@ -1,4 +1,4 @@
From 549a301ccedf9ed4857d740d1b8a3e60783a7378 Mon Sep 17 00:00:00 2001
From 9abee8e0c381e92a3bc16558af2bf3beb47c6c61 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 10 Jan 2013 00:18:11 -0500
Subject: [PATCH] Spigot Timings
@ -781,10 +781,10 @@ index 9cf1b49..c249e77 100644
Server server = queuedChunk.provider.world.getServer();
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 84dcfcc..100c348 100644
index 9fea4fb..8442ecb 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -342,7 +342,9 @@ public class CraftScheduler implements BukkitScheduler {
@@ -346,7 +346,9 @@ public class CraftScheduler implements BukkitScheduler {
}
if (task.isSync()) {
try {

Datei anzeigen

@ -1,4 +1,4 @@
From 3764db804eab7f4953c62610d69a6f2d49bf7d2a Mon Sep 17 00:00:00 2001
From 424d78558ae745d107f06902fa46ab9eb48303fa Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:50:27 +1000
Subject: [PATCH] Thread Naming and Tweaks
@ -6,10 +6,10 @@ Subject: [PATCH] Thread Naming and Tweaks
Removes the sleep forever thread and adds useful names for debugging to all staged thread files.
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 100c348..a9fdc9f 100644
index 8442ecb..93d8d42 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -71,7 +71,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -72,7 +72,7 @@ public class CraftScheduler implements BukkitScheduler {
*/
private final ConcurrentHashMap<Integer, CraftTask> runners = new ConcurrentHashMap<Integer, CraftTask>();
private volatile int currentTick = -1;

Datei anzeigen

@ -1,4 +1,4 @@
From 7145e03eed873f3a2a1d4aba7c7d66f079a621f4 Mon Sep 17 00:00:00 2001
From 75731a693a69ff66ccce78f5b108ed1b2a69973f Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 27 Jun 2013 17:26:09 +1000
Subject: [PATCH] Properly Close Inventories
@ -66,3 +66,4 @@ index 13b75ff..bf8e745 100644
}
--
1.9.1

Datei anzeigen

@ -1,22 +1,49 @@
From 1f53dfee69b4631f24c8b755fe5af870cd8d4e5d Mon Sep 17 00:00:00 2001
From 93d639c32e8655d78c9944ddf8a19f5fce9b7832 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Thu, 26 Jun 2014 23:42:52 +0100
Subject: [PATCH] Add damager to the unhandled error
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0db8897..c8e3db0 100644
index 6cc8a2d..feac545 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -207,7 +207,7 @@ public class CraftEventFactory {
*/
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
- throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack));
+ throw new IllegalArgumentException(String.format("%s performing %s with %s", who, action, itemstack)); // Spigot
}
return callPlayerInteractEvent(who, action, 0, 256, 0, 0, itemstack);
}
@@ -479,7 +479,7 @@ public class CraftEventFactory {
if (source == DamageSource.CACTUS) {
cause = DamageCause.CONTACT;
} else {
- throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
+ throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex)); // Spigot
}
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
if (!event.isCancelled()) {
@@ -497,7 +497,7 @@ public class CraftEventFactory {
} else if (source == DamageSource.FALL) {
cause = DamageCause.FALL;
} else {
- throw new RuntimeException("Unhandled entity damage");
+ throw new RuntimeException("Unhandled entity damage from " + damager.getHandle().getName()); // Spigot - Add damager
- throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex));
+ throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); // Spigot
}
EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
if (!event.isCancelled()) {
@@ -535,7 +535,7 @@ public class CraftEventFactory {
return callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions);
}
- throw new AssertionError(String.format("Unhandled damage of %s from %s", entity, source.translationIndex));
+ throw new RuntimeException(String.format("Unhandled damage of %s from %s", entity, source.translationIndex)); // Spigot
}
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) {
--
1.9.1

Datei anzeigen

@ -1,4 +1,4 @@
From ca596392f362f870968fbfe4c51b6de4b2f36127 Mon Sep 17 00:00:00 2001
From 98658d64599b2521538967a27f90d50f8347d92c Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Thu, 7 Aug 2014 15:48:33 +0100
Subject: [PATCH] Fix LEFT_CLICK_AIR detection when not in creative
@ -19,3 +19,4 @@ index 97037ff..0e2bc03 100644
--
1.9.1

Datei anzeigen

@ -0,0 +1,63 @@
From cda57ced6f737f807bc0a8cc9ecd00a56389c877 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 4684e89..e9469a5 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 a;
private Map b = new HashMap();
- private List c = new ArrayList();
+ public List c = new ArrayList(); // Spigot
private Map d = new HashMap();
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 6100297..7a547da 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1170,6 +1170,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.i.remove( entity );
+ for ( Iterator<WorldMapHumanTracker> iter = (Iterator<WorldMapHumanTracker>) map.f.iterator(); iter.hasNext(); )
+ {
+ if ( iter.next().trackee == entity )
+ {
+ iter.remove();
+ }
+ }
+ }
+ }
+ // Spigot end
this.everyoneSleeping();
}
}
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index bd5cfca..3254b87 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -22,7 +22,7 @@ public class WorldMap extends PersistentBase {
public byte scale;
public byte[] colors = new byte[16384];
public List f = new ArrayList();
- private Map i = new HashMap();
+ public Map i = new HashMap(); // Spigot
public Map decorations = new LinkedHashMap();
// CraftBukkit start
--
1.9.1

Datei anzeigen

@ -1,4 +1,4 @@
From 4a4dbdc85d1ba862ac43f5ab115bd4be3a2957ee Mon Sep 17 00:00:00 2001
From bbdcf22da6baf9b023003bf2ba541638ba2269d8 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 21 Jul 2014 18:46:53 -0500
Subject: [PATCH] Invisible players don't have rights
@ -44,10 +44,10 @@ index 7f8a33b..73f52ac 100644
if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Blocks.PORTAL) {
this.ah();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 744d942..a204966 100644
index a6ef3b6..7281b59 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1666,6 +1666,13 @@ public abstract class World implements IBlockAccess {
@@ -1683,6 +1683,13 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);

Datei anzeigen

@ -1,4 +1,4 @@
From 540fb3b37e67af699dded843a702b512c5c991ea Mon Sep 17 00:00:00 2001
From 3ed41430e90a11705a2d857d72f052b83fb79d0e Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Wed, 6 Aug 2014 18:17:41 -0500
Subject: [PATCH] Center TNT grid sample points
@ -6,10 +6,10 @@ Subject: [PATCH] Center TNT grid sample points
More information at https://bugs.mojang.com/browse/MC-65697
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e82cb35..a9f45f9 100644
index 0358c7c..717be3b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1894,6 +1894,12 @@ public abstract class World implements IBlockAccess {
@@ -1911,6 +1911,12 @@ public abstract class World implements IBlockAccess {
double d1 = 1.0D / ((axisalignedbb.e - axisalignedbb.b) * 2.0D + 1.0D);
double d2 = 1.0D / ((axisalignedbb.f - axisalignedbb.c) * 2.0D + 1.0D);
@ -22,7 +22,7 @@ index e82cb35..a9f45f9 100644
if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) {
int i = 0;
int j = 0;
@@ -1906,7 +1912,7 @@ public abstract class World implements IBlockAccess {
@@ -1923,7 +1929,7 @@ public abstract class World implements IBlockAccess {
double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1;
double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2;