Paper 1.9

This commit is contained in:
Zach Brown 2016-02-29 17:09:49 -06:00
parent adb92a86db
commit 99fec76702
180 changed files with 7198 additions and 9759 deletions

4
.gitignore vendored
View File

@ -39,9 +39,11 @@ work/
# other stuff # other stuff
Spigot-API Spigot-API
Spigot-Server Spigot-Server
Paper-Server
Paper-API
PaperSpigot-Server PaperSpigot-Server
PaperSpigot-API PaperSpigot-API
Bukkit Bukkit
CraftBukkit CraftBukkit
Paperclip Paperclip
Paperclip.jar Paperclip.jar

View File

@ -8,7 +8,7 @@ before_install:
- ./remap.sh - ./remap.sh
- ./decompile.sh - ./decompile.sh
- ./init.sh - ./init.sh
- ./newApplyPatches.sh - ./applyPatches.sh
after_success: after_success:
- ./paperclip.sh - ./paperclip.sh
cache: cache:

2
Bukkit

@ -1 +1 @@
Subproject commit 972b9fea86022c4136504fbd3ac9c00070b96baa Subproject commit fccf27b47d27d5bece10ccfc21770adfe89e26de

@ -1 +1 @@
Subproject commit c194444207ae8543dc4ec4669a6e0d446f41d3b6 Subproject commit e2c5473e0780cea305203070ac25f4c9d2369077

View File

@ -1,4 +1,4 @@
PaperSpigot [![CI Status](http://ci.destroystokyo.com/buildStatus/icon?job=PaperSpigot)](http://ci.destroystokyo.com/job/PaperSpigot/) Paper [![CI Status](http://ci.destroystokyo.com/buildStatus/icon?job=PaperSpigot)](http://ci.destroystokyo.com/job/PaperSpigot/)
=========== ===========
High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies. High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies.
@ -15,12 +15,12 @@ https://ci.destroystokyo.com/job/PaperSpigot/
Run the PaperClip jar directly from your server. Just like old times Run the PaperClip jar directly from your server. Just like old times
PaperSpigot requires **JRE 8** or above. PaperSpigot requires **Java 8** or above.
How To (Compiling From Source) How To (Compiling From Source)
------ ------
To compile PaperSpigot, you need JDK8, maven, and an internet connection. To compile PaperSpigot, you need JDK 8, maven, and an internet connection.
Clone this repo, run ./build.sh from *bash*, get files. Clone this repo, run ./build.sh from *bash*, get files.

View File

@ -1,11 +1,11 @@
From 5d7fe1d8ba54b000f583088bc50141a184818516 Mon Sep 17 00:00:00 2001 From 6f357f8fcd6d70079999cfc38064ec0df97c4b99 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 6 Jan 2015 22:12:31 -0600 Date: Mon, 29 Feb 2016 17:16:08 -0600
Subject: [PATCH] POM changes Subject: [PATCH] POM changes
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index cb142f2..d63151f 100644 index dec3b6c..b85201d 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -4,35 +4,37 @@ @@ -4,35 +4,37 @@
@ -15,22 +15,22 @@ index cb142f2..d63151f 100644
- <groupId>org.sonatype.oss</groupId> - <groupId>org.sonatype.oss</groupId>
- <artifactId>oss-parent</artifactId> - <artifactId>oss-parent</artifactId>
- <version>9</version> - <version>9</version>
+ <groupId>org.github.paperspigot</groupId> + <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paperspigot-parent</artifactId> + <artifactId>paper-parent</artifactId>
+ <version>dev-SNAPSHOT</version> + <version>dev-SNAPSHOT</version>
</parent> </parent>
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId> - <artifactId>spigot-api</artifactId>
+ <groupId>org.github.paperspigot</groupId> + <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paperspigot-api</artifactId> + <artifactId>paper-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version> <version>1.9-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
- <name>Spigot-API</name> - <name>Spigot-API</name>
- <url>http://www.spigotmc.org/</url> - <url>http://www.spigotmc.org/</url>
+ <name>PaperSpigot-API</name> + <name>Paper-API</name>
+ <url>https://hub.spigotmc.org/stash/projects/PAPER/</url> + <url>https://github.com/PaperSpigot/Paper</url>
<description>An enhanced plugin API for Minecraft servers.</description> <description>An enhanced plugin API for Minecraft servers.</description>
<properties> <properties>
@ -65,7 +65,7 @@ index cb142f2..d63151f 100644
<plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId> - <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId> - <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.13</version> - <version>1.14</version>
- <executions> - <executions>
- <execution> - <execution>
- <phase>process-classes</phase> - <phase>process-classes</phase>
@ -85,7 +85,7 @@ index cb142f2..d63151f 100644
- <plugin> - <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.3</version> <version>2.4.1</version>
-- --
2.7.1 2.7.2

View File

@ -1,90 +0,0 @@
From 5db35d30b2c5deb83eae1e6b2f9f9e60dba9a31e Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 19 May 2014 22:51:45 -0500
Subject: [PATCH] Add float methods to configs
diff --git a/src/main/java/org/bukkit/configuration/ConfigurationSection.java b/src/main/java/org/bukkit/configuration/ConfigurationSection.java
index 1bd7fb5..9afc1dc 100644
--- a/src/main/java/org/bukkit/configuration/ConfigurationSection.java
+++ b/src/main/java/org/bukkit/configuration/ConfigurationSection.java
@@ -355,6 +355,48 @@ public interface ConfigurationSection {
*/
public boolean isDouble(String path);
+ // PaperSpigot start - Add getFloat
+ /**
+ * Gets the requested float by path.
+ * <p>
+ * If the float does not exist but a default value has been specified,
+ * this will return the default value. If the float does not exist and no
+ * default value was specified, this will return 0.
+ *
+ * @param path Path of the float to get.
+ * @return Requested float.
+ */
+ public float getFloat(String path);
+
+ /**
+ * Gets the requested float by path, returning a default value if not
+ * found.
+ * <p>
+ * If the float does not exist then the specified default value will
+ * returned regardless of if a default has been identified in the root
+ * {@link Configuration}.
+ *
+ * @param path Path of the float to get.
+ * @param def The default value to return if the path is not found or is
+ * not a float.
+ * @return Requested float.
+ */
+ public float getFloat(String path, float def);
+
+ /**
+ * Checks if the specified path is a float.
+ * <p>
+ * If the path exists but is not a float, this will return false. If the
+ * path does not exist, this will return false. If the path does not exist
+ * but a default value has been specified, this will check if that default
+ * value is a gloat and return appropriately.
+ *
+ * @param path Path of the float to check.
+ * @return Whether or not the specified path is a float.
+ */
+ public boolean isFloat(String path);
+ // PaperSpigot end
+
/**
* Gets the requested long by path.
* <p>
diff --git a/src/main/java/org/bukkit/configuration/MemorySection.java b/src/main/java/org/bukkit/configuration/MemorySection.java
index f180bf5..0e2b26a 100644
--- a/src/main/java/org/bukkit/configuration/MemorySection.java
+++ b/src/main/java/org/bukkit/configuration/MemorySection.java
@@ -336,6 +336,23 @@ public class MemorySection implements ConfigurationSection {
return val instanceof Double;
}
+ // PaperSpigot start - Add getFloat
+ public float getFloat(String path) {
+ Object def = getDefault(path);
+ return getFloat(path, (def instanceof Float) ? toFloat(def) : 0);
+ }
+
+ public float getFloat(String path, float def) {
+ Object val = get(path, def);
+ return (val instanceof Float) ? toFloat(val) : def;
+ }
+
+ public boolean isFloat(String path) {
+ Object val = get(path);
+ return val instanceof Float;
+ }
+ // PaperSpigot end
+
public long getLong(String path) {
Object def = getDefault(path);
return getLong(path, (def instanceof Number) ? toLong(def) : 0);
--
1.9.1

View File

@ -0,0 +1,34 @@
From 9a4a2c1714d36269d90b39931fbc0209bacc9194 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Mon, 29 Feb 2016 17:22:34 -0600
Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index dc58bea..2721f4c 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1270,6 +1270,20 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
+ /**
+ * Get whether the player can affect mob spawning
+ *
+ * @return if the player can affect mob spawning
+ */
+ public boolean getAffectsSpawning();
+
+ /**
+ * Set whether the player can affect mob spawning
+ *
+ * @param affects Whether the player can affect mob spawning
+ */
+ public void setAffectsSpawning(boolean affects);
+
// Spigot start
public class Spigot extends Entity.Spigot
{
--
2.7.2

View File

@ -0,0 +1,46 @@
From 9082960948db00f8186644598d78836679ac08cf Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 17:24:57 -0600
Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index dc2c9d1..e19f3d7 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1141,6 +1141,14 @@ public final class Bukkit {
}
/**
+ * Gets the current server TPS
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ public static double[] getTPS() {
+ return server.getTPS();
+ }
+
+ /**
* @see UnsafeValues
* @return the unsafe values instance
*/
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 69720e9..92a5cbc 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -934,6 +934,13 @@ public interface Server extends PluginMessageRecipient {
BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag ...flags);
/**
+ * Gets the current server TPS
+ *
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ public double[] getTPS();
+
+ /**
* @see UnsafeValues
* @return the unsafe values instance
*/
--
2.7.2

View File

@ -1,31 +0,0 @@
From 1ada1bf4361c4a6312d2228ad5fa62ade8d0d91e Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 May 2015 00:00:29 -0500
Subject: [PATCH] Stop using spigot's website for timings
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
index fc59aa3..9782a3b 100644
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
@@ -94,7 +94,7 @@ public class TimingsCommand extends BukkitCommand {
}
sender.sendMessage("Timings written to " + timings.getPath());
- sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." );
+ sender.sendMessage( "Paste contents of file into form at http://aikar.co/timings.php to read results." );
} catch (IOException e) {
} finally {
@@ -241,7 +241,7 @@ public class TimingsCommand extends BukkitCommand {
String location = con.getHeaderField( "Location" );
String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 );
- sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://www.spigotmc.org/go/timings?url=" + pasteID );
+ sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://aikar.co/timings.php?url=" + pasteID );
} catch ( IOException ex )
{
sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" );
--
2.4.1.windows.1

View File

@ -0,0 +1,92 @@
From 71adf6472ca1b721a50a1258ae05839fe735e00d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 17:43:33 -0600
Subject: [PATCH] Add async chunk load API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 4125633..724d7a9 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -130,6 +130,78 @@ public interface World extends PluginMessageRecipient, Metadatable {
public Chunk getChunkAt(Block block);
/**
+ * Used by {@link World#getChunkAtAsync(Location,ChunkLoadCallback)} methods
+ * to request a {@link Chunk} to be loaded, with this callback receiving
+ * the chunk when it is finished.
+ *
+ * This callback will be executed on synchronously on the main thread.
+ *
+ * Timing and order this callback is fired is intentionally not defined and
+ * and subject to change.
+ */
+ public static interface ChunkLoadCallback {
+ public void onLoad(Chunk chunk);
+ }
+
+ /**
+ * Requests a {@link Chunk} to be loaded at the given coordinates
+ *
+ * This method makes no guarantee on how fast the chunk will load,
+ * and will return the chunk to the callback at a later time.
+ *
+ * You should use this method if you need a chunk but do not need it
+ * immediately, and you wish to let the server control the speed
+ * of chunk loads, keeping performance in mind.
+ *
+ * The {@link ChunkLoadCallback} will always be executed synchronously
+ * on the main Server Thread.
+ *
+ * @param x Chunk X-coordinate of the chunk - (world coordinate / 16)
+ * @param z Chunk Z-coordinate of the chunk - (world coordinate / 16)
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public void getChunkAtAsync(int x, int z, ChunkLoadCallback cb);
+
+ /**
+ * Requests a {@link Chunk} to be loaded at the given {@link Location}
+ *
+ * This method makes no guarantee on how fast the chunk will load,
+ * and will return the chunk to the callback at a later time.
+ *
+ * You should use this method if you need a chunk but do not need it
+ * immediately, and you wish to let the server control the speed
+ * of chunk loads, keeping performance in mind.
+ *
+ * The {@link ChunkLoadCallback} will always be executed synchronously
+ * on the main Server Thread.
+ *
+ * @param location Location of the chunk
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public void getChunkAtAsync(Location location, ChunkLoadCallback cb);
+
+ /**
+ * Requests {@link Chunk} to be loaded that contains the given {@link Block}
+ *
+ * This method makes no guarantee on how fast the chunk will load,
+ * and will return the chunk to the callback at a later time.
+ *
+ * You should use this method if you need a chunk but do not need it
+ * immediately, and you wish to let the server control the speed
+ * of chunk loads, keeping performance in mind.
+ *
+ * The {@link ChunkLoadCallback} will always be executed synchronously
+ * on the main Server Thread.
+ *
+ * @param block Block to get the containing chunk from
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public void getChunkAtAsync(Block block, ChunkLoadCallback cb);
+
+ /**
* Checks if the specified {@link Chunk} is loaded
*
* @param chunk The chunk to check
--
2.7.2

View File

@ -1,42 +0,0 @@
From ca5a9ea7df0a2f0fbe9f584560528dcc1cdb1605 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 8 Aug 2014 22:51:26 -0500
Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 9508e84..f93dcec 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1161,6 +1161,28 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ /**
+ * Get whether the player affects mob spawning
+ *
+ * @return whether or not the player affects
+ * mob spawning.
+ */
+ public boolean getAffectsSpawning()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ /**
+ * Set whether or not the player affects mob spawning
+ *
+ * @param affects whether or not the player should affect
+ * spawning or not.
+ */
+ public void setAffectsSpawning(boolean affects)
+ {
+ throw new UnsupportedOperationException( "Not supported yet" );
+ }
}
Spigot spigot();
--
1.9.5.msysgit.1

View File

@ -1,27 +0,0 @@
From 8bce4a508162d640c99efa7ddde38c1fe773d49e Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sun, 19 Oct 2014 18:22:18 -0500
Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 169008a..26acdda 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -956,6 +956,13 @@ public interface Server extends PluginMessageRecipient {
public void restart() {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ // PaperSpigot start - Add getTPS method
+ public double[] getTPS()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+ // PaperSpigot end
}
Spigot spigot();
--
2.5.0

View File

@ -0,0 +1,41 @@
From a1986bb1ab9932a428e2e58202ee90900c09e620 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 17:50:31 -0600
Subject: [PATCH] FallingBlock and TNTPrimed source location API
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index bc56fa2..ae9033c 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -59,4 +59,11 @@ public interface FallingBlock extends Entity {
* @param hurtEntities whether entities will be damaged by this block.
*/
void setHurtEntities(boolean hurtEntities);
+
+ /**
+ * Gets the source block location of the FallingBlock
+ *
+ * @return the source block location the FallingBlock was spawned from
+ */
+ public org.bukkit.Location getSourceLoc();
}
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
index 3ce322d..74b82f9 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -35,4 +35,11 @@ public interface TNTPrimed extends Explosive {
* @return the source of this primed TNT
*/
public Entity getSource();
+
+ /**
+ * Gets the source block location of the TNTPrimed
+ *
+ * @return the source block location the TNTPrimed was spawned from
+ */
+ public org.bukkit.Location getSourceLoc();
}
--
2.7.2

View File

@ -1,29 +0,0 @@
From 498f77bac894f37bb813f93a2d3da2c127a2384f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 6 Nov 2014 18:29:20 -0600
Subject: [PATCH] Add async chunk load API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index ab73174..c962e7d 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -129,6 +129,15 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Chunk getChunkAt(Block block);
+ // PaperSpigot start - Async chunk load API
+ public static interface ChunkLoadCallback {
+ public void onLoad(Chunk chunk);
+ }
+ public void getChunkAtAsync(int x, int z, ChunkLoadCallback cb);
+ public void getChunkAtAsync(Location location, ChunkLoadCallback cb);
+ public void getChunkAtAsync(Block block, ChunkLoadCallback cb);
+ // PaperSpigot end
+
/**
* Checks if the specified {@link Chunk} is loaded
*
--
1.9.1

View File

@ -0,0 +1,77 @@
From 7d9c89c650173fed78c662109eea960d61b6e678 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 17:58:01 -0600
Subject: [PATCH] Check Paper versions
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index b55abdb..e1bea95 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -185,30 +185,17 @@ public class VersionCommand extends BukkitCommand {
private void obtainVersion() {
String version = Bukkit.getVersion();
if (version == null) version = "Custom";
- if (version.startsWith("git-Spigot-")) {
- String[] parts = version.substring("git-Spigot-".length()).split("-");
- int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
- int spigotVersions = getDistance("spigot", parts[0]);
- if (cbVersions == -1 || spigotVersions == -1) {
+ // Paper start
+ if (version.startsWith("git-Paper-")) {
+ String[] parts = version.substring("git-Paper-".length()).split("[-\\s]");
+ int paperVersions = getDistance("paper", parts[0]);
+ if (paperVersions == -1) {
setVersionMessage("Error obtaining version information");
} else {
- if (cbVersions == 0 && spigotVersions == 0) {
+ if (paperVersions == 0) {
setVersionMessage("You are running the latest version");
} else {
- setVersionMessage("You are " + (cbVersions + spigotVersions) + " version(s) behind");
- }
- }
-
- } else if (version.startsWith("git-Bukkit-")) {
- version = version.substring("git-Bukkit-".length());
- int cbVersions = getDistance("craftbukkit", version.substring(0, version.indexOf(' ')));
- if (cbVersions == -1) {
- setVersionMessage("Error obtaining version information");
- } else {
- if (cbVersions == 0) {
- setVersionMessage("You are running the latest version");
- } else {
- setVersionMessage("You are " + cbVersions + " version(s) behind");
+ setVersionMessage("You are " + paperVersions + " version(s) behind");
}
}
} else {
@@ -232,17 +219,20 @@ public class VersionCommand extends BukkitCommand {
}
}
- private static int getDistance(String repo, String hash) {
+ private static int getDistance(String repo, String currentVerInt) { // Paper
try {
BufferedReader reader = Resources.asCharSource(
- new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
+ new URL("https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/buildNumber"), // Paper
Charsets.UTF_8
).openBufferedStream();
try {
- JSONObject obj = (JSONObject) new JSONParser().parse(reader);
- return ((Number) obj.get("totalCount")).intValue();
- } catch (ParseException ex) {
+ // Paper start
+ int newVer = Integer.decode(reader.readLine());
+ int currentVer = Integer.decode(currentVerInt);
+ return newVer - currentVer;
+ } catch (NumberFormatException ex) {
ex.printStackTrace();
+ // Paper end
return -1;
} finally {
reader.close();
--
2.7.2

View File

@ -1,19 +1,20 @@
From eb89a2994624f064ca2508434247629e746a8dd4 Mon Sep 17 00:00:00 2001 From 3c8bd87bc36a0c83f24b14609fe615824d1b6002 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 27 Apr 2015 21:41:39 -0500 Date: Mon, 29 Feb 2016 18:02:25 -0600
Subject: [PATCH] Add PlayerLocaleChangeEvent Subject: [PATCH] Add PlayerLocaleChangeEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
new file mode 100644 new file mode 100644
index 0000000..3efd159 index 0000000..17afc8c
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
@@ -0,0 +1,46 @@ @@ -0,0 +1,47 @@
+package org.bukkit.event.player; +package com.destroystokyo.paper.event.player;
+ +
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+ +
+/** +/**
+ * Called when the locale of the player is changed. + * Called when the locale of the player is changed.
@ -56,7 +57,6 @@ index 0000000..3efd159
+ return handlers; + return handlers;
+ } + }
+} +}
\ No newline at end of file
-- --
1.9.1 2.7.2

View File

@ -1,25 +0,0 @@
From 28b66c77af202f83255000ebfa9050978a83af4a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 30 Nov 2014 22:57:17 -0600
Subject: [PATCH] Add TNT source location API
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
index 3ce322d..7b1b6b6 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -35,4 +35,11 @@ public interface TNTPrimed extends Explosive {
* @return the source of this primed TNT
*/
public Entity getSource();
+
+ /**
+ * Gets the source block location of the primed TNT.
+ *
+ * @return the source block location the TNT was spawned from
+ */
+ public org.bukkit.Location getSourceLoc();
}
--
1.9.1

View File

@ -0,0 +1,34 @@
From 43f1261cbeab869585712a558a8a333b7a316348 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 18:05:37 -0600
Subject: [PATCH] Add player view distance API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2721f4c..ed8b8f1 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1284,6 +1284,20 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
*/
public void setAffectsSpawning(boolean affects);
+ /**
+ * Gets the view distance for this player
+ *
+ * @return the player's view distance
+ */
+ public int getViewDistance();
+
+ /**
+ * Sets the view distance for this player
+ *
+ * @param viewDistance the player's view distance
+ */
+ public void setViewDistance(int viewDistance);
+
// Spigot start
public class Spigot extends Entity.Spigot
{
--
2.7.2

View File

@ -1,63 +0,0 @@
From 386d76f2e47c4d3e3b824d6ec2c25d914fbe6e2c Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sun, 28 Dec 2014 16:28:21 -0600
Subject: [PATCH] Check PaperSpigot versions
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index b55abdb..e91e1d8 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -185,7 +185,21 @@ public class VersionCommand extends BukkitCommand {
private void obtainVersion() {
String version = Bukkit.getVersion();
if (version == null) version = "Custom";
- if (version.startsWith("git-Spigot-")) {
+ // PaperSpigot start
+ if (version.startsWith("git-PaperSpigot-")) {
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("[-\\s]");
+ int paperSpigotVersions = getDistance("paperspigot", parts[0]);
+ if (paperSpigotVersions == -1) {
+ setVersionMessage("Error obtaining version information");
+ } else {
+ if (paperSpigotVersions == 0) {
+ setVersionMessage("You are running the latest version");
+ } else {
+ setVersionMessage("You are " + paperSpigotVersions + " version(s) behind");
+ }
+ }
+ } else if (version.startsWith("git-Spigot-")) {
+ // PaperSpigot end
String[] parts = version.substring("git-Spigot-".length()).split("-");
int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
int spigotVersions = getDistance("spigot", parts[0]);
@@ -232,17 +246,20 @@ public class VersionCommand extends BukkitCommand {
}
}
- private static int getDistance(String repo, String hash) {
+ private static int getDistance(String repo, String currentVerInt) { // PaperSpigot
try {
BufferedReader reader = Resources.asCharSource(
- new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
+ new URL("https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/buildNumber"), // PaperSpigot
Charsets.UTF_8
).openBufferedStream();
try {
- JSONObject obj = (JSONObject) new JSONParser().parse(reader);
- return ((Number) obj.get("totalCount")).intValue();
- } catch (ParseException ex) {
- ex.printStackTrace();
+ // PaperSpigot start
+ int newVer = Integer.decode(reader.readLine());
+ int currentVer = Integer.decode(currentVerInt);
+ return newVer - currentVer;
+ } catch (NumberFormatException ex) {
+ //ex.printStackTrace();
+ // PaperSpigot end
return -1;
} finally {
reader.close();
--
2.7.1

View File

@ -1,16 +1,16 @@
From f126884b3b8347bc53ee7223e58f653028facacb Mon Sep 17 00:00:00 2001 From 9070ef66368a21f22fca497c89a62e1dacded81a Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Thu, 23 Jul 2015 11:45:20 -0700 Date: Mon, 29 Feb 2016 18:09:40 -0600
Subject: [PATCH] Add BeaconEffectEvent Subject: [PATCH] Add BeaconEffectEvent
diff --git a/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java b/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
new file mode 100644 new file mode 100644
index 0000000..d9f9b95 index 0000000..6579ae9
--- /dev/null --- /dev/null
+++ b/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
@@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
+package org.github.paperspigot.event.block; +package com.destroystokyo.paper.event.block;
+ +
+import org.bukkit.block.Block; +import org.bukkit.block.Block;
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
@ -92,5 +92,5 @@ index 0000000..d9f9b95
+ } + }
+} +}
-- --
2.5.1 2.7.2

View File

@ -1,25 +0,0 @@
From f255e1de552da583447620334ba2df03daabf61d Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Fri, 17 Apr 2015 02:43:00 -0700
Subject: [PATCH] Add FallingBlock source location API
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index bc56fa2..240a278 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -59,4 +59,11 @@ public interface FallingBlock extends Entity {
* @param hurtEntities whether entities will be damaged by this block.
*/
void setHurtEntities(boolean hurtEntities);
+
+ /**
+ * Gets the source block location of the falling block
+ *
+ * @return the source block location the falling block was spawned from
+ */
+ org.bukkit.Location getSourceLoc(); // PaperSpigot - Add FallingBlock source location API
}
--
2.5.2

View File

@ -1,21 +1,22 @@
From 391fd5f868cb9dcafb5be14f3a1efec2eec4faec Mon Sep 17 00:00:00 2001 From 0bae0f2147779322e69049cf9514e97f2b346a0e Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com> From: Steve Anton <anxuiz.nx@gmail.com>
Date: Tue, 22 Dec 2015 22:04:15 -0600 Date: Mon, 29 Feb 2016 18:13:58 -0600
Subject: [PATCH] Add PlayerInitialSpawnEvent Subject: [PATCH] Add PlayerInitialSpawnEvent
For modifying a player's initial spawn location as they join the server For modifying a player's initial spawn location as they join the server
diff --git a/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
new file mode 100644 new file mode 100644
index 0000000..be82593 index 0000000..d1d6f33
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
@@ -0,0 +1,42 @@ @@ -0,0 +1,43 @@
+package org.bukkit.event.player; +package com.destroystokyo.paper.event.player;
+ +
+import org.bukkit.Location; +import org.bukkit.Location;
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+ +
+public class PlayerInitialSpawnEvent extends PlayerEvent { +public class PlayerInitialSpawnEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList(); + private static final HandlerList handlers = new HandlerList();
@ -53,7 +54,6 @@ index 0000000..be82593
+ return handlers; + return handlers;
+ } + }
+} +}
\ No newline at end of file
-- --
2.6.4 2.7.2

View File

@ -1,40 +0,0 @@
From 4159fb44e468dfea3813b86d3c69956393ec8dde Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 1 Jul 2015 00:59:50 -0700
Subject: [PATCH] Add player view distance API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f93dcec..7522d45 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1183,6 +1183,26 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
{
throw new UnsupportedOperationException( "Not supported yet" );
}
+
+ /**
+ * Get the view distance for this player
+ *
+ * @return View distance
+ */
+ public int getViewDistance()
+ {
+ throw new UnsupportedOperationException( "Not supported yet" );
+ }
+
+ /**
+ * Set the view distance for this player
+ *
+ * @param viewDistance View distance
+ */
+ public void setViewDistance(int viewDistance)
+ {
+ throw new UnsupportedOperationException( "Not supported yet" );
+ }
}
Spigot spigot();
--
1.9.5.msysgit.1

View File

@ -1,14 +1,19 @@
From b5e8582ab199f61b7dcdf2520e9a921907f4e35f Mon Sep 17 00:00:00 2001 From 2913f79fb789598971e82b36b116972502375d43 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 8 Jan 2016 23:12:28 -0600 Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2 Subject: [PATCH] Timings v2
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index d63151f..fe9d6d2 100644 index 2e8b318..3be5e5b 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -48,6 +48,13 @@ @@ -1,4 +1,3 @@
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -48,6 +47,13 @@
<dependencies> <dependencies>
<dependency> <dependency>
@ -1709,7 +1714,7 @@ index 0000000..fe19ea0
+ parent.put("config", createObject( + parent.put("config", createObject(
+ pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), + pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
+ pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), + pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
+ pair("paperspigot", mapAsJSON(Bukkit.spigot().getPaperSpigotConfig(), null)) + pair("paperspigot", mapAsJSON(Bukkit.spigot().getPaperConfig(), null))
+ )); + ));
+ +
+ new TimingsExport(sender, parent, history).start(); + new TimingsExport(sender, parent, history).start();
@ -2778,10 +2783,10 @@ index 0000000..3a288d2
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 584fe11..a4396e8 100644 index e19f3d7..8d602a3 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -533,7 +533,6 @@ public final class Bukkit { @@ -537,7 +537,6 @@ public final class Bukkit {
*/ */
public static void reload() { public static void reload() {
server.reload(); server.reload();
@ -2790,10 +2795,10 @@ index 584fe11..a4396e8 100644
/** /**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 26acdda..ae75bd4 100644 index 92a5cbc..86fe389 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -926,12 +926,27 @@ public interface Server extends PluginMessageRecipient { @@ -949,12 +949,27 @@ public interface Server extends PluginMessageRecipient {
public class Spigot public class Spigot
{ {
@ -2814,7 +2819,7 @@ index 26acdda..ae75bd4 100644
+ throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException("Not supported yet.");
+ } + }
+ +
+ public org.bukkit.configuration.file.YamlConfiguration getPaperSpigotConfig() + public org.bukkit.configuration.file.YamlConfiguration getPaperConfig()
+ { + {
+ throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException("Not supported yet.");
+ } + }
@ -2896,26 +2901,56 @@ index a08a49d..a300ae7 100644
fallbackPrefix = fallbackPrefix.toLowerCase().trim(); fallbackPrefix = fallbackPrefix.toLowerCase().trim();
boolean registered = register(label, command, false, fallbackPrefix); boolean registered = register(label, command, false, fallbackPrefix);
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
index 9782a3b..80e0b0f 100644 deleted file mode 100644
index fc59aa3..0000000
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java --- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java +++ /dev/null
@@ -33,87 +33,22 @@ import org.spigotmc.CustomTimingsHandler; @@ -1,253 +0,0 @@
// Spigot end -package org.bukkit.command.defaults;
-
public class TimingsCommand extends BukkitCommand { -import java.io.File;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang.Validate;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.RegisteredListener;
-import org.bukkit.plugin.TimedRegisteredListener;
-import org.bukkit.util.StringUtil;
-
-import com.google.common.collect.ImmutableList;
-
-// Spigot start
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.logging.Level;
-
-import org.bukkit.command.RemoteConsoleCommandSender;
-import org.bukkit.plugin.SimplePluginManager;
-import org.spigotmc.CustomTimingsHandler;
-// Spigot end
-
-public class TimingsCommand extends BukkitCommand {
- private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste"); // Spigot - private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste"); // Spigot
- public static long timingStart = 0; // Spigot - public static long timingStart = 0; // Spigot
+ public static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate"); -
- public TimingsCommand(String name) {
public TimingsCommand(String name) { - super(name);
super(name);
- this.description = "Manages Spigot Timings data to see performance of the server."; // Spigot - this.description = "Manages Spigot Timings data to see performance of the server."; // Spigot
- this.usageMessage = "/timings <reset|report|on|off|paste>"; // Spigot - this.usageMessage = "/timings <reset|report|on|off|paste>"; // Spigot
+ this.description = "Records timings for all plugin events"; - this.setPermission("bukkit.command.timings");
+ this.usageMessage = "/timings <reset>"; - }
this.setPermission("bukkit.command.timings"); -
}
- // Spigot start - redesigned Timings Command - // Spigot start - redesigned Timings Command
- public void executeSpigotTimings(CommandSender sender, String[] args) { - public void executeSpigotTimings(CommandSender sender, String[] args) {
- if ( "on".equals( args[0] ) ) - if ( "on".equals( args[0] ) )
@ -2967,7 +3002,7 @@ index 9782a3b..80e0b0f 100644
- } - }
- -
- sender.sendMessage("Timings written to " + timings.getPath()); - sender.sendMessage("Timings written to " + timings.getPath());
- sender.sendMessage( "Paste contents of file into form at http://aikar.co/timings.php to read results." ); - sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." );
- -
- } catch (IOException e) { - } catch (IOException e) {
- } finally { - } finally {
@ -2979,22 +3014,99 @@ index 9782a3b..80e0b0f 100644
- } - }
- // Spigot end - // Spigot end
- -
@Override - @Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) { - public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true; - if (!testPermission(sender)) return true;
- if (args.length < 1) { // Spigot - if (args.length < 1) { // Spigot
+ if (args.length != 1) { - sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); - return false;
return false; - }
}
- if (true) { executeSpigotTimings(sender, args); return true; } // Spigot - if (true) { executeSpigotTimings(sender, args); return true; } // Spigot
if (!sender.getServer().getPluginManager().useTimings()) { - if (!sender.getServer().getPluginManager().useTimings()) {
sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml"); - sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml");
return true; - return true;
@@ -199,55 +134,4 @@ public class TimingsCommand extends BukkitCommand { - }
} -
return ImmutableList.of(); - boolean separate = "separate".equalsIgnoreCase(args[0]);
} - if ("reset".equalsIgnoreCase(args[0])) {
- for (HandlerList handlerList : HandlerList.getHandlerLists()) {
- for (RegisteredListener listener : handlerList.getRegisteredListeners()) {
- if (listener instanceof TimedRegisteredListener) {
- ((TimedRegisteredListener)listener).reset();
- }
- }
- }
- sender.sendMessage("Timings reset");
- } else if ("merged".equalsIgnoreCase(args[0]) || separate) {
-
- int index = 0;
- int pluginIdx = 0;
- File timingFolder = new File("timings");
- timingFolder.mkdirs();
- File timings = new File(timingFolder, "timings.txt");
- File names = null;
- while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt");
- PrintStream fileTimings = null;
- PrintStream fileNames = null;
- try {
- fileTimings = new PrintStream(timings);
- if (separate) {
- names = new File(timingFolder, "names" + index + ".txt");
- fileNames = new PrintStream(names);
- }
- for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
- pluginIdx++;
- long totalTime = 0;
- if (separate) {
- fileNames.println(pluginIdx + " " + plugin.getDescription().getFullName());
- fileTimings.println("Plugin " + pluginIdx);
- }
- else fileTimings.println(plugin.getDescription().getFullName());
- for (RegisteredListener listener : HandlerList.getRegisteredListeners(plugin)) {
- if (listener instanceof TimedRegisteredListener) {
- TimedRegisteredListener trl = (TimedRegisteredListener) listener;
- long time = trl.getTotalTime();
- int count = trl.getCount();
- if (count == 0) continue;
- long avg = time / count;
- totalTime += time;
- Class<? extends Event> eventClass = trl.getEventClass();
- if (count > 0 && eventClass != null) {
- fileTimings.println(" " + eventClass.getSimpleName() + (trl.hasMultiple() ? " (and sub-classes)" : "") + " Time: " + time + " Count: " + count + " Avg: " + avg);
- }
- }
- }
- fileTimings.println(" Total time " + totalTime + " (" + totalTime / 1000000000 + "s)");
- }
- sender.sendMessage("Timings written to " + timings.getPath());
- if (separate) sender.sendMessage("Names written to " + names.getPath());
- } catch (IOException e) {
- } finally {
- if (fileTimings != null) {
- fileTimings.close();
- }
- if (fileNames != null) {
- fileNames.close();
- }
- }
- } else {
- sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
- return false;
- }
- return true;
- }
-
- @Override
- public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
- Validate.notNull(sender, "Sender cannot be null");
- Validate.notNull(args, "Arguments cannot be null");
- Validate.notNull(alias, "Alias cannot be null");
-
- if (args.length == 1) {
- return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, new ArrayList<String>(TIMINGS_SUBCOMMANDS.size()));
- }
- return ImmutableList.of();
- }
- -
- // Spigot start - // Spigot start
- private static class PasteThread extends Thread - private static class PasteThread extends Thread
@ -3037,7 +3149,7 @@ index 9782a3b..80e0b0f 100644
- -
- String location = con.getHeaderField( "Location" ); - String location = con.getHeaderField( "Location" );
- String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 ); - String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 );
- sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://aikar.co/timings.php?url=" + pasteID ); - sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://www.spigotmc.org/go/timings?url=" + pasteID );
- } catch ( IOException ex ) - } catch ( IOException ex )
- { - {
- sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" ); - sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" );
@ -3046,14 +3158,14 @@ index 9782a3b..80e0b0f 100644
- } - }
- } - }
- // Spigot end - // Spigot end
} -}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7522d45..c0ebe65 100644 index ed8b8f1..855bde5 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1203,6 +1203,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline @@ -1384,6 +1384,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
{ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException( "Not supported yet" ); throw new UnsupportedOperationException("Not supported yet.");
} }
+ +
+ public int getPing() + public int getPing()
@ -3426,5 +3538,5 @@ index 8d98297..7e89b97 100644
- } - }
} }
-- --
2.7.1 2.7.2

View File

@ -1,12 +1,12 @@
From c2382d5656ff7e3c1b42ecc8cec1278b60b366d9 Mon Sep 17 00:00:00 2001 From 78cc4ff51183b89e12aa39a47d39bf06497613ea Mon Sep 17 00:00:00 2001
From: DemonWav <demonwav@gmail.com> From: DemonWav <demonwav@gmail.com>
Date: Sat, 30 Jan 2016 18:58:09 -0600 Date: Mon, 29 Feb 2016 19:37:41 -0600
Subject: [PATCH] Add Location support to tab completers (vanilla feature Subject: [PATCH] Add Location support to tab completers (vanilla feature
missing in CraftBukkit) missing in CraftBukkit)
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 548d570..c126a1e 100644 index 548d570..18c54b3 100644
--- a/src/main/java/org/bukkit/command/Command.java --- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java
@@ -8,6 +8,7 @@ import java.util.Set; @@ -8,6 +8,7 @@ import java.util.Set;
@ -17,11 +17,12 @@ index 548d570..c126a1e 100644
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.minecart.CommandMinecart; import org.bukkit.entity.minecart.CommandMinecart;
@@ -109,6 +110,30 @@ public abstract class Command { @@ -109,6 +110,31 @@ public abstract class Command {
return matchedPlayers; return matchedPlayers;
} }
+ // PaperSpigot start - location tab-completes + // Paper start - location tab-completes
+
+ /** + /**
+ * Executed on tab completion for this command, returning a list of options the player can tab through. This method + * Executed on tab completion for this command, returning a list of options the player can tab through. This method
+ * returns the {@link Location} of the block the player is looking at at the time of the tab complete. + * returns the {@link Location} of the block the player is looking at at the time of the tab complete.
@ -31,46 +32,40 @@ index 548d570..c126a1e 100644
+ * attempts the tab complete. For this to be valid, the block must be highlighted by the player (i.e. the player is + * attempts the tab complete. For this to be valid, the block must be highlighted by the player (i.e. the player is
+ * close enough to interact with the block). + * close enough to interact with the block).
+ * + *
+ * @param sender Source object which is executing this command + * @param sender Source object which is executing this command
+ * @param alias the alias being used + * @param alias the alias being used
+ * @param args All arguments passed to the command, split via ' ' + * @param args All arguments passed to the command, split via ' '
+ * @param location the location of the block the player is looking at + * @param location the location of the block the player is looking at
+ * @return a list of tab-completions for the specified arguments. This + * @return a list of tab-completions for the specified arguments. This
+ * will never be null. List may be immutable. + * will never be null. List may be immutable.
+ * @throws IllegalArgumentException if sender, alias, or args is null + * @throws IllegalArgumentException if sender, alias, or args is null
+ */ + */
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { + public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
+ // Simply default to the standard tab-complete, subclasses can override this if needed + // Simply default to the standard tab-complete, subclasses can override this if needed
+ return tabComplete(sender, alias, args); + return tabComplete(sender, alias, args);
+ } + }
+ // PaperSpigot end + // Paper end
+ +
/** /**
* Returns the name of this command * Returns the name of this command
* *
diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java
index 3bfa31f..597d7c2 100644 index 3bfa31f..9b93872 100644
--- a/src/main/java/org/bukkit/command/PluginCommand.java --- a/src/main/java/org/bukkit/command/PluginCommand.java
+++ b/src/main/java/org/bukkit/command/PluginCommand.java +++ b/src/main/java/org/bukkit/command/PluginCommand.java
@@ -1,10 +1,11 @@ @@ -3,6 +3,7 @@ package org.bukkit.command;
package org.bukkit.command; import java.util.List;
-import java.util.List;
-
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
+import org.bukkit.Location; +import org.bukkit.Location;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
+import java.util.List;
+
/** /**
* Represents a {@link Command} belonging to a plugin
*/
@@ -122,6 +123,15 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo @@ -122,6 +123,15 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
*/ */
@Override @Override
public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException { public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException {
+ return tabComplete(sender, alias, args, null); // PaperSpigot - The code from this method has been (slightly modified) moved to the Location method. + return tabComplete(sender, alias, args, null); // Paper - The code from this method has been (slightly modified) moved to the Location method.
+ } + }
+ +
+ // PaperSpigot start - location tab-completes + // PaperSpigot start - location tab-completes
@ -87,11 +82,11 @@ index 3bfa31f..597d7c2 100644
try { try {
if (completer != null) { if (completer != null) {
- completions = completer.onTabComplete(sender, this, alias, args); - completions = completer.onTabComplete(sender, this, alias, args);
+ completions = completer.onTabComplete(sender, this, alias, args, location); // PaperSpigot - add location argument + completions = completer.onTabComplete(sender, this, alias, args, location); // Paper - add location argument
} }
if (completions == null && executor instanceof TabCompleter) { if (completions == null && executor instanceof TabCompleter) {
- completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args); - completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args);
+ completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args, location); // PaperSpigot - add location argument + completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args, location); // Paper - add location argument
} }
} catch (Throwable ex) { } catch (Throwable ex) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
@ -99,12 +94,12 @@ index 3bfa31f..597d7c2 100644
} }
return completions; return completions;
} }
+ // PaperSpigot end + // Paper end
@Override @Override
public String toString() { public String toString() {
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index a300ae7..12d9232 100644 index a300ae7..980c4fd 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -12,6 +12,7 @@ import java.util.Map; @@ -12,6 +12,7 @@ import java.util.Map;
@ -119,12 +114,12 @@ index a300ae7..12d9232 100644
} }
public List<String> tabComplete(CommandSender sender, String cmdLine) { public List<String> tabComplete(CommandSender sender, String cmdLine) {
+ return tabComplete(sender, cmdLine, null); // PaperSpigot - location tab-completes, code moved below + return tabComplete(sender, cmdLine, null); // Paper - location tab-completes, code moved below
+ } + }
+ +
+ // PaperSpigot start - location tab-completes + // Paper start - location tab-completes
+ /* + /**
+ this code was copied, except for the noted change, from tabComplete(CommandSender sender, String cmdLine) + * This code was copied, except for the noted change, from tabComplete(CommandSender sender, String cmdLine)
+ */ + */
+ public List<String> tabComplete(CommandSender sender, String cmdLine, Location location) { + public List<String> tabComplete(CommandSender sender, String cmdLine, Location location) {
Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(sender, "Sender cannot be null");
@ -135,19 +130,19 @@ index a300ae7..12d9232 100644
try { try {
- return target.tabComplete(sender, commandName, args); - return target.tabComplete(sender, commandName, args);
+ return target.tabComplete(sender, commandName, args, location); // PaperSpigot - add location argument + return target.tabComplete(sender, commandName, args, location); // Paper - add location argument
} catch (CommandException ex) { } catch (CommandException ex) {
throw ex; throw ex;
} catch (Throwable ex) { } catch (Throwable ex) {
throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex); throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
} }
} }
+ // PaperSpigot end + // Paper end
public Collection<Command> getCommands() { public Collection<Command> getCommands() {
return Collections.unmodifiableCollection(knownCommands.values()); return Collections.unmodifiableCollection(knownCommands.values());
diff --git a/src/main/java/org/bukkit/command/TabCompleter.java b/src/main/java/org/bukkit/command/TabCompleter.java diff --git a/src/main/java/org/bukkit/command/TabCompleter.java b/src/main/java/org/bukkit/command/TabCompleter.java
index 6d61e3a..2cb971c 100644 index 6d61e3a..85b10e5 100644
--- a/src/main/java/org/bukkit/command/TabCompleter.java --- a/src/main/java/org/bukkit/command/TabCompleter.java
+++ b/src/main/java/org/bukkit/command/TabCompleter.java +++ b/src/main/java/org/bukkit/command/TabCompleter.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -163,12 +158,12 @@ index 6d61e3a..2cb971c 100644
*/ */
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args); public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args);
+ +
+ // PaperSpigot start - location tab-completes + // Paper start - location tab-completes
+ default List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args, Location location) { + default List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args, Location location) {
+ return onTabComplete(sender, command, alias, args); + return onTabComplete(sender, command, alias, args);
+ } + }
+ // PaperSpigot end + // Paper end
} }
-- --
2.7.1 2.7.2

View File

@ -1,36 +1,36 @@
From 09b55d7828f2499a4179e60f0be9dbb6b7888ba8 Mon Sep 17 00:00:00 2001 From ae556b9d833294cf0e1f865b6851447a11cdcda5 Mon Sep 17 00:00:00 2001
From: Nik Gil <nikmanG@users.noreply.github.com> From: Nik Gil <nikmanG@users.noreply.github.com>
Date: Mon, 1 Feb 2016 23:36:31 -0700 Date: Mon, 29 Feb 2016 19:42:10 -0600
Subject: [PATCH] Made EntityDismountEvent Cancellable Subject: [PATCH] Made EntityDismountEvent Cancellable
diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
index 24d4942..b35c7c1 100644 index 24d4942..ce989bb 100644
--- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java --- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java +++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
@@ -4,11 +4,15 @@ import org.bukkit.entity.Entity; @@ -1,6 +1,7 @@
package org.spigotmc.event.entity;
import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent; import org.bukkit.event.entity.EntityEvent;
+// PaperSpigot start @@ -8,7 +9,7 @@ import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.event.Cancellable;
+// PaperSpigot end
+
/**
* Called when an entity stops riding another entity. * Called when an entity stops riding another entity.
* *
*/ */
-public class EntityDismountEvent extends EntityEvent -public class EntityDismountEvent extends EntityEvent
+public class EntityDismountEvent extends EntityEvent implements Cancellable // PaperSpigot - implement Cancellable +public class EntityDismountEvent extends EntityEvent implements Cancellable // Paper - implement Cancellable
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@@ -36,4 +40,16 @@ public class EntityDismountEvent extends EntityEvent @@ -36,4 +37,16 @@ public class EntityDismountEvent extends EntityEvent
{ {
return handlers; return handlers;
} }
+ +
+ // PaperSpigot start - implement Cancellable methods + // Paper start - Implement cancellable methods
+ @Override + @Override
+ public boolean isCancelled() { + public boolean isCancelled() {
+ return cancelled; + return cancelled;
@ -40,8 +40,8 @@ index 24d4942..b35c7c1 100644
+ public void setCancelled(boolean cancelled) { + public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled; + this.cancelled = cancelled;
+ } + }
+ // PaperSpigot end + // Paper end
} }
-- --
2.7.0 2.7.2

View File

@ -1,24 +1,24 @@
From 94997a931505151e58013ba362249d63daa09654 Mon Sep 17 00:00:00 2001 From 9003dd80621ac325f76aab4af72047c9da57f691 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 11 Feb 2016 23:21:31 -0500 Date: Mon, 29 Feb 2016 19:45:21 -0600
Subject: [PATCH] Automatically disable plugins that fail to load Subject: [PATCH] Automatically disable plugins that fail to load
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 4983ea8..b057b05 100644 index 4983ea8..93a43dd 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -332,6 +332,10 @@ public final class JavaPluginLoader implements PluginLoader { @@ -332,6 +332,10 @@ public final class JavaPluginLoader implements PluginLoader {
jPlugin.setEnabled(true); jPlugin.setEnabled(true);
} catch (Throwable ex) { } catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ // PaperSpigot start - Disable plugins that fail to load + // Paper start - Disable plugins that fail to load
+ disablePlugin(jPlugin); + disablePlugin(jPlugin);
+ return; + return;
+ // PaperSpigot end + // Paper end
} }
// Perhaps abort here, rather than continue going, but as it stands, // Perhaps abort here, rather than continue going, but as it stands,
-- --
2.7.1 2.7.2

View File

@ -0,0 +1,74 @@
From 7c9892de7be9a27ba1014d2ee6202c70230b114d Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Mon, 29 Feb 2016 19:48:59 -0600
Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 8d602a3..b6a0b40 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
-import org.bukkit.command.CommandException;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.command.PluginCommand;
+import org.bukkit.command.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
@@ -1156,6 +1153,17 @@ public final class Bukkit {
return server.getUnsafe();
}
+ // Paper start
+ /**
+ * Gets the active {@link CommandMap}
+ *
+ * @return the active command map
+ */
+ public static CommandMap getCommandMap() {
+ return server.getCommandMap();
+ }
+ // Paper end
+
public static Server.Spigot spigot()
{
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 86fe389..9ee3815 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
-import org.bukkit.command.CommandException;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.command.PluginCommand;
+import org.bukkit.command.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
@@ -940,6 +937,14 @@ public interface Server extends PluginMessageRecipient {
*/
public double[] getTPS();
+ // Paper start
+ /**
+ * Gets the active {@link CommandMap}
+ *
+ * @return the active command map
+ */
+ CommandMap getCommandMap();
+
/**
* @see UnsafeValues
* @return the unsafe values instance
--
2.7.2

View File

@ -1,11 +1,11 @@
From 0cedba608ed4c22ed465f612d48437ec5955953b Mon Sep 17 00:00:00 2001 From 47ecb6bf0557814cd48f9b732e1bd5bee223f923 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 16 Feb 2016 19:15:30 -0600 Date: Mon, 29 Feb 2016 19:54:32 -0600
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index f0e1b99..8fbc828 100644 index b6a0b40..f93ca2e 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -292,6 +292,26 @@ public final class Bukkit { @@ -292,6 +292,26 @@ public final class Bukkit {
@ -36,7 +36,7 @@ index f0e1b99..8fbc828 100644
* Gets the name of the update folder. The update folder is used to safely * Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load. * update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 316336d..1b62463 100644 index 9ee3815..77d4f34 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -238,6 +238,22 @@ public interface Server extends PluginMessageRecipient { @@ -238,6 +238,22 @@ public interface Server extends PluginMessageRecipient {
@ -63,10 +63,10 @@ index 316336d..1b62463 100644
* Gets the name of the update folder. The update folder is used to safely * Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load. * update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c0ebe65..9ebfa47 100644 index 855bde5..024b8dd 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -330,6 +330,22 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline @@ -331,6 +331,22 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
*/ */
public void sendMap(MapView map); public void sendMap(MapView map);
@ -90,5 +90,5 @@ index c0ebe65..9ebfa47 100644
* Forces an update of the player's entire inventory. * Forces an update of the player's entire inventory.
* *
-- --
2.7.1 2.7.2

View File

@ -1,154 +1,16 @@
From 9da88eae7c63d03c2303ddfa86cededaf1244d70 Mon Sep 17 00:00:00 2001 From 084b100716809ddb5c563ed03318c2cb010f7382 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com> From: Techcable <Techcable@outlook.com>
Date: Tue, 16 Feb 2016 19:51:11 -0600 Date: Mon, 29 Feb 2016 20:02:40 -0600
Subject: [PATCH] Player Tab List and Title APIs Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/com/destroystokyo/paper/Title.java b/src/main/java/com/destroystokyo/paper/Title.java
index 9ebfa47..d02fe56 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -19,6 +19,9 @@ import org.bukkit.conversations.Conversable;
import org.bukkit.map.MapView;
import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.scoreboard.Scoreboard;
+// PaperSpigot start
+import org.github.paperspigot.Title;
+// PaperSpigot end
/**
* Represents a player, connected or not
@@ -344,6 +347,112 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* @param components the components to send
*/
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components);
+
+ /**
+ * Set the text displayed in the player list header and footer for this player
+ *
+ * @param header content for the top of the player list
+ * @param footer content for the bottom of the player list
+ */
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer);
+
+ /**
+ * Set the text displayed in the player list header and footer for this player
+ *
+ * @param header content for the top of the player list
+ * @param footer content for the bottom of the player list
+ */
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer);
+
+ /**
+ * Update the times for titles displayed to the player
+ *
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Update the subtitle of titles displayed to the player
+ * @deprecated Use {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle);
+
+ /**
+ * Update the subtitle of titles displayed to the player
+ * @deprecated Use {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle);
+
+ /**
+ * Show the given title to the player, along with the last subtitle set, using the last set times
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title);
+
+ /**
+ * Show the given title to the player, along with the last subtitle set, using the last set times
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title);
+
+ /**
+ * Show the given title and subtitle to the player using the given times
+ *
+ * @param title big text
+ * @param subtitle little text under it
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title, net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Show the given title and subtitle to the player using the given times
+ *
+ * @param title big text
+ * @param subtitle little text under it
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
+ *
+ * <p>This method overrides any previous title, use {@link #updateTitle(Title)} to change the existing one.</p>
+ *
+ * @param title the title to send
+ * @throws NullPointerException if the title is null
+ */
+ void sendTitle(Title title);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
+ *
+ * <p>This method doesn't override previous titles, but changes their values.</p>
+ *
+ * @param title the title to send
+ * @throws NullPointerException if title is null
+ */
+ void updateTitle(Title title);
+
+ /**
+ * Hide any title that is currently visible to the player
+ */
+ public void hideTitle();
// Paper end
/**
@@ -1086,9 +1195,8 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
/**
* Resets the title displayed to the player.
- * @deprecated API subject to change.
*/
- @Deprecated
+ // Paper - Undeprecate
public void resetTitle();
// Spigot start
diff --git a/src/main/java/org/github/paperspigot/Title.java b/src/main/java/org/github/paperspigot/Title.java
new file mode 100644 new file mode 100644
index 0000000..27f9bc2 index 0000000..e1ecd44
--- /dev/null --- /dev/null
+++ b/src/main/java/org/github/paperspigot/Title.java +++ b/src/main/java/com/destroystokyo/paper/Title.java
@@ -0,0 +1,358 @@ @@ -0,0 +1,358 @@
+package org.github.paperspigot; +package com.destroystokyo.paper;
+ +
+import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.api.chat.TextComponent; +import net.md_5.bungee.api.chat.TextComponent;
@ -506,7 +368,144 @@ index 0000000..27f9bc2
+ } + }
+ } + }
+} +}
\ No newline at end of file diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 024b8dd..50a6a41 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2,6 +2,7 @@ package org.bukkit.entity;
import java.net.InetSocketAddress;
+import com.destroystokyo.paper.Title;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@@ -345,6 +346,116 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* @param components the components to send
*/
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components);
+
+ /**
+ * Set the text displayed in the player list header and footer for this player
+ *
+ * @param header content for the top of the player list
+ * @param footer content for the bottom of the player list
+ */
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer);
+
+ /**
+ * Set the text displayed in the player list header and footer for this player
+ *
+ * @param header content for the top of the player list
+ * @param footer content for the bottom of the player list
+ */
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer);
+
+ /**
+ * Update the times for titles displayed to the player
+ *
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Update the subtitle of titles displayed to the player
+ *
+ * @deprecated Use {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle);
+
+ /**
+ * Update the subtitle of titles displayed to the player
+ *
+ * @deprecated Use {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle);
+
+ /**
+ * Show the given title to the player, along with the last subtitle set, using the last set times
+ *
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title);
+
+ /**
+ * Show the given title to the player, along with the last subtitle set, using the last set times
+ *
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title);
+
+ /**
+ * Show the given title and subtitle to the player using the given times
+ *
+ * @param title big text
+ * @param subtitle little text under it
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title, net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Show the given title and subtitle to the player using the given times
+ *
+ * @param title big text
+ * @param subtitle little text under it
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
+ * <p>
+ * <p>This method overrides any previous title, use {@link #updateTitle(Title)} to change the existing one.</p>
+ *
+ * @param title the title to send
+ * @throws NullPointerException if the title is null
+ */
+ void sendTitle(Title title);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
+ * <p>
+ * <p>This method doesn't override previous titles, but changes their values.</p>
+ *
+ * @param title the title to send
+ * @throws NullPointerException if title is null
+ */
+ void updateTitle(Title title);
+
+ /**
+ * Hide any title that is currently visible to the player
+ */
+ public void hideTitle();
// Paper end
/**
@@ -1089,7 +1200,7 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* Resets the title displayed to the player.
* @deprecated API subject to change.
*/
- @Deprecated
+ // Paper - undeprecate
public void resetTitle();
-- --
2.7.1 2.7.2

View File

@ -1,67 +0,0 @@
From 184494ffcdbd826e48aa98fd8945b44723793af8 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Mon, 15 Feb 2016 07:11:17 -0800
Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a4396e8..f0e1b99 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -14,6 +14,7 @@ import java.util.logging.Logger;
import org.bukkit.Warning.WarningState;
import org.bukkit.command.CommandException;
+import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
@@ -1130,6 +1131,17 @@ public final class Bukkit {
return server.getUnsafe();
}
+ // Paper start
+ /**
+ * Gets the active {@link CommandMap}.
+ *
+ * @return the active command map
+ */
+ public static CommandMap getCommandMap() {
+ return server.getCommandMap();
+ }
+ // Paper end
+
public static Server.Spigot spigot()
{
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ae75bd4..316336d 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -14,6 +14,7 @@ import java.util.logging.Logger;
import org.bukkit.Warning.WarningState;
import org.bukkit.command.CommandException;
+import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
@@ -924,6 +925,15 @@ public interface Server extends PluginMessageRecipient {
@Deprecated
UnsafeValues getUnsafe();
+ // Paper start
+ /**
+ * Gets the active {@link CommandMap}.
+ *
+ * @return the active command map
+ */
+ CommandMap getCommandMap();
+ // Paper end
+
public class Spigot
{
@Deprecated
--
2.7.0.rc0.20.g4b9ab0e

View File

@ -1,6 +1,6 @@
From f77db2e56a6185471090b6cfeba2c441e19af096 Mon Sep 17 00:00:00 2001 From c872380e8a9e221324e69639a39bffb18fc8f883 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 24 Feb 2016 00:57:22 -0500 Date: Mon, 29 Feb 2016 20:26:39 -0600
Subject: [PATCH] Fix ServerListPingEvent flagging as Async Subject: [PATCH] Fix ServerListPingEvent flagging as Async
This event can sometimes fire Async, set the proper boolean This event can sometimes fire Async, set the proper boolean
@ -50,5 +50,5 @@ index 343f238..3c38d85 100644
this.address = address; this.address = address;
this.motd = motd; this.motd = motd;
-- --
2.7.1 2.7.2

View File

@ -1,11 +1,11 @@
From 9e315343a720a550c61568b70657ad2076501022 Mon Sep 17 00:00:00 2001 From 3f12fafbace495fff95f54531ff5d52d6706b3c1 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 19 Mar 2015 19:41:15 -0500 Date: Mon, 29 Feb 2016 20:40:33 -0600
Subject: [PATCH] POM Changes Subject: [PATCH] POM Changes
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 91627ff..fd051da 100644 index 953cdbc..ddbb829 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
@ -14,24 +14,24 @@ index 91627ff..fd051da 100644
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot</artifactId> - <artifactId>spigot</artifactId>
+ <groupId>org.github.paperspigot</groupId> + <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paperspigot</artifactId> + <artifactId>paper</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.8.8-R0.1-SNAPSHOT</version> <version>1.9-SNAPSHOT</version>
- <name>Spigot</name> - <name>Spigot</name>
- <url>http://www.spigotmc.org</url> - <url>http://www.spigotmc.org</url>
+ <name>PaperSpigot</name> + <name>Paper</name>
+ <url>https://hub.spigotmc.org/stash/projects/PAPER/</url> + <url>https://github.com/PaperSpigot/Paper</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -16,13 +16,14 @@ @@ -15,21 +15,22 @@
<minecraft_version>1_8_R3</minecraft_version> <minecraft_version>1_9_R1</minecraft_version>
<buildtag.prefix>git-Bukkit-</buildtag.prefix> <buildtag.prefix>git-Bukkit-</buildtag.prefix>
<buildtag.suffix></buildtag.suffix> <buildtag.suffix></buildtag.suffix>
- <maven.compiler.source>1.6</maven.compiler.source> - <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target> - <maven.compiler.target>1.6</maven.compiler.target>
+ <!--PaperSpigot - Bump to 1.8 - This will haunt me --> + <!--Paper - Bump to 1.8 - This will haunt me -->
+ <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>
@ -39,43 +39,37 @@ index 91627ff..fd051da 100644
<parent> <parent>
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot-parent</artifactId> - <artifactId>spigot-parent</artifactId>
+ <groupId>org.github.paperspigot</groupId> + <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paperspigot-parent</artifactId> + <artifactId>paper-parent</artifactId>
<version>dev-SNAPSHOT</version> <version>dev-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -34,8 +35,8 @@
<version>3.0.3</version> <dependencies>
</dependency>
<dependency> <dependency>
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId> - <artifactId>spigot-api</artifactId>
+ <groupId>org.github.paperspigot</groupId> + <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paperspigot-api</artifactId> + <artifactId>paper-api</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>jar</type>
<scope>compile</scope> <scope>compile</scope>
@@ -96,6 +97,11 @@ </dependency>
<id>spigotmc-public</id> @@ -95,32 +96,18 @@
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url> <build>
</pluginRepository>
+ <!-- PaperSpigot - Repo for gitdescribe -->
+ <pluginRepository>
+ <id>destroystokyo</id>
+ <url>https://ci.destroystokyo.com/plugin/repository/everything/</url>
+ </pluginRepository>
</pluginRepositories>
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
@@ -103,36 +109,22 @@
<defaultGoal>install</defaultGoal>
<plugins> <plugins>
<plugin> <plugin>
- <groupId>net.md-5</groupId> - <groupId>net.md-5</groupId>
- <artifactId>scriptus</artifactId> - <artifactId>scriptus</artifactId>
- <version>0.2</version> - <version>0.2</version>
- <executions> + <groupId>com.lukegb.mojo</groupId>
- <execution> + <artifactId>gitdescribe-maven-plugin</artifactId>
+ <version>1.3</version>
+ <configuration>
+ <outputPrefix>git-Paper-</outputPrefix>
+ <scmDirectory>..</scmDirectory>
+ </configuration>
<executions>
<execution>
- <id>ex-spigot</id> - <id>ex-spigot</id>
- <configuration> - <configuration>
- <format>git-Spigot-%s</format> - <format>git-Spigot-%s</format>
@ -95,32 +89,19 @@ index 91627ff..fd051da 100644
- <descriptionProperty>craftbukkit.desc</descriptionProperty> - <descriptionProperty>craftbukkit.desc</descriptionProperty>
- </configuration> - </configuration>
- <phase>initialize</phase> - <phase>initialize</phase>
- <goals> + <phase>compile</phase>
<goals>
- <goal>describe</goal> - <goal>describe</goal>
- </goals> + <goal>gitdescribe</goal>
- </execution> </goals>
- </executions> </execution>
- </plugin> </executions>
+ <groupId>com.lukegb.mojo</groupId> @@ -130,11 +117,12 @@
+ <artifactId>gitdescribe-maven-plugin</artifactId>
+ <version>1.3</version>
+ <configuration>
+ <outputPrefix>git-PaperSpigot-</outputPrefix>
+ <scmDirectory>..</scmDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>gitdescribe</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
@@ -142,7 +134,7 @@ <version>2.6</version>
<configuration>
+ <forceCreation>true</forceCreation> <!-- Required to prevent shading the jar multiple times -->
<archive>
<manifestEntries> <manifestEntries>
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class> <Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
<Implementation-Title>CraftBukkit</Implementation-Title> <Implementation-Title>CraftBukkit</Implementation-Title>
@ -129,13 +110,13 @@ index 91627ff..fd051da 100644
<Implementation-Vendor>Bukkit Team</Implementation-Vendor> <Implementation-Vendor>Bukkit Team</Implementation-Vendor>
<Specification-Title>Bukkit</Specification-Title> <Specification-Title>Bukkit</Specification-Title>
<Specification-Version>${api.version}</Specification-Version> <Specification-Version>${api.version}</Specification-Version>
@@ -172,26 +164,6 @@ @@ -164,26 +152,6 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId> - <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId> - <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.13</version> - <version>1.14</version>
- <executions> - <executions>
- <execution> - <execution>
- <phase>process-classes</phase> - <phase>process-classes</phase>
@ -155,22 +136,30 @@ index 91627ff..fd051da 100644
- <plugin> - <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.3</version> <version>2.4.1</version>
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java @@ -232,20 +200,6 @@
index c110e0c..5540dde 100644 <artifactId>maven-compiler-plugin</artifactId>
--- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java <!-- versions after this appear to be broken -->
+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java <version>3.1</version>
@@ -11,7 +11,7 @@ public class PathfinderGoalNearestAttackableTarget<T extends EntityLiving> exten - <configuration>
protected final Class<T> a; - <!-- we use the Eclipse compiler as it doesn't need a JDK -->
private final int g; - <compilerId>eclipse</compilerId>
protected final PathfinderGoalNearestAttackableTarget.DistanceComparator b; - <!-- source and target are ignored if this isn't true -->
- protected Predicate<? super T> c; - <optimize>true</optimize>
+ protected Predicate c; - </configuration>
protected EntityLiving d; - <dependencies>
- <!-- we need our custom version as it fixes some bugs on case sensitive file systems -->
public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class<T> oclass, boolean flag) { - <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-compiler-eclipse</artifactId>
- <version>2.5.0-spigotmc</version>
- </dependency>
- </dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 9304637..3a4b142 100644 index 9304637..674096c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning { @@ -11,7 +11,7 @@ public final class Versioning {
@ -178,10 +167,10 @@ index 9304637..3a4b142 100644
String result = "Unknown-Version"; String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties"); - InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties");
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.github.paperspigot/paperspigot-api/pom.properties"); + InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.destroystokyo.paper/paper-api/pom.properties");
Properties properties = new Properties(); Properties properties = new Properties();
if (stream != null) { if (stream != null) {
-- --
2.7.1 2.7.2

View File

@ -0,0 +1,291 @@
From 377f09f50cc994ec746ef79a44d51bae391884b2 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 21:02:09 -0600
Subject: [PATCH] Paper config files
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644
index 0000000..dca7763
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +1,122 @@
+package com.destroystokyo.paper;
+
+import com.google.common.base.Throwables;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import net.minecraft.server.MinecraftServer;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.configuration.InvalidConfigurationException;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+public class PaperConfig {
+
+ private static File CONFIG_FILE;
+ private static final String HEADER = "This is the main configuration file for Paper.\n"
+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n"
+ + "with caution, and make sure you know what each option does before configuring.\n"
+ + "\n"
+ + "If you need help with the configuration or have any questions related to PaperSpigot,\n"
+ + "join us at the IRC.\n"
+ + "\n"
+ + "IRC: #paperspigot @ irc.spi.gt ( http://irc.spi.gt/iris/?channels=PaperSpigot )\n"
+ + "Wiki: https://paper.readthedocs.org/ \n"
+ + "Paper Forums: https://aquifermc.org/ \n";
+ /*========================================================================*/
+ public static YamlConfiguration config;
+ static int version;
+ static Map<String, Command> commands;
+ /*========================================================================*/
+
+ public static void init(File configFile) {
+ CONFIG_FILE = configFile;
+ config = new YamlConfiguration();
+ try {
+ config.load(CONFIG_FILE);
+ } catch (IOException ex) {
+ } catch (InvalidConfigurationException ex) {
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load paper.yml, please correct your syntax errors", ex);
+ throw Throwables.propagate(ex);
+ }
+ config.options().header(HEADER);
+ config.options().copyDefaults(true);
+
+ commands = new HashMap<String, Command>();
+
+ version = getInt("config-version", 9);
+ set("config-version", 9);
+ readConfig(PaperConfig.class, null);
+ }
+
+ public static void registerCommands() {
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue());
+ }
+ }
+
+ static void readConfig(Class<?> clazz, Object instance) {
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (Modifier.isPrivate(method.getModifiers())) {
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
+ try {
+ method.setAccessible(true);
+ method.invoke(instance);
+ } catch (InvocationTargetException ex) {
+ throw Throwables.propagate(ex.getCause());
+ } catch (Exception ex) {
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
+ }
+ }
+ }
+ }
+
+ try {
+ config.save(CONFIG_FILE);
+ } catch (IOException ex) {
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
+ }
+ }
+
+ private static void set(String path, Object val) {
+ config.set(path, val);
+ }
+
+ private static boolean getBoolean(String path, boolean def) {
+ config.addDefault(path, def);
+ return config.getBoolean(path, config.getBoolean(path));
+ }
+
+ private static double getDouble(String path, double def) {
+ config.addDefault(path, def);
+ return config.getDouble(path, config.getDouble(path));
+ }
+
+ private static float getFloat(String path, float def) {
+ // TODO: Figure out why getFloat() always returns the default value.
+ return (float) getDouble(path, (double) def);
+ }
+
+ private static int getInt(String path, int def) {
+ config.addDefault(path, def);
+ return config.getInt(path, config.getInt(path));
+ }
+
+ private static <T> List getList(String path, T def) {
+ config.addDefault(path, def);
+ return (List<T>) config.getList(path, config.getList(path));
+ }
+
+ private static String getString(String path, String def) {
+ config.addDefault(path, def);
+ return config.getString(path, config.getString(path));
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
new file mode 100644
index 0000000..ca6d1a2
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +1,66 @@
+package com.destroystokyo.paper;
+
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+public class PaperWorldConfig {
+
+ private final String worldName;
+ private final YamlConfiguration config;
+ private boolean verbose;
+
+ public PaperWorldConfig(String worldName) {
+ this.worldName = worldName;
+ this.config = PaperConfig.config;
+ init();
+ }
+
+ public void init() {
+ this.verbose = getBoolean("verbose", false);
+
+ log("-------- World Settings For [" + worldName + "] --------");
+ PaperConfig.readConfig(PaperWorldConfig.class, this);
+ }
+
+ private void log(String s) {
+ if (verbose) {
+ Bukkit.getLogger().info(s);
+ }
+ }
+
+ private void set(String path, Object val) {
+ config.set("world-settings.default." + path, val);
+ }
+
+ private boolean getBoolean(String path, boolean def) {
+ config.addDefault("world-settings.default." + path, def);
+ return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path));
+ }
+
+ private double getDouble(String path, double def) {
+ config.addDefault("world-settings.default." + path, def);
+ return config.getDouble("world-settings." + worldName + "." + path, config.getDouble("world-settings.default." + path));
+ }
+
+ private int getInt(String path, int def) {
+ config.addDefault("world-settings.default." + path, def);
+ return config.getInt("world-settings." + worldName + "." + path, config.getInt("world-settings.default." + path));
+ }
+
+ private float getFloat(String path, float def) {
+ // TODO: Figure out why getFloat() always returns the default value.
+ return (float) getDouble(path, (double) def);
+ }
+
+ private <T> List getList(String path, T def) {
+ config.addDefault("world-settings.default." + path, def);
+ return (List<T>) config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path));
+ }
+
+ private String getString(String path, String def) {
+ config.addDefault("world-settings.default." + path, def);
+ return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
+ }
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 0f8c10a..45680ed 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -180,6 +180,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
+ // Paper start
+ com.destroystokyo.paper.PaperConfig.init((File) options.valueOf("paper-settings"));
+ com.destroystokyo.paper.PaperConfig.registerCommands();
+ // Paper end
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 833d5a4..227fd95 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -125,6 +125,8 @@ public abstract class World implements IBlockAccess {
private int tickPosition;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
+
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
private boolean guardEntityList; // Spigot
public static boolean haveWeSilencedAPhysicsCrash;
@@ -147,6 +149,7 @@ public abstract class World implements IBlockAccess {
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
+ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig( worlddata.getName() ); // Paper
this.generator = gen;
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 7831a12..7e5870f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -692,6 +692,7 @@ public final class CraftServer implements Server {
}
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
+ com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
for (WorldServer world : console.worlds) {
world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals);
@@ -707,12 +708,14 @@ public final class CraftServer implements Server {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
}
world.spigotConfig.init(); // Spigot
+ world.paperConfig.init(); // Paper
}
pluginManager.clearPlugins();
commandMap.clearCommands();
resetRecipes();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
+ com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 337aa29..979adad 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -122,6 +122,14 @@ public class Main {
.defaultsTo(new File("spigot.yml"))
.describedAs("Yml file");
// Spigot End
+
+ // Paper Start
+ acceptsAll(asList("paper", "paper-settings"), "File for paper settings")
+ .withRequiredArg()
+ .ofType(File.class)
+ .defaultsTo(new File("paper.yml"))
+ .describedAs("Yml file");
+ // Paper end
}
};
--
2.7.2

View File

@ -1,321 +0,0 @@
From d27df4714c775e383f7388373b4dac6aea181526 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 May 2015 00:08:15 -0500
Subject: [PATCH] PaperSpigot config files
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index c30867d..45cea14 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -177,6 +177,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
+ // PaperSpigot start
+ org.github.paperspigot.PaperSpigotConfig.init((File) options.valueOf("paper-settings"));
+ org.github.paperspigot.PaperSpigotConfig.registerCommands();
+ // PaperSpigot end
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 eca86db8..bb46799 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -161,6 +161,8 @@ public abstract class World implements IBlockAccess {
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot
+
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
public CraftWorld getWorld() {
@@ -177,6 +179,7 @@ public abstract class World implements IBlockAccess {
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
+ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( worlddata.getName() ); // PaperSpigot
this.generator = gen;
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 2759425..019f7a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -688,6 +688,7 @@ public final class CraftServer implements Server {
}
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
+ org.github.paperspigot.PaperSpigotConfig.init((File) console.options.valueOf("paper-settings")); // PaperSpigot
for (WorldServer world : console.worlds) {
world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals);
@@ -703,12 +704,14 @@ public final class CraftServer implements Server {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
}
world.spigotConfig.init(); // Spigot
+ world.paperSpigotConfig.init(); // PaperSpigot
}
pluginManager.clearPlugins();
commandMap.clearCommands();
resetRecipes();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
+ org.github.paperspigot.PaperSpigotConfig.registerCommands(); // PaperSpigot
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 337aa29..c936219 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -122,6 +122,14 @@ public class Main {
.defaultsTo(new File("spigot.yml"))
.describedAs("Yml file");
// Spigot End
+
+ // PaperSpigot Start
+ acceptsAll(asList("paper", "paper-settings"), "File for paperspigot settings")
+ .withRequiredArg()
+ .ofType(File.class)
+ .defaultsTo(new File("paper.yml"))
+ .describedAs("Yml file");
+ // PaperSpigot End
}
};
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
new file mode 100644
index 0000000..a08688f
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +1,141 @@
+package org.github.paperspigot;
+
+import com.google.common.base.Throwables;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import net.minecraft.server.MinecraftServer;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.configuration.InvalidConfigurationException;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+public class PaperSpigotConfig
+{
+
+ private static File CONFIG_FILE;
+ private static final String HEADER = "This is the main configuration file for PaperSpigot.\n"
+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n"
+ + "with caution, and make sure you know what each option does before configuring.\n"
+ + "\n"
+ + "If you need help with the configuration or have any questions related to PaperSpigot,\n"
+ + "join us at the IRC.\n"
+ + "\n"
+ + "IRC: #paperspigot @ irc.spi.gt ( http://irc.spi.gt/iris/?channels=PaperSpigot )\n";
+ /*========================================================================*/
+ public static YamlConfiguration config;
+ static int version;
+ static Map<String, Command> commands;
+ /*========================================================================*/
+
+ public static void init(File configFile)
+ {
+ CONFIG_FILE = configFile;
+ config = new YamlConfiguration();
+ try
+ {
+ config.load ( CONFIG_FILE );
+ } catch ( IOException ex )
+ {
+ } catch ( InvalidConfigurationException ex )
+ {
+ Bukkit.getLogger().log( Level.SEVERE, "Could not load paper.yml, please correct your syntax errors", ex );
+ throw Throwables.propagate( ex );
+ }
+ config.options().header( HEADER );
+ config.options().copyDefaults( true );
+
+ commands = new HashMap<String, Command>();
+
+ version = getInt( "config-version", 9 );
+ set( "config-version", 9 );
+ readConfig( PaperSpigotConfig.class, null );
+ }
+
+ public static void registerCommands()
+ {
+ for ( Map.Entry<String, Command> entry : commands.entrySet() )
+ {
+ MinecraftServer.getServer().server.getCommandMap().register( entry.getKey(), "PaperSpigot", entry.getValue() );
+ }
+ }
+
+ static void readConfig(Class<?> clazz, Object instance)
+ {
+ for ( Method method : clazz.getDeclaredMethods() )
+ {
+ if ( Modifier.isPrivate( method.getModifiers() ) )
+ {
+ if ( method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE )
+ {
+ try
+ {
+ method.setAccessible( true );
+ method.invoke( instance );
+ } catch ( InvocationTargetException ex )
+ {
+ throw Throwables.propagate( ex.getCause() );
+ } catch ( Exception ex )
+ {
+ Bukkit.getLogger().log( Level.SEVERE, "Error invoking " + method, ex );
+ }
+ }
+ }
+ }
+
+ try
+ {
+ config.save( CONFIG_FILE );
+ } catch ( IOException ex )
+ {
+ Bukkit.getLogger().log( Level.SEVERE, "Could not save " + CONFIG_FILE, ex );
+ }
+ }
+
+ private static void set(String path, Object val)
+ {
+ config.set( path, val );
+ }
+
+ private static boolean getBoolean(String path, boolean def)
+ {
+ config.addDefault( path, def );
+ return config.getBoolean( path, config.getBoolean( path ) );
+ }
+
+ private static double getDouble(String path, double def)
+ {
+ config.addDefault( path, def );
+ return config.getDouble( path, config.getDouble( path ) );
+ }
+
+ private static float getFloat(String path, float def)
+ {
+ // TODO: Figure out why getFloat() always returns the default value.
+ return (float) getDouble( path, (double) def );
+ }
+
+ private static int getInt(String path, int def)
+ {
+ config.addDefault( path, def );
+ return config.getInt( path, config.getInt( path ) );
+ }
+
+ private static <T> List getList(String path, T def)
+ {
+ config.addDefault( path, def );
+ return (List<T>) config.getList( path, config.getList( path ) );
+ }
+
+ private static String getString(String path, String def)
+ {
+ config.addDefault( path, def );
+ return config.getString( path, config.getString( path ) );
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
new file mode 100644
index 0000000..146324a
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +1,77 @@
+package org.github.paperspigot;
+
+import java.util.List;
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+public class PaperSpigotWorldConfig
+{
+
+ private final String worldName;
+ private final YamlConfiguration config;
+ private boolean verbose;
+
+ public PaperSpigotWorldConfig(String worldName)
+ {
+ this.worldName = worldName;
+ this.config = PaperSpigotConfig.config;
+ init();
+ }
+
+ public void init()
+ {
+ this.verbose = getBoolean( "verbose", true );
+
+ log( "-------- World Settings For [" + worldName + "] --------" );
+ PaperSpigotConfig.readConfig( PaperSpigotWorldConfig.class, this );
+ }
+
+ private void log(String s)
+ {
+ if ( verbose )
+ {
+ Bukkit.getLogger().info( s );
+ }
+ }
+
+ private void set(String path, Object val)
+ {
+ config.set( "world-settings.default." + path, val );
+ }
+
+ private boolean getBoolean(String path, boolean def)
+ {
+ config.addDefault( "world-settings.default." + path, def );
+ return config.getBoolean( "world-settings." + worldName + "." + path, config.getBoolean( "world-settings.default." + path ) );
+ }
+
+ private double getDouble(String path, double def)
+ {
+ config.addDefault( "world-settings.default." + path, def );
+ return config.getDouble( "world-settings." + worldName + "." + path, config.getDouble( "world-settings.default." + path ) );
+ }
+
+ private int getInt(String path, int def)
+ {
+ config.addDefault( "world-settings.default." + path, def );
+ return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) );
+ }
+
+ private float getFloat(String path, float def)
+ {
+ // TODO: Figure out why getFloat() always returns the default value.
+ return (float) getDouble( path, (double) def );
+ }
+
+ private <T> List getList(String path, T def)
+ {
+ config.addDefault( "world-settings.default." + path, def );
+ return (List<T>) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) );
+ }
+
+ private String getString(String path, String def)
+ {
+ config.addDefault( "world-settings.default." + path, def );
+ return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
+ }
+}
--
2.7.0

File diff suppressed because it is too large Load Diff

View File

@ -1,97 +1,98 @@
From 4c8e5bf4bb19ffc86e578b04deaa1ec1746a0201 Mon Sep 17 00:00:00 2001 From de4a6a9e00d7de06c75df36b7b96ee4d3750a430 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 19:50:01 -0600 Date: Mon, 29 Feb 2016 21:20:21 -0600
Subject: [PATCH] Vanished players don't have rights Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 3a80776..eac0363 100644 index e40642f..5ccdb88 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java --- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -220,6 +220,14 @@ public class EntityArrow extends Entity implements IProjectile { @@ -184,6 +184,14 @@ public abstract class EntityArrow extends Entity implements IProjectile {
float f2; }
float f3; }
+ // PaperSpigot start - Allow arrows to fly through vanished players the shooter can't see + // Paper start - Allow arrows to fly through vanished players the shooter can't see
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
+ movingobjectposition = null; + movingobjectposition = null;
+ } + }
+ } + }
+ // PaperSpigot end + // Paper end
+ +
if (movingobjectposition != null) { if (movingobjectposition != null) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event this.a(movingobjectposition);
if (movingobjectposition.entity != null) { }
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 503e78a..00ffff0 100644 index a07e55e..2751b92 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java --- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -187,6 +187,14 @@ public class EntityFishingHook extends Entity { @@ -198,6 +198,14 @@ public class EntityFishingHook extends Entity {
movingobjectposition = new MovingObjectPosition(entity); movingobjectposition = new MovingObjectPosition(entity);
} }
+ // PaperSpigot start - Allow fishing hooks to fly through vanished players the shooter can't see + // Paper start - Allow fishing hooks to fly through vanished players the shooter can't see
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) { + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) {
+ if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
+ movingobjectposition = null; + movingobjectposition = null;
+ }
+ } + }
+ } + // Paper end
+ // PaperSpigot end
+ +
if (movingobjectposition != null) { if (movingobjectposition != null) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
if (movingobjectposition.entity != null) { if (movingobjectposition.entity != null) {
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 72478be..e7cca3c 100644 index 93014a4..e0fc22b 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java --- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -147,6 +147,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile { @@ -157,6 +157,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
} movingobjectposition = new MovingObjectPosition(entity);
} }
+ // PaperSpigot start - Allow projectiles to fly through vanished players the shooter can't see + // Paper start - Allow projectiles to fly through vanished players the shooter can't see
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
+ movingobjectposition = null; + movingobjectposition = null;
+ } + }
+ } + }
+ // PaperSpigot end + // Paper end
+ +
if (movingobjectposition != null) { if (movingobjectposition != null) {
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) { if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) {
this.d(movingobjectposition.a()); this.e(movingobjectposition.a());
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 57b3d9d..0cd4175 100644 index 300573a..6eeb03b 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java --- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -25,7 +25,7 @@ public class ItemBlock extends Item { @@ -21,7 +21,7 @@ public class ItemBlock extends Item {
return false; blockposition = blockposition.shift(enumdirection);
} else if (!entityhuman.a(blockposition, enumdirection, itemstack)) { }
return false;
- } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { - if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) {
+ } else if (world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // PaperSpigot - Pass entityhuman instead of null + if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // Paper - Pass entityhuman instead of null
int i = this.filterData(itemstack.getData()); int i = this.filterData(itemstack.getData());
IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman); IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bb46799..d184f8a 100644 index 92f9e3d..93dbc9c 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1673,6 +1673,13 @@ public abstract class World implements IBlockAccess { @@ -1646,6 +1646,14 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i); Entity entity1 = (Entity) list.get(i);
+ // PaperSpigot start - Allow block placement if the placer cannot see the vanished blocker + // Paper start - Allow block placement if the placer cannot see the vanished blocker
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) { + if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) { + if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
+ continue; + continue;
+ } + }
+ } + }
+ // Paper end
+ +
if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) { if (!entity1.dead && entity1.i && entity1 != entity && (entity == null || entity1.x(entity))) {
return false; return false;
} }
-- --
2.6.3.windows.1 2.7.2

View File

@ -1,41 +0,0 @@
From 0105ce07d38b5554882c5c8293218219baf01c74 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 19:57:50 -0600
Subject: [PATCH] Allow undead horse types to be leashed
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
index 688099f..d1d45b6 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -179,6 +179,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
public boolean cb() {
+ // PaperSpigot start - Configurable undead horse leashing
+ if (this.world.paperSpigotConfig.allowUndeadHorseLeashing) {
+ return super.cb();
+ }
+ // PaperSpigot end
return !this.cR() && super.cb();
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index f3bc3aa..0b47234 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -74,4 +74,11 @@ public class PaperSpigotWorldConfig
config.addDefault( "world-settings.default." + path, def );
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
}
+
+ public boolean allowUndeadHorseLeashing;
+ private void allowUndeadHorseLeashing()
+ {
+ allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", false );
+ log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing );
+ }
}
--
1.9.1

View File

@ -0,0 +1,40 @@
From f07fd6b18c525b635c99a3390a5f83361cb640fa Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 12:45:11 -0600
Subject: [PATCH] Configurable squid spawn ranges
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ca6d1a2..ac7a176 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -63,4 +63,12 @@ public class PaperWorldConfig {
config.addDefault("world-settings.default." + path, def);
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
}
+
+ public double squidMinSpawnHeight;
+ public double squidMaxSpawnHeight;
+ private void squidSpawnHeights() {
+ squidMinSpawnHeight = getDouble("squid-spawn-height.minimum", 45.0D);
+ squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 63.0D);
+ log("Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index b94444d..9f1a50e 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -138,7 +138,8 @@ public class EntitySquid extends EntityWaterAnimal {
}
public boolean cF() {
- return this.locY > 45.0D && this.locY < (double) this.world.K() && super.cF();
+ // Paper - Configurable squid spawn height range
+ return this.locY > world.paperConfig.squidMinSpawnHeight && this.locY < world.paperConfig.squidMaxSpawnHeight && super.cF();
}
public void b(float f, float f1, float f2) {
--
2.7.2

View File

@ -0,0 +1,53 @@
From ac2539c743cbcce559a561db94f7afef9d6260d8 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:02:51 -0600
Subject: [PATCH] Configurable cactus and reed natural growth heights
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ac7a176..ca0c9f0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -71,4 +71,13 @@ public class PaperWorldConfig {
squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 63.0D);
log("Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight);
}
+
+ public int cactusMaxHeight;
+ public int reedMaxHeight;
+ private void blowGrowthHeight() {
+ cactusMaxHeight = getInt("max-growth-height.cactus", 3);
+ reedMaxHeight = getInt("max-growth-height.reeds", 3);
+ log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight);
+
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 862075d..b615f18 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -28,7 +28,7 @@ public class BlockCactus extends Block {
;
}
- if (i < 3) {
+ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
if (j >= (byte) range(3, (world.spigotConfig.cactusModifier / 100 * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index b8c36a7..1e5e9b8 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -27,7 +27,7 @@ public class BlockReed extends Block {
;
}
- if (i < 3) {
+ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
if (j >= (byte) range(3, (world.spigotConfig.caneModifier /100 * 15) + 0.5F, 15)) { // Spigot
--
2.7.2

View File

@ -1,41 +0,0 @@
From 6b5d69ae84764c2a11f03c5fd257486181017987 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 20:20:29 -0600
Subject: [PATCH] Configurable squid spawn ranges
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index 511bec7..31996b4 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -141,7 +141,8 @@ public class EntitySquid extends EntityWaterAnimal {
}
public boolean bR() {
- return this.locY > 45.0D && this.locY < (double) this.world.F() && super.bR();
+ // PaperSpigot - Configurable squid spawn range
+ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < (double) this.world.paperSpigotConfig.squidMaxSpawnHeight && super.bR();
}
public void b(float f, float f1, float f2) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0b47234..f3bbac8 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -81,4 +81,13 @@ public class PaperSpigotWorldConfig
allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", false );
log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing );
}
+
+ public double squidMinSpawnHeight;
+ public double squidMaxSpawnHeight;
+ private void squidSpawnHeight()
+ {
+ squidMinSpawnHeight = getDouble( "squid-spawn-height.minimum", 45.0D );
+ squidMaxSpawnHeight = getDouble( "squid-spawn-height.maximum", 63.0D );
+ log( "Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight );
+ }
}
--
1.9.1

View File

@ -0,0 +1,49 @@
From de2a0128b959a312b8568680540decf3bf9af46e Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:09:16 -0600
Subject: [PATCH] Configurable baby zombie movement speed
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ca0c9f0..852a5bd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -80,4 +80,10 @@ public class PaperWorldConfig {
log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight);
}
+
+ public double babyZombieMovementSpeed;
+ private void babyZombieMovementSpeed() {
+ babyZombieMovementSpeed = getDouble("baby-zombie-movement-speed", 0.5D); // Player moves at 0.1F, for reference
+ log("Baby zombies will move at the speed of " + babyZombieMovementSpeed);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index ba2f12f..24e5863 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -15,7 +15,7 @@ public class EntityZombie extends EntityMonster {
protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, 1);
+ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", world.paperConfig.babyZombieMovementSpeed, 1); // Paper - Remove static - Make baby speed configurable
private static final DataWatcherObject<Boolean> bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h);
private static final DataWatcherObject<Integer> bw = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h);
@@ -105,9 +105,9 @@ public class EntityZombie extends EntityMonster {
if (this.world != null && !this.world.isClientSide) {
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
- attributeinstance.c(EntityZombie.c);
+ attributeinstance.c(this.c);
if (flag) {
- attributeinstance.b(EntityZombie.c);
+ attributeinstance.b(this.c);
}
}
--
2.7.2

View File

@ -1,38 +0,0 @@
From 9b9c2851ddafd52f5e631de7ec1be02a35ad64e1 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 20:27:02 -0600
Subject: [PATCH] Configurable damage multiplier for PvP blocking
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index d73395a..9dce3ac 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -861,7 +861,7 @@ public abstract class EntityHuman extends EntityLiving {
// CraftBukkit end
if (!this.isInvulnerable(damagesource)) {
if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) {
- f = (1.0F + f) * 0.5F;
+ f = (1.0F + f) * this.world.paperSpigotConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable damage multiplier for blocking;
}
f = this.applyArmorModifier(damagesource, f);
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index f3bbac8..2a84879 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -90,4 +90,11 @@ public class PaperSpigotWorldConfig
squidMaxSpawnHeight = getDouble( "squid-spawn-height.maximum", 63.0D );
log( "Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight );
}
+
+ public float playerBlockingDamageMultiplier;
+ private void playerBlockingDamageMultiplier()
+ {
+ playerBlockingDamageMultiplier = getFloat( "player-blocking-damage-multiplier", 0.5F );
+ log( "Player blocking damage multiplier set to " + playerBlockingDamageMultiplier );
+ }
}
--
1.9.1

View File

@ -1,53 +0,0 @@
From 5ac0e55838b5e0bf667cc3759af1e2744eea2a2a Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 20:32:13 -0600
Subject: [PATCH] Configurable cactus and reed natural growth heights
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 488e5c2..ddc2135 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -26,7 +26,7 @@ public class BlockCactus extends Block {
;
}
- if (i < 3) {
+ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks) {
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index d00067d..337f2c4 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -25,7 +25,7 @@ public class BlockReed extends Block {
;
}
- if (i < 3) {
+ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks) {
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 2a84879..c8b428c 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -97,4 +97,13 @@ public class PaperSpigotWorldConfig
playerBlockingDamageMultiplier = getFloat( "player-blocking-damage-multiplier", 0.5F );
log( "Player blocking damage multiplier set to " + playerBlockingDamageMultiplier );
}
+
+ public int cactusMaxHeight;
+ public int reedMaxHeight;
+ private void blockGrowthHeight()
+ {
+ cactusMaxHeight = getInt( "max-growth-height.cactus", 3 );
+ reedMaxHeight = getInt( "max-growth-height.reeds", 3 );
+ log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight );
+ }
}
--
1.9.1

View File

@ -0,0 +1,39 @@
From b88a07a3dffa0b0742869f430b392b3696251239 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:14:11 -0600
Subject: [PATCH] Configurable fishing time ranges
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 852a5bd..2f30b66 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -86,4 +86,12 @@ public class PaperWorldConfig {
babyZombieMovementSpeed = getDouble("baby-zombie-movement-speed", 0.5D); // Player moves at 0.1F, for reference
log("Baby zombies will move at the speed of " + babyZombieMovementSpeed);
}
+
+ public int fishingMinTicks;
+ public int fishingMaxTicks;
+ private void fishingTickRange() {
+ fishingMinTicks = getInt("fishing-time-range.MinimumTicks", 100);
+ fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 900);
+ log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 2751b92..a38898c 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -359,7 +359,7 @@ public class EntityFishingHook extends Entity {
this.aw = MathHelper.nextInt(this.random, 20, 80);
}
} else {
- this.av = MathHelper.nextInt(this.random, 100, 900);
+ this.av = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - Configurable fishing time range
this.av -= EnchantmentManager.g(this.owner) * 20 * 5;
}
}
--
2.7.2

View File

@ -1,46 +1,46 @@
From 3a9f1ad42ef76caca5fcfc663e91f27d9c963833 Mon Sep 17 00:00:00 2001 From f7cca8a66999ab5b254908f7da834e66e0b6bfa3 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 21:03:06 -0600 Date: Tue, 1 Mar 2016 13:24:16 -0600
Subject: [PATCH] Allow nerfed mobs to jump Subject: [PATCH] Allow nerfed mobs to jump
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index a8a327d..aa38fe6 100644 index 7d4bb9f..a45e87c 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java --- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -33,6 +33,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -43,6 +43,7 @@ public abstract class EntityInsentient extends EntityLiving {
private boolean bo; private boolean bC;
private Entity bp; private Entity leashHolder;
private NBTTagCompound bq; private NBTTagCompound bE;
+ public PathfinderGoalFloat goalFloat; // PaperSpigot + public PathfinderGoalFloat goalFloat; // Paper
public EntityInsentient(World world) { public EntityInsentient(World world) {
super(world); super(world);
@@ -460,6 +461,12 @@ public abstract class EntityInsentient extends EntityLiving { @@ -629,6 +630,12 @@ public abstract class EntityInsentient extends EntityLiving {
// Spigot Start // Spigot Start
if ( this.fromMobSpawner ) if ( this.fromMobSpawner )
{ {
+ // PaperSpigot start - Allow nerfed mobs to jump + // Paper start - Allow nerfed mobs to jump and float
+ if (goalFloat != null) { + if (goalFloat != null) {
+ if (goalFloat.a()) goalFloat.e(); + if (goalFloat.a()) goalFloat.e();
+ this.g.b(); + this.g.b();
+ } + }
+ // PaperSpigot end + // Paper end
return; return;
} }
// Spigot End // Spigot End
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
index 6014b09..da019c1 100644 index 1a20dbf..e385148 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java --- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
@@ -6,6 +6,7 @@ public class PathfinderGoalFloat extends PathfinderGoal { @@ -6,6 +6,7 @@ public class PathfinderGoalFloat extends PathfinderGoal {
public PathfinderGoalFloat(EntityInsentient entityinsentient) { public PathfinderGoalFloat(EntityInsentient entityinsentient) {
this.a = entityinsentient; this.a = entityinsentient;
+ entityinsentient.goalFloat = this; // PaperSpigot + entityinsentient.goalFloat = this; // Paper
this.a(4); this.a(4);
((Navigation) entityinsentient.getNavigation()).d(true); ((Navigation) entityinsentient.getNavigation()).c(true);
} }
-- --
2.5.1 2.7.2

View File

@ -1,37 +0,0 @@
From 0b4987d924c62805d99df5922954b2cce6a3a81f Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 20:41:55 -0600
Subject: [PATCH] Configurable baby zombie movement speed
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 1a8d3d8..6d3b002 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -16,7 +16,7 @@ public class EntityZombie extends EntityMonster {
protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, 1);
+ private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); // PaperSpigot - Configurable baby zombie movement speed
private final PathfinderGoalBreakDoor bm = new PathfinderGoalBreakDoor(this);
private int bn;
private boolean bo = false;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index eef9722..0e9d57f 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -138,4 +138,10 @@ public class PaperSpigotConfig
config.addDefault( path, def );
return config.getString( path, config.getString( path ) );
}
+
+ public static double babyZombieMovementSpeed;
+ private static void babyZombieMovementSpeed()
+ {
+ babyZombieMovementSpeed = getDouble( "settings.baby-zombie-movement-speed", 0.5D ); // Player moves at 0.1F, for reference
+ }
}
--
2.4.1.windows.1

View File

@ -1,39 +0,0 @@
From 212022045788f038265c3d8e51e5858e17b56f05 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 21:00:13 -0600
Subject: [PATCH] Configurable fishing time ranges
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 00ffff0..df6ce0d 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -339,7 +339,7 @@ public class EntityFishingHook extends Entity {
this.ax = MathHelper.nextInt(this.random, 20, 80);
}
} else {
- this.aw = MathHelper.nextInt(this.random, 100, 900);
+ this.aw = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks); // PaperSpigot - Configurable fishing tick range
this.aw -= EnchantmentManager.h(this.owner) * 20 * 5;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index db40fb8..5ae9afb 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -106,4 +106,12 @@ public class PaperSpigotWorldConfig
reedMaxHeight = getInt( "max-growth-height.reeds", 3 );
log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight );
}
+
+ public int fishingMinTicks;
+ public int fishingMaxTicks;
+ private void fishingTickRange()
+ {
+ fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", 100 );
+ fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", 900 );
+ }
}
--
2.6.3.windows.1

View File

@ -0,0 +1,40 @@
From 6b7626be9f683f5e31323cdd56e10546437785c4 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:31:05 -0600
Subject: [PATCH] Toggle for player interact limiter
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 881e989..c8638a8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -119,4 +119,12 @@ public class PaperConfig {
config.addDefault(path, def);
return config.getString(path, config.getString(path));
}
+
+ public static boolean useInteractLimiter;
+ private static void useInteractLimiter() {
+ useInteractLimiter = getBoolean("settings.limit-player-interactions", true);
+ if (!useInteractLimiter) {
+ Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users");
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0f873ae..b7db9b6 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -864,7 +864,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.resetIdleTimer();
// Spigot start
boolean throttled = false;
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
+ // Paper - Allow disabling interact limiter
+ if (com.destroystokyo.paper.PaperConfig.useInteractLimiter && lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
throttled = true;
} else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 )
{
--
2.7.2

View File

@ -0,0 +1,60 @@
From d5804afa686172f201f7d7f7cef178f54ba4a4f3 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Tue, 1 Mar 2016 13:43:16 -0600
Subject: [PATCH] Player Exhaustion Multipliers
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2f30b66..d5b4756 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -94,4 +94,13 @@ public class PaperWorldConfig {
fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 900);
log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
}
+
+ public float blockBreakExhaustion;
+ public float playerSwimmingExhaustion;
+ public void exhaustionValues() {
+ blockBreakExhaustion = getFloat("player-exhaustion.block-break", 0.025F);
+ playerSwimmingExhaustion = getFloat("player-exhaustion.swimming", 0.015F);
+ log("Player exhaustion penalty for breaking blocks is " + blockBreakExhaustion);
+ log("Player exhaustion penalty for swimming is " + playerSwimmingExhaustion);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 1d2f580..bed5577 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -409,7 +409,7 @@ public class Block {
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity, ItemStack itemstack) {
entityhuman.b(StatisticList.a(this));
- entityhuman.applyExhaustion(0.025F);
+ entityhuman.applyExhaustion(world.paperConfig.blockBreakExhaustion); // Paper - Configurable block break exhaustion
if (this.o() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0) {
ItemStack itemstack1 = this.u(iblockdata);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 53936de..d8161a8 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1446,13 +1446,13 @@ public abstract class EntityHuman extends EntityLiving {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.q, i);
- this.applyExhaustion(0.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion
}
} else if (this.isInWater()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
- this.applyExhaustion(0.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion
}
} else if (this.n_()) {
if (d1 > 0.0D) {
--
2.7.2

View File

@ -0,0 +1,55 @@
From ba115e8f3764ef9162fba23d75154d9d5bb0054e Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Tue, 1 Mar 2016 13:51:54 -0600
Subject: [PATCH] Add configurable despawn distances for living entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d5b4756..a662f26 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -103,4 +103,20 @@ public class PaperWorldConfig {
log("Player exhaustion penalty for breaking blocks is " + blockBreakExhaustion);
log("Player exhaustion penalty for swimming is " + playerSwimmingExhaustion);
}
+
+ public int softDespawnDistance;
+ public int hardDespawnDistance;
+ private void despawnDistances() {
+ softDespawnDistance = getInt("despawn-ranges.soft", 32); // 32^2 = 1024, Minecraft Default
+ hardDespawnDistance = getInt("despawn-ranges.hard", 128); // 128^2 = 16384, Minecraft Default
+
+ if (softDespawnDistance > hardDespawnDistance) {
+ softDespawnDistance = hardDespawnDistance;
+ }
+
+ log("Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance);
+
+ softDespawnDistance = softDespawnDistance*softDespawnDistance;
+ hardDespawnDistance = hardDespawnDistance*hardDespawnDistance;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index a45e87c..916c913 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -608,13 +608,13 @@ public abstract class EntityInsentient extends EntityLiving {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (d3 > world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances
this.die();
}
- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > world.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances
this.die();
- } else if (d3 < 1024.0D) {
+ } else if (d3 < world.paperConfig.softDespawnDistance) { // Paper - custom despawn distances
this.ticksFarFromPlayer = 0;
}
}
--
2.7.2

View File

@ -1,42 +0,0 @@
From 0c1371c36a93de12180683ee8c33bb9fb8d61cec Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 21:07:10 -0600
Subject: [PATCH] Toggle for player interact limiter
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 68358e9..7ea74c0 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -661,7 +661,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u());
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
boolean throttled = false;
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
+ // PaperSpigot - Allow disabling the player interaction limiter
+ if (org.github.paperspigot.PaperSpigotConfig.interactLimitEnabled && lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
throttled = true;
} else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 )
{
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index 85ee51b..b0dd5b0 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -144,4 +144,14 @@ public class PaperSpigotConfig
{
babyZombieMovementSpeed = getDouble( "settings.baby-zombie-movement-speed", 0.5D ); // Player moves at 0.1F, for reference
}
+
+ public static boolean interactLimitEnabled;
+ private static void interactLimitEnabled()
+ {
+ interactLimitEnabled = getBoolean( "settings.limit-player-interactions", true );
+ if ( !interactLimitEnabled )
+ {
+ Bukkit.getLogger().log( Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users" );
+ }
+ }
}
--
2.5.1

View File

@ -0,0 +1,36 @@
From 44d08ff1133630f18994c477b7408a9bca02da16 Mon Sep 17 00:00:00 2001
From: Dmck2b <itallhappenedverysuddenly@gmail.com>
Date: Tue, 1 Mar 2016 13:59:50 -0600
Subject: [PATCH] Allow for toggling of spawn chunks
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a662f26..41747bd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -119,4 +119,10 @@ public class PaperWorldConfig {
softDespawnDistance = softDespawnDistance*softDespawnDistance;
hardDespawnDistance = hardDespawnDistance*hardDespawnDistance;
}
+
+ public boolean keepSpawnInMemory;
+ private void keepSpawnInMemory() {
+ keepSpawnInMemory = getBoolean("keep-spawn-loaded", true);
+ log("Keep spawn chunk loaded: " + keepSpawnInMemory);
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 93dbc9c..d3d92a3 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -168,6 +168,7 @@ public abstract class World implements IBlockAccess {
this.isClientSide = flag;
this.N = worldprovider.getWorldBorder();
this.getServer().addWorld(this.world); // CraftBukkit
+ this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
--
2.7.2

View File

@ -1,59 +0,0 @@
From fbdc8216d9f45a2c13cdf26343f5306ccc73664b Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Sat, 7 Mar 2015 21:35:14 -0600
Subject: [PATCH] Player Exhaustion Multipliers
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 5e91e82..c26975a 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -566,7 +566,7 @@ public class Block {
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) {
entityhuman.b(StatisticList.MINE_BLOCK_COUNT[getId(this)]);
- entityhuman.applyExhaustion(0.025F);
+ entityhuman.applyExhaustion(world.paperSpigotConfig.blockBreakExhaustion); // PaperSpigot - Configurable block break exhaustion
if (this.I() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.i(iblockdata);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index e705b86..ae2c44e 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1370,13 +1370,13 @@ public abstract class EntityHuman extends EntityLiving {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.p, i);
- this.applyExhaustion(0.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion
}
} else if (this.V()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.l, i);
- this.applyExhaustion(0.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion
}
} else if (this.k_()) {
if (d1 > 0.0D) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 5ae9afb..23a2a96 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -114,4 +114,12 @@ public class PaperSpigotWorldConfig
fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", 100 );
fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", 900 );
}
+
+ public float blockBreakExhaustion;
+ public float playerSwimmingExhaustion;
+ private void exhaustionValues()
+ {
+ blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F );
+ playerSwimmingExhaustion = getFloat( "player-exhaustion.swimming", 0.015F );
+ }
}
--
2.5.1

View File

@ -1,56 +0,0 @@
From 38ac29dbbda20d4ba78b51249c311026d597a50d Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Sat, 7 Mar 2015 21:40:48 -0600
Subject: [PATCH] Add configurable despawn distances for living entities
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index aa38fe6..2d4d34c 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -439,13 +439,13 @@ public abstract class EntityInsentient extends EntityLiving {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (d3 > this.world.paperSpigotConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances
this.die();
}
- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distance
this.die();
- } else if (d3 < 1024.0D) {
+ } else if (d3 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances
this.ticksFarFromPlayer = 0;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 23a2a96..1164186 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -122,4 +122,21 @@ public class PaperSpigotWorldConfig
blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F );
playerSwimmingExhaustion = getFloat( "player-exhaustion.swimming", 0.015F );
}
+
+ public int softDespawnDistance;
+ public int hardDespawnDistance;
+ private void despawnDistances()
+ {
+ softDespawnDistance = getInt( "despawn-ranges.soft", 32 ); // 32^2 = 1024, Minecraft Default
+ hardDespawnDistance = getInt( "despawn-ranges.hard", 128 ); // 128^2 = 16384, Minecraft Default;
+
+ if ( softDespawnDistance > hardDespawnDistance ) {
+ softDespawnDistance = hardDespawnDistance;
+ }
+
+ log( "Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance );
+
+ softDespawnDistance = softDespawnDistance*softDespawnDistance;
+ hardDespawnDistance = hardDespawnDistance*hardDespawnDistance;
+ }
}
--
2.5.1

View File

@ -0,0 +1,68 @@
From e29729e0e0500cc46e355b654b01114a03605c96 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 14:14:15 -0600
Subject: [PATCH] Drop falling block and tnt entities at the specified height
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 41747bd..0d0cca5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -125,4 +125,14 @@ public class PaperWorldConfig {
keepSpawnInMemory = getBoolean("keep-spawn-loaded", true);
log("Keep spawn chunk loaded: " + keepSpawnInMemory);
}
+
+ public int fallingBlockHeightNerf;
+ public int entityTNTHeightNerf;
+ private void heightNerfs() {
+ fallingBlockHeightNerf = getInt("falling-block-height-nerf", 0);
+ entityTNTHeightNerf = getInt("tnt-entity-height-nerf", 0);
+
+ if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
+ if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 86cb592..9c506ed 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -76,6 +76,17 @@ public class EntityFallingBlock extends Entity {
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // Paper start - Configurable EntityFallingBlock height nerf
+ if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperConfig.fallingBlockHeightNerf) {
+ if (this.dropItem) {
+ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F);
+ }
+
+ this.die();
+ }
+ // Paper end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 35ed2a6..564ea37 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -51,6 +51,13 @@ public class EntityTNTPrimed extends Entity {
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // Paper start - Configurable TNT entity height nerf
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY > this.world.paperConfig.entityTNTHeightNerf) {
+ this.die();
+ }
+ // Paper end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
--
2.7.2

View File

@ -1,37 +0,0 @@
From 3688509ebd26b57e70a5d28caa24be2d44e3f387 Mon Sep 17 00:00:00 2001
From: Dmck2b <itallhappenedverysuddenly@gmail.com>
Date: Sat, 7 Mar 2015 21:50:40 -0600
Subject: [PATCH] Allow for toggling of spawn chunks
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index af60059..03eb5f2 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -230,6 +230,7 @@ public abstract class World implements IBlockAccess {
});
this.getServer().addWorld(this.world);
// CraftBukkit end
+ this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot
timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 1164186..b7703a0 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -139,4 +139,11 @@ public class PaperSpigotWorldConfig
softDespawnDistance = softDespawnDistance*softDespawnDistance;
hardDespawnDistance = hardDespawnDistance*hardDespawnDistance;
}
+
+ public boolean keepSpawnInMemory;
+ private void keepSpawnInMemory()
+ {
+ keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
+ log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
+ }
}
--
2.5.1

View File

@ -1,11 +1,26 @@
From 89acd9868cbace41415af5c22266009e9e7b8764 Mon Sep 17 00:00:00 2001 From dffc7e903b5996c39b84fca2262852fa7f13f24b Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Sat, 7 Mar 2015 22:17:03 -0600 Date: Tue, 1 Mar 2016 14:27:13 -0600
Subject: [PATCH] Configurable speed for water flowing over lava Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0d0cca5..6ccd700 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -135,4 +135,10 @@ public class PaperWorldConfig {
if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
}
+
+ public int waterOverLavaFlowSpeed;
+ private void waterOverLawFlowSpeed() {
+ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 5d36af3..de1dddb 100644 index 800ffdc..036e861 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java --- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids { @@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids {
@ -13,50 +28,34 @@ index 5d36af3..de1dddb 100644
} }
- int j = this.a(world); - int j = this.a(world);
+ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot + int j = this.getFlowSpeed(world, blockposition); // Paper
int k; int k;
if (i > 0) { if (i > 0) {
@@ -259,8 +259,22 @@ public class BlockFlowing extends BlockFluids { @@ -263,8 +263,22 @@ public class BlockFlowing extends BlockFluids {
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!this.e(world, blockposition, iblockdata)) { if (!this.e(world, blockposition, iblockdata)) {
- world.a(blockposition, (Block) this, this.a(world)); - world.a(blockposition, (Block) this, this.a(world));
+ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // PaperSpigot + world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // Paper
} }
} }
+ +
+ /** + /**
+ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava + * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava
+ */ + */
+ public int getFlowSpeed(World world, BlockPosition blockposition) { + public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.getMaterial() == Material.WATER && ( + if (this.material == Material.WATER && (
+ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA || + world.getType(blockposition.north(1)).getBlock().material == Material.LAVA ||
+ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA || + world.getType(blockposition.south(1)).getBlock().material == Material.LAVA ||
+ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA || + world.getType(blockposition.west(1)).getBlock().material == Material.LAVA ||
+ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) { + world.getType(blockposition.east(1)).getBlock().material == Material.LAVA)) {
+ return world.paperSpigotConfig.waterOverLavaFlowSpeed; + return world.paperConfig.waterOverLavaFlowSpeed;
+ } + }
+ return super.a(world); + return super.a(world);
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 52c05a8..781cf75 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -166,4 +166,11 @@ public class PaperSpigotWorldConfig
log( "TNT Entity Height Limit set to Y: " + tntEntityHeightNerf );
}
}
+
+ public int waterOverLavaFlowSpeed;
+ private void waterOverLavaFlowSpeed()
+ {
+ waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
+ } + }
} }
-- --
2.7.0 2.7.2

View File

@ -1,78 +0,0 @@
From 19a21a3299d8e33e9d2e74f2ec7216689a03c8e5 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sat, 7 Mar 2015 22:03:47 -0600
Subject: [PATCH] Drop falling block and tnt entities at the specified height
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 7a42040..95c188b 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -69,6 +69,17 @@ public class EntityFallingBlock extends Entity {
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // PaperSpigot start - Drop falling blocks above the specified height
+ if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) {
+ if (this.dropItem) {
+ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F);
+ }
+
+ this.die();
+ }
+ // PaperSpigot end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 2d22327..d2d94d7 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -47,6 +47,13 @@ public class EntityTNTPrimed extends Entity {
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // PaperSpigot start - Drop TNT entities above the specified height
+ if (this.world.paperSpigotConfig.tntEntityHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.tntEntityHeightNerf) {
+ this.die();
+ }
+ // PaperSpigot end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index b7703a0..52c05a8 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -146,4 +146,24 @@ public class PaperSpigotWorldConfig
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
}
+
+ public int fallingBlockHeightNerf;
+ private void fallingBlockheightNerf()
+ {
+ fallingBlockHeightNerf = getInt( "falling-block-height-nerf", 0 );
+ if ( fallingBlockHeightNerf != 0 )
+ {
+ log( "Falling Block Height Limit set to Y: " + fallingBlockHeightNerf );
+ }
+ }
+
+ public int tntEntityHeightNerf;
+ private void tntEntityHeightNerf()
+ {
+ tntEntityHeightNerf = getInt( "tnt-entity-height-nerf", 0 );
+ if ( tntEntityHeightNerf != 0 )
+ {
+ log( "TNT Entity Height Limit set to Y: " + tntEntityHeightNerf );
+ }
+ }
}
--
2.7.0

View File

@ -1,25 +1,38 @@
From 98de4059bdb6cc1443c58be63c829dfea29d11cb Mon Sep 17 00:00:00 2001 From 61ede748726903b893c445653d8efe03a567607d Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 7 Mar 2015 22:55:25 -0600 Date: Tue, 1 Mar 2016 14:32:43 -0600
Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
Mojang stats stats
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1d29ae7..9fc2cfa 100644 index 89e6ad3..7b99c2f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1023,7 +1023,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs @@ -1017,7 +1017,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
} }
public String getServerModName() { public String getServerModName() {
- return "Spigot"; // Spigot - Spigot > // CraftBukkit - cb > vanilla! - return "Spigot"; // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "PaperSpigot"; // PaperSpigot - PaperSpigot > // Spigot - Spigot > // CraftBukkit - cb > vanilla! + return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
} }
public CrashReport b(CrashReport crashreport) { public CrashReport b(CrashReport crashreport) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7e5870f..40998cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -130,7 +130,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
public final class CraftServer implements Server {
private static final Player[] EMPTY_PLAYER_ARRAY = new Player[0];
- private final String serverName = "CraftBukkit";
+ private final String serverName = "Paper";
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 94a3d42..c8f619a 100644 index 94a3d42..3ed983c 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java --- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -19,7 +19,7 @@ public class WatchdogThread extends Thread @@ -19,7 +19,7 @@ public class WatchdogThread extends Thread
@ -27,7 +40,7 @@ index 94a3d42..c8f619a 100644
private WatchdogThread(long timeoutTime, boolean restart) private WatchdogThread(long timeoutTime, boolean restart)
{ {
- super( "Spigot Watchdog Thread" ); - super( "Spigot Watchdog Thread" );
+ super( "PaperSpigot Watchdog Thread" ); + super( "Paper Watchdog Thread" );
this.timeoutTime = timeoutTime; this.timeoutTime = timeoutTime;
this.restart = restart; this.restart = restart;
} }
@ -36,10 +49,10 @@ index 94a3d42..c8f619a 100644
Logger log = Bukkit.getServer().getLogger(); Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" ); log.log( Level.SEVERE, "The server has stopped responding!" );
- log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" ); - log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" );
+ log.log( Level.SEVERE, "Please report this to PaperSpigot directly!" ); + log.log( Level.SEVERE, "Please report this to https://aquifermc.org/" );
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() ); - log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "PaperSpigot version: " + Bukkit.getServer().getVersion() ); + log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
// //
if(net.minecraft.server.World.haveWeSilencedAPhysicsCrash) if(net.minecraft.server.World.haveWeSilencedAPhysicsCrash)
{ {
@ -48,10 +61,10 @@ index 94a3d42..c8f619a 100644
// //
log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" ); - log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" );
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to PaperSpigot!):" ); + log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" );
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log );
log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "------------------------------" );
// //
-- --
2.6.1.windows.1 2.7.2

View File

@ -1,122 +1,78 @@
From afaf20bf4d69579819800ee7daa8c9a677ebe318 Mon Sep 17 00:00:00 2001 From 068300d37fa5f1d5782feaf840b64294e69bd72e Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com> From: Jedediah Smith <jedediah@silencegreys.com>
Date: Mon, 18 May 2015 17:52:45 -0500 Date: Tue, 1 Mar 2016 14:47:52 -0600
Subject: [PATCH] Player affects spawning API Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index ae2c44e..b901c69 100644 index d8161a8..5fcd6b8 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -60,6 +60,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -63,6 +63,7 @@ public abstract class EntityHuman extends EntityLiving {
private final GameProfile bH; private ItemStack bT = null;
private boolean bI = false; private final ItemCooldown bU = this.l();
public EntityFishingHook hookedFish; public EntityFishingHook hookedFish;
+ public boolean affectsSpawning = true; // PaperSpigot + public boolean affectsSpawning = true; // Paper
// CraftBukkit start // CraftBukkit start
public boolean fauxSleeping; public boolean fauxSleeping;
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 2d4d34c..b82b984 100644 index 916c913..c04490a 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java --- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -431,7 +431,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -600,7 +600,7 @@ public abstract class EntityInsentient extends EntityLiving {
if (this.persistent) { if (this.persistent) {
this.ticksFarFromPlayer = 0; this.ticksFarFromPlayer = 0;
} else { } else {
- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); - EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
+ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot - Affects Spawning API + EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // Paper - Affects Spawning API
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.locX - this.locX; double d0 = entityhuman.locX - this.locX;
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 6004e23..ebd1e36 100644 index efe792b..917b626 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -52,7 +52,7 @@ public abstract class MobSpawnerAbstract { @@ -32,7 +32,7 @@ public abstract class MobSpawnerAbstract {
private boolean g() { private boolean h() {
BlockPosition blockposition = this.b(); BlockPosition blockposition = this.b();
- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); - return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange);
+ return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // PaperSpigot - Affects Spawning API + return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper - Affects spawning API
} }
public void c() { public void c() {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 3964e3f..611b8fd 100644 index 9e19dfd..b724586 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java --- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -52,7 +52,7 @@ public final class SpawnerCreature { @@ -50,7 +50,7 @@ public final class SpawnerCreature {
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next(); EntityHuman entityhuman = (EntityHuman) iterator.next();
- if (!entityhuman.isSpectator()) { - if (!entityhuman.isSpectator()) {
+ if (!entityhuman.isSpectator() || !entityhuman.affectsSpawning) { // PaperSpigot + if (!entityhuman.isSpectator() || !entityhuman.affectsSpawning) {
int l = MathHelper.floor(entityhuman.locX / 16.0D); int l = MathHelper.floor(entityhuman.locX / 16.0D);
j = MathHelper.floor(entityhuman.locZ / 16.0D); j = MathHelper.floor(entityhuman.locZ / 16.0D);
@@ -156,7 +156,7 @@ public final class SpawnerCreature { @@ -160,7 +160,7 @@ public final class SpawnerCreature {
float f = (float) j3 + 0.5F; float f = (float) j3 + 0.5F;
float f1 = (float) l3 + 0.5F; float f1 = (float) l3 + 0.5F;
- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { - if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
+ if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { // PaperSpigot - Affects Spawning API + if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
if (biomebase_biomemeta == null) { if (biomebase_biomemeta == null) {
biomebase_biomemeta = worldserver.a(enumcreaturetype, blockposition2); biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition);
if (biomebase_biomemeta == null) { if (biomebase_biomemeta == null) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 03eb5f2..641db2a 100644 index 9bee723..1c5718e 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -2,35 +2,23 @@ package net.minecraft.server; @@ -2650,6 +2650,53 @@ public abstract class World implements IBlockAccess {
return i;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-
-// CraftBukkit start
import com.google.common.collect.Maps;
-import java.util.Map;
-
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
-import org.bukkit.craftbukkit.util.CraftMagicNumbers;
-import org.bukkit.craftbukkit.util.LongHashSet;
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
-import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.SpigotTimings;
import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
-import org.bukkit.event.weather.WeatherChangeEvent;
-import org.bukkit.event.weather.ThunderChangeEvent;
+import org.bukkit.generator.ChunkGenerator;
+
+import java.util.*;
+import java.util.concurrent.Callable;
+
+// CraftBukkit start
// CraftBukkit end
public abstract class World implements IBlockAccess {
@@ -2807,6 +2795,53 @@ public abstract class World implements IBlockAccess {
return false;
} }
+ // PaperSpigot start - Modified methods for affects spawning + // Paper start - Modified methods for affects spawning
+ public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double d0) { + public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double d0) {
+ return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, d0); + return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, d0);
+ } + }
@ -161,42 +117,34 @@ index 03eb5f2..641db2a 100644
+ +
+ return false; + return false;
+ } + }
+ // PaperSpigot end + // Paper end
+ +
public EntityHuman a(String s) { public EntityHuman findNearbyPlayer(Entity entity, double d0) {
for (int i = 0; i < this.players.size(); ++i) { return this.a(entity.locX, entity.locY, entity.locZ, d0, false);
EntityHuman entityhuman = (EntityHuman) this.players.get(i); }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 35608b7..a9b4160 100644 index 9298344..a9f55ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -7,6 +7,7 @@ import io.netty.buffer.Unpooled; @@ -1416,6 +1416,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
import java.io.ByteArrayOutputStream; }
import java.io.IOException;
+import java.lang.Override;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.ArrayList;
@@ -1470,6 +1471,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
packet.components = components;
getHandle().playerConnection.sendPacket(packet);
}
+
+ // PaperSpigot start - Implement affects spawning API
+ @Override
+ public boolean getAffectsSpawning() {
+ return getHandle().affectsSpawning;
+ }
+
+ @Override
+ public void setAffectsSpawning(boolean affects) {
+ getHandle().affectsSpawning = affects;
+ }
+ // PaperSpigot end
};
public Player.Spigot spigot() + // Paper start
+ @Override
+ public boolean getAffectsSpawning() {
+ return getHandle().affectsSpawning;
+ }
+
+ @Override
+ public void setAffectsSpawning(boolean affects) {
+ getHandle().affectsSpawning = affects;
+ }
+ // Paper end
+
// Spigot start
private final Player.Spigot spigot = new Player.Spigot()
{
-- --
2.5.1 2.7.2

View File

@ -1,11 +1,11 @@
From a7cb1698f46a168af727798e55ef5116bf8ddde2 Mon Sep 17 00:00:00 2001 From f137764bcd4a87ce47c095d5cb18eafc33d93949 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 18 Mar 2015 22:55:25 -0600 Date: Tue, 1 Mar 2016 14:54:32 -0600
Subject: [PATCH] Metrics Subject: [PATCH] Metrics
diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java
index a5fd59d..558989c 100644 index a5fd59d..680283c 100644
--- a/src/main/java/org/spigotmc/Metrics.java --- a/src/main/java/org/spigotmc/Metrics.java
+++ b/src/main/java/org/spigotmc/Metrics.java +++ b/src/main/java/org/spigotmc/Metrics.java
@@ -344,7 +344,7 @@ public class Metrics { @@ -344,7 +344,7 @@ public class Metrics {
@ -13,10 +13,10 @@ index a5fd59d..558989c 100644
private void postPlugin(final boolean isPing) throws IOException { private void postPlugin(final boolean isPing) throws IOException {
// Server software specific section // Server software specific section
- String pluginName = "Spigot"; - String pluginName = "Spigot";
+ String pluginName = "PaperSpigot"; // PaperSpigot - We need some usage data + String pluginName = "PaperSpigot"; // Paper - Keep old name for legacy data
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
String pluginVersion = (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"; String pluginVersion = (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown";
String serverVersion = Bukkit.getVersion(); String serverVersion = Bukkit.getVersion();
-- --
2.6.0 2.7.2

View File

@ -0,0 +1,24 @@
From c17ea8cfc18f7783044c50d9fc4bdb528ce2e83d Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 15:08:03 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index f2bb134..2f37957 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -717,6 +717,10 @@ public class Chunk {
tileentity.z();
this.tileEntities.put(blockposition, tileentity);
// CraftBukkit start
+ // Paper start - Remove invalid mob spawner tile entities
+ } else if (tileentity instanceof TileEntityMobSpawner && org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) != org.bukkit.Material.MOB_SPAWNER) {
+ this.tileEntities.remove(blockposition);
+ // Paper end
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
+ " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!");
--
2.7.2

View File

@ -0,0 +1,238 @@
From 9d63918c050e6ef7fd07581bc6563a8076c62424 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 22:01:19 -0600
Subject: [PATCH] Optimize TileEntity Ticking
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 8f988c3..e7829c5 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -8,17 +8,17 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
-public class TileEntityChest extends TileEntityLootable implements ITickable, IInventory {
+public class TileEntityChest extends TileEntityLootable implements IInventory { // Paper - Remove ITickable
private ItemStack[] items = new ItemStack[27];
public boolean a;
- public TileEntityChest f;
- public TileEntityChest g;
- public TileEntityChest h;
- public TileEntityChest i;
- public float j;
+ public TileEntityChest f; // Paper - Adjacent Chest Z Neg
+ public TileEntityChest g; // Paper - Adjacent Chest X Pos
+ public TileEntityChest h; // Paper - Adjacent Chest X Neg
+ public TileEntityChest i; // Paper - Adjacent Chest Z Pos
+ public float j; // Paper - lid angle
public float k;
- public int l;
+ public int l; // Paper - Number of viewers
private int p;
private BlockChest.Type q;
private String r;
@@ -231,6 +231,8 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II
}
public void c() {
+ // Paper - Disable all of this, just in case this does get ticked
+ /*
this.m();
int i = this.position.getX();
int j = this.position.getY();
@@ -311,7 +313,8 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II
this.j = 0.0F;
}
}
-
+ */
+ // Paper end
}
public boolean c(int i, int j) {
@@ -331,6 +334,28 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II
int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added
++this.l;
+
+ // Paper start - Move chest open sound out of the tick loop
+ this.m();
+
+ if (this.l > 0 && this.j == 0.0F && this.f == null && this.h == null) {
+ this.j = 0.7F;
+
+ double d0 = (double) this.position.getZ() + 0.5D;
+ double d1 = (double) this.position.getX() + 0.5D;
+
+ if (this.i != null) {
+ d0 += 0.5D;
+ }
+
+ if (this.g != null) {
+ d1 += 0.5D;
+ }
+
+ this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.X, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // Paper end
+
if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.position, this.getBlock(), 1, this.l);
@@ -354,6 +379,33 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II
int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added
--this.l;
if (this.world == null) return; // CraftBukkit
+
+ // Paper start - Move chest close sound out of the tick loop
+ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) {
+ float f = 0.1F;
+
+ if (this.l > 0) {
+ this.j += f;
+ } else {
+ this.j -= f;
+ }
+
+ double d0 = (double) this.getPosition().getX() + 0.5D;
+ double d2 = (double) this.getPosition().getZ() + 0.5D;
+
+ if (this.i != null) {
+ d2 += 0.5D;
+ }
+
+ if (this.g != null) {
+ d0 += 0.5D;
+ }
+
+ this.world.a((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.V, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.j = 0.0F;
+ }
+ // Paper end
+
this.world.playBlockAction(this.position, this.getBlock(), 1, this.l);
// CraftBukkit start - Call redstone event
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index e454622..d01b65a 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -1,15 +1,17 @@
package net.minecraft.server;
-public class TileEntityEnderChest extends TileEntity implements ITickable {
+public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable
- public float a;
+ public float a; // Paper - lid angle
public float f;
- public int g;
+ public int g; // Paper - Number of viewers
private int h;
public TileEntityEnderChest() {}
public void c() {
+ // Paper start - Disable all of this, just in case this does get ticked
+ /*
if (++this.h % 20 * 4 == 0) {
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
@@ -54,6 +56,8 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
this.a = 0.0F;
}
}
+ */
+ // Paper end
}
@@ -73,11 +77,34 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
public void b() {
++this.g;
+
+ // Paper start - Move enderchest open sounds out of the tick loop
+ if (this.g > 0 && this.a == 0.0F) {
+ this.a = 0.7F;
+
+ double d1 = (double) this.getPosition().getX() + 0.5D;
+ double d0 = (double) this.getPosition().getZ() + 0.5D;
+
+ this.world.a((EntityHuman) null, d1, (double) this.getPosition().getY() + 0.5D, d0, SoundEffects.aL, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // Paper end
+
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
public void d() {
--this.g;
+
+ // Paper start - Move enderchest close sounds out of the tick loop
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ double d0 = (double) this.getPosition().getX() + 0.5D;
+ double d2 = (double) this.getPosition().getZ() + 0.5D;
+
+ this.world.a((EntityHuman) null, d0, (double) this.getPosition().getY() + 0.5D, d2, SoundEffects.aK, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.a = 0.0F;
+ }
+ // Paper end
+
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f0988fa..d9a84b6 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -60,7 +60,7 @@ public abstract class World implements IBlockAccess {
};
// Spigot end
protected final List<Entity> f = Lists.newArrayList();
- public final List<TileEntity> tileEntityList = Lists.newArrayList();
+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - Remove unused list
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
private final List<TileEntity> b = Lists.newArrayList();
private final List<TileEntity> tileEntityListUnload = Lists.newArrayList();
@@ -1428,7 +1428,7 @@ public abstract class World implements IBlockAccess {
// CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.tileEntityListUnload.isEmpty()) {
this.tileEntityListTick.removeAll(this.tileEntityListUnload);
- this.tileEntityList.removeAll(this.tileEntityListUnload);
+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - Remove unused list
this.tileEntityListUnload.clear();
}
// CraftBukkit end
@@ -1476,7 +1476,7 @@ public abstract class World implements IBlockAccess {
if (tileentity.x()) {
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
- this.tileEntityList.remove(tileentity);
+ //this.tileEntityList.remove(tileentity); // Paper - Remove unused list
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition());
}
@@ -1527,7 +1527,7 @@ public abstract class World implements IBlockAccess {
protected void l() {}
public boolean a(TileEntity tileentity) {
- boolean flag = this.tileEntityList.add(tileentity);
+ boolean flag = true; // Paper - Remove unused list
if (flag && tileentity instanceof ITickable) {
this.tileEntityListTick.add(tileentity);
@@ -2000,7 +2000,7 @@ public abstract class World implements IBlockAccess {
} else {
if (tileentity != null) {
this.b.remove(tileentity);
- this.tileEntityList.remove(tileentity);
+ //this.tileEntityList.remove(tileentity); // Paper - Remove unused list
this.tileEntityListTick.remove(tileentity);
}
--
2.7.2

View File

@ -1,6 +1,6 @@
From 8cae5d46b1afced146412ba40e28ac7e08d61d83 Mon Sep 17 00:00:00 2001 From b5989dbd8369d267021623b3426053f1e020a2e3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 03:47:32 -0500 Date: Tue, 1 Mar 2016 23:09:29 -0600
Subject: [PATCH] Further improve server tick loop Subject: [PATCH] Further improve server tick loop
Improves how the catchup buffer is handled, allowing it to roll both ways Improves how the catchup buffer is handled, allowing it to roll both ways
@ -12,15 +12,15 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable 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 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9fc2cfa..06ae3fc 100644 index 7b99c2f..0a23d2a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -111,17 +111,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs @@ -109,17 +109,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
public ConsoleReader reader; public ConsoleReader reader;
- public static int currentTick = (int) (System.currentTimeMillis() / 50); - public static int currentTick = (int) (System.currentTimeMillis() / 50);
+ public static int currentTick = 0; // PaperSpigot - Further improve tick loop + public static int currentTick = 0; // Paper - Further improve tick loop
public final Thread primaryThread; public final Thread primaryThread;
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
@ -32,9 +32,9 @@ index 9fc2cfa..06ae3fc 100644
- public final double[] recentTps = new double[ 3 ]; - public final double[] recentTps = new double[ 3 ];
- // Spigot end - // Spigot end
public MinecraftServer(OptionSet options, Proxy proxy, File file1) { public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable
@@ -513,12 +507,54 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs @@ -510,12 +504,54 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.isRunning = false; this.isRunning = false;
} }
@ -42,7 +42,7 @@ index 9fc2cfa..06ae3fc 100644
- private static double calcTps(double avg, double exp, double tps) - private static double calcTps(double avg, double exp, double tps)
- { - {
- return ( avg * exp ) + ( tps * ( 1 - exp ) ); - return ( avg * exp ) + ( tps * ( 1 - exp ) );
+ // PaperSpigot start - Further improve tick loop + // Paper start - Further improve server tick loop
+ private static final int TPS = 20; + private static final int TPS = 20;
+ private static final long SEC_IN_NANO = 1000000000; + private static final long SEC_IN_NANO = 1000000000;
+ private static final long TICK_TIME = SEC_IN_NANO / TPS; + private static final long TICK_TIME = SEC_IN_NANO / TPS;
@ -51,7 +51,7 @@ index 9fc2cfa..06ae3fc 100644
+ public final RollingAverage tps1 = new RollingAverage(60); + public final RollingAverage tps1 = new RollingAverage(60);
+ public final RollingAverage tps5 = new RollingAverage(60 * 5); + public final RollingAverage tps5 = new RollingAverage(60 * 5);
+ public final RollingAverage tps15 = new RollingAverage(60 * 15); + public final RollingAverage tps15 = new RollingAverage(60 * 15);
+ public double[] recentTps = new double[ 3 ]; // PaperSpigot - Fine have your darn compat with bad plugins + public double[] recentTps = new double[3]; // Paper - Fine have your darn compat with bad plugins
+ +
+ public static class RollingAverage { + public static class RollingAverage {
+ private final int size; + private final int size;
@ -90,24 +90,20 @@ index 9fc2cfa..06ae3fc 100644
+ } + }
} }
- // Spigot End - // Spigot End
+ // PaperSpigot End + // Paper End
public void run() { public void run() {
try { try {
@@ -531,26 +567,47 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs @@ -529,24 +565,41 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.a(this.r);
// Spigot start // Spigot start
+ // PaperSpigot start - Further improve tick loop
Arrays.fill( recentTps, 20 ); Arrays.fill( recentTps, 20 );
- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; - long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick;
+ //long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; + long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop
+ long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start;
+ // PaperSpigot end
while (this.isRunning) { while (this.isRunning) {
curTime = System.nanoTime(); curTime = System.nanoTime();
- wait = TICK_TIME - (curTime - lastTick) - catchupTime; - wait = TICK_TIME - (curTime - lastTick) - catchupTime;
+ // PaperSpigot start - Further improve tick loop + // Paper start - Further improve server tick loop
+ wait = TICK_TIME - (curTime - lastTick); + wait = TICK_TIME - (curTime - lastTick);
+ if (wait > 0) { + if (wait > 0) {
+ if (catchupTime < 2E6) { + if (catchupTime < 2E6) {
@ -132,7 +128,6 @@ index 9fc2cfa..06ae3fc 100644
- if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) - if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait); + catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
+
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) + if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
{ {
- double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL; - double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL;
@ -148,35 +143,34 @@ index 9fc2cfa..06ae3fc 100644
+ recentTps[0] = tps1.getAverage(); + recentTps[0] = tps1.getAverage();
+ recentTps[1] = tps5.getAverage(); + recentTps[1] = tps5.getAverage();
+ recentTps[2] = tps15.getAverage(); + recentTps[2] = tps15.getAverage();
+ // Paper end
tickSection = curTime; tickSection = curTime;
+ // PaperSpigot end
} }
lastTick = curTime; lastTick = curTime;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5ce0d50..97a53d3 100644 index 40998cf..4654a4b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1704,6 +1704,17 @@ public final class CraftServer implements Server { @@ -1712,6 +1712,17 @@ public final class CraftServer implements Server {
return CraftMagicNumbers.INSTANCE;
}
+ // Paper - Add getTPS API - Further improve tick loop
+ @Override
+ public double[] getTPS() {
+ return new double[] {
+ MinecraftServer.getServer().tps1.getAverage(),
+ MinecraftServer.getServer().tps5.getAverage(),
+ MinecraftServer.getServer().tps15.getAverage()
+ };
+ }
+ // Paper end
+
private final Spigot spigot = new Spigot() private final Spigot spigot = new Spigot()
{ {
+ // PaperSpigot start - Add getTPS (Further improve tick loop)
+ @Override
+ public double[] getTPS() {
+ return new double[] {
+ MinecraftServer.getServer().tps1.getAverage(),
+ MinecraftServer.getServer().tps5.getAverage(),
+ MinecraftServer.getServer().tps15.getAverage()
+ };
+ }
+ // PaperSpigot end
+
@Override
public YamlConfiguration getConfig()
{
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index be2e31d..21fd7ef 100644 index be2e31d..6d21c32 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -1,8 +1,5 @@ @@ -1,8 +1,5 @@
@ -188,7 +182,7 @@ index be2e31d..21fd7ef 100644
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -26,18 +23,19 @@ public class TicksPerSecondCommand extends Command @@ -26,18 +23,20 @@ public class TicksPerSecondCommand extends Command
return true; return true;
} }
@ -197,24 +191,25 @@ index be2e31d..21fd7ef 100644
- { - {
- sb.append( format( tps ) ); - sb.append( format( tps ) );
- sb.append( ", " ); - sb.append( ", " );
+ // PaperSpigot start - Further improve tick handling + // Paper start - Further improve tick handling
+ double[] tps = org.bukkit.Bukkit.spigot().getTPS(); + double[] tps = org.bukkit.Bukkit.getTPS();
+ String[] tpsAvg = new String[tps.length]; + String[] tpsAvg = new String[tps.length];
+ +
+ for ( int i = 0; i < tps.length; i++) { + for ( int i = 0; i < tps.length; i++) {
+ tpsAvg[i] = format( tps[i] ); + tpsAvg[i] = format( tps[i] );
} }
- sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); - sender.sendMessage( sb.substring( 0, sb.length() - 2 ) );
+ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); + sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "));
+ // Paper end
return true; return true;
} }
- private String format(double tps) - private String format(double tps)
+ private static String format(double tps) // PaperSpigot - made static + private static String format(double tps) // Paper - Made static
{ {
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
-- --
2.5.2 2.7.2

View File

@ -1,41 +0,0 @@
From 1f32bbad70c29f4636c376fa8dac5e579e3e4865 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sun, 8 Mar 2015 22:55:25 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 022ba31..7242d45 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -784,6 +784,11 @@ public class Chunk {
tileentity.D();
this.tileEntities.put(blockposition, tileentity);
// CraftBukkit start
+ // PaperSpigot start - Remove invalid mob spawner tile entities
+ } else if (this.world.paperSpigotConfig.removeInvalidMobSpawnerTEs && tileentity instanceof TileEntityMobSpawner &&
+ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) != org.bukkit.Material.MOB_SPAWNER) {
+ this.tileEntities.remove(blockposition);
+ // PaperSpigot end
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
+ " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!");
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 781cf75..af53220 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -173,4 +173,11 @@ public class PaperSpigotWorldConfig
waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
}
+
+ public boolean removeInvalidMobSpawnerTEs;
+ private void removeInvalidMobSpawnerTEs()
+ {
+ removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true );
+ log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs );
+ }
}
--
2.7.0

View File

@ -1,28 +1,28 @@
From dbcd027da8be15f1eb656da2f13bf0cbba8fa583 Mon Sep 17 00:00:00 2001 From 43233efe6e6330c3c626f395b56b566db354b57f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 28 Nov 2014 13:20:22 -0600 Date: Tue, 1 Mar 2016 23:12:03 -0600
Subject: [PATCH] Only refresh abilities if needed Subject: [PATCH] Only refresh abilities if needed
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a9b4160..506a03c 100644 index 9298344..039a170 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1143,12 +1143,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1143,12 +1143,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setFlying(boolean value) { public void setFlying(boolean value) {
+ boolean needsUpdate = getHandle().abilities.canFly != value; // PaperSpigot - Only refresh abilities if needed + boolean needsUpdate = getHandle().abilities.canFly != value; // Paper - Only refresh abilities if needed
if (!getAllowFlight() && value) { if (!getAllowFlight() && value) {
throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false"); throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false");
} }
getHandle().abilities.isFlying = value; getHandle().abilities.isFlying = value;
- getHandle().updateAbilities(); - getHandle().updateAbilities();
+ if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed + if (needsUpdate) getHandle().updateAbilities(); // Paper - Only refresh abilities if needed
} }
@Override @Override
-- --
2.5.2 2.7.2

View File

@ -1,248 +0,0 @@
From 107454d78a44a4dd3d04fc0f68cce6b476ae6274 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 22:55:25 -0600
Subject: [PATCH] Optimize TileEntity Ticking
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 5eb55e5..5192d95 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -8,17 +8,17 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
-public class TileEntityChest extends TileEntityContainer implements IUpdatePlayerListBox, IInventory {
+public class TileEntityChest extends TileEntityContainer implements IInventory { // PaperSpigot - remove IUpdatePlayerListBox
private ItemStack[] items = new ItemStack[27];
public boolean a;
- public TileEntityChest f;
- public TileEntityChest g;
- public TileEntityChest h;
- public TileEntityChest i;
- public float j;
+ public TileEntityChest f; // PaperSpigot - adjacentChestZNeg
+ public TileEntityChest g; // PaperSpigot - adjacentChestXPos
+ public TileEntityChest h; // PaperSpigot - adjacentChestXNeg
+ public TileEntityChest i; // PaperSpigot - adjacentChestZPos
+ public float j; // PaperSpigot - lidAngle
public float k;
- public int l;
+ public int l; // PaperSpigot - numPlayersUsing
private int n;
private int o = -1;
private String p;
@@ -238,6 +238,8 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
}
public void c() {
+ // PaperSpigot - Move chest sounds out of the tick loop
+ /*
this.m();
int i = this.position.getX();
int j = this.position.getY();
@@ -318,7 +320,8 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
this.j = 0.0F;
}
}
-
+ */
+ // PaperSpigot end
}
public boolean c(int i, int j) {
@@ -339,6 +342,28 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
++this.l;
if (this.world == null) return; // CraftBukkit
+
+ // PaperSpigot start - Move chest open sound out of the tick loop
+ this.m();
+
+ if (this.l > 0 && this.j == 0.0F && this.f == null && this.h == null) {
+ this.j = 0.7F;
+
+ double d0 = (double) this.position.getZ() + 0.5D;
+ double d1 = (double) this.position.getX() + 0.5D;
+
+ if (this.i != null) {
+ d0 += 0.5D;
+ }
+
+ if (this.g != null) {
+ d1 += 0.5D;
+ }
+
+ this.world.makeSound(d1, (double) this.position.getY() + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, this.w(), 1, this.l);
// CraftBukkit start - Call redstone event
@@ -361,6 +386,33 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye
int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added
--this.l;
if (this.world == null) return; // CraftBukkit
+
+ // PaperSpigot start - Move chest close sound handling out of the tick loop
+ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) {
+ float f = 0.1F;
+
+ if (this.l > 0) {
+ this.j += f;
+ } else {
+ this.j -= f;
+ }
+
+ double d0 = (double) this.getPosition().getX() + 0.5D;
+ double d2 = (double) this.getPosition().getZ() + 0.5D;
+
+ if (this.i != null) {
+ d2 += 0.5D;
+ }
+
+ if (this.g != null) {
+ d0 += 0.5D;
+ }
+
+ this.world.makeSound(d0, (double) this.getPosition().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.j = 0.0F;
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, this.w(), 1, this.l);
// CraftBukkit start - Call redstone event
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index 794cdc8..00fceda 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -1,15 +1,17 @@
package net.minecraft.server;
-public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox {
+public class TileEntityEnderChest extends TileEntity { // PaperSpigot - remove IUpdatePlayerListBox
- public float a;
+ public float a; // PaperSpigot - lidAngle
public float f;
- public int g;
+ public int g; // PaperSpigot - numPlayersUsing
private int h;
public TileEntityEnderChest() {}
public void c() {
+ // PaperSpigot start - Move enderchest sound handling out of the tick loop
+ /*
if (++this.h % 20 * 4 == 0) {
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
@@ -54,7 +56,8 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis
this.a = 0.0F;
}
}
-
+ */
+ // PaperSpigot end
}
public boolean c(int i, int j) {
@@ -73,11 +76,34 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis
public void b() {
++this.g;
+
+ // PaperSpigot start - Move enderchest open sounds out of the tick loop
+ if (this.g > 0 && this.a == 0.0F) {
+ this.a = 0.7F;
+
+ double d1 = (double) this.getPosition().getX() + 0.5D;
+ double d0 = (double) this.getPosition().getZ() + 0.5D;
+
+ this.world.makeSound(d1, (double) this.getPosition().getY() + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
public void d() {
--this.g;
+
+ // PaperSpigot start - Move enderchest close sounds out of the tick loop
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ double d0 = (double) this.getPosition().getX() + 0.5D;
+ double d2 = (double) this.getPosition().getZ() + 0.5D;
+
+ this.world.makeSound(d0, (double) this.getPosition().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.a = 0.0F;
+ }
+ // PaperSpigot end
+
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index acfceb8..4b642ba 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -52,7 +52,7 @@ public abstract class World implements IBlockAccess {
};
// Spigot end
protected final List<Entity> g = Lists.newArrayList();
- public final List<TileEntity> h = Lists.newArrayList();
+ //public final List<TileEntity> h = Lists.newArrayList(); // PaperSpigot - Remove unused list
public final List<TileEntity> tileEntityList = Lists.newArrayList();
private final List<TileEntity> b = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
@@ -1450,7 +1450,7 @@ public abstract class World implements IBlockAccess {
// CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.c.isEmpty()) {
this.tileEntityList.removeAll(this.c);
- this.h.removeAll(this.c);
+ //this.h.removeAll(this.c); // PaperSpigot - Remove unused list
this.c.clear();
}
// CraftBukkit end
@@ -1496,7 +1496,7 @@ public abstract class World implements IBlockAccess {
if (tileentity.x()) {
tilesThisCycle--;
this.tileEntityList.remove(tileTickPosition--);
- this.h.remove(tileentity);
+ //this.h.remove(tileentity); // PaperSpigot - Remove unused list
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).e(tileentity.getPosition());
}
@@ -1543,7 +1543,7 @@ public abstract class World implements IBlockAccess {
}
public boolean a(TileEntity tileentity) {
- boolean flag = this.h.add(tileentity);
+ boolean flag = true; // PaperSpigot - Remove unused list
if (flag && tileentity instanceof IUpdatePlayerListBox) {
this.tileEntityList.add(tileentity);
@@ -1561,7 +1561,7 @@ public abstract class World implements IBlockAccess {
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
- this.h.add(tileentity);
+ //this.h.add(tileentity); // PaperSpigot - Remove unused list
if (tileentity instanceof IUpdatePlayerListBox) {
this.tileEntityList.add(tileentity);
}
@@ -1997,7 +1997,7 @@ public abstract class World implements IBlockAccess {
} else {
if (tileentity != null) {
this.b.remove(tileentity);
- this.h.remove(tileentity);
+ //this.h.remove(tileentity); // PaperSpigot - Remove unused list
this.tileEntityList.remove(tileentity);
}
--
2.6.1.windows.1

View File

@ -1,20 +1,20 @@
From 33a53bb028aadbb40a503e0f4087cb6718bfc420 Mon Sep 17 00:00:00 2001 From e15513a2c62039f36abc3db23fed7f193bfffc15 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 6 Nov 2014 18:29:20 -0600 Date: Tue, 1 Mar 2016 23:19:01 -0600
Subject: [PATCH] Add async chunk load API Subject: [PATCH] Add async chunk load API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 17f2c0a..552f5c3 100644 index c0d7ac5..173f1c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -122,6 +122,24 @@ public class CraftWorld implements World { @@ -121,6 +121,26 @@ public class CraftWorld implements World {
} }
} }
+ // PaperSpigot start - Async chunk load API + // Paper start - Async chunk load API
+ public void getChunkAtAsync(final int x, final int z, final ChunkLoadCallback callback) { + public void getChunkAtAsync(final int x, final int z, final ChunkLoadCallback callback) {
+ final ChunkProviderServer cps = this.world.chunkProviderServer; + final ChunkProviderServer cps = this.world.getChunkProviderServer();
+ cps.getChunkAt(x, z, new Runnable() { + cps.getChunkAt(x, z, new Runnable() {
+ @Override + @Override
+ public void run() { + public void run() {
@ -22,17 +22,19 @@ index 17f2c0a..552f5c3 100644
+ } + }
+ }); + });
+ } + }
+
+ public void getChunkAtAsync(Block block, ChunkLoadCallback callback) { + public void getChunkAtAsync(Block block, ChunkLoadCallback callback) {
+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, callback); + getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, callback);
+ } + }
+
+ public void getChunkAtAsync(Location location, ChunkLoadCallback callback) { + public void getChunkAtAsync(Location location, ChunkLoadCallback callback) {
+ getChunkAtAsync(location.getBlockX() >> 4, location.getBlockZ() >> 4, callback); + getChunkAtAsync(location.getBlockX() >> 4, location.getBlockZ() >> 4, callback);
+ } + }
+ // PaperSpigot end + // Paper end
+ +
public Chunk getChunkAt(int x, int z) { public Chunk getChunkAt(int x, int z) {
return this.world.chunkProviderServer.getChunkAt(x, z).bukkitChunk; return this.world.getChunkProviderServer().getChunkAt(x, z).bukkitChunk;
} }
-- --
2.5.2 2.7.2

View File

@ -1,119 +0,0 @@
From ac3f20717a8488391789eefd180e54977a436842 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Sun, 8 Mar 2015 03:34:15 -0500
Subject: [PATCH] Remove certain entities that fly through unloaded chunks
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e345dd7..3e89aa9 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -115,6 +115,7 @@ public abstract class Entity implements ICommandListener {
public boolean valid; // CraftBukkit
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
+ public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks
// Spigot start
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index 48ada4d..f4b5032 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -30,6 +30,12 @@ public class EntityEnderPearl extends EntityProjectile {
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, entityliving), 0.0F);
}
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedEnderPearls) {
+ this.die();
+ }
+ // PaperSpigot end
+
for (int i = 0; i < 32; ++i) {
this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]);
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 95c188b..86556cd 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -70,6 +70,12 @@ public class EntityFallingBlock extends Entity {
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedFallingBlocks) {
+ this.die();
+ }
+ // PaperSpigot end
+
// PaperSpigot start - Drop falling blocks above the specified height
if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) {
if (this.dropItem) {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index d2d94d7..ebc4b85 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -54,6 +54,13 @@ public class EntityTNTPrimed extends Entity {
}
// PaperSpigot end
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedTNTEntities) {
+ this.die();
+ this.fuseTicks = 2;
+ }
+ // PaperSpigot end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4b642ba..46e39f2 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1160,6 +1160,7 @@ public abstract class World implements IBlockAccess {
{
if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
{
+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
continue;
}
int cz = chunkz << 4;
@@ -1583,6 +1584,14 @@ public abstract class World implements IBlockAccess {
if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
entity.ticksLived++;
entity.inactiveTick();
+ // PaperSpigot start - Remove entities in unloaded chunks
+ if (!this.isChunkLoaded(i, j, true) && ((entity instanceof EntityEnderPearl && this.paperSpigotConfig.removeUnloadedEnderPearls) ||
+ (entity instanceof EntityFallingBlock && this.paperSpigotConfig.removeUnloadedFallingBlocks) ||
+ (entity instanceof EntityTNTPrimed && this.paperSpigotConfig.removeUnloadedTNTEntities))) {
+ entity.inUnloadedChunk = true;
+ entity.die();
+ }
+ // PaperSpigot end
} else {
entity.tickTimer.startTiming(); // Spigot
// CraftBukkit end
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index af53220..4596616 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -180,4 +180,14 @@ public class PaperSpigotWorldConfig
removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true );
log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs );
}
+
+ public boolean removeUnloadedEnderPearls;
+ public boolean removeUnloadedTNTEntities;
+ public boolean removeUnloadedFallingBlocks;
+ private void removeUnloaded()
+ {
+ removeUnloadedEnderPearls = getBoolean( "remove-unloaded.enderpearls", true );
+ removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true );
+ removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true );
+ }
}
--
2.7.0

View File

@ -1,39 +0,0 @@
From f4bb4188db4477614faec7dcfb84f67496cdde11 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Sun, 8 Mar 2015 03:41:33 -0500
Subject: [PATCH] Configurable strength and weakness effect modifiers
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
index 620685a..175503b 100644
--- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -7,6 +7,7 @@ public class MobEffectAttackDamage extends MobEffectList {
}
public double a(int i, AttributeModifier attributemodifier) {
- return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1);
+ // PaperSpigot - Configurable modifiers for strength and weakness effects
+ return this.id == MobEffectList.WEAKNESS.id ? (double) (org.github.paperspigot.PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : org.github.paperspigot.PaperSpigotConfig.strengthEffectModifier * (double) (i + 1);
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index b0dd5b0..5df90f9 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -154,4 +154,12 @@ public class PaperSpigotConfig
Bukkit.getLogger().log( Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users" );
}
}
+
+ public static double strengthEffectModifier;
+ public static double weaknessEffectModifier;
+ private static void effectModifiers()
+ {
+ strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D );
+ weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D );
+ }
}
--
2.5.2

View File

@ -0,0 +1,267 @@
From e235a4f67d0e1b770147f4666b04193a91e05314 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] FallingBlock and TNTPrimed source location API
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index f6095af..5c12227 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -33,7 +33,10 @@ public class BlockDragonEgg extends Block {
byte b0 = 32;
if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
- world.addEntity(new EntityFallingBlock(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData()));
+ // Paper start - Add FallingBlock source location API
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F));
+ world.addEntity(new EntityFallingBlock(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData()));
+ // Paper end
} else {
world.setAir(blockposition);
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
index 6654240..936a754 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -36,7 +36,10 @@ public class BlockFalling extends Block {
if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
if (!world.isClientSide) {
- EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
+ // Paper start - Add FallingBlock source location
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F));
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(loc, world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
+ // Paper end
this.a(entityfallingblock);
world.addEntity(entityfallingblock);
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index f794167..09d5f7b 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -29,7 +29,8 @@ public class BlockTNT extends Block {
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
if (!world.isClientSide) {
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
+ org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
world.addEntity(entitytntprimed);
@@ -43,7 +44,8 @@ public class BlockTNT extends Block {
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) {
if (!world.isClientSide) {
if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving);
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc
world.addEntity(entitytntprimed);
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F);
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
index d7bea3d..c1c0c7c 100644
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
@@ -519,7 +519,7 @@ public class DispenserRegistry {
}
}
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null);
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(block.getLocation(), world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); // Paper - Add source loc
// CraftBukkit end
world.addEntity(entitytntprimed);
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 9c506ed..500163b 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -17,13 +17,25 @@ public class EntityFallingBlock extends Entity {
private float fallHurtAmount = 2.0F;
public NBTTagCompound tileEntityData;
protected static final DataWatcherObject<BlockPosition> d = DataWatcher.a(EntityFallingBlock.class, DataWatcherRegistry.j);
+ public org.bukkit.Location sourceLoc; // Paper
+ // Paper start - FallingBlock source location API
public EntityFallingBlock(World world) {
+ this(null, world);
+ }
+
+ public EntityFallingBlock(org.bukkit.Location loc, World world) {
super(world);
}
public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) {
+ this(null, world, d0, d1, d2, iblockdata);
+ }
+
+ public EntityFallingBlock(org.bukkit.Location loc, World world, double d0, double d1, double d2, IBlockData iblockdata) {
super(world);
+ sourceLoc = loc;
+ // Paper end
this.block = iblockdata;
this.i = true;
this.setSize(0.98F, 0.98F);
@@ -206,6 +218,13 @@ public class EntityFallingBlock extends Entity {
nbttagcompound.set("TileEntityData", this.tileEntityData);
}
+ // Paper start - Add FallingBlock source location API
+ if (sourceLoc != null) {
+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX());
+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY());
+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ());
+ }
+ // Paper end
}
protected void a(NBTTagCompound nbttagcompound) {
@@ -242,6 +261,14 @@ public class EntityFallingBlock extends Entity {
this.block = Blocks.SAND.getBlockData();
}
+ // Paper start - Add FallingBlock source location API
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
+ }
+ // Paper end
}
public void a(boolean flag) {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 564ea37..1820c7b 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -9,16 +9,28 @@ public class EntityTNTPrimed extends Entity {
private int c;
public float yield = 4; // CraftBukkit - add field
public boolean isIncendiary = false; // CraftBukkit - add field
+ public org.bukkit.Location sourceLoc; // Paper - TNT soure location API
+ // Paper start - TNT source location API
public EntityTNTPrimed(World world) {
+ this(null, world);
+ }
+
+ public EntityTNTPrimed(org.bukkit.Location loc, World world) {
super(world);
+ sourceLoc = loc;
+ // Paper end
this.c = 80;
this.i = true;
this.setSize(0.98F, 0.98F);
}
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
- this(world);
+ this(null, world, d0, d1, d2, entityliving);
+ }
+
+ public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) {
+ this(loc, world);
this.setPosition(d0, d1, d2);
float f = (float) (Math.random() * 6.2831854820251465D);
@@ -100,10 +112,25 @@ public class EntityTNTPrimed extends Entity {
protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Fuse", (short) this.getFuseTicks());
+ // Paper start - TNT source location API
+ if (sourceLoc != null) {
+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX());
+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY());
+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ());
+ }
+ // Paper end
}
protected void a(NBTTagCompound nbttagcompound) {
this.setFuseTicks(nbttagcompound.getShort("Fuse"));
+ // Paper start - TNT source location API
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
+ }
+ // Paper end
}
public EntityLiving getSource() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 173f1c5..24ecfae 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -880,7 +880,10 @@ public class CraftWorld implements World {
double y = location.getBlockY() + 0.5;
double z = location.getBlockZ() + 0.5;
- EntityFallingBlock entity = new EntityFallingBlock(world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
+ // Paper start - Add FallingBlock source location API
+ location = location.clone();
+ EntityFallingBlock entity = new EntityFallingBlock(location, world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
+ // Paper end
entity.ticksLived = 1;
world.addEntity(entity, SpawnReason.CUSTOM);
@@ -916,7 +919,10 @@ public class CraftWorld implements World {
int type = CraftMagicNumbers.getId(blockData.getBlock());
int data = blockData.getBlock().toLegacyData(blockData);
- entity = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
+ // Paper start - Add FallingBlock source location API
+ location = location.clone();
+ entity = new EntityFallingBlock(location, world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
+ // Paper end
} else if (Projectile.class.isAssignableFrom(clazz)) {
if (Snowball.class.isAssignableFrom(clazz)) {
entity = new EntitySnowball(world, x, y, z);
@@ -1111,7 +1117,8 @@ public class CraftWorld implements World {
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
}
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
- entity = new EntityTNTPrimed(world, x, y, z, null);
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), x, y, z); // Paper
+ entity = new EntityTNTPrimed(loc, world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
entity = new EntityExperienceOrb(world, x, y, z, 0);
} else if (Weather.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
index 75eed48..9e6ed0c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
public void setHurtEntities(boolean hurtEntities) {
getHandle().hurtEntities = hurtEntities;
}
+
+ // Paper start - Add FallingBlock source location API
+ @Override
+ public org.bukkit.Location getSourceLoc() {
+ return getHandle().sourceLoc;
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
index c493c9c..eea3238 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
@@ -65,4 +65,11 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return null;
}
+
+ // Paper start
+ @Override
+ public org.bukkit.Location getSourceLoc() {
+ return getHandle().sourceLoc;
+ }
+ // Paper end
}
--
2.7.2

View File

@ -1,69 +1,68 @@
From a68057fa44ba44de92cdaf84ed4a047960c9e1bd Mon Sep 17 00:00:00 2001 From 45a92c6e251d7281edc48b071e4371b9467cd4a6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 04:37:23 -0500 Date: Tue, 1 Mar 2016 23:52:34 -0600
Subject: [PATCH] Prevent tile entity and entity crashes Subject: [PATCH] Prevent tile entity and entity crashes
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index c268a40..3fc6450 100644 index e6524e9..d898428 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java --- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -157,7 +157,12 @@ public abstract class TileEntity { @@ -163,7 +163,12 @@ public abstract class TileEntity {
} }
}); });
if (this.world != null) { if (this.world != null) {
- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.w(), this.u()); - CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.u());
+ // PaperSpigot start - Prevent tile entity and entity crashes + // Paper start - Prevent TileEntity and Entity crashes
+ Block block = this.w(); + Block block = this.getBlock();
+ if (block != null) { + if (block != null) {
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.w(), this.u()); + CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.u());
+ } + }
+ // PaperSpigot end + // Paper end
crashreportsystemdetails.a("Actual block type", new Callable() { crashreportsystemdetails.a("Actual block type", new Callable() {
public String a() throws Exception { public String a() throws Exception {
int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock()); int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 46e39f2..c50536e 100644 index d9a84b6..2406541 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1418,10 +1418,13 @@ public abstract class World implements IBlockAccess { @@ -1395,10 +1395,13 @@ public abstract class World implements IBlockAccess {
this.g(entity); this.g(entity);
SpigotTimings.tickEntityTimer.stopTiming(); // Spigot SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
- crashreport = CrashReport.a(throwable1, "Ticking entity"); - crashreport1 = CrashReport.a(throwable1, "Ticking entity");
- crashreportsystemdetails = crashreport.a("Entity being ticked"); - crashreportsystemdetails1 = crashreport1.a("Entity being ticked");
- entity.appendEntityCrashDetails(crashreportsystemdetails); - entity.appendEntityCrashDetails(crashreportsystemdetails1);
- throw new ReportedException(crashreport); - throw new ReportedException(crashreport1);
+ // PaperSpigot start - Prevent tile entity and entity crashes + // Paper start - Prevent tile entity and entity crashes
+ SpigotTimings.tickEntityTimer.stopTiming(); + SpigotTimings.tickEntityTimer.stopTiming();
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); + System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
+ throwable1.printStackTrace(); + throwable1.printStackTrace();
+ entity.dead = true; + entity.dead = true;
+ continue; + continue;
+ // PaperSpigot end + // Paper end
} }
} }
@@ -1480,11 +1483,14 @@ public abstract class World implements IBlockAccess { @@ -1460,10 +1463,14 @@ public abstract class World implements IBlockAccess {
tileentity.tickTimer.startTiming(); // Spigot ((ITickable) tileentity).c();
((IUpdatePlayerListBox) tileentity).c(); this.methodProfiler.b();
} catch (Throwable throwable2) { } catch (Throwable throwable2) {
- CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); - crashreport1 = CrashReport.a(throwable2, "Ticking block entity");
- CrashReportSystemDetails crashreportsystemdetails1 = crashreport1.a("Block entity being ticked"); - crashreportsystemdetails1 = crashreport1.a("Block entity being ticked");
-
- tileentity.a(crashreportsystemdetails1); - tileentity.a(crashreportsystemdetails1);
- throw new ReportedException(crashreport1); - throw new ReportedException(crashreport1);
+ // PaperSpigot start - Prevent tile entity and entity crashes + // Paper start - Prevent tile entity and entity crashes
+ tileentity.tickTimer.stopTiming(); + tileentity.tickTimer.stopTiming();
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); + System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
+ throwable2.printStackTrace(); + throwable2.printStackTrace();
+ tilesThisCycle--; + tilesThisCycle--;
+ this.tileEntityList.remove(tileTickPosition--); + this.tileEntityListTick.remove(tileTickPosition--);
+ continue; + continue;
+ // PaperSpigot end + // Paper end
} }
// Spigot start // Spigot start
finally { finally {
-- --
2.6.1.windows.1 2.7.2

View File

@ -0,0 +1,51 @@
From b957945130e1dcd74a709f8335efee886512b17c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 23:58:50 -0600
Subject: [PATCH] Configurable top of nether void damage
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6ccd700..a45bb02 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -141,4 +141,10 @@ public class PaperWorldConfig {
waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
}
+
+ public boolean netherVoidTopDamage;
+ private void netherVoidTopDamage() {
+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
+ log("Top of the nether void damage: " + netherVoidTopDamage);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a4a6352..b0834dc 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -299,6 +299,13 @@ public abstract class Entity implements ICommandListener {
this.U();
}
+ /**
+ * Paper - Checks if the feature is enabled and the entity is above the nether world bedrock height
+ */
+ private boolean paperNetherCheck() {
+ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D;
+ }
+
public void U() {
this.world.methodProfiler.a("entityBaseTick");
if (this.isPassenger() && this.by().dead) {
@@ -379,7 +386,7 @@ public abstract class Entity implements ICommandListener {
this.fallDistance *= 0.5F;
}
- if (this.locY < -64.0D) {
+ if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage)
this.Y();
}
--
2.7.2

View File

@ -1,22 +1,22 @@
From b667634876a8af5cfc59125dffafebc1c8d5b685 Mon Sep 17 00:00:00 2001 From dc64ce3540b084ffcf8b87f0fa9d7fe71d830fac Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 5 Mar 2015 15:30:06 -0600 Date: Wed, 2 Mar 2016 00:03:55 -0600
Subject: [PATCH] Check online mode before converting and renaming player data Subject: [PATCH] Check online mode before converting and renaming player data
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index 7c51750..e5124af 100644 index df82c14..c2d384c 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -202,7 +202,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { @@ -166,7 +166,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat");
// Spigot Start // Spigot Start
boolean usingWrongFile = false; boolean usingWrongFile = false;
- if ( !file.exists() ) - if ( !file.exists() )
+ if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // PaperSpigot - Check online mode first + if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
{ {
file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
if ( file.exists() ) if ( file.exists() )
-- --
2.5.2 2.7.2

View File

@ -1,82 +0,0 @@
From b550c3d13b8fec67ae07928e772475624ccf31be Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Sun, 8 Mar 2015 04:10:02 -0500
Subject: [PATCH] Configurable game mechanics changes
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index f6a43c0..0e6f8c0 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -340,13 +340,7 @@ public class EntityBoat extends Entity {
if (!destroyEvent.isCancelled()) {
this.die();
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
- for (k = 0; k < 3; ++k) {
- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F);
- }
-
- for (k = 0; k < 2; ++k) {
- this.a(Items.STICK, 1, 0.0F);
- }
+ breakNaturally(); // PaperSpigot
}
} // CraftBukkit end
}
@@ -451,15 +445,7 @@ public class EntityBoat extends Entity {
if (!destroyEvent.isCancelled()) {
this.die();
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
- int i;
-
- for (i = 0; i < 3; ++i) {
- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F);
- }
-
- for (i = 0; i < 2; ++i) {
- this.a(Items.STICK, 1, 0.0F);
- }
+ breakNaturally(); // PaperSpigot
}
} // CraftBukkit end
}
@@ -495,4 +481,21 @@ public class EntityBoat extends Entity {
public int m() {
return this.datawatcher.getInt(18);
}
+
+ /**
+ * PaperSpigot - Handles boat drops depending on the user's config setting
+ */
+ public void breakNaturally() {
+ if (this.world.paperSpigotConfig.boatsDropBoats) {
+ this.a(Items.BOAT, 1, 0.0F);
+ } else {
+ for (int k = 0; k < 3; ++k) {
+ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F);
+ }
+
+ for (int k = 0; k < 2; ++k) {
+ this.a(Items.STICK, 1, 0.0F);
+ }
+ }
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 4596616..a6d444b 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -190,4 +190,10 @@ public class PaperSpigotWorldConfig
removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true );
removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true );
}
+
+ public boolean boatsDropBoats;
+ private void mechanicsChanges()
+ {
+ boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
+ }
}
--
2.7.0

View File

@ -0,0 +1,79 @@
From aad4d45a696b28cd81f39fdcadea59802c9b08d7 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 00:21:24 -0600
Subject: [PATCH] Fix redstone lag issues
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a45bb02..3ac2edd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -147,4 +147,15 @@ public class PaperWorldConfig {
netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
log("Top of the nether void damage: " + netherVoidTopDamage);
}
+
+ public int tickNextTickCap;
+ public boolean tickNextTickListCapIgnoresRedstone;
+ private void tickNextTickCap() {
+ tickNextTickCap = getInt("tick-next-tick-list-cap", 1000); // Higher values will be friendlier to vanilla style mechanics (to a point) but may hurt performance
+ tickNextTickListCapIgnoresRedstone = getBoolean("tick-next-tick-list-cap-ignores-redstone", false); // Redstone TickNextTicks will always bypass the preceding cap
+ log("WorldServer TickNextTick cap set at " + tickNextTickCap);
+ log("WorldServer TickNextTickList cap always processes redstone: " + tickNextTickListCapIgnoresRedstone);
+
+ }
+
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index c2ca2df..1c8f6a1 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -689,6 +689,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
if (false) { // CraftBukkit
throw new IllegalStateException("TickNextTick list out of synch");
} else {
+ // Paper start - No, stop doing this, it affects things like redstone
+ /*
if (i > 1000) {
// CraftBukkit start - If the server has too much to process over time, try to alleviate that
if (i > 20 * 1000) {
@@ -698,6 +700,11 @@ public class WorldServer extends World implements IAsyncTaskHandler {
}
// CraftBukkit end
}
+ */
+ if (i > paperConfig.tickNextTickCap) {
+ i = paperConfig.tickNextTickCap;
+ }
+ // Paper end
this.methodProfiler.a("cleaning");
@@ -715,6 +722,24 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.U.add(nextticklistentry);
}
+ // Paper start - Allow redstone ticks to bypass the tickNextTickListCap
+ if (paperConfig.tickNextTickListCapIgnoresRedstone) {
+ Iterator<NextTickListEntry> iterator = this.nextTickList.iterator();
+ while (iterator.hasNext()) {
+ NextTickListEntry next = iterator.next();
+ if (!flag && next.b > this.worldData.getTime()) {
+ break;
+ }
+
+ IBlockData data = next.a().getBlockData();
+ if (next.a().isPowerSource(data) || next.a() instanceof IInventory) {
+ iterator.remove();
+ this.U.add(next);
+ }
+ }
+ }
+ // Paper end
+
this.methodProfiler.b();
this.methodProfiler.a("ticking");
Iterator iterator = this.U.iterator();
--
2.7.2

View File

@ -1,68 +0,0 @@
From 6a96486151df3e2561efe99e284926b68531aef0 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sun, 30 Nov 2014 18:58:07 -0600
Subject: [PATCH] Allow specified ItemStacks to retain their invalid data
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 5496805..015ce28 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -18,6 +18,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end
+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot
+
public final class ItemStack {
public static final DecimalFormat a = new DecimalFormat("#.###");
@@ -321,9 +323,13 @@ public final class ItemStack {
}
// Is this a block?
- if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) != Blocks.AIR) {
+ // PaperSpigot start - Allow specific blocks to retain their data values
+ int id = CraftMagicNumbers.getId(this.getItem());
+ if (CraftMagicNumbers.getBlock(id) != Blocks.AIR) {
// If vanilla doesn't use data on it don't allow any
- if (!(this.usesData() || this.getItem().usesDurability())) {
+ if ((PaperSpigotConfig.dataValueAllowedItems == null || !PaperSpigotConfig.dataValueAllowedItems.contains(id)) &&
+ (!(this.usesData() || this.getItem().usesDurability()))) {
+ // PaperSpigot end
i = 0;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index 5df90f9..744773d 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -6,11 +6,10 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.logging.Level;
import net.minecraft.server.MinecraftServer;
+import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.InvalidConfigurationException;
@@ -162,4 +161,11 @@ public class PaperSpigotConfig
strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D );
weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D );
}
+
+ public static Set<Integer> dataValueAllowedItems;
+ private static void dataValueAllowedItems()
+ {
+ dataValueAllowedItems = new HashSet<Integer>( getList( "data-value-allowed-items", Collections.emptyList() ) );
+ Bukkit.getLogger().info( "Data value allowed items: " + StringUtils.join(dataValueAllowedItems, ", ") );
+ }
}
--
2.5.2

View File

@ -0,0 +1,57 @@
From 168fdae3cde0d895e3ac002c11c988c09069a28b Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 00:32:25 -0600
Subject: [PATCH] Always tick falling blocks
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index d88f1b1..97fbd95 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -2,33 +2,8 @@ package org.spigotmc;
import java.util.List;
import java.util.Set;
-import net.minecraft.server.AxisAlignedBB;
-import net.minecraft.server.Chunk;
-import net.minecraft.server.Entity;
-import net.minecraft.server.EntityAmbient;
-import net.minecraft.server.EntityAnimal;
-import net.minecraft.server.EntityArrow;
-import net.minecraft.server.EntityComplexPart;
-import net.minecraft.server.EntityCreature;
-import net.minecraft.server.EntityCreeper;
-import net.minecraft.server.EntityEnderCrystal;
-import net.minecraft.server.EntityEnderDragon;
-import net.minecraft.server.EntityFireball;
-import net.minecraft.server.EntityFireworks;
-import net.minecraft.server.EntityHuman;
-import net.minecraft.server.EntityLiving;
-import net.minecraft.server.EntityMonster;
-import net.minecraft.server.EntityProjectile;
-import net.minecraft.server.EntitySheep;
-import net.minecraft.server.EntitySlice;
-import net.minecraft.server.EntitySlime;
-import net.minecraft.server.EntityTNTPrimed;
-import net.minecraft.server.EntityVillager;
-import net.minecraft.server.EntityWeather;
-import net.minecraft.server.EntityWither;
-import net.minecraft.server.MathHelper;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.World;
+
+import net.minecraft.server.*;
import org.bukkit.craftbukkit.SpigotTimings;
public class ActivationRange
@@ -80,6 +55,7 @@ public class ActivationRange
|| entity instanceof EntityFireball
|| entity instanceof EntityWeather
|| entity instanceof EntityTNTPrimed
+ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworks )
{
--
2.7.2

View File

@ -1,132 +0,0 @@
From caf326d2691e94f197820555136aac73ef7cee29 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 04:23:41 -0500
Subject: [PATCH] Add TNT source location API
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index e151bc5..27ce179 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -29,7 +29,8 @@ public class BlockTNT extends Block {
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
if (!world.isClientSide) {
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
+ org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // PaperSpigot
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // PaperSpigot - add loc
entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
world.addEntity(entitytntprimed);
@@ -43,7 +44,8 @@ public class BlockTNT extends Block {
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) {
if (!world.isClientSide) {
if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving);
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // PaperSpigot
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // PaperSpigot - add loc
world.addEntity(entitytntprimed);
world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
index f2c78f3..bc07d3d 100644
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
@@ -541,7 +541,7 @@ public class DispenserRegistry {
}
}
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null);
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(block.getLocation(), world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); // PaperSpigot
// CraftBukkit end
world.addEntity(entitytntprimed);
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 2eeea05..7f82c4a 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -8,15 +8,23 @@ public class EntityTNTPrimed extends Entity {
private EntityLiving source;
public float yield = 4; // CraftBukkit - add field
public boolean isIncendiary = false; // CraftBukkit - add field
+ public org.bukkit.Location sourceLoc; // PaperSpigot
+ // PaperSpigot start - TNT source location API
public EntityTNTPrimed(World world) {
+ this(null, world);
+ }
+
+ public EntityTNTPrimed(org.bukkit.Location loc, World world) {
super(world);
+ sourceLoc = loc;
+ // PaperSpigot end
this.k = true;
this.setSize(0.98F, 0.98F);
}
- public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
- this(world);
+ public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) {
+ this(loc, world);
this.setPosition(d0, d1, d2);
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
@@ -102,10 +110,25 @@ public class EntityTNTPrimed extends Entity {
protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setByte("Fuse", (byte) this.fuseTicks);
+ // PaperSpigot start - TNT source location API
+ if (sourceLoc != null) {
+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX());
+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY());
+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ());
+ }
+ // PaperSpigot end
}
protected void a(NBTTagCompound nbttagcompound) {
this.fuseTicks = nbttagcompound.getByte("Fuse");
+ // PaperSpigot start - TNT source location API
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
+ }
+ // PaperSpigot end
}
public EntityLiving getSource() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 89e78ab..d8417c9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1110,7 +1110,8 @@ public class CraftWorld implements World {
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
}
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
- entity = new EntityTNTPrimed(world, x, y, z, null);
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), x, y, z); // PaperSpigot
+ entity = new EntityTNTPrimed(loc, world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
entity = new EntityExperienceOrb(world, x, y, z, 0);
} else if (Weather.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
index e08ad47..b7e8b4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
@@ -65,4 +65,11 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return null;
}
+
+ // PaperSpigot start
+ @Override
+ public org.bukkit.Location getSourceLoc() {
+ return getHandle().sourceLoc;
+ }
+ // PaperSpigot end
}
--
2.7.0

View File

@ -1,61 +1,75 @@
From 887a1070709897069646cb85cb7c86813926d695 Mon Sep 17 00:00:00 2001 From be968a89c4fbd89664c97deeeeaacbc8b004209b Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 1 Jul 2015 00:18:10 -0700 Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Configurable async light updates Subject: [PATCH] Configurable async light updates
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3ac2edd..3506b1b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -158,4 +158,9 @@ public class PaperWorldConfig {
}
+ public boolean useAsyncLighting;
+ private void useAsyncLighting() {
+ useAsyncLighting = getBoolean( "use-async-lighting", false );
+ log("World async lighting: " + useAsyncLighting);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 7242d45..5a3b22a 100644 index 2f37957..3e9b26f 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -11,6 +11,8 @@ import java.util.Map; @@ -11,6 +11,8 @@ import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicInteger; // PaperSpigot +import java.util.concurrent.atomic.AtomicInteger; // Paper
+ +
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@@ -43,6 +45,10 @@ public class Chunk { @@ -44,6 +46,10 @@ public class Chunk {
private int v; private int w;
private ConcurrentLinkedQueue<BlockPosition> w; private ConcurrentLinkedQueue<BlockPosition> x;
protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
+ // PaperSpigot start - Asynchronous light updates + // Paper start - Asynchronous light updates
+ public AtomicInteger pendingLightUpdates = new AtomicInteger(); + public AtomicInteger pendingLightUpdates = new AtomicInteger();
+ public long lightUpdateTime; + public long lightUpdateTime;
+ // PaperSpigot end + // Paper end
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
private int neighbors = 0x1 << 12; private int neighbors = 0x1 << 12;
@@ -274,7 +280,7 @@ public class Chunk { @@ -278,7 +284,7 @@ public class Chunk {
private void a(int i, int j, int k, int l) { private void a(int i, int j, int k, int l) {
if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) { if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) {
for (int i1 = k; i1 < l; ++i1) { for (int i1 = k; i1 < l; ++i1) {
- this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); - this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
+ this.world.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); // PaperSpigot - Asynchronous lighting updates + this.world.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
} }
this.q = true; this.r = true;
@@ -1044,7 +1050,7 @@ public class Chunk { @@ -991,7 +997,7 @@ public class Chunk {
public void b(boolean flag) { public void b(boolean flag) {
if (this.k && !this.world.worldProvider.o() && !flag) { if (this.l && !this.world.worldProvider.m() && !flag) {
- this.h(this.world.isClientSide); - this.h(this.world.isClientSide);
+ this.recheckGaps(this.world.isClientSide); // PaperSpigot - Asynchronous lighting updates + this.recheckGaps(this.world.isClientSide); // Paper - Asynchronous lighting updates
} }
this.p = true; this.q = true;
@@ -1065,6 +1071,23 @@ public class Chunk { @@ -1012,6 +1018,23 @@ public class Chunk {
} }
+ /** + /**
+ * PaperSpigot - Recheck gaps asynchronously. + * Paper- Recheck gaps asynchronously
+ */ + */
+ public void recheckGaps(final boolean isClientSide) { + public void recheckGaps(final boolean isClientSide) {
+ if (!world.paperSpigotConfig.useAsyncLighting) { + if (!world.paperConfig.useAsyncLighting) {
+ this.h(isClientSide); + this.h(this.world.isClientSide);
+ return; + return;
+ } + }
+ +
@ -71,75 +85,79 @@ index 7242d45..5a3b22a 100644
// Spigot Start // Spigot Start
/* /*
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 975d666..ae0f276 100644 index fd3f457..72c1fc7 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -53,6 +53,12 @@ public class ChunkProviderServer implements IChunkProvider { @@ -46,6 +46,12 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public void queueUnload(int i, int j) { public void queueUnload(int i, int j) {
+ // PaperSpigot start - Asynchronous lighting updates + // Paper start - Asynchronous lighting updates
+ Chunk chunk = chunks.get(LongHash.toLong(i, j)); + Chunk chunk = chunks.get(LongHash.toLong(i, j));
+ if (chunk != null && chunk.world.paperSpigotConfig.useAsyncLighting && (chunk.pendingLightUpdates.get() > 0 || chunk.world.getTime() - chunk.lightUpdateTime < 20)) { + if (chunk != null && chunk.world.paperConfig.useAsyncLighting && (chunk.pendingLightUpdates.get() > 0 || chunk.world.getTime() - chunk.lightUpdateTime < 20)) {
+ return; + return;
+ } + }
+ // PaperSpigot end + // Paper end
if (this.world.worldProvider.e()) { if (this.world.worldProvider.c(i, j)) {
if (!this.world.c(i, j)) { // CraftBukkit start
// CraftBukkit start this.unloadQueue.add(i, j);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c50536e..82c43e3 100644 index 180eccb..79cd94d 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -18,6 +18,12 @@ import org.bukkit.generator.ChunkGenerator; @@ -29,6 +29,12 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import java.util.*; import org.bukkit.generator.ChunkGenerator;
import java.util.concurrent.Callable; // CraftBukkit end
+// PaperSpigot start +// Paper start
+import java.util.concurrent.ExecutorService; +import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors; +import java.util.concurrent.Executors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.common.util.concurrent.ThreadFactoryBuilder;
+// PaperSpigot end +// Paper end
+ +
// CraftBukkit start public abstract class World implements IBlockAccess {
// CraftBukkit end
@@ -128,6 +134,7 @@ public abstract class World implements IBlockAccess { private int a = 63;
@@ -134,6 +140,7 @@ public abstract class World implements IBlockAccess {
private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition; private int tileTickPosition;
+ public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("PaperSpigot - Lighting Thread").build()); // PaperSpigot - Asynchronous lighting updates + public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper - Lighting Thread").build()); // Paper - Asynchronous lighting updates
public static long chunkToKey(int x, int z) public CraftWorld getWorld() {
{ return this.world;
@@ -497,7 +504,7 @@ public abstract class World implements IBlockAccess { @@ -447,7 +454,7 @@ public abstract class World implements IBlockAccess {
if (!this.worldProvider.o()) { if (!this.worldProvider.m()) {
for (i1 = k; i1 <= l; ++i1) { for (i1 = k; i1 <= l; ++i1) {
- this.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); - this.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
+ this.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); // PaperSpigot - Asynchronous lighting updates + this.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); // Paper - Asynchronous lighting updates
} }
} }
@@ -2325,10 +2332,10 @@ public abstract class World implements IBlockAccess { @@ -2215,10 +2222,10 @@ public abstract class World implements IBlockAccess {
boolean flag = false; boolean flag = false;
if (!this.worldProvider.o()) { if (!this.worldProvider.m()) {
- flag |= this.c(EnumSkyBlock.SKY, blockposition); - flag |= this.c(EnumSkyBlock.SKY, blockposition);
+ flag |= this.updateLight(EnumSkyBlock.SKY, blockposition); // PaperSpigot - Asynchronous lighting updates + flag |= this.updateLight(EnumSkyBlock.SKY, blockposition); // Paper - Asynchronous lighting updates
} }
- flag |= this.c(EnumSkyBlock.BLOCK, blockposition); - flag |= this.c(EnumSkyBlock.BLOCK, blockposition);
+ flag |= this.updateLight(EnumSkyBlock.BLOCK, blockposition); // PaperSpigot - Asynchronous lighting updates + flag |= this.updateLight(EnumSkyBlock.BLOCK, blockposition); // Paper - Asynchronous lighting updates
return flag; return flag;
} }
@@ -2375,10 +2382,10 @@ public abstract class World implements IBlockAccess { @@ -2268,10 +2275,15 @@ public abstract class World implements IBlockAccess {
} }
} }
- public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { + // Paper start - Asynchronous lighting updates
+ public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition, Chunk chunk, List<Chunk> neighbors) { // PaperSpigot public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
+ return this.c(enumskyblock, blockposition, null, null);
+ }
+
+ public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition, Chunk chunk, List<Chunk> neighbors) { // Paper
// CraftBukkit start - Use neighbor cache instead of looking up // CraftBukkit start - Use neighbor cache instead of looking up
- Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); - Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
- if (chunk == null || !chunk.areNeighborsLoaded(1) /*!this.areChunksLoaded(blockposition, 17, false)*/) { - if (chunk == null || !chunk.areNeighborsLoaded(1) /*!this.areChunksLoaded(blockposition, 17, false)*/) {
@ -148,12 +166,12 @@ index c50536e..82c43e3 100644
// CraftBukkit end // CraftBukkit end
return false; return false;
} else { } else {
@@ -2496,11 +2503,66 @@ public abstract class World implements IBlockAccess { @@ -2342,6 +2354,17 @@ public abstract class World implements IBlockAccess {
} i = 0;
} }
+ // PaperSpigot start - Asynchronous light updates + // Paper start - Asynchronous light updates
+ if (chunk.world.paperSpigotConfig.useAsyncLighting) { + if (chunk.world.paperConfig.useAsyncLighting) {
+ chunk.pendingLightUpdates.decrementAndGet(); + chunk.pendingLightUpdates.decrementAndGet();
+ if (neighbors != null) { + if (neighbors != null) {
+ for (Chunk neighbor : neighbors) { + for (Chunk neighbor : neighbors) {
@ -161,14 +179,17 @@ index c50536e..82c43e3 100644
+ } + }
+ } + }
+ } + }
+ // PaperSpigot end + // Paper end
+
this.methodProfiler.b(); this.methodProfiler.b();
return true; this.methodProfiler.a("checkedPosition < toCheckCount");
@@ -2396,6 +2419,52 @@ public abstract class World implements IBlockAccess {
} }
} }
+ /** + /**
+ * PaperSpigot - Asynchronous lighting updates + * Paper - Asynchronous lighting updates
+ */ + */
+ public boolean updateLight(final EnumSkyBlock enumskyblock, final BlockPosition position) { + public boolean updateLight(final EnumSkyBlock enumskyblock, final BlockPosition position) {
+ int x = position.getX(); + int x = position.getX();
@ -178,7 +199,7 @@ index c50536e..82c43e3 100644
+ return false; + return false;
+ } + }
+ +
+ if (!chunk.world.paperSpigotConfig.useAsyncLighting) { + if (!chunk.world.paperConfig.useAsyncLighting) {
+ return this.c(enumskyblock, position, chunk, null); + return this.c(enumskyblock, position, chunk, null);
+ } + }
+ +
@ -186,6 +207,7 @@ index c50536e..82c43e3 100644
+ chunk.lightUpdateTime = chunk.world.getTime(); + chunk.lightUpdateTime = chunk.world.getTime();
+ +
+ final List<Chunk> neighbors = new ArrayList<Chunk>(); + final List<Chunk> neighbors = new ArrayList<Chunk>();
+
+ for (int cx = (x >> 4) - 1; cx <= (x >> 4) + 1; ++cx) { + for (int cx = (x >> 4) - 1; cx <= (x >> 4) + 1; ++cx) {
+ for (int cz = (z >> 4) - 1; cz <= (z >> 4) + 1; ++cz) { + for (int cz = (z >> 4) - 1; cz <= (z >> 4) + 1; ++cz) {
+ if (cx != x >> 4 && cz != z >> 4) { + if (cx != x >> 4 && cz != z >> 4) {
@ -215,22 +237,6 @@ index c50536e..82c43e3 100644
public boolean a(boolean flag) { public boolean a(boolean flag) {
return false; return false;
} }
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index c8971d1..9ad53fa 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -212,4 +212,11 @@ public class PaperSpigotWorldConfig
log( "WorldServer TickNextTick cap set at " + tickNextTickCap );
log( "WorldServer TickNextTickList cap always processes redstone: " + tickNextTickListCapIgnoresRedstone );
}
+
+ public boolean useAsyncLighting;
+ private void useAsyncLighting()
+ {
+ useAsyncLighting = getBoolean( "use-async-lighting", false );
+ log( "World async lighting: " + useAsyncLighting );
+ }
}
-- --
2.7.0 2.7.2

View File

@ -0,0 +1,28 @@
From 114d4ec98f8118bca7faf64c5d7a0eeac6b2bebf Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 00:55:24 -0600
Subject: [PATCH] Optimize draining
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 328615c..ec04cd8 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -88,7 +88,13 @@ public class BlockFlowing extends BlockFluids {
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
world.setTypeAndData(blockposition, iblockdata, 2);
world.a(blockposition, (Block) this, j);
- world.applyPhysics(blockposition, this);
+ // Paper start - Optimize draining
+ world.e(blockposition.west(), this);
+ world.e(blockposition.east(), this);
+ world.e(blockposition.up(), this);
+ world.e(blockposition.north(), this);
+ world.e(blockposition.south(), this);
+ // Paper end
}
}
} else {
--
2.7.2

View File

@ -0,0 +1,75 @@
From b65a790b6121f108f31a54f98e6cee3368e00807 Mon Sep 17 00:00:00 2001
From: DoctorDark <doctordark11@gmail.com>
Date: Wed, 2 Mar 2016 01:17:06 -0600
Subject: [PATCH] Configurable end credits when leaving the end
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3506b1b..e68595b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -163,4 +163,10 @@ public class PaperWorldConfig {
useAsyncLighting = getBoolean( "use-async-lighting", false );
log("World async lighting: " + useAsyncLighting);
}
+
+ public boolean disableEndCredits;
+ private void disableEndCredits() {
+ disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
+ log("End credits disabled: " + disableEndCredits);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 2f1d95b..b32617b 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -526,9 +526,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public Entity c(int i) {
this.cj = true;
+ // Paper start - Allow configurable end portal credits
if (this.dimension == 1 && i == 1) {
- this.world.kill(this);
- if (!this.viewingCredits) {
+ if (!this.viewingCredits && !world.paperConfig.disableEndCredits) {
+ this.world.kill(this);
+ // Paper end
this.viewingCredits = true;
if (this.a(AchievementList.D)) {
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
@@ -546,7 +548,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} else {
this.b((Statistic) AchievementList.y);
}
+ }
+ if (!(this.dimension == 1 && i == 1) || world.paperConfig.disableEndCredits) { // Paper - Allow configurable end portal credits
// CraftBukkit start
TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this
@@ -557,6 +561,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.cb = -1;
return this;
}
+
+ return null; // Paper - Theoretically it should never make it here
}
public boolean a(EntityPlayer entityplayer) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 50add77..38d20b7 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -730,7 +730,8 @@ public abstract class PlayerList {
return;
}
- exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
+ // Paper - Configurable end credits, if a plugin sets to use a travel agent even if the cause is an end portal, ignore it
+ exit = cause != TeleportCause.END_PORTAL && event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
if (exit == null) {
return;
}
--
2.7.2

View File

@ -1,51 +0,0 @@
From 61dc85a7666c14d6599771c6fe971920efd40fb9 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 23 Feb 2015 14:57:28 -0600
Subject: [PATCH] Configurable top of nether void damage
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3e89aa9..a3b4cdb 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -248,6 +248,13 @@ public abstract class Entity implements ICommandListener {
this.K();
}
+ /**
+ * PaperSpigot - Checks if the feature is enabled and the entity is above the nether world bedrock height
+ */
+ private boolean paperNetherCheck() {
+ return this.world.paperSpigotConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D;
+ }
+
public void K() {
this.world.methodProfiler.a("entityBaseTick");
if (this.vehicle != null && this.vehicle.dead) {
@@ -324,7 +331,7 @@ public abstract class Entity implements ICommandListener {
this.fallDistance *= 0.5F;
}
- if (this.locY < -64.0D) {
+ if (this.locY < -64.0D || paperNetherCheck()) { // PaperSpigot - Configurable top-of-nether void damage
this.O();
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index a6d444b..b2f9a8e 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -196,4 +196,10 @@ public class PaperSpigotWorldConfig
{
boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
}
+
+ public boolean netherVoidTopDamage;
+ private void nethervoidTopDamage()
+ {
+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
+ }
}
--
2.7.0

View File

@ -1,27 +0,0 @@
From addd766578b634af56ba6ceef98ea1d74426f9f1 Mon Sep 17 00:00:00 2001
From: Zach <zach.brown@destroystokyo.com>
Date: Fri, 13 Feb 2015 14:49:30 -0600
Subject: [PATCH] Enderman drop the block they're holding when they die
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index a250062..f3afbbd 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -251,6 +251,13 @@ public class EntityEnderman extends EntityMonster {
}
}
+ // PaperSpigot start - Drop the block the entity is holding when it dies
+ Item carriedItem = Item.getItemOf(getCarried().getBlock());
+ if (carriedItem != null) {
+ this.a(carriedItem, 1);
+ }
+ // PaperSpigot end
+
}
public void setCarried(IBlockData iblockdata) {
--
2.5.2

View File

@ -1,11 +1,11 @@
From ddac02b42300698b7bff62fc5dc572ecb91cac5f Mon Sep 17 00:00:00 2001 From cd20fd6624aa3ff40de2ce1e5219743c289bf2e7 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv> From: Iceee <andrew@opticgaming.tv>
Date: Mon, 1 Jun 2015 22:54:18 -0700 Date: Wed, 2 Mar 2016 01:39:52 -0600
Subject: [PATCH] Fix lag from explosions processing dead entities Subject: [PATCH] Fix lag from explosions processing dead entities
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index c41b911..78e3a7d 100644 index 2d8d862..87e123c 100644
--- a/src/main/java/net/minecraft/server/Explosion.java --- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -103,7 +103,14 @@ public class Explosion { @@ -103,7 +103,14 @@ public class Explosion {
@ -13,17 +13,17 @@ index c41b911..78e3a7d 100644
int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D); int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D);
int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D); int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D);
- List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1)); - List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1));
+ // PaperSpigot start - Fix lag from explosions processing dead entities + // Paper start - Fix lag from explosions processing dead entities
+ List list = this.world.a(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate<Entity>() { + List list = this.world.a(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate<Entity>() {
+ @Override + @Override
+ public boolean apply(Entity entity) { + public boolean apply(Entity entity) {
+ return IEntitySelector.d.apply(entity) && !entity.dead; + return IEntitySelector.d.apply(entity) && !entity.dead;
+ } + }
+ }); + });
+ // PaperSpigot end + // Paper end
Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ); Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ);
for (int l1 = 0; l1 < list.size(); ++l1) { for (int l1 = 0; l1 < list.size(); ++l1) {
-- --
2.5.2 2.7.2

View File

@ -0,0 +1,278 @@
From 546984cc7a32e0532b0d9732b4c77a3332a4994e Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 02:17:54 -0600
Subject: [PATCH] Generator Settings
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e68595b..3cde5fd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -169,4 +169,28 @@ public class PaperWorldConfig {
disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
log("End credits disabled: " + disableEndCredits);
}
+
+ public boolean generateCanyon;
+ public boolean generateCaves;
+ public boolean generateDungeon;
+ public boolean generateFortress;
+ public boolean generateMineshaft;
+ public boolean generateMonument;
+ public boolean generateStronghold;
+ public boolean generateTemple;
+ public boolean generateVillage;
+ public boolean generateFlatBedrock;
+
+ private void generatorSettings() {
+ generateCanyon = getBoolean("generator-settings.canyon", true);
+ generateCaves = getBoolean("generator-settings.caves", true);
+ generateDungeon = getBoolean("generator-settings.dungeon", true);
+ generateFortress = getBoolean("generator-settings.fortress", true);
+ generateMineshaft = getBoolean("generator-settings.mineshaft", true);
+ generateMonument = getBoolean("generator-settings.monument", true);
+ generateStronghold = getBoolean("generator-settings.stronghold", true);
+ generateTemple = getBoolean("generator-settings.temple", true);
+ generateVillage = getBoolean("generator-settings.village", true);
+ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index be4b871..854bbb4 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -47,7 +47,7 @@ public abstract class BiomeBase {
protected List<BiomeBase.BiomeMeta> x;
public static int a(BiomeBase biomebase) {
- return BiomeBase.REGISTRY_ID.a((Object) biomebase);
+ return BiomeBase.REGISTRY_ID.a(biomebase); // Paper - Fix compile
}
public static BiomeBase a(int i) {
@@ -174,7 +174,7 @@ public abstract class BiomeBase {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int l1 = 255; l1 >= 0; --l1) {
- if (l1 <= random.nextInt(5)) {
+ if (l1 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock
chunksnapshot.a(k1, l1, j1, BiomeBase.c);
} else {
IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1);
diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java
index 3ce22aa..336fa16 100644
--- a/src/main/java/net/minecraft/server/BiomeMesa.java
+++ b/src/main/java/net/minecraft/server/BiomeMesa.java
@@ -98,7 +98,7 @@ public class BiomeMesa extends BiomeBase {
chunksnapshot.a(l, l1, k, BiomeMesa.a);
}
- if (l1 <= random.nextInt(5)) {
+ if (l1 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock
chunksnapshot.a(l, l1, k, BiomeMesa.c);
} else {
IBlockData iblockdata2 = chunksnapshot.a(l, l1, k);
diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
index 17e0b8e..89a33fd 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
@@ -25,7 +25,7 @@ public class ChunkProviderFlat implements ChunkGenerator {
if (flag) {
Map map = this.d.b();
- if (map.containsKey("village")) {
+ if (map.containsKey("village") && world.paperConfig.generateVillage) { // Paper
Map map1 = (Map) map.get("village");
if (!map1.containsKey("size")) {
@@ -35,19 +35,19 @@ public class ChunkProviderFlat implements ChunkGenerator {
this.e.add(new WorldGenVillage(map1));
}
- if (map.containsKey("biome_1")) {
+ if (map.containsKey("biome_1") && world.paperConfig.generateTemple) { // Paper
this.e.add(new WorldGenLargeFeature((Map) map.get("biome_1")));
}
- if (map.containsKey("mineshaft")) {
+ if (map.containsKey("mineshaft") && world.paperConfig.generateMineshaft) { // Paper
this.e.add(new WorldGenMineshaft((Map) map.get("mineshaft")));
}
- if (map.containsKey("stronghold")) {
+ if (map.containsKey("stronghold") && world.paperConfig.generateStronghold) { // Paper
this.e.add(new WorldGenStronghold((Map) map.get("stronghold")));
}
- if (map.containsKey("oceanmonument")) {
+ if (map.containsKey("oceanmonument") && world.paperConfig.generateMonument) { // Paper
this.e.add(new WorldGenMonument((Map) map.get("oceanmonument")));
}
}
@@ -60,7 +60,7 @@ public class ChunkProviderFlat implements ChunkGenerator {
this.i = new WorldGenLakes(Blocks.LAVA);
}
- this.g = this.d.b().containsKey("dungeon");
+ this.g = world.paperConfig.generateDungeon && this.d.b().containsKey("dungeon"); // Paper
int j = 0;
int k = 0;
boolean flag1 = true;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
index 88d0374..168d071 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
@@ -157,32 +157,32 @@ public class ChunkProviderGenerate implements ChunkGenerator {
this.a(i, j, chunksnapshot);
this.C = this.n.getWorldChunkManager().getBiomeBlock(this.C, i * 16, j * 16, 16, 16);
this.a(i, j, chunksnapshot, this.C);
- if (this.s.r) {
+ if (this.s.r && this.n.paperConfig.generateCaves) { // Paper
this.v.a(this.n, i, j, chunksnapshot);
}
- if (this.s.z) {
+ if (this.s.z && this.n.paperConfig.generateCanyon) { // Paper
this.A.a(this.n, i, j, chunksnapshot);
}
if (this.o) {
- if (this.s.w) {
+ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper
this.y.a(this.n, i, j, chunksnapshot);
}
- if (this.s.v) {
+ if (this.s.v&& this.n.paperConfig.generateVillage) { // Paper
this.x.a(this.n, i, j, chunksnapshot);
}
- if (this.s.u) {
+ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper
this.w.a(this.n, i, j, chunksnapshot);
}
- if (this.s.x) {
+ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper
this.z.a(this.n, i, j, chunksnapshot);
}
- if (this.s.y) {
+ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper
this.B.a(this.n, i, j, chunksnapshot);
}
}
@@ -319,23 +319,23 @@ public class ChunkProviderGenerate implements ChunkGenerator {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
if (this.o) {
- if (this.s.w) {
+ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper
this.y.a(this.n, this.i, chunkcoordintpair);
}
- if (this.s.v) {
+ if (this.s.v && this.n.paperConfig.generateVillage) { // Paper
flag = this.x.a(this.n, this.i, chunkcoordintpair);
}
- if (this.s.u) {
+ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper
this.w.a(this.n, this.i, chunkcoordintpair);
}
- if (this.s.x) {
+ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper
this.z.a(this.n, this.i, chunkcoordintpair);
}
- if (this.s.y) {
+ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper
this.B.a(this.n, this.i, chunkcoordintpair);
}
}
@@ -360,7 +360,7 @@ public class ChunkProviderGenerate implements ChunkGenerator {
}
}
- if (this.s.s) {
+ if (this.s.s && this.n.paperConfig.generateDungeon) { // Paper
for (k1 = 0; k1 < this.s.t; ++k1) {
l1 = this.i.nextInt(16) + 8;
i2 = this.i.nextInt(256);
@@ -424,23 +424,23 @@ public class ChunkProviderGenerate implements ChunkGenerator {
public void recreateStructures(Chunk chunk, int i, int j) {
if (this.o) {
- if (this.s.w) {
+ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper
this.y.a(this.n, i, j, (ChunkSnapshot) null);
}
- if (this.s.v) {
+ if (this.s.v && this.n.paperConfig.generateVillage) { // Paper
this.x.a(this.n, i, j, (ChunkSnapshot) null);
}
- if (this.s.u) {
+ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper
this.w.a(this.n, i, j, (ChunkSnapshot) null);
}
- if (this.s.x) {
+ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper
this.z.a(this.n, i, j, (ChunkSnapshot) null);
}
- if (this.s.y) {
+ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper
this.B.a(this.n, i, j, (ChunkSnapshot) null);
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java
index 0150efd..d17a6fd 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderHell.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java
@@ -148,7 +148,10 @@ public class ChunkProviderHell implements ChunkGenerator {
IBlockData iblockdata1 = ChunkProviderHell.b;
for (int l1 = 127; l1 >= 0; --l1) {
- if (l1 < 127 - this.p.nextInt(5) && l1 > this.p.nextInt(5)) {
+ // Paper start - Configurable flat bedrock worldgen
+ if (l1 < 127 - (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5)) &&
+ l1 > (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5))) {
+ // Paper end
IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l);
if (iblockdata2.getBlock() != null && iblockdata2.getMaterial() != Material.AIR) {
@@ -364,6 +367,6 @@ public class ChunkProviderHell implements ChunkGenerator {
}
public void recreateStructures(Chunk chunk, int i, int j) {
- this.H.a(this.n, i, j, (ChunkSnapshot) null);
+ if (this.n.paperConfig.generateFortress) this.H.a(this.n, i, j, (ChunkSnapshot) null); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 22d96e9..83d9509 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -90,6 +90,7 @@ public abstract class StructureGenerator extends WorldGenBase {
}
public boolean b(BlockPosition blockposition) {
+ if (this.g == null) return false; // Paper
this.a(this.g);
return this.c(blockposition) != null;
}
@@ -117,6 +118,7 @@ public abstract class StructureGenerator extends WorldGenBase {
}
public boolean b(World world, BlockPosition blockposition) {
+ if (this.g == null) return false; // Paper
this.a(world);
Iterator iterator = this.c.values().iterator();
--
2.7.2

View File

@ -1,77 +0,0 @@
From d3fbc65d48a954e502579dccb29442db086fa363 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 13 Apr 2015 15:47:15 -0500
Subject: [PATCH] Fix redstone lag issues
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index bf7c876..9829ff0 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -611,6 +611,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
if (false) { // CraftBukkit
throw new IllegalStateException("TickNextTick list out of synch");
} else {
+ // PaperSpigot start - No, stop doing this, it affects things like redstone
+ /*
if (i > 1000) {
// CraftBukkit start - If the server has too much to process over time, try to alleviate that
if (i > 20 * 1000) {
@@ -619,7 +621,11 @@ public class WorldServer extends World implements IAsyncTaskHandler {
i = 1000;
}
// CraftBukkit end
+ */
+ if (i > paperSpigotConfig.tickNextTickCap) {
+ i = paperSpigotConfig.tickNextTickCap;
}
+ // PaperSpigot end
this.methodProfiler.a("cleaning");
@@ -636,6 +642,23 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.V.add(nextticklistentry);
}
+ // PaperSpigot start - Allow redstone ticks to bypass the tickNextTickListCap
+ if (paperSpigotConfig.tickNextTickListCapIgnoresRedstone) {
+ Iterator<NextTickListEntry> iterator = this.M.iterator();
+ while (iterator.hasNext()) {
+ NextTickListEntry next = iterator.next();
+ if (!flag && next.b > this.worldData.getTime()) {
+ break;
+ }
+
+ if (next.a().isPowerSource() || next.a() instanceof IContainer) {
+ iterator.remove();
+ this.V.add(next);
+ }
+ }
+ }
+ // PaperSpigot end
+
this.methodProfiler.b();
this.methodProfiler.a("ticking");
Iterator iterator = this.V.iterator();
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index b2f9a8e..c8971d1 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -202,4 +202,14 @@ public class PaperSpigotWorldConfig
{
netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
}
+
+ public int tickNextTickCap;
+ public boolean tickNextTickListCapIgnoresRedstone;
+ private void tickNextTickCap()
+ {
+ tickNextTickCap = getInt( "tick-next-tick-list-cap", 10000 ); // Higher values will be friendlier to vanilla style mechanics (to a point) but may hurt performance
+ tickNextTickListCapIgnoresRedstone = getBoolean( "tick-next-tick-list-cap-ignores-redstone", false ); // Redstone TickNextTicks will always bypass the preceding cap.
+ log( "WorldServer TickNextTick cap set at " + tickNextTickCap );
+ log( "WorldServer TickNextTickList cap always processes redstone: " + tickNextTickListCapIgnoresRedstone );
+ }
}
--
2.7.0

View File

@ -1,6 +1,6 @@
From d5ef4de366d7f65280dd0466a92f71a09b1120fd Mon Sep 17 00:00:00 2001 From d173d8966a5f250a5aac7191b46b297e26d72f3b Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Tue, 16 Jun 2015 00:43:17 -0700 Date: Wed, 2 Mar 2016 11:59:48 -0600
Subject: [PATCH] Optimize explosions Subject: [PATCH] Optimize explosions
The process of determining an entity's exposure from explosions can be The process of determining an entity's exposure from explosions can be
@ -9,8 +9,23 @@ expensive when there are hundreds or more entities in range.
This patch adds a per-tick cache that is used for storing and retrieving This patch adds a per-tick cache that is used for storing and retrieving
an entity's exposure during an explosion. an entity's exposure during an explosion.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3cde5fd..ee50493 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -193,4 +193,10 @@ public class PaperWorldConfig {
generateVillage = getBoolean("generator-settings.village", true);
generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false);
}
+
+ public boolean optimizeExplosions;
+ private void optimizeExplosions() {
+ optimizeExplosions = getBoolean("optimize-explosions", false);
+ log("Optimize explosions: " + optimizeExplosions);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 0e8af2e..f6067ce 100644 index 87e123c..afe402e 100644
--- a/src/main/java/net/minecraft/server/Explosion.java --- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -129,7 +129,7 @@ public class Explosion { @@ -129,7 +129,7 @@ public class Explosion {
@ -18,21 +33,20 @@ index 0e8af2e..f6067ce 100644
d9 /= d11; d9 /= d11;
d10 /= d11; d10 /= d11;
- double d12 = (double) this.world.a(vec3d, entity.getBoundingBox()); - double d12 = (double) this.world.a(vec3d, entity.getBoundingBox());
+ double d12 = this.getBlockDensity(vec3d, entity.getBoundingBox()); // PaperSpigot - Optimize explosions + double d12 = this.getBlockDensity(vec3d, entity.getBoundingBox()); // Paper - Optimize explosions
double d13 = (1.0D - d7) * d12; double d13 = (1.0D - d7) * d12;
// entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));+ // CraftBukkit start // CraftBukkit start
@@ -294,4 +294,86 @@ public class Explosion { @@ -296,4 +296,85 @@ public class Explosion {
public List<BlockPosition> getBlocks() { public List<BlockPosition> getBlocks() {
return this.blocks; return this.blocks;
} }
+ +
+ // PaperSpigot start - Optimize explosions + // Paper start - Optimize explosions
+ private float getBlockDensity(Vec3D vec3d, AxisAlignedBB aabb) { + private float getBlockDensity(Vec3D vec3d, AxisAlignedBB aabb) {
+ if (!this.world.paperSpigotConfig.optimizeExplosions) { + if (!this.world.paperConfig.optimizeExplosions) {
+ return this.world.a(vec3d, aabb); + return this.world.a(vec3d, aabb);
+ } + }
+
+ CacheKey key = new CacheKey(this, aabb); + CacheKey key = new CacheKey(this, aabb);
+ Float blockDensity = this.world.explosionDensityCache.get(key); + Float blockDensity = this.world.explosionDensityCache.get(key);
+ if (blockDensity == null) { + if (blockDensity == null) {
@ -107,47 +121,40 @@ index 0e8af2e..f6067ce 100644
+ return result; + return result;
+ } + }
+ } + }
+ // PaperSpigot end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 06ae3fc..eac71e8 100644 index 0a23d2a..ac1bec6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -861,6 +861,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs @@ -858,6 +858,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
worldserver.timings.tracker.stopTiming(); // Spigot worldserver.timings.tracker.stopTiming(); // Spigot
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();
+ worldserver.explosionDensityCache.clear(); // PaperSpigot - Optimize explosions + worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
// } // CraftBukkit // } // CraftBukkit
// this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit // this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7660356..68cb798 100644 index 79cd94d..8925c67 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -135,6 +135,7 @@ public abstract class World implements IBlockAccess { @@ -32,6 +32,7 @@ import org.bukkit.generator.ChunkGenerator;
// Paper start
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.HashMap;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
// Paper end
@@ -141,6 +142,7 @@ public abstract class World implements IBlockAccess {
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition; private int tileTickPosition;
public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("PaperSpigot - Lighting Thread").build()); // PaperSpigot - Asynchronous lighting updates public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper - Lighting Thread").build()); // Paper - Asynchronous lighting updates
+ public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<Explosion.CacheKey, Float>(); // PaperSpigot - Optimize explosions + public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<Explosion.CacheKey, Float>(); // Paper - Optimize explosions
public static long chunkToKey(int x, int z) public CraftWorld getWorld() {
{ return this.world;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index ef59074..e42b574 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -306,4 +306,10 @@ public class PaperSpigotWorldConfig
{
fallingBlocksCollideWithSigns = getBoolean( "falling-blocks-collide-with-signs", false );
}
+
+ public boolean optimizeExplosions;
+ private void optimizeExplosions()
+ {
+ optimizeExplosions = getBoolean( "optimize-explosions", false );
+ }
}
-- --
2.7.0 2.7.2

View File

@ -1,29 +0,0 @@
From d983745c2061cbee37aa5a1ed042ae595b75dfbe Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 10 Apr 2015 18:07:36 -0500
Subject: [PATCH] Always tick falling blocks
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index d8d54bd..d6311bd 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -14,6 +14,7 @@ import net.minecraft.server.EntityCreature;
import net.minecraft.server.EntityCreeper;
import net.minecraft.server.EntityEnderCrystal;
import net.minecraft.server.EntityEnderDragon;
+import net.minecraft.server.EntityFallingBlock;
import net.minecraft.server.EntityFireball;
import net.minecraft.server.EntityFireworks;
import net.minecraft.server.EntityHuman;
@@ -82,6 +83,7 @@ public class ActivationRange
|| entity instanceof EntityFireball
|| entity instanceof EntityWeather
|| entity instanceof EntityTNTPrimed
+ || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworks )
{
--
2.6.0

View File

@ -1,21 +1,21 @@
From adb1d170502e3b0e44d08399ec31c0633f411c1c Mon Sep 17 00:00:00 2001 From f78ee3cdf59990c2d828a298c6bf4c06bcd82dc0 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv> From: Iceee <andrew@opticgaming.tv>
Date: Tue, 30 Jun 2015 19:31:02 -0700 Date: Wed, 2 Mar 2016 12:03:23 -0600
Subject: [PATCH] Stop updating flowing block if material has changed Subject: [PATCH] Stop updating flowing block if material has changed
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index ff18f63..ab2e43f 100644 index f35f30c..1f07f82 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java --- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -102,6 +102,7 @@ public class BlockFlowing extends BlockFluids { @@ -101,6 +101,7 @@ public class BlockFlowing extends BlockFluids {
this.f(world, blockposition, iblockdata); this.f(world, blockposition, iblockdata);
} }
+ if (world.getType(blockposition).getBlock().getMaterial() != material) return; // PaperSpigot - Stop updating flowing block if material has changed + if (world.getType(blockposition).getBlock().getBlockData().getMaterial() != material) return; // Paper - Stop updating flowing block if material has changed
IBlockData iblockdata2 = world.getType(blockposition.down()); IBlockData iblockdata2 = world.getType(blockposition.down());
if (this.h(world, blockposition.down(), iblockdata2)) { if (this.h(world, blockposition.down(), iblockdata2)) {
-- --
2.5.2 2.7.2

View File

@ -1,148 +0,0 @@
From 70501efcdaf3ca00782b429d7ec5d50aef96db37 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Fri, 17 Apr 2015 02:26:14 -0700
Subject: [PATCH] Add FallingBlock source location API
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index de7ac6f..76a6272 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -28,7 +28,10 @@ public class BlockDragonEgg extends Block {
byte b0 = 32;
if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
- world.addEntity(new EntityFallingBlock(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData()));
+ // PaperSpigot start - Add FallingBlock source location API
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F));
+ world.addEntity(new EntityFallingBlock(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData()));
+ // PaperSpigot end
} else {
world.setAir(blockposition);
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
index 29f8554..1d952b8 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -36,7 +36,10 @@ public class BlockFalling extends Block {
if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
if (!world.isClientSide) {
- EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
+ // PaperSpigot start - Add FallingBlock source location API
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F));
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(loc, world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
+ // PaperSpigot end
this.a(entityfallingblock);
world.addEntity(entityfallingblock);
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 86556cd..b34e93c 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -16,13 +16,26 @@ public class EntityFallingBlock extends Entity {
private int fallHurtMax = 40;
private float fallHurtAmount = 2.0F;
public NBTTagCompound tileEntityData;
+ public org.bukkit.Location sourceLoc; // PaperSpigot
+ // PaperSpigot start - Add FallingBlock source location API
public EntityFallingBlock(World world) {
+ this(null, world);
+ }
+
+ public EntityFallingBlock(org.bukkit.Location loc, World world) {
super(world);
+ sourceLoc = loc;
}
public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) {
+ this(null, world, d0, d1, d2, iblockdata);
+ }
+
+ public EntityFallingBlock(org.bukkit.Location loc, World world, double d0, double d1, double d2, IBlockData iblockdata) {
super(world);
+ sourceLoc = loc;
+ // PaperSpigot end
this.block = iblockdata;
this.k = true;
this.setSize(0.98F, 0.98F);
@@ -197,7 +210,13 @@ public class EntityFallingBlock extends Entity {
if (this.tileEntityData != null) {
nbttagcompound.set("TileEntityData", this.tileEntityData);
}
-
+ // PaperSpigot start - Add FallingBlock source location API
+ if (sourceLoc != null) {
+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX());
+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY());
+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ());
+ }
+ // PaperSpigot end
}
protected void a(NBTTagCompound nbttagcompound) {
@@ -233,7 +252,14 @@ public class EntityFallingBlock extends Entity {
if (block == null || block.getMaterial() == Material.AIR) {
this.block = Blocks.SAND.getBlockData();
}
-
+ // PaperSpigot start - Add FallingBlock source location API
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
+ }
+ // PaperSpigot end
}
public void a(boolean flag) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d8417c9..c15a0ba 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -886,7 +886,10 @@ public class CraftWorld implements World {
double y = location.getBlockY() + 0.5;
double z = location.getBlockZ() + 0.5;
- EntityFallingBlock entity = new EntityFallingBlock(world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
+ // PaperSpigot start - Add FallingBlock source location API
+ location = location.clone();
+ EntityFallingBlock entity = new EntityFallingBlock(location, world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
+ // PaperSpigot end
entity.ticksLived = 1;
world.addEntity(entity, SpawnReason.CUSTOM);
@@ -921,8 +924,10 @@ public class CraftWorld implements World {
IBlockData blockData = world.getType(new BlockPosition(x, y, z));
int type = CraftMagicNumbers.getId(blockData.getBlock());
int data = blockData.getBlock().toLegacyData(blockData);
-
- entity = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
+ // PaperSpigot start - Add FallingBlock source location API
+ location = location.clone();
+ entity = new EntityFallingBlock(location, world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
+ // PaperSpigot end
} else if (Projectile.class.isAssignableFrom(clazz)) {
if (Snowball.class.isAssignableFrom(clazz)) {
entity = new EntitySnowball(world, x, y, z);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
index 75eed48..eedb66f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
public void setHurtEntities(boolean hurtEntities) {
getHandle().hurtEntities = hurtEntities;
}
+
+ // PaperSpigot start - Add FallingBlock source location API
+ @Override
+ public org.bukkit.Location getSourceLoc() {
+ return getHandle().sourceLoc;
+ }
+ // PaperSpigot end
}
--
2.6.3

View File

@ -1,11 +1,27 @@
From 0400a17ebc786a5b92448a24fb891814519d2fd3 Mon Sep 17 00:00:00 2001 From 60647fcd622bf436128c3f5d98e953ec0530a013 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Tue, 30 Jun 2015 19:31:02 -0700 Date: Wed, 2 Mar 2016 12:20:52 -0600
Subject: [PATCH] Fast draining Subject: [PATCH] Fast draining
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d022513..269d373 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -199,4 +199,11 @@ public class PaperWorldConfig {
optimizeExplosions = getBoolean("optimize-explosions", false);
log("Optimize explosions: " + optimizeExplosions);
}
+
+ public boolean fastDrainLava;
+ public boolean fastDrainWater;
+ private void fastDrain() {
+ fastDrainLava = getBoolean("fast-drain.lava", false);
+ fastDrainWater = getBoolean("fast-drain.water", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index ab2e43f..fc3fc48 100644 index 1f07f82..517c1e8 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java --- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -74,7 +74,7 @@ public class BlockFlowing extends BlockFluids { @@ -74,7 +74,7 @@ public class BlockFlowing extends BlockFluids {
@ -13,7 +29,7 @@ index ab2e43f..fc3fc48 100644
} }
- if (this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { - if (this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) {
+ if (!world.paperSpigotConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // PaperSpigot + if (!world.paperConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // Paper
j *= 4; j *= 4;
} }
@ -22,80 +38,63 @@ index ab2e43f..fc3fc48 100644
} else { } else {
i = i1; i = i1;
- if (i1 < 0) { - if (i1 < 0) {
+ if (i1 < 0 || canFastDrain(world, blockposition)) { // PaperSpigot - Fast draining + if (i1 < 0 || canFastDrain(world, blockposition)) { // Paper - Fast draining
world.setAir(blockposition); world.setAir(blockposition);
} else { } else {
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1)); iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
@@ -285,4 +285,52 @@ public class BlockFlowing extends BlockFluids { @@ -288,4 +288,52 @@ public class BlockFlowing extends BlockFluids {
} }
return super.a(world); return super.a(world);
} }
+ +
+ /** + /**
+ * PaperSpigot - Data check method for fast draining + * Paper - Data check method for fast draining
+ */ + */
+ public int getData(World world, BlockPosition position) { + public int getData(World world, BlockPosition position) {
+ int data = this.e(world, position); + int data = this.c((IBlockAccess) world, position);
+ return data < 8 ? data : 0; + return data < 8 ? data : 0;
+ } + }
+ +
+ /** + /**
+ * PaperSpigot - Checks surrounding blocks to determine if block can be fast drained + * Paper - Checks surrounding blocks to determine if block can be fast drained
+ */ + */
+ public boolean canFastDrain(World world, BlockPosition position) { + public boolean canFastDrain(World world, BlockPosition position) {
+ boolean result = false; + boolean result = false;
+ int data = getData(world, position); + int data = getData(world, position);
+ if (this.material == Material.WATER) { + if (this.material == Material.WATER) {
+ if (world.paperSpigotConfig.fastDrainWater) { + if (world.paperConfig.fastDrainWater) {
+ result = true; + result = true;
+ if (getData(world, position.down()) < 0) { + if (getData(world, position.down()) < 0) {
+ result = false; + result = false;
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.WATER && getData(world, position.north()) < data) { + } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.north()) < data) {
+ result = false; + result = false;
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.WATER && getData(world, position.south()) < data) { + } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.south()) < data) {
+ result = false; + result = false;
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.WATER && getData(world, position.west()) < data) { + } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.west()) < data) {
+ result = false; + result = false;
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.WATER && getData(world, position.east()) < data) { + } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.east()) < data) {
+ result = false; + result = false;
+ } + }
+ } + }
+ } else if (this.material == Material.LAVA) { + } else if (this.material == Material.LAVA) {
+ if (world.paperSpigotConfig.fastDrainLava) { + if (world.paperConfig.fastDrainLava) {
+ result = true; + result = true;
+ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getMaterial() != Material.AIR) { + if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getBlockData().getMaterial() != Material.AIR) {
+ result = false; + result = false;
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.LAVA && getData(world, position.north()) < data) { + } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.north()) < data) {
+ result = false; + result = false;
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.LAVA && getData(world, position.south()) < data) { + } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.south()) < data) {
+ result = false; + result = false;
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.LAVA && getData(world, position.west()) < data) { + } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.west()) < data) {
+ result = false; + result = false;
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.LAVA && getData(world, position.east()) < data) { + } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.east()) < data) {
+ result = false; + result = false;
+ } + }
+ } + }
+ } + }
+ return result; + return result;
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index e42b574..56c8433 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -312,4 +312,12 @@ public class PaperSpigotWorldConfig
{
optimizeExplosions = getBoolean( "optimize-explosions", false );
}
+
+ public boolean fastDrainLava;
+ public boolean fastDrainWater;
+ private void fastDraining()
+ {
+ fastDrainLava = getBoolean( "fast-drain.lava", false );
+ fastDrainWater = getBoolean( "fast-drain.water", false );
+ } + }
} }
-- --
2.7.0 2.7.2

View File

@ -0,0 +1,39 @@
From 38052c7fb6cc2f5ee6bd889f908747a44b99f400 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 12:27:07 -0600
Subject: [PATCH] Configurable lava flow speed
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index dad5a95..72f1000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -206,4 +206,11 @@ public class PaperWorldConfig {
fastDrainLava = getBoolean("fast-drain.lava", false);
fastDrainWater = getBoolean("fast-drain.water", false);
}
+
+ public int lavaFlowSpeedNormal;
+ public int lavaFlowSpeedNether;
+ private void lavaFlowSpeeds() {
+ lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30);
+ lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 141765e..2ca998b 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -279,6 +279,9 @@ public class BlockFlowing extends BlockFluids {
* Paper - Get flow speed. Throttle if its water and flowing adjacent to lava
*/
public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.material == Material.LAVA) {
+ return world.worldProvider.m() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.lavaFlowSpeedNormal;
+ }
if (this.material == Material.WATER && (
world.getType(blockposition.north(1)).getBlock().material == Material.LAVA ||
world.getType(blockposition.south(1)).getBlock().material == Material.LAVA ||
--
2.7.2

View File

@ -0,0 +1,113 @@
From 69fe942c444ac6c117ed54c4d8729cf2a70c7bdc Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 14:35:27 -0600
Subject: [PATCH] Add player view distance API
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index b32617b..8be847d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -53,6 +53,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public boolean f;
public int ping;
public boolean viewingCredits;
+ public int viewDistance; // Paper - Player view distance API
// CraftBukkit start
public String displayName;
@@ -83,6 +84,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, gameprofile);
+ this.viewDistance = world.spigotConfig.viewDistance; // Paper - Player view distance API
playerinteractmanager.player = this;
this.playerInteractManager = playerinteractmanager;
BlockPosition blockposition = worldserver.getSpawn();
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 8ef7eb2..5421026 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -284,8 +284,10 @@ public class PlayerChunkMap {
int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4;
- for (int k = i - this.j; k <= i + this.j; ++k) {
- for (int l = j - this.j; l <= j + this.j; ++l) {
+ // Paper start - Player view distance API
+ for (int k = i - entityplayer.viewDistance; k <= i + entityplayer.viewDistance; ++k) {
+ for (int l = j - entityplayer.viewDistance; l <= j + entityplayer.viewDistance; ++l) {
+ // Paper end
PlayerChunk playerchunk = this.b(k, l);
if (playerchunk != null) {
@@ -315,7 +317,7 @@ public class PlayerChunkMap {
if (d2 >= 64.0D) {
int k = (int) entityplayer.d >> 4;
int l = (int) entityplayer.e >> 4;
- int i1 = this.j;
+ int i1 = entityplayer.viewDistance; // Paper - Player view distance API
int j1 = i - k;
int k1 = j - l;
@@ -471,4 +473,36 @@ public class PlayerChunkMap {
}
}
// CraftBukkit end
+
+ // Paper start - Player view distance API
+ public void updateViewDistance(EntityPlayer player, int viewDistance) {
+ viewDistance = MathHelper.clamp(viewDistance, 3, 32);
+ if (viewDistance != player.viewDistance) {
+ int cx = (int) player.locX >> 4;
+ int cz = (int) player.locZ >> 4;
+
+ if (viewDistance - player.viewDistance > 0) {
+ for (int x = cx - viewDistance; x <= cx + viewDistance; ++x) {
+ for (int z = cz - viewDistance; z <= cz + viewDistance; ++z) {
+ PlayerChunk playerchunkmap_playerchunk = this.c(x, z);
+
+ if (!playerchunkmap_playerchunk.c.contains(player)) {
+ playerchunkmap_playerchunk.a(player);
+ }
+ }
+ }
+ } else {
+ for (int x = cx - player.viewDistance; x <= cx + player.viewDistance; ++x) {
+ for (int z = cz - player.viewDistance; z <= cz + player.viewDistance; ++z) {
+ if (!this.a(x, z, cx, cz, viewDistance)) {
+ this.c(x, z).b(player);
+ }
+ }
+ }
+ }
+
+ player.viewDistance = viewDistance;
+ }
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8fcbba3..6fb4fb0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1427,6 +1427,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setAffectsSpawning(boolean affects) {
getHandle().affectsSpawning = affects;
}
+
+ @Override
+ public int getViewDistance() {
+ return getHandle().viewDistance;
+ }
+
+ @Override
+ public void setViewDistance(int viewDistance) {
+ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance);
+ }
// Paper end
// Spigot start
--
2.7.2

View File

@ -1,29 +0,0 @@
From e930fc7dbc68671274199b2268d34bb3d8179990 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Fri, 10 Apr 2015 02:24:20 -0700
Subject: [PATCH] Optimize draining
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index de1dddb..ff18f63 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -88,7 +88,14 @@ public class BlockFlowing extends BlockFluids {
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
world.setTypeAndData(blockposition, iblockdata, 2);
world.a(blockposition, (Block) this, j);
- world.applyPhysics(blockposition, this);
+ // PaperSpigot start - Optimize draining
+ world.d(blockposition.west(), this);
+ world.d(blockposition.east(), this);
+ world.d(blockposition.up(), this);
+ world.d(blockposition.north(), this);
+ world.d(blockposition.south(), this);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
+ // PaperSpigot end
}
}
} else {
--
2.5.2

View File

@ -0,0 +1,73 @@
From 8720ceb09eaf96052ee087a76ecb1782fbda6d27 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Wed, 2 Mar 2016 14:48:03 -0600
Subject: [PATCH] Disable explosion knockback
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8d6e0a2..6b5067a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -213,4 +213,9 @@ public class PaperWorldConfig {
lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30);
lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10);
}
+
+ public boolean disableExplosionKnockback;
+ private void disableExplosionKnockback(){
+ disableExplosionKnockback = getBoolean("disable-explosion-knockback", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index b410f3b..8d91f7c 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -851,12 +851,14 @@ public abstract class EntityLiving extends Entity {
}
}
+ boolean knockbackCancelled = world.paperConfig.disableExplosionKnockback && damagesource.isExplosion() && this instanceof EntityHuman; // Paper - Disable explosion knockback
if (flag1) {
if (flag) {
this.world.broadcastEntityEffect(this, (byte) 29);
} else if (damagesource instanceof EntityDamageSource && ((EntityDamageSource) damagesource).x()) {
this.world.broadcastEntityEffect(this, (byte) 33);
} else {
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
this.world.broadcastEntityEffect(this, (byte) 2);
}
@@ -880,6 +882,8 @@ public abstract class EntityLiving extends Entity {
}
}
+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback
+
if (this.getHealth() <= 0.0F) {
SoundEffect soundeffect = this.bS();
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index afe402e..cd2fb14 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -145,7 +145,7 @@ public class Explosion {
double d14 = 1.0D;
if (entity instanceof EntityLiving) {
- d14 = EnchantmentProtection.a((EntityLiving) entity, d13);
+ d14 = entity instanceof EntityHuman && world.paperConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a((EntityLiving) entity, d13); // Paper - Disable explosion knockback
}
entity.motX += d8 * d14;
@@ -154,7 +154,7 @@ public class Explosion {
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
- if (!entityhuman.isSpectator() && (!entityhuman.l_() || !entityhuman.abilities.isFlying)) {
+ if (!entityhuman.isSpectator() && (!entityhuman.l_() && !world.paperConfig.disableExplosionKnockback|| !entityhuman.abilities.isFlying)) { // Paper - Disable explosion knockback
this.k.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13));
}
}
--
2.7.2

View File

@ -1,38 +0,0 @@
From 75816e95b1a72dabba47e22901bff5c9ce7d89cc Mon Sep 17 00:00:00 2001
From: Roman Alexander <romanalexander@users.noreply.github.com>
Date: Fri, 27 Mar 2015 00:52:24 -0400
Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index b901c69..cc1e33c 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -974,7 +974,7 @@ public abstract class EntityHuman extends EntityLiving {
}
if (f > 0.0F || f1 > 0.0F) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.k_() && !this.V() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ boolean flag = !world.paperSpigotConfig.disablePlayerCrits && this.fallDistance > 0.0F && !this.onGround && !this.k_() && !this.V() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; // PaperSpigot
if (flag && f > 0.0F) {
f *= 1.5F;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 9ad53fa..1a4a9af 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -192,9 +192,11 @@ public class PaperSpigotWorldConfig
}
public boolean boatsDropBoats;
+ public boolean disablePlayerCrits;
private void mechanicsChanges()
{
boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
+ disablePlayerCrits = getBoolean( "game-mechanics.disable-player-crits", false );
}
public boolean netherVoidTopDamage;
--
2.7.0

Some files were not shown because too many files have changed in this diff Show More