Update our patches for Spigot changes

This commit is contained in:
Zach Brown 2014-12-05 22:22:47 -06:00
parent c9daa16dac
commit 137dfd0b4f
11 changed files with 28 additions and 106 deletions

View File

@ -1,11 +1,11 @@
From 1ca95f1f1dc4022158def293a6a1f6d0b3f59132 Mon Sep 17 00:00:00 2001
From 5068a5667ecaf1150afc13415600636945d7bfbd Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Tue, 2 Dec 2014 00:35:01 -0600
Date: Fri, 5 Dec 2014 22:04:50 -0600
Subject: [PATCH] POM changes
diff --git a/pom.xml b/pom.xml
index 5fd93be..87ffb97 100644
index 74efc8b..31a9b5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,12 @@
@ -48,7 +48,7 @@ index 5fd93be..87ffb97 100644
<type>jar</type>
<scope>compile</scope>
@@ -152,12 +152,12 @@
</configuration>
</configuration>
<executions>
<execution>
- <id>ex-spigot</id>

View File

@ -1,4 +1,4 @@
From a68171e5ec55b704a2f5f3c9125974b2ed9ba49d Mon Sep 17 00:00:00 2001
From c8f410d89fe8e4a4d7cf179e40be0307bd857f5d Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sat, 12 Jul 2014 19:32:01 -0500
Subject: [PATCH] PaperSpigot config files
@ -20,7 +20,7 @@ index 2806f1e..2e38fec 100644
DedicatedServer.LOGGER.info("Generating keypair");
this.a(MinecraftEncryption.b());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 8c9568c..f128789 100644
index b6221c6..7a41398 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -192,6 +192,8 @@ public abstract class World implements IBlockAccess {
@ -41,10 +41,10 @@ index 8c9568c..f128789 100644
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 545fb94..e5426b3 100644
index 57bd4f1..a9e23ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -689,6 +689,7 @@ public final class CraftServer implements Server {
@@ -688,6 +688,7 @@ public final class CraftServer implements Server {
}
org.spigotmc.SpigotConfig.init(); // Spigot
@ -52,7 +52,7 @@ index 545fb94..e5426b3 100644
for (WorldServer world : console.worlds) {
world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals);
@@ -704,12 +705,14 @@ public final class CraftServer implements Server {
@@ -703,12 +704,14 @@ public final class CraftServer implements Server {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
}
world.spigotConfig.init(); // Spigot

View File

@ -1,4 +1,4 @@
From a1002560bc6eec5a3442c42ecdbc4073a19d9465 Mon Sep 17 00:00:00 2001
From 4466adf61a6bf167e76311adcd48de923c863512 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Tue, 19 Aug 2014 14:21:37 -0500
Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and
@ -6,10 +6,10 @@ Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cbea48e..e588241 100644
index 5736d88..86b8cb2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1044,7 +1044,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -1045,7 +1045,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
}
public String getServerModName() {

View File

@ -1,4 +1,4 @@
From a136b73aec98890a24457940f0f7dc79ce69c01d Mon Sep 17 00:00:00 2001
From 9fe35c0ebea691395dbbb7d4fad86a374f989fba Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Fri, 28 Nov 2014 12:48:26 -0600
Subject: [PATCH] Further improve server tick loop
@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e588241..e9f3458 100644
index 86b8cb2..3592150 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -113,17 +113,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@ -150,10 +150,10 @@ index e588241..e9f3458 100644
lastTick = curTime;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b677519..612161e 100644
index a9e23ac..590fe28 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1684,6 +1684,17 @@ public final class CraftServer implements Server {
@@ -1683,6 +1683,17 @@ public final class CraftServer implements Server {
private final Spigot spigot = new Spigot()
{

View File

@ -1,4 +1,4 @@
From 0d9f4bc43cd3f638de483f1c7b9139896c888bba Mon Sep 17 00:00:00 2001
From 7195c33c775f1a8e89e96a70f00cea5aa5e3f68d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Nov 2014 13:43:11 -0600
Subject: [PATCH] Player lookup improvements
@ -13,7 +13,7 @@ By using a map based approach for player lookups, player lookup should
be consistent in performance regardless of how many players are online.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 04d9be9..9595b54 100644
index fc7b7f0..69585aa 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -48,6 +48,39 @@ public abstract class PlayerList {
@ -83,16 +83,17 @@ index 04d9be9..9595b54 100644
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.getUniqueID().equals(uuid)) {
@@ -414,6 +453,8 @@ public abstract class PlayerList {
@@ -414,6 +453,9 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (EntityPlayer) iterator.next();
+ */
+ */
+ if ((entityplayer = uuidMap.get(uuid)) != null) {
+ // PaperSpigot end
entityplayer.playerConnection.disconnect("You logged in from another location");
}
@@ -924,6 +965,7 @@ public abstract class PlayerList {
@@ -924,6 +966,7 @@ public abstract class PlayerList {
}
public EntityPlayer getPlayer(String s) {
@ -124,7 +125,7 @@ index 8be0698..1dc9fb3 100644
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dca6f17..2845152 100644
index 590fe28..127947f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -397,7 +397,12 @@ public final class CraftServer implements Server {
@ -141,7 +142,7 @@ index dca6f17..2845152 100644
String lowerName = name.toLowerCase();
int delta = Integer.MAX_VALUE;
for (Player player : getOnlinePlayers()) {
@@ -418,27 +423,19 @@ public final class CraftServer implements Server {
@@ -418,15 +423,10 @@ public final class CraftServer implements Server {
public Player getPlayerExact(String name) {
Validate.notNull(name, "Name cannot be null");
@ -157,28 +158,12 @@ index dca6f17..2845152 100644
+ // PaperSpigot start - Improved player lookup, replace whole method
+ EntityPlayer player = playerList.playerMap.get(name);
+ return player != null ? player.getBukkitEntity() : null;
+ // PaperSpigot end
}
// TODO: In 1.8+ this should use the server's UUID->EntityPlayer map
@Override
public Player getPlayer(UUID id) {
- for (Player player : getOnlinePlayers()) {
- if (player.getUniqueId().equals(id)) {
- return player;
- }
- }
-
- return null;
+ // PaperSpigot start - Improved player lookup, replace whole method
+ EntityPlayer player = playerList.uuidMap.get(id);
+ return player != null ? player.getBukkitEntity() : null;
+ // PaperSpigot end
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6da3b32..7f55310 100644
index b8a37b6..405ec6a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -103,13 +103,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -1,63 +0,0 @@
From 3a8b7719afd3d7a3301e1ef828dc15fdbff40023 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Nov 2014 13:47:24 -0600
Subject: [PATCH] Improve autosave mechanism
Only save modified chunks, or chunks with entities after 4 auto save passes
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 949fa96..881e963 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -927,7 +927,7 @@ public class Chunk {
if (this.r && this.world.getTime() != this.lastSaved || this.q) {
return true;
}
- } else if (this.r && this.world.getTime() >= this.lastSaved + 600L) {
+ } else if (this.r && this.world.getTime() >= + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification
return true;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e9f3458..e3c5754 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -694,9 +694,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
// Spigot Start
// We replace this with saving each individual world as this.saveChunks(...) is broken,
// and causes the main thread to sleep for random amounts of time depending on chunk activity
+ // Also pass flag to only save modified chunks -- PaperSpigot
server.playerCommandState = true;
for (World world : worlds) {
- world.getWorld().save();
+ world.getWorld().save(true);
}
server.playerCommandState = false;
// this.saveChunks(true);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 62f6328..91e6aed 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -688,12 +688,18 @@ public class CraftWorld implements World {
}
public void save() {
+ // PaperSpigot start - Improved autosave
+ save(true);
+ }
+
+ public void save(boolean forceSave) {
+ // PaperSpigot end
this.server.checkSaveState();
try {
boolean oldSave = world.savingDisabled;
world.savingDisabled = false;
- world.save(true, null);
+ world.save(forceSave, null);
world.savingDisabled = oldSave;
} catch (ExceptionWorldConflict ex) {
--
1.9.1

View File

@ -1,4 +1,4 @@
From b28d65be28fae89865bb81de326b6ab5dfde6b70 Mon Sep 17 00:00:00 2001
From d209349d290cbd554d7dcab9c90f1aff5d0c7310 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 30 Nov 2014 22:57:18 -0600
Subject: [PATCH] Add TNT source location API
@ -98,10 +98,10 @@ index b5763bb..611bac8 100644
public EntityLiving getSource() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5fe4693..2887202 100644
index 0804eb6..29f743f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1076,7 +1076,8 @@ public class CraftWorld implements World {
@@ -1075,7 +1075,8 @@ public class CraftWorld implements World {
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
}
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {