Paper 1.9

This commit is contained in:
Zach Brown 2016-02-29 17:09:49 -06:00
parent cf5b4b8828
commit 26eb457a39
139 changed files with 5550 additions and 8067 deletions

2
.gitignore vendored
View file

@ -39,6 +39,8 @@ work/
# other stuff
Spigot-API
Spigot-Server
Paper-Server
Paper-API
PaperSpigot-Server
PaperSpigot-API
Bukkit

View file

@ -8,7 +8,7 @@ before_install:
- ./remap.sh
- ./decompile.sh
- ./init.sh
- ./newApplyPatches.sh
- ./applyPatches.sh
after_success:
- ./paperclip.sh
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.
@ -15,12 +15,12 @@ https://ci.destroystokyo.com/job/PaperSpigot/
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)
------
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.

View file

@ -1,16 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /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 +0,0 @@
+package org.github.paperspigot.event.block;
+package com.destroystokyo.paper.event.block;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;

View file

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -0,0 +0,0 @@ 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
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
missing in CraftBukkit)
@ -21,7 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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
+ * returns the {@link Location} of the block the player is looking at at the time of the tab complete.
@ -31,19 +32,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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).
+ *
+ * @param sender Source object which is executing this command
+ * @param alias the alias being used
+ * @param args All arguments passed to the command, split via ' '
+ * @param sender Source object which is executing this command
+ * @param alias the alias being used
+ * @param args All arguments passed to the command, split via ' '
+ * @param location the location of the block the player is looking at
+ * @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
+ */
+ 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
+ return tabComplete(sender, alias, args);
+ }
+ // PaperSpigot end
+ // Paper end
+
/**
* Returns the name of this command
@ -52,25 +53,19 @@ diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/command/PluginCommand.java
+++ b/src/main/java/org/bukkit/command/PluginCommand.java
@@ -0,0 +0,0 @@
package org.bukkit.command;
@@ -0,0 +0,0 @@ package org.bukkit.command;
import java.util.List;
-import java.util.List;
-
import org.apache.commons.lang.Validate;
+import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
+import java.util.List;
+
/**
* Represents a {@link Command} belonging to a plugin
*/
@@ -0,0 +0,0 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
*/
@Override
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
@ -87,11 +82,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
try {
if (completer != null) {
- 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) {
- 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) {
StringBuilder message = new StringBuilder();
@ -99,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
return completions;
}
+ // PaperSpigot end
+ // Paper end
@Override
public String toString() {
@ -119,12 +114,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
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
+ /*
+ this code was copied, except for the noted change, from tabComplete(CommandSender sender, String cmdLine)
+ // Paper start - location tab-completes
+ /**
+ * 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) {
Validate.notNull(sender, "Sender cannot be null");
@ -135,14 +130,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
try {
- 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) {
throw ex;
} catch (Throwable ex) {
throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
}
}
+ // PaperSpigot end
+ // Paper end
public Collection<Command> getCommands() {
return Collections.unmodifiableCollection(knownCommands.values());
@ -163,10 +158,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/
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) {
+ return onTabComplete(sender, command, alias, args);
+ }
+ // PaperSpigot end
+ // Paper end
}
--

View file

@ -1,21 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /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 +0,0 @@
+package org.bukkit.event.player;
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+
+public class PlayerInitialSpawnEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
@ -53,5 +54,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return handlers;
+ }
+}
\ No newline at end of file
--

View file

@ -1,19 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Mon, 27 Apr 2015 21:41:39 -0500
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 29 Feb 2016 18:02:25 -0600
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /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 +0,0 @@
+package org.bukkit.event.player;
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+
+/**
+ * Called when the locale of the player is changed.
@ -56,5 +57,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return handlers;
+ }
+}
\ No newline at end of file
--

View file

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -0,0 +0,0 @@ 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();
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 6 Nov 2014 18:29:20 -0600
Date: Mon, 29 Feb 2016 17:43:33 -0600
Subject: [PATCH] Add async chunk load API
@ -9,19 +9,82 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Chunk getChunkAt(Block block);
+ // PaperSpigot start - Async chunk load API
/**
+ * 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);
+ }
+ 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
+
/**
+ /**
+ * 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
--

View file

@ -1,23 +1,476 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 20:07:46 -0500
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 29 Feb 2016 20:24:35 -0600
Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.server;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang.Validate;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import com.destroystokyo.paper.exception.ServerException;
+
+/**
+ * Called whenever an exception is thrown in a recoverable section of the server.
+ */
+public class ServerExceptionEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private ServerException exception;
+
+ public ServerExceptionEvent(ServerException exception) {
+ this.exception = Preconditions.checkNotNull(exception, "exception");
+ }
+
+ /**
+ * Gets the wrapped exception that was thrown.
+ *
+ * @return Exception thrown
+ */
+ public ServerException getException() {
+ return exception;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Thrown when a command throws an exception
+ */
+public class ServerCommandException extends ServerException {
+
+ private final Command command;
+ private final CommandSender commandSender;
+ private final String[] arguments;
+
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(cause);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ /**
+ * Gets the command which threw the exception
+ *
+ * @return exception throwing command
+ */
+ public Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Gets the command sender which executed the command request
+ *
+ * @return command sender of exception thrown command request
+ */
+ public CommandSender getCommandSender() {
+ return commandSender;
+ }
+
+ /**
+ * Gets the arguments which threw the exception for the command
+ *
+ * @return arguments of exception thrown command request
+ */
+ public String[] getArguments() {
+ return arguments;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Exception thrown when a server event listener throws an exception
+ */
+public class ServerEventException extends ServerPluginException {
+
+ private final Listener listener;
+ private final Event event;
+
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(message, cause, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(cause, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ /**
+ * Gets the listener which threw the exception
+ *
+ * @return event listener
+ */
+ public Listener getListener() {
+ return listener;
+ }
+
+ /**
+ * Gets the event which caused the exception
+ *
+ * @return event
+ */
+ public Event getEvent() {
+ return event;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+/**
+ * Wrapper exception for all exceptions that are thrown by the server.
+ */
+public class ServerException extends Exception {
+
+ public ServerException(String message) {
+ super(message);
+ }
+
+ public ServerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerException(Throwable cause) {
+ super(cause);
+ }
+
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.Bukkit;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+
+/**
+ * Thrown when the internal server throws a recoverable exception.
+ */
+public class ServerInternalException extends ServerException {
+
+ public ServerInternalException(String message) {
+ super(message);
+ }
+
+ public ServerInternalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerInternalException(Throwable cause) {
+ super(cause);
+ }
+
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ public static void reportInternalException(Throwable cause) {
+ try {
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
+ ;
+ } catch (Throwable t) {
+ t.printStackTrace(); // Don't want to rethrow!
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.plugin.Plugin;
+
+/**
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
+ */
+public class ServerPluginEnableDisableException extends ServerPluginException {
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
+ super(message, cause, responsiblePlugin);
+ }
+
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
+ super(cause, responsiblePlugin);
+ }
+
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang.Validate;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
+ */
+public class ServerPluginException extends ServerException {
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
+ super(message, cause);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
+ super(cause);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ private final Plugin responsiblePlugin;
+
+ /**
+ * Gets the plugin which is directly responsible for the exception being thrown
+ *
+ * @return plugin which is responsible for the exception throw
+ */
+ public Plugin getResponsiblePlugin() {
+ return responsiblePlugin;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Thrown when an incoming plugin message channel throws an exception
+ */
+public class ServerPluginMessageException extends ServerPluginException {
+
+ private final Player player;
+ private final String channel;
+ private final byte[] data;
+
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(message, cause, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(cause, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ /**
+ * Gets the channel to which the error occurred from recieving data from
+ *
+ * @return exception channel
+ */
+ public String getChannel() {
+ return channel;
+ }
+
+ /**
+ * Gets the data to which the error occurred from
+ *
+ * @return exception data
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ /**
+ * Gets the player which the plugin message causing the exception originated from
+ *
+ * @return exception player
+ */
+ public Player getPlayer() {
+ return player;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.scheduler.BukkitTask;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Thrown when a plugin's scheduler fails with an exception
+ */
+public class ServerSchedulerException extends ServerPluginException {
+
+ private final BukkitTask task;
+
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
+ super(message, cause, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
+ super(cause, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ /**
+ * Gets the task which threw the exception
+ *
+ * @return exception throwing task
+ */
+ public BukkitTask getTask() {
+ return task;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+
+/**
+ * Called when a tab-complete request throws an exception
+ */
+public class ServerTabCompleteException extends ServerCommandException {
+
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, command, commandSender, arguments);
+ }
+
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(cause, command, commandSender, arguments);
+ }
+
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -0,0 +0,0 @@ import org.bukkit.Server;
import org.bukkit.command.defaults.*;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerCommandException;
+import org.github.paperspigot.exception.ServerTabCompleteException;
@@ -0,0 +0,0 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class SimpleCommandMap implements CommandMap {
private static final Pattern PATTERN_ON_SPACE = Pattern.compile(" ", Pattern.LITERAL);
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerCommandException;
+import com.destroystokyo.paper.exception.ServerTabCompleteException;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap {
throw ex;
} catch (Throwable ex) {
@ -39,21 +492,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new CommandException(msg, ex);
}
}
// PaperSpigot end
// Paper end
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -0,0 +0,0 @@ import org.bukkit.permissions.PermissionDefault;
import org.bukkit.util.FileUtil;
@@ -0,0 +0,0 @@ import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.collect.ImmutableSet;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerEventException;
+import org.github.paperspigot.exception.ServerPluginEnableDisableException;
/**
* Handles all plugin management from the Server
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerEventException;
+import com.destroystokyo.paper.exception.ServerPluginEnableDisableException;
import org.apache.commons.lang.Validate;
import org.bukkit.Server;
import org.bukkit.command.Command;
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().enablePlugin(plugin);
@ -133,481 +586,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
}
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
@@ -0,0 +0,0 @@ import java.util.Map;
import java.util.Set;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerPluginMessageException;
/**
* Standard implementation to {@link Messenger}
@@ -0,0 +0,0 @@ public class StandardMessenger implements Messenger {
registration.getListener().onPluginMessageReceived( channel, source, message );
} catch ( Throwable t )
{
- org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Could not pass incoming plugin message to " + registration.getPlugin(), t );
+ // Paper start
+ String msg = "Could not pass incoming plugin message to " + registration.getPlugin();
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, msg, t );
+ source.getServer().getPluginManager().callEvent(new ServerExceptionEvent(
+ new ServerPluginMessageException(msg, t, registration.getPlugin(), source, channel, message)
+ ));
+ // Paper end
}
// Spigot End
}
diff --git a/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java b/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.event;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang.Validate;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.github.paperspigot.exception.ServerException;
+
+/**
+ * Called whenever an exception is thrown in a recoverable section of the server.
+ */
+public class ServerExceptionEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private ServerException exception;
+
+ public ServerExceptionEvent (ServerException exception) {
+ this.exception = Preconditions.checkNotNull(exception, "exception");
+ }
+
+ /**
+ * Gets the wrapped exception that was thrown.
+ * @return Exception thrown
+ */
+ public ServerException getException() {
+ return exception;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerCommandException.java b/src/main/java/org/github/paperspigot/exception/ServerCommandException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerCommandException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Thrown when a command throws an exception
+ */
+public class ServerCommandException extends ServerException {
+
+ private final Command command;
+ private final CommandSender commandSender;
+ private final String[] arguments;
+
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(cause);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ /**
+ * Gets the command which threw the exception
+ *
+ * @return exception throwing command
+ */
+ public Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Gets the command sender which executed the command request
+ *
+ * @return command sender of exception thrown command request
+ */
+ public CommandSender getCommandSender() {
+ return commandSender;
+ }
+
+ /**
+ * Gets the arguments which threw the exception for the command
+ *
+ * @return arguments of exception thrown command request
+ */
+ public String[] getArguments() {
+ return arguments;
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerEventException.java b/src/main/java/org/github/paperspigot/exception/ServerEventException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerEventException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Exception thrown when a server event listener throws an exception
+ */
+public class ServerEventException extends ServerPluginException {
+
+ private final Listener listener;
+ private final Event event;
+
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(message, cause, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(cause, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ /**
+ * Gets the listener which threw the exception
+ *
+ * @return event listener
+ */
+ public Listener getListener() {
+ return listener;
+ }
+
+ /**
+ * Gets the event which caused the exception
+ *
+ * @return event
+ */
+ public Event getEvent() {
+ return event;
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerException.java b/src/main/java/org/github/paperspigot/exception/ServerException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+/**
+ * Wrapper exception for all exceptions that are thrown by the server.
+ */
+public class ServerException extends Exception {
+
+ public ServerException(String message) {
+ super(message);
+ }
+
+ public ServerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerException(Throwable cause) {
+ super(cause);
+ }
+
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerInternalException.java b/src/main/java/org/github/paperspigot/exception/ServerInternalException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerInternalException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.ThrownExpBottle;
+import org.github.paperspigot.event.ServerExceptionEvent;
+
+/**
+ * Thrown when the internal server throws a recoverable exception.
+ */
+public class ServerInternalException extends ServerException {
+
+ public ServerInternalException(String message) {
+ super(message);
+ }
+
+ public ServerInternalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerInternalException(Throwable cause) {
+ super(cause);
+ }
+
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ public static void reportInternalException(Throwable cause) {
+ try {
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));;
+ } catch (Throwable t) {
+ t.printStackTrace(); // Don't want to rethrow!
+ }
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java b/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.plugin.Plugin;
+
+/**
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
+ */
+public class ServerPluginEnableDisableException extends ServerPluginException {
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
+ super(message, cause, responsiblePlugin);
+ }
+
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
+ super(cause, responsiblePlugin);
+ }
+
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerPluginException.java b/src/main/java/org/github/paperspigot/exception/ServerPluginException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang.Validate;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
+ */
+public class ServerPluginException extends ServerException {
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
+ super(message, cause);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
+ super(cause);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ private final Plugin responsiblePlugin;
+
+ /**
+ * Gets the plugin which is directly responsible for the exception being thrown
+ *
+ * @return plugin which is responsible for the exception throw
+ */
+ public Plugin getResponsiblePlugin() {
+ return responsiblePlugin;
+ }
+
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java b/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Thrown when an incoming plugin message channel throws an exception
+ */
+public class ServerPluginMessageException extends ServerPluginException {
+
+ private final Player player;
+ private final String channel;
+ private final byte[] data;
+
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(message, cause, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(cause, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ /**
+ * Gets the channel to which the error occurred from recieving data from
+ * @return exception channel
+ */
+ public String getChannel() {
+ return channel;
+ }
+
+ /**
+ * Gets the data to which the error occurred from
+ * @return exception data
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ /**
+ * Gets the player which the plugin message causing the exception originated from
+ * @return exception player
+ */
+ public Player getPlayer() {
+ return player;
+ }
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java b/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.scheduler.BukkitTask;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Thrown when a plugin's scheduler fails with an exception
+ */
+public class ServerSchedulerException extends ServerPluginException {
+
+ private final BukkitTask task;
+
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
+ super(message, cause, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
+ super(cause, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ /**
+ * Gets the task which threw the exception
+ * @return exception throwing task
+ */
+ public BukkitTask getTask() {
+ return task;
+ }
+
+}
diff --git a/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java b/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot.exception;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+
+/**
+ * Called when a tab-complete request throws an exception
+ */
+public class ServerTabCompleteException extends ServerCommandException {
+
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, command, commandSender, arguments);
+ }
+
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(cause, command, commandSender, arguments);
+ }
+
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
+ }
+}
--

View file

@ -1,88 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/configuration/ConfigurationSection.java
+++ b/src/main/java/org/bukkit/configuration/ConfigurationSection.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/configuration/MemorySection.java
+++ b/src/main/java/org/bukkit/configuration/MemorySection.java
@@ -0,0 +0,0 @@ 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);
--

View file

@ -1,25 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 19 Oct 2014 18:22:18 -0500
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -0,0 +0,0 @@ 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
}
BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag ...flags);
Spigot spigot();
/**
+ * 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
*/
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 1 Jul 2015 00:59:50 -0700
Date: Mon, 29 Feb 2016 18:05:37 -0600
Subject: [PATCH] Add player view distance API
@ -9,32 +9,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ 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" );
+ }
}
*/
public void setAffectsSpawning(boolean affects);
Spigot spigot();
+ /**
+ * 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
{
--
1.9.5.msysgit.1

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
jPlugin.setEnabled(true);
} catch (Throwable 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);
+ return;
+ // PaperSpigot end
+ // Paper end
}
// Perhaps abort here, rather than continue going, but as it stands,

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 28 Dec 2014 16:28:21 -0600
Subject: [PATCH] Check PaperSpigot versions
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
@ -13,48 +13,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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]);
- 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 {
@@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand {
}
}
- private static int getDistance(String repo, String hash) {
+ private static int getDistance(String repo, String currentVerInt) { // PaperSpigot
+ 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"), // PaperSpigot
+ 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) {
- ex.printStackTrace();
+ // PaperSpigot start
+ // Paper start
+ int newVer = Integer.decode(reader.readLine());
+ int currentVer = Integer.decode(currentVerInt);
+ return newVer - currentVer;
+ } catch (NumberFormatException ex) {
+ //ex.printStackTrace();
+ // PaperSpigot end
ex.printStackTrace();
+ // Paper end
return -1;
} finally {
reader.close();

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
Date: Mon, 15 Feb 2016 07:11:17 -0800
Date: Mon, 29 Feb 2016 19:48:59 -0600
Subject: [PATCH] Expose server CommandMap
@ -8,21 +8,25 @@ diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Buk
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public final class Bukkit {
return server.getUnsafe();
}
+ // Paper start
+ /**
+ * Gets the active {@link CommandMap}.
+ * Gets the active {@link CommandMap}
+ *
+ * @return the active command map
+ */
@ -38,30 +42,31 @@ diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Ser
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
@Deprecated
UnsafeValues getUnsafe();
*/
public double[] getTPS();
+ // Paper start
+ /**
+ * Gets the active {@link CommandMap}.
+ * Gets the active {@link CommandMap}
+ *
+ * @return the active command map
+ */
+ CommandMap getCommandMap();
+ // Paper end
+
public class Spigot
{
@Deprecated
/**
* @see UnsafeValues
* @return the unsafe values instance
--
2.7.0.rc0.20.g4b9ab0e

View file

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -0,0 +0,0 @@ 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();
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
This event can sometimes fire Async, set the proper boolean

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
@ -8,20 +8,20 @@ diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
@@ -0,0 +0,0 @@ import org.bukkit.entity.Entity;
@@ -0,0 +0,0 @@
package org.spigotmc.event.entity;
import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent;
+// PaperSpigot start
+import org.bukkit.event.Cancellable;
+// PaperSpigot end
+
/**
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityEvent;
* Called when an entity stops riding another entity.
*
*/
-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();
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return handlers;
}
+
+ // PaperSpigot start - implement Cancellable methods
+ // Paper start - Implement cancellable methods
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
@ -40,6 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+ // PaperSpigot end
+ // Paper end
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 6 Jan 2015 22:12:31 -0600
Date: Mon, 29 Feb 2016 17:16:08 -0600
Subject: [PATCH] POM changes
@ -15,22 +15,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <groupId>org.sonatype.oss</groupId>
- <artifactId>oss-parent</artifactId>
- <version>9</version>
+ <groupId>org.github.paperspigot</groupId>
+ <artifactId>paperspigot-parent</artifactId>
+ <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paper-parent</artifactId>
+ <version>dev-SNAPSHOT</version>
</parent>
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
+ <groupId>org.github.paperspigot</groupId>
+ <artifactId>paperspigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
+ <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paper-api</artifactId>
<version>1.9-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Spigot-API</name>
- <url>http://www.spigotmc.org/</url>
+ <name>PaperSpigot-API</name>
+ <url>https://hub.spigotmc.org/stash/projects/PAPER/</url>
+ <name>Paper-API</name>
+ <url>https://github.com/PaperSpigot/Paper</url>
<description>An enhanced plugin API for Minecraft servers.</description>
<properties>
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.13</version>
- <version>1.14</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
@ -85,5 +85,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<version>2.4.1</version>
--

View file

@ -1,154 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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
/**
@@ -0,0 +0,0 @@ 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
diff --git a/src/main/java/com/destroystokyo/paper/Title.java b/src/main/java/com/destroystokyo/paper/Title.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/Title.java
+++ b/src/main/java/com/destroystokyo/paper/Title.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot;
+package com.destroystokyo.paper;
+
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.api.chat.TextComponent;
@ -506,5 +368,142 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+}
\ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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
/**
@@ -0,0 +0,0 @@ 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();
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 8 Aug 2014 22:51:26 -0500
Date: Mon, 29 Feb 2016 17:22:34 -0600
Subject: [PATCH] Player affects spawning API
@ -9,34 +9,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ 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" );
+ }
}
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
Spigot spigot();
+ /**
+ * 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
{
--
1.9.5.msysgit.1

View file

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
@@ -0,0 +0,0 @@ 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 {
@@ -0,0 +0,0 @@ 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" );
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
@ -8,6 +8,11 @@ diff --git a/pom.xml b/pom.xml
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
-
<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>
@@ -0,0 +0,0 @@
<dependencies>
@ -1709,7 +1714,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ parent.put("config", createObject(
+ pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), 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();
@ -2814,7 +2819,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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.");
+ }
@ -2896,26 +2901,56 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
fallbackPrefix = fallbackPrefix.toLowerCase().trim();
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
@@ -0,0 +0,0 @@ import org.spigotmc.CustomTimingsHandler;
// Spigot end
public class TimingsCommand extends BukkitCommand {
+++ /dev/null
@@ -0,0 +0,0 @@
-package org.bukkit.command.defaults;
-
-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
- public static long timingStart = 0; // Spigot
+ public static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate");
public TimingsCommand(String name) {
super(name);
-
- public TimingsCommand(String name) {
- super(name);
- this.description = "Manages Spigot Timings data to see performance of the server."; // Spigot
- this.usageMessage = "/timings <reset|report|on|off|paste>"; // Spigot
+ this.description = "Records timings for all plugin events";
+ this.usageMessage = "/timings <reset>";
this.setPermission("bukkit.command.timings");
}
- this.setPermission("bukkit.command.timings");
- }
-
- // Spigot start - redesigned Timings Command
- public void executeSpigotTimings(CommandSender sender, String[] args) {
- if ( "on".equals( args[0] ) )
@ -2967,7 +3002,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
-
- 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) {
- } finally {
@ -2979,22 +3014,99 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- // Spigot end
-
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
- @Override
- public boolean execute(CommandSender sender, String currentAlias, String[] args) {
- if (!testPermission(sender)) return true;
- if (args.length < 1) { // Spigot
+ if (args.length != 1) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
- sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
- return false;
- }
- if (true) { executeSpigotTimings(sender, args); return true; } // Spigot
if (!sender.getServer().getPluginManager().useTimings()) {
sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml");
return true;
@@ -0,0 +0,0 @@ public class TimingsCommand extends BukkitCommand {
}
return ImmutableList.of();
}
- if (!sender.getServer().getPluginManager().useTimings()) {
- sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml");
- return true;
- }
-
- 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
- private static class PasteThread extends Thread
@ -3037,7 +3149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-
- 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://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 )
- {
- sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" );
@ -3046,14 +3158,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- }
- // Spigot end
}
-}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
{
throw new UnsupportedOperationException( "Not supported yet" );
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ public int getPing()

View file

@ -1,9 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Thu, 23 Apr 2015 17:26:21 -0400
Date: Wed, 2 Mar 2016 23:30:53 -0600
Subject: [PATCH] Add BeaconEffectEvent
diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobEffectList.java
+++ b/src/main/java/net/minecraft/server/MobEffectList.java
@@ -0,0 +0,0 @@ public class MobEffectList {
private final Map<IAttribute, AttributeModifier> a = Maps.newHashMap();
private final boolean c;
private final int d;
- private String e = "";
+ public String e = ""; // Paper - private -> public
private int f = -1;
public double durationModifier;
private boolean h;
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
@ -12,52 +25,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
+// PaperSpigot start
+// Paper start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.entity.Player;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.github.paperspigot.event.block.BeaconEffectEvent;
+// PaperSpigot end
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
+// Paper end
+
public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlayerListBox, IInventory {
public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory {
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffectList.FASTER_MOVEMENT, MobEffectList.FASTER_DIG}, { MobEffectList.RESISTANCE, MobEffectList.JUMP}, { MobEffectList.INCREASE_DAMAGE}, { MobEffectList.REGENERATION}};
@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
Iterator iterator = list.iterator();
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}};
@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable,
EntityHuman entityhuman;
+ // PaperSpigot start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
+ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getById(this.k), 180, b0, true, true);
+ // PaperSpigot end
+ // Paper start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
+ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getByName(this.l.e), 180, b0, true, true);
+ // Paper end
+
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
- entityhuman.addEffect(new MobEffect(this.k, 180, b0, true, true));
+ // PaperSpigot start - BeaconEffectEvent
- entityhuman.addEffect(new MobEffect(this.l, i, b0, true, true));
+ // Paper start - BeaconEffectEvent
+ BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true);
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+
+ PotionEffect effect = event.getEffect();
+ entityhuman.addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ // PaperSpigot end
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ // Paper end
}
if (this.j >= 4 && this.k != this.l && this.l > 0) {
if (this.k >= 4 && this.l != this.m && this.m != null) {
iterator = list.iterator();
+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getById(this.l), 180, 0, true, true); // PaperSpigot
+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getByName(this.m.e), 180, 0, true, true); // Paper
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
- entityhuman.addEffect(new MobEffect(this.l, 180, 0, true, true));
+ // PaperSpigot start - BeaconEffectEvent
- entityhuman.addEffect(new MobEffect(this.m, i, 0, true, true));
+ // Paper start - BeaconEffectEvent
+ BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false);
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+
+ PotionEffect effect = event.getEffect();
+ entityhuman.addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ // PaperSpigot end
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ // Paper end
}
}
}

View file

@ -1,146 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
@@ -0,0 +0,0 @@ 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
}
--

View file

@ -1,10 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DemonWav <demonwav@gmail.com>
Date: Sat, 30 Jan 2016 19:17:19 -0600
Date: Thu, 3 Mar 2016 01:44:39 -0600
Subject: [PATCH] Add Location support to tab completers (vanilla feature
missing in CraftBukkit)
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
}
+
+ public boolean allowBlockLocationTabCompletion;
+ private void allowBlockLocationTabCompletion() {
+ allowBlockLocationTabCompletion = getBoolean("allow-block-location-tab-completion", true);
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
@ -13,8 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return arraylist;
}
*/
- return server.tabComplete(icommandlistener, s);
+ return server.tabComplete(icommandlistener, s, blockposition); // PaperSpigot - add Location argument
- return server.tabComplete(icommandlistener, s); // PAIL : todo args
+ return server.tabComplete(icommandlistener, s, blockposition); // PAIL : todo args // Paper - add Location arg
// CraftBukkit end
}
@ -22,24 +36,36 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
+import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.UnsafeValues;
@@ -0,0 +0,0 @@ import javax.imageio.ImageIO;
import net.minecraft.server.*;
-import org.bukkit.BanList;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.GameMode;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Server;
-import org.bukkit.UnsafeValues;
+import net.minecraft.server.WorldType;
+import org.bukkit.*;
import org.bukkit.Warning.WarningState;
import org.bukkit.World;
import org.bukkit.World.Environment;
-import org.bukkit.WorldCreator;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
}
public List<String> tabComplete(net.minecraft.server.ICommandListener sender, String message) {
+ return tabComplete(sender, message, null); // PaperSpigot - location tab-completes. Original code here moved below
+ return tabComplete(sender, message, null); // Paper - location tab-completes. Original code here moved below
+ }
+
+ // PaperSpigot start - add BlockPosition support
+ // Paper start - add BlockPosition support
+ /*
+ this code is copied, except for the noted change, from the original tabComplete(net.minecraft.server.ICommandListener sender, String message) method
+ this code is copied, except for the noted change, from the original tabComplete(net.minecraft.server.ICommandListener sender, String message) method
+ */
+ public List<String> tabComplete(net.minecraft.server.ICommandListener sender, String message, BlockPosition blockPosition) {
if (!(sender instanceof EntityPlayer)) {
@ -53,16 +79,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
return tabCompleteChat(player, message);
}
+ // Paper end
}
+ // PaperSpigot end
public List<String> tabCompleteCommand(Player player, String message) {
+ return tabCompleteCommand(player, message, null); // PaperSpigot - location tab-completes. Original code here moved below
+ return tabCompleteCommand(player, message, null); // Paper - location tab-completes. Original code here moved below
+ }
+
+ // PaperSpigot start - add BlockPosition support
+ // Paper start - add BlockPosition support
+ /*
+ this code is copied, except for the noted change, from the original tabCompleteCommand(Player player, String message) method
+ this code is copied, except for the noted change, from the original tabComplete(net.minecraft.server.ICommandListener sender, String message) method
+ */
+ public List<String> tabCompleteCommand(Player player, String message, BlockPosition blockPosition) {
// Spigot Start
@ -76,24 +102,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
List<String> completions = null;
try {
- completions = getCommandMap().tabComplete(player, message.substring(1));
+ // send location info if present
+ // send location info if presen
+ // completions = getCommandMap().tabComplete(player, message.substring(1));
+ if (blockPosition == null || !((CraftWorld) player.getWorld()).getHandle().paperSpigotConfig.allowBlockLocationTabCompletion) {
+ if (blockPosition == null || !((CraftWorld) player.getWorld()).getHandle().paperConfig.allowBlockLocationTabCompletion) {
+ completions = getCommandMap().tabComplete(player, message.substring(1));
+ } else {
+ completions = getCommandMap().tabComplete(player, message.substring(1), new Location(player.getWorld(), blockPosition.getX(), blockPosition.getY(), blockPosition.getZ()));
+ }
+ // Paper end
} catch (CommandException ex) {
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex);
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
return completions == null ? ImmutableList.<String>of() : completions;
}
+ // PaperSpigot end
public List<String> tabCompleteChat(Player player, String message) {
List<String> completions = new ArrayList<String>();
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@ -110,42 +129,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
+ return tabComplete(sender, alias, args, null); // PaperSpigot - location tab-completes. Original code moved below
+ return tabComplete(sender, alias, args, null); // Paper - location tab-completes. Original code moved below
+ }
+
+ // PaperSpigot start - location tab-completes
+ // Paper start - location tab-completes
+ /*
+ this code is copied, except for the noted change, from the original tabComplete(CommandSender sender, String alias, String[] args) method
+ this code is copied, except for the noted change, from the original tabComplete(CommandSender sender, String alias, String[] args) method
+ */
+ @Override
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
- return (List<String>) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(0, 0, 0));
- return (List<String>) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, new BlockPosition(0, 0, 0));
+ if (location == null) { // PaperSpigot use location information if available
+ return (List<String>) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(0, 0, 0));
+ return (List<String>) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, new BlockPosition(0, 0, 0));
+ } else {
+ return (List<String>) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
+ return (List<String>) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
+ }
}
+ // PaperSpigot end
public static CommandSender lastSender = null; // Nasty :(
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false );
}
+
+ public boolean allowBlockLocationTabCompletion;
+ private void allowBlockLocationTabCompletion()
+ {
+ allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true );
+ }
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com>
Date: Tue, 22 Dec 2015 22:04:15 -0600
Date: Thu, 3 Mar 2016 00:09:38 -0600
Subject: [PATCH] Add PlayerInitialSpawnEvent
For modifying a player's initial spawn location as they join the server
@ -13,9 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
+ // PaperSpigot start - support PlayerInitialSpawnEvent
+ // Paper start - support PlayerInitialSpawnEvent
+ Location originalLoc = new Location(entityplayer.world.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
+ org.bukkit.event.player.PlayerInitialSpawnEvent event = new org.bukkit.event.player.PlayerInitialSpawnEvent(entityplayer.getBukkitEntity(), originalLoc);
+ com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent event = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(entityplayer.getBukkitEntity(), originalLoc);
+ this.server.server.getPluginManager().callEvent(event);
+
+ Location newLoc = event.getSpawnLocation();
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entityplayer.pitch = newLoc.getPitch();
+ entityplayer.dimension = ((CraftWorld) newLoc.getWorld()).getHandle().dimension;
+ entityplayer.spawnWorld = entityplayer.world.worldData.getName();
+ // PaperSpigot end
+ // Paper end
+
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);

View file

@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Fri, 27 Mar 2015 00:52:24 -0400
Subject: [PATCH] Add PlayerLocaleChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(PacketPlayInSettings packetplayinsettings) {
+ // PaperSpigot start - Add PlayerLocaleChangeEvent
+ String oldLocale = this.locale;
this.locale = packetplayinsettings.a();
+ if (!this.locale.equals(oldLocale)) {
+ CraftEventFactory.callPlayerLocaleChangeEvent(this, oldLocale, this.locale);
+ }
+ // PaperSpigot end
this.bR = packetplayinsettings.c();
this.bS = packetplayinsettings.d();
this.getDataWatcher().watch(10, Byte.valueOf((byte) packetplayinsettings.e()));
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory {
firework.world.getServer().getPluginManager().callEvent(event);
return event;
}
+
+ // PaperSpigot start - Add PlayerLocaleChangeEvent
+ public static PlayerLocaleChangeEvent callPlayerLocaleChangeEvent(EntityHuman who, String oldLocale, String newLocale) {
+ Player player = (Player) who.getBukkitEntity();
+ PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(player, oldLocale, newLocale);
+ Bukkit.getPluginManager().callEvent(event);
+ return event;
+ }
+ // PaperSpigot end
}
--

View file

@ -1,130 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
@@ -0,0 +0,0 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return null;
}
+
+ // PaperSpigot start
+ @Override
+ public org.bukkit.Location getSourceLoc() {
+ return getHandle().sourceLoc;
+ }
+ // PaperSpigot end
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 6 Nov 2014 18:29:20 -0600
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 1 Mar 2016 23:19:01 -0600
Subject: [PATCH] Add async chunk load API
@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+ // PaperSpigot start - Async chunk load API
+ // Paper start - Async chunk load API
+ 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() {
+ @Override
+ public void run() {
@ -22,15 +22,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ });
+ }
+
+ public void getChunkAtAsync(Block block, ChunkLoadCallback callback) {
+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, callback);
+ }
+
+ public void getChunkAtAsync(Location location, ChunkLoadCallback callback) {
+ getChunkAtAsync(location.getBlockX() >> 4, location.getBlockZ() >> 4, callback);
+ }
+ // PaperSpigot end
+ // Paper end
+
public Chunk getChunkAt(int x, int z) {
return this.world.chunkProviderServer.getChunkAt(x, z).bukkitChunk;
return this.world.getChunkProviderServer().getChunkAt(x, z).bukkitChunk;
}
--

View file

@ -1,9 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Sat, 7 Mar 2015 21:40:48 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
@ -13,42 +38,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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
+ 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 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distance
+ 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 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances
+ } else if (d3 < world.paperConfig.softDespawnDistance) { // Paper - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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;
+ }
}
--

View file

@ -1,9 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 23:38:24 -0500
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void allowBlockLocationTabCompletion() {
allowBlockLocationTabCompletion = getBoolean("allow-block-location-tab-completion", true);
}
+
+ public int portalSearchRadius;
+ private void portalSearchRadius() {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ }
}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
@ -13,49 +27,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- public BlockPosition findPortal(double x, double y, double z, int short1) {
+ public BlockPosition findPortal(double x, double y, double z, int searchRadius) { // Paper - actually use search radius
if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) {
return this.findEndPortal(this.a.worldProvider.h());
+ public BlockPosition findPortal(double x, double y, double z, int searchRadius) { // Paper - short1 -> searchRadius
if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) {
return this.findEndPortal(this.world.worldProvider.h());
}
@@ -0,0 +0,0 @@ public class PortalTravelAgent {
} else {
BlockPosition blockposition = new BlockPosition(x, y, z);
BlockPosition blockposition = new BlockPosition(x, y, z); // CraftBukkit
- for (int l = -128; l <= 128; ++l) {
+ for (int l = -searchRadius; l <= searchRadius; ++l) { // Paper - actually use search radius
+ for (int l = -searchRadius; l <= searchRadius; ++l) { // Paper - actually use search radiusfor (int l = -128; l <= 128; ++l) {
BlockPosition blockposition1;
- for (int i1 = -128; i1 <= 128; ++i1) {
+ for (int i1 = -searchRadius; i1 <= searchRadius; ++i1) { // Paper - actually use search radius
for (BlockPosition blockposition2 = blockposition.a(l, this.a.V() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
+ for (int i1 = -searchRadius; i1 <= searchRadius; ++i1) { // Paper - actually use search radius
for (BlockPosition blockposition2 = blockposition.a(l, this.world.Z() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
blockposition1 = blockposition2.down();
if (this.a.getType(blockposition2).getBlock() == Blocks.PORTAL) {
if (this.world.getType(blockposition2).getBlock() == Blocks.PORTAL) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
this.worldProvider.a(this);
this.chunkProvider = this.k();
- this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
+ this.Q = ((org.bukkit.craftbukkit.CraftTravelAgent) new org.bukkit.craftbukkit.CraftTravelAgent(this).setSearchRadius(paperSpigotConfig.portalSearchRadius)); // CraftBukkit // Paper - configurable search radius
this.B();
this.C();
this.getWorldBorder().a(minecraftserver.aI());
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true );
}
+
+ public int portalSearchRadius;
+ private void portalSearchRadius()
+ {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ }
}
this.worldProvider.a((World) this);
this.chunkProvider = this.n();
- this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
+ this.portalTravelAgent = ((org.bukkit.craftbukkit.CraftTravelAgent) new org.bukkit.craftbukkit.CraftTravelAgent(this).setSearchRadius(paperConfig.portalSearchRadius)); // CraftBukkit // Paper - configurable search radius
this.H();
this.I();
this.getWorldBorder().a(minecraftserver.aD());
--

View file

@ -1,434 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 20:07:46 -0500
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
import com.google.common.collect.Lists; // CraftBukkit
import org.bukkit.Bukkit; // CraftBukkit
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerInternalException;
public class Chunk {
@@ -0,0 +0,0 @@ public class Chunk {
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!");
- System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
- new Exception().printStackTrace();
+ // Paper start
+ ServerInternalException e = new ServerInternalException(
+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + ","
+ + tileentity.position.getY() + "," + tileentity.position.getZ()
+ + " (" + CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!\n" +
+ "Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
+ e.printStackTrace();
+ ServerInternalException.reportInternalException(e);
+ // Paper end
// CraftBukkit end
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
import java.util.Random;
import java.util.logging.Level;
+import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.craftbukkit.util.LongObjectHashMap;
import org.bukkit.event.world.ChunkUnloadEvent;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerInternalException;
// CraftBukkit end
public class ChunkProviderServer implements IChunkProvider {
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
if (chunk == emptyChunk) return chunk;
if (i != chunk.locX || j != chunk.locZ) {
- b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
+ // Paper start
+ String msg = "Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'";
+ b.error(msg);
b.error(chunk.getClass().getName());
- Throwable ex = new Throwable();
- ex.fillInStackTrace();
+ ServerInternalException ex = new ServerInternalException(msg);
ex.printStackTrace();
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(ex));
+ // Paper end
}
return chunk;
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
return chunk;
} catch (Exception exception) {
- ChunkProviderServer.b.error("Couldn\'t load chunk", exception);
+ // Paper start
+ String msg = "Couldn\'t load chunk";
+ ChunkProviderServer.b.error(msg, exception);
+ ServerInternalException.reportInternalException(exception);
+ // Paper end
return null;
}
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -0,0 +0,0 @@ import java.util.Map;
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.Bukkit;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerInternalException;
public class NameReferencingFileConverter {
@@ -0,0 +0,0 @@ public class NameReferencingFileConverter {
root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1));
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
if (root != null) {
@@ -0,0 +0,0 @@ public class NameReferencingFileConverter {
NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
- }
+ }
// CraftBukkit end
NameReferencingFileConverter.b(file);
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import org.bukkit.Bukkit;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerInternalException;
+
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
@@ -0,0 +0,0 @@ public class PersistentCollection {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception);
}
}
@@ -0,0 +0,0 @@ public class PersistentCollection {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
return oshort.shortValue();
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
import com.google.common.collect.Lists;
+import org.github.paperspigot.exception.ServerInternalException;
+
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -0,0 +0,0 @@ public class RegionFile {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
@@ -0,0 +0,0 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.az() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
import com.google.common.collect.Maps;
+import org.github.paperspigot.exception.ServerInternalException;
+
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
@@ -0,0 +0,0 @@ public class RegionFileCache {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -0,0 +0,0 @@ import java.util.Set;
import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.github.paperspigot.exception.ServerInternalException;
// CraftBukkit end
public final class SpawnerCreature {
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver});
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
return j1;
}
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
continue;
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
import co.aikar.timings.SpigotTimings; // Spigot
import co.aikar.timings.Timing; // Spigot
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
+import org.github.paperspigot.exception.ServerInternalException;
public abstract class TileEntity {
@@ -0,0 +0,0 @@ public abstract class TileEntity {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
if (tileentity != null) {
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import org.github.paperspigot.exception.ServerInternalException;
+
import java.util.Iterator;
import java.util.List;
@@ -0,0 +0,0 @@ public class VillageSiege {
entityzombie.setVillager(false);
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
return false;
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerInternalException;
// PaperSpigot end
// CraftBukkit start
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} catch (Throwable throwable1) {
// PaperSpigot start - Prevent tile entity and entity crashes
entity.tickTimer.stopTiming();
- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ;
+ System.err.println(msg);
throwable1.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable1)));
entity.dead = true;
continue;
// PaperSpigot end
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} catch (Throwable throwable2) {
// PaperSpigot start - Prevent tile entity and entity crashes
tileentity.tickTimer.stopTiming();
- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ();
+ System.err.println(msg);
throwable2.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable2)));
tilesThisCycle--;
this.tileEntityList.remove(tileTickPosition--);
continue;
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
import java.util.UUID;
import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.github.paperspigot.exception.ServerInternalException;
// CraftBukkit end
public class WorldNBTStorage implements IDataManager, IPlayerFileData {
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
return new WorldData(nbttagcompound1);
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
return new WorldData(nbttagcompound1);
} catch (Exception exception1) {
exception1.printStackTrace();
+ ServerInternalException.reportInternalException(exception1); // Paper
}
}
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.StandardMessenger;
import org.bukkit.util.Vector;
+import org.github.paperspigot.exception.ServerInternalException;
public class CraftWorld implements World {
public static final int CUSTOM_DIMENSION_OFFSET = 10;
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
world.savingDisabled = oldSave;
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
+ ServerInternalException.reportInternalException(ex); // Paper
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -0,0 +0,0 @@ import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scheduler.BukkitWorker;
+import org.github.paperspigot.ServerSchedulerReportingWrapper;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerSchedulerException;
/**
* The fundamental concepts for this implementation:
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
try {
task.run();
} catch (final Throwable throwable) {
+ // Paper start
+ String msg = String.format(
+ "Task #%s for %s generated an exception",
+ task.getTaskId(),
+ task.getOwner().getDescription().getFullName());
task.getOwner().getLogger().log(
Level.WARNING,
- String.format(
- "Task #%s for %s generated an exception",
- task.getTaskId(),
- task.getOwner().getDescription().getFullName()),
+ msg,
throwable);
+ task.getOwner().getServer().getPluginManager().callEvent(
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task))
+ );
+ // Paper end
}
parsePending();
} else {
debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass()));
- executor.execute(task);
+ executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java b/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
@@ -0,0 +0,0 @@
+package org.github.paperspigot;
+package com.destroystokyo.paper;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang.Validate;
+import org.bukkit.craftbukkit.scheduler.CraftTask;
+import org.github.paperspigot.event.ServerExceptionEvent;
+import org.github.paperspigot.exception.ServerSchedulerException;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerSchedulerException;
+
+/**
+ * Reporting wrapper to catch exceptions not natively
@ -461,4 +48,327 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return internalTask;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.Predicate;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
import com.google.common.collect.Lists; // CraftBukkit
import org.bukkit.Bukkit; // CraftBukkit
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
public class Chunk {
@@ -0,0 +0,0 @@ public class Chunk {
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!");
- System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
- new Exception().printStackTrace();
+ // Paper start
+ ServerInternalException e = new ServerInternalException(
+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + ","
+ + tileentity.position.getY() + "," + tileentity.position.getZ()
+ + " (" + CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!\n" +
+ "Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
+ e.printStackTrace();
+ ServerInternalException.reportInternalException(e);
+ // Paper end
// CraftBukkit end
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ import java.io.IOException;
import java.util.Iterator;
import java.util.List;
+import com.destroystokyo.paper.exception.ServerInternalException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
return chunk;
} catch (Exception exception) {
- ChunkProviderServer.a.error("Couldn\'t load chunk", exception);
+ // Paper start
+ String msg = "Couldn\'t load chunk";
+ ChunkProviderServer.a.error(msg, exception);
+ ServerInternalException.reportInternalException(exception);
+ // Paper end
return null;
}
}
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
try {
this.chunkLoader.b(this.world, chunk);
} catch (Exception exception) {
- ChunkProviderServer.a.error("Couldn\'t save entities", exception);
+ // Paper start
+ String msg = "Couldn\'t save entities";
+ ChunkProviderServer.a.error(msg, exception);
+ ServerInternalException.reportInternalException(exception);
+ // Paper end
}
}
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
chunk.setLastSaved(this.world.getTime());
this.chunkLoader.a(this.world, chunk);
} catch (IOException ioexception) {
- ChunkProviderServer.a.error("Couldn\'t save chunk", ioexception);
+ // Paper start
+ String msg = "Couldn\'t save chunk";
+ ChunkProviderServer.a.error(msg, ioexception);
+ ServerInternalException.reportInternalException(ioexception);
} catch (ExceptionWorldConflict exceptionworldconflict) {
- ChunkProviderServer.a.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ String msg = "Couldn\'t save chunk; already in use by another instance of Minecraft?";
+ ChunkProviderServer.a.error(msg, exceptionworldconflict);
+ ServerInternalException.reportInternalException(exceptionworldconflict);
}
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.Charsets;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
@@ -0,0 +0,0 @@ public class NameReferencingFileConverter {
root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1));
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
if (root != null) {
@@ -0,0 +0,0 @@ public class NameReferencingFileConverter {
NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.io.DataInputStream;
@@ -0,0 +0,0 @@ public class PersistentCollection {
}
} catch (Exception exception1) {
exception1.printStackTrace();
+ ServerInternalException.reportInternalException(exception1); // Paper
}
}
@@ -0,0 +0,0 @@ public class PersistentCollection {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.collect.Lists;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -0,0 +0,0 @@ public class RegionFile {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
@@ -0,0 +0,0 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.av() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.collect.Maps;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -0,0 +0,0 @@ public class RegionFileCache {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -0,0 +0,0 @@ import java.util.List;
import java.util.Random;
// CraftBukkit start
+import com.destroystokyo.paper.exception.ServerInternalException;
import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver});
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
return j1;
}
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
continue;
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
+
import java.util.Iterator;
import java.util.List;
@@ -0,0 +0,0 @@ public class VillageSiege {
entityzombie.clearVillagerType();
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
return false;
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} catch (Throwable throwable1) {
// Paper start - Prevent tile entity and entity crashes
entity.tickTimer.stopTiming();
- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ;
+ System.err.println(msg);
throwable1.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable1)));
entity.dead = true;
continue;
// Paper end
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
} catch (Throwable throwable2) {
// Paper start - Prevent tile entity and entity crashes
tileentity.tickTimer.stopTiming();
- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ();
+ System.err.println(msg);
throwable2.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable2)));
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -0,0 +0,0 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
+import com.destroystokyo.paper.ServerSchedulerReportingWrapper;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerSchedulerException;
import org.apache.commons.lang.Validate;
import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.Plugin;
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
try {
task.run();
} catch (final Throwable throwable) {
+ // Paper start
+ String msg = String.format(
+ "Task #%s for %s generated an exception",
+ task.getTaskId(),
+ task.getOwner().getDescription().getFullName());
task.getOwner().getLogger().log(
Level.WARNING,
- String.format(
- "Task #%s for %s generated an exception",
- task.getTaskId(),
- task.getOwner().getDescription().getFullName()),
+ msg,
throwable);
+ task.getOwner().getServer().getPluginManager().callEvent(
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task))
+ );
+ // Paper end
}
parsePending();
} else {
debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass()));
- executor.execute(task);
+ executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 1 Jul 2015 00:59:06 -0700
Date: Wed, 2 Mar 2016 14:35:27 -0600
Subject: [PATCH] Add player view distance API
@ -9,18 +9,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
// Spigot start
public boolean collidesWithEntities = true;
+ public int viewDistance; // PaperSpigot - Player view distance API
public boolean f;
public int ping;
public boolean viewingCredits;
+ public int viewDistance; // Paper - Player view distance API
@Override
public boolean ad()
// CraftBukkit start
public String displayName;
@@ -0,0 +0,0 @@ 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; // PaperSpigot - Player view distance API
+ this.viewDistance = world.spigotConfig.viewDistance; // Paper - Player view distance API
playerinteractmanager.player = this;
this.playerInteractManager = playerinteractmanager;
BlockPosition blockposition = worldserver.getSpawn();
@ -28,55 +28,34 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
// CraftBukkit start - Load nearby chunks first
List<ChunkCoordIntPair> chunkList = new LinkedList<ChunkCoordIntPair>();
- for (int k = i - this.g; k <= i + this.g; ++k) {
- for (int l = j - this.g; l <= j + this.g; ++l) {
+ // PaperSpigot 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) {
+ // PaperSpigot end
chunkList.add(new ChunkCoordIntPair(k, l));
}
}
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
public void b(EntityPlayer entityplayer) {
ArrayList arraylist = Lists.newArrayList(entityplayer.chunkCoordIntPairQueue);
int i = 0;
- int j = this.g;
+ int j = entityplayer.viewDistance; // PaperSpigot - Player view distance API
int k = (int) entityplayer.locX >> 4;
int l = (int) entityplayer.locZ >> 4;
int i1 = 0;
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4;
- for (int k = i - this.g; k <= i + this.g; ++k) {
- for (int l = j - this.g; l <= j + this.g; ++l) {
+ // PaperSpigot start - Player view distance API
- 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) {
+ // PaperSpigot end
PlayerChunkMap.PlayerChunk playerchunkmap_playerchunk = this.a(k, l, false);
+ // Paper end
PlayerChunk playerchunk = this.b(k, l);
if (playerchunkmap_playerchunk != null) {
if (playerchunk != null) {
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
if (d2 >= 64.0D) {
int k = (int) entityplayer.d >> 4;
int l = (int) entityplayer.e >> 4;
- int i1 = this.g;
+ int i1 = entityplayer.viewDistance; // PaperSpigot - Player view distance API
- int i1 = this.j;
+ int i1 = entityplayer.viewDistance; // Paper - Player view distance API
int j1 = i - k;
int k1 = j - l;
List<ChunkCoordIntPair> chunksToLoad = new LinkedList<ChunkCoordIntPair>(); // CraftBukkit
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
}
}
+ // PaperSpigot start - Player view distance API
// 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) {
@ -86,9 +65,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (viewDistance - player.viewDistance > 0) {
+ for (int x = cx - viewDistance; x <= cx + viewDistance; ++x) {
+ for (int z = cz - viewDistance; z <= cz + viewDistance; ++z) {
+ PlayerChunkMap.PlayerChunk playerchunkmap_playerchunk = this.a(x, z, true);
+ PlayerChunk playerchunkmap_playerchunk = this.c(x, z);
+
+ if (!playerchunkmap_playerchunk.b.contains(player)) {
+ if (!playerchunkmap_playerchunk.c.contains(player)) {
+ playerchunkmap_playerchunk.a(player);
+ }
+ }
@ -97,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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.a(x, z, true).b(player);
+ this.c(x, z).b(player);
+ }
+ }
+ }
@ -106,32 +85,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ player.viewDistance = viewDistance;
+ }
+ }
+ // PaperSpigot end
+
public static int getFurthestViewableBlock(int i) {
return i * 16 - 16;
}
+ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().affectsSpawning = affects;
}
// PaperSpigot end
public void setAffectsSpawning(boolean affects) {
getHandle().affectsSpawning = affects;
}
+
+ // PaperSpigot start - Player view distance API
+ @Override
+ public int getViewDistance() {
+ return getHandle().viewDistance;
+ }
+ @Override
+ public int getViewDistance() {
+ return getHandle().viewDistance;
+ }
+
+ @Override
+ public void setViewDistance(int viewDistance) {
+ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance);
+ }
+ // PaperSpigot end
};
+ @Override
+ public void setViewDistance(int viewDistance) {
+ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance);
+ }
// Paper end
public Player.Spigot spigot()
// Spigot start
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Mon, 22 Feb 2016 16:05:32 -0500
Date: Thu, 3 Mar 2016 02:48:12 -0600
Subject: [PATCH] Add velocity warnings
@ -8,43 +8,17 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -0,0 +0,0 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.permissions.ServerOperator;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
+import org.github.paperspigot.PaperSpigotConfig;
public abstract class CraftEntity implements org.bukkit.entity.Entity {
private static final PermissibleBase perm = new PermissibleBase(new ServerOperator() {
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public void setVelocity(Vector vel) {
+ // Paper start - warn server owners when plugins try to set super high velocities
+ if (PaperSpigotConfig.warnForExcessiveVelocity) {
+ if(vel.getX() > 4 || vel.getX() < -4 || vel.getY() > 4 || vel.getY() < -4 || vel.getZ() > 4 || vel.getZ() < -4) {
+ getServer().getLogger().warning("Excessive velocity set detected: tried to set velocity of entity #"+getEntityId()+" to ("+vel.getX()+","+vel.getY()+","+vel.getZ()+").");
+ Thread.dumpStack();
+ }
+ // Paper start - Warn server owners when plugins try to set super high velocities
+ if (vel.getX() > 4 || vel.getX() < -4 || vel.getY() > 4 || vel.getY() < -4 || vel.getZ() > 4 || vel.getZ() < -4) {
+ getServer().getLogger().warning("Excessive velocity set detected: tried to set velocity of entity #"+getEntityId()+" to ("+vel.getX()+","+vel.getY()+","+vel.getZ()+").");
+ Thread.dumpStack();
+ }
+ // Paper end
+
entity.motX = vel.getX();
entity.motY = vel.getY();
entity.motZ = vel.getZ();
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotConfig
e.printStackTrace();
}
}
+
+ public static boolean warnForExcessiveVelocity;
+ private static void excessiveVelocityWarning()
+ {
+ warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true);
+ }
}
--

View file

@ -1,37 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: vemacs <d@nkmem.es>
Date: Fri, 29 Jan 2016 02:28:17 -0600
Date: Thu, 3 Mar 2016 01:19:22 -0600
Subject: [PATCH] All chunks are slime spawn chunks toggle
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void disableChestCatDetection() {
disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false);
}
+
+ public boolean allChunksAreSlimeChunks;
+ private void allChunksAreSlimeChunks() {
+ allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster {
return super.bR();
return super.cF();
}
- if (this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D) {
+ // PaperSpigot - Toggle to make all chunks spawn chunks
+ boolean isSlimeChunk = world.paperSpigotConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0;
+ boolean isSlimeChunk = world.paperConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0;
+ if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) {
return super.bR();
return super.cF();
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
useHopperCheck = getBoolean( "use-hopper-check", false );
}
+
+ public boolean allChunksAreSlimeChunks;
+ private void allChunksAreSlimeChunks()
+ {
+ allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false );
+ }
}
--

View file

@ -1,35 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmck2b <itallhappenedverysuddenly@gmail.com>
Date: Sat, 7 Mar 2015 21:50:40 -0600
Date: Tue, 1 Mar 2016 13:59:50 -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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ 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);
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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
@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
private boolean bo;
private Entity bp;
private NBTTagCompound bq;
+ public PathfinderGoalFloat goalFloat; // PaperSpigot
private boolean bC;
private Entity leashHolder;
private NBTTagCompound bE;
+ public PathfinderGoalFloat goalFloat; // Paper
public EntityInsentient(World world) {
super(world);
@ -20,12 +20,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot Start
if ( this.fromMobSpawner )
{
+ // PaperSpigot start - Allow nerfed mobs to jump
+ // Paper start - Allow nerfed mobs to jump and float
+ if (goalFloat != null) {
+ if (goalFloat.a()) goalFloat.e();
+ this.g.b();
+ }
+ // PaperSpigot end
+ // Paper end
return;
}
// Spigot End
@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public PathfinderGoalFloat(EntityInsentient entityinsentient) {
this.a = entityinsentient;
+ entityinsentient.goalFloat = this; // PaperSpigot
+ entityinsentient.goalFloat = this; // Paper
this.a(4);
((Navigation) entityinsentient.getNavigation()).d(true);
((Navigation) entityinsentient.getNavigation()).c(true);
}
--

View file

@ -1,66 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ 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("#.###");
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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, ", ") );
+ }
}
--

View file

@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Fri, 10 Apr 2015 18:07:36 -0500
Date: Wed, 2 Mar 2016 00:32:25 -0600
Subject: [PATCH] Always tick falling blocks
@ -8,19 +8,47 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ public class ActivationRange
|| entity instanceof EntityFireball
|| entity instanceof EntityWeather
|| entity instanceof EntityTNTPrimed
+ || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
+ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworks )
{

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: CullanP <cullanpage@gmail.com>
Date: Thu, 11 Feb 2016 21:43:17 -0700
Date: Thu, 3 Mar 2016 02:13:38 -0600
Subject: [PATCH] Avoid hopper searches if there are no items
Hoppers searching for items and minecarts is the most expensive part of hopper ticking.
@ -18,28 +18,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk {
private boolean k;
public final Map<BlockPosition, TileEntity> tileEntities;
public final List<Entity>[] entitySlices; // Spigot
+ // PaperSpigot start - track the number of minecarts and items
// Paper start - Asynchronous light updates
public AtomicInteger pendingLightUpdates = new AtomicInteger();
public long lightUpdateTime;
+ // Track the number of minecarts and items
+ // Keep this synced with entitySlices.add() and entitySlices.remove()
+ private final int[] itemCounts = new int[16];
+ private final int[] inventoryEntityCounts = new int[16];
+ // PaperSpigot end
private boolean done;
private boolean lit;
private boolean p;
// Paper end
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
@@ -0,0 +0,0 @@ public class Chunk {
entity.af = k;
entity.ag = this.locZ;
entity.ac = k;
entity.ad = this.locZ;
this.entitySlices[k].add(entity);
+ // PaperSpigot start - update counts
+ // Paper start - update count
+ if (entity instanceof EntityItem) {
+ itemCounts[k]++;
+ } else if (entity instanceof IInventory) {
+ inventoryEntityCounts[k]++;
+ }
+ // PaperSpigot end
+ // Paper end
// Spigot start - increment creature type count
// Keep this synced up with World.a(Class)
if (entity instanceof EntityInsentient) {
@ -47,30 +46,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
this.entitySlices[i].remove(entity);
+ // PaperSpigot start - update counts
+ // Paper start - update counts
+ if (entity instanceof EntityItem) {
+ itemCounts[i]--;
+ } else if (entity instanceof IInventory) {
+ inventoryEntityCounts[i]--;
+ }
+ // PaperSpigot end
+ // Paper end
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)
if (entity instanceof EntityInsentient) {
@@ -0,0 +0,0 @@ public class Chunk {
for (int k = i; k <= j; ++k) {
if (!this.entitySlices[k].isEmpty()) {
Iterator iterator = this.entitySlices[k].iterator();
-
+ // PaperSpigot start - Don't search for inventories if we have none, and that is all we want
+ // Paper start - Don't search for inventories if we have none, and that is all we want
+ /*
+ * We check if they want inventories by seeing if it is the static `IEntitySelector.c`
+ *
+ * Make sure the inventory selector stays in sync.
+ * It should be the one that checks `var1 instanceof IInventory && var1.isAlive()`
+ */
+ * We check if they want inventories by seeing if it is the static `IEntitySelector.c`
+ *
+ * Make sure the inventory selector stays in sync.
+ * It should be the one that checks `var1 instanceof IInventory && var1.isAlive()`
+ */
+ if (predicate == IEntitySelector.c && inventoryEntityCounts[k] <= 0) continue;
+ // PaperSpigot end
+ // Paper end
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
@ -78,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
i = MathHelper.clamp(i, 0, this.entitySlices.length - 1);
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);
+ // PaperSpigot start
+ // Paper start
+ int[] counts;
+ if (ItemStack.class.isAssignableFrom(oclass)) {
+ counts = itemCounts;
@ -87,9 +85,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else {
+ counts = null;
+ }
+ // PaperSpigot end
+ // Paper end
for (int k = i; k <= j; ++k) {
+ if (counts != null && counts[k] <= 0) continue; // PaperSpigot - Don't check a chunk if it doesn't have the type we are looking for
+ if (counts != null && counts[k] <= 0) continue; // Paper - Don't check a chunk if it doesn't have the type we are looking for
Iterator iterator = this.entitySlices[k].iterator(); // Spigot
while (iterator.hasNext()) {

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
Date: Tue, 16 Feb 2016 13:36:04 -0800
Date: Thu, 3 Mar 2016 02:18:39 -0600
Subject: [PATCH] Be a bit more informative in maxHealth exception
@ -13,12 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void setHealth(double health) {
if ((health < 0) || (health > getMaxHealth())) {
- throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth());
+ // Paper - Be more informative
+ throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health
+ + ". (attribute base value: " + this.getHandle().getAttributeInstance(GenericAttributes.maxHealth).b()
+ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
+ + ". (attribute base value: " + this.getHandle().getAttributeInstance(GenericAttributes.maxHealth).b()
+ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
}
if (entity instanceof EntityPlayer && health == 0) {
--
2.7.0.rc0.20.g4b9ab0e

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 15 Nov 2015 19:36:37 -0600
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Wed, 2 Mar 2016 23:46:57 -0600
Subject: [PATCH] Bump thread count for chunk loading
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class ChunkIOExecutor {
- static final int BASE_THREADS = 1;
+ static final int BASE_THREADS = 2; // PaperSpigot - Bumped value
+ static final int BASE_THREADS = 2; // Paper - Bumped value
static final int PLAYERS_PER_THREAD = 50;
private static final AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException> instance = new AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException>(new ChunkIOProvider(), BASE_THREADS);

View file

@ -1,63 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 00:42:18 -0500
Date: Thu, 3 Mar 2016 02:39:54 -0600
Subject: [PATCH] Change implementation of (tile)entity removal list
As it stood, the complexity of a ArrayList.removeAll(ArrayList) is
much greater as the argument array list grew than .removeAll(HashSet).
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.HashMap;
+import java.util.Set;
+import com.google.common.collect.Sets;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.CraftServer;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
// Paper end
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
};
// Spigot end
- protected final List<Entity> g = Lists.newArrayList();
+ protected final Set<Entity> g = Sets.newHashSet(); // Paper
//public final List<TileEntity> h = Lists.newArrayList(); // PaperSpigot - Remove unused list
public final List<TileEntity> tileEntityList = Lists.newArrayList();
- protected final List<Entity> f = Lists.newArrayList();
+ protected final Set<Entity> f = Sets.newHashSet(); // Paper
//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> c = Lists.newArrayList();
+ private final Set<TileEntity> c = Sets.newHashSet(); // Paper
- private final List<TileEntity> tileEntityListUnload = Lists.newArrayList();
+ private final Set<TileEntity> tileEntityListUnload = Sets.newHashSet(); // Paper
public final List<EntityHuman> players = Lists.newArrayList();
public final List<Entity> k = Lists.newArrayList();
public final List<Entity> j = Lists.newArrayList();
protected final IntHashMap<Entity> entitiesById = new IntHashMap();
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
int j;
int k;
- for (i = 0; i < this.g.size(); ++i) {
- entity = (Entity) this.g.get(i);
- j = entity.ae;
- k = entity.ag;
- if (entity.ad && this.isChunkLoaded(j, k, true)) {
- this.getChunkAt(j, k).b(entity);
int j;
- for (i = 0; i < this.f.size(); ++i) {
- entity = (Entity) this.f.get(i);
- int k = entity.ab;
+ // Paper start - Set based removal lists
+ for (Entity e : this.g) {
+ j = e.ae;
+ k = e.ag;
+ if (e.ad && this.isChunkLoaded(j, k, true)) {
+ this.getChunkAt(j, k).b(e);
+ for (Entity e : this.f) {
+ j = e.getChunkX();
+ int k = e.getChunkZ();
- j = entity.ad;
- if (entity.aa && this.isChunkLoaded(k, j, true)) {
- this.getChunkAt(k, j).b(entity);
+ if (e.aa && this.isChunkLoaded(k, j, true)) {
+ this.getChunkAt(k, j).b(e);
}
}
- for (i = 0; i < this.g.size(); ++i) {
- this.b((Entity) this.g.get(i));
+ for (Entity e : this.g) {
+ this.b(e);
- for (i = 0; i < this.f.size(); ++i) {
- this.c((Entity) this.f.get(i));
+ for (Entity e : this.f) {
+ this.c(e);
}
+ // Paper end
this.g.clear();
timings.entityRemoval.stopTiming(); // Spigot
this.f.clear();
this.l();
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot Start
boolean usingWrongFile = false;
- 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");
if ( file.exists() )

View file

@ -1,138 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Wed, 15 Jul 2015 02:41:12 -0700
Subject: [PATCH] ChunkMap caching
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk {
public long lightUpdateTime;
// PaperSpigot end
+ // PaperSpigot start - ChunkMap caching
+ private PacketPlayOutMapChunk.ChunkMap chunkMap;
+ private int emptySectionBits;
+
+ public PacketPlayOutMapChunk.ChunkMap getChunkMap(boolean groundUpContinuous, int primaryBitMask) {
+ if (!world.paperSpigotConfig.cacheChunkMaps || !groundUpContinuous || (primaryBitMask != 0 && primaryBitMask != '\uffff')) {
+ return PacketPlayOutMapChunk.a(this, groundUpContinuous, !world.worldProvider.o(), primaryBitMask);
+ }
+
+ if (primaryBitMask == 0) {
+ PacketPlayOutMapChunk.ChunkMap chunkMap = new PacketPlayOutMapChunk.ChunkMap();
+ chunkMap.a = new byte[0];
+ return chunkMap;
+ }
+
+ boolean isDirty = false;
+ for (int i = 0; i < sections.length; ++i) {
+ ChunkSection section = sections[i];
+ if (section == null) {
+ if ((emptySectionBits & (1 << i)) == 0) {
+ isDirty = true;
+ emptySectionBits |= (1 << i);
+ }
+ } else {
+ if ((emptySectionBits & (1 << i)) == 1) {
+ isDirty = true;
+ emptySectionBits &= ~(1 << i);
+ section.isDirty = false;
+ } else if (section.isDirty) {
+ isDirty = true;
+ section.isDirty = false;
+ }
+ }
+ }
+
+ if (isDirty || chunkMap == null) {
+ chunkMap = PacketPlayOutMapChunk.a(this, true, !world.worldProvider.o(), '\uffff');
+ }
+
+ return chunkMap;
+ }
+ // PaperSpigot end
+
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
private int neighbors = 0x1 << 12;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -0,0 +0,0 @@ public class ChunkSection {
private char[] blockIds;
private NibbleArray emittedLight;
private NibbleArray skyLight;
+ boolean isDirty; // PaperSpigot
public ChunkSection(int i, boolean flag) {
this.yPos = i;
@@ -0,0 +0,0 @@ public class ChunkSection {
}
this.blockIds[j << 8 | k << 4 | i] = (char) Block.d.b(iblockdata);
+ isDirty = true; // PaperSpigot
}
public Block b(int i, int j, int k) {
@@ -0,0 +0,0 @@ public class ChunkSection {
public void a(int i, int j, int k, int l) {
this.skyLight.a(i, j, k, l);
+ isDirty = true; // PaperSpigot
}
public int d(int i, int j, int k) {
@@ -0,0 +0,0 @@ public class ChunkSection {
public void b(int i, int j, int k, int l) {
this.emittedLight.a(i, j, k, l);
+ isDirty = true; // PaperSpigot
}
public int e(int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
this.a = chunk.locX;
this.b = chunk.locZ;
this.d = flag;
- this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i);
+ this.c = chunk.getChunkMap(flag, i); // PaperSpigot
chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world);
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
for (int j = 0; j < i; ++j) {
Chunk chunk = (Chunk) list.get(j);
- PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff');
+ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = chunk.getChunkMap(true, '\uffff'); // PaperSpigot
this.a[j] = chunk.locX;
this.b[j] = chunk.locZ;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 );
}
+
+ public boolean cacheChunkMaps;
+ private void cacheChunkMaps()
+ {
+ cacheChunkMaps = getBoolean( "cache-chunk-maps", false );
+ }
}
--

View file

@ -1,19 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Thu, 4 Jun 2015 13:55:02 -0700
Date: Wed, 2 Mar 2016 23:00:53 -0600
Subject: [PATCH] Configurable TNT cannon fix
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void mobSpawnerTickRate() {
mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
}
+
+ public boolean fixCannons;
+ private void fixCannons() {
+ fixCannons = getBoolean("fix-cannons", false);
+ log("Fix TNT cannons: " + fixCannons);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
} else {
this.b(world, blockposition, iblockdata, 0);
world.setAir(blockposition);
+ // PaperSpigot start - Fix cannons
+ if (world.paperSpigotConfig.fixCannons) {
+ // Paper start - Fix cannons
+ if (world.paperConfig.fixCannons) {
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this);
@ -22,16 +37,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
+ return;
+ }
+ // PaperSpigot end
+ // Paper end
EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (this.N) {
+ // PaperSpigot start - Fix cannons
+ if (world.paperSpigotConfig.fixCannons) {
if (this.d) {
+ // Paper start - Fix cannons
+ if (world.paperConfig.fixCannons) {
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
@ -40,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
+ return;
+ }
+ // PaperSpigot end
+ // Paper end
EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
@ -52,8 +67,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (this.isOn) {
+ // PaperSpigot start - Fix cannons
+ if (world.paperSpigotConfig.fixCannons) {
+ // Paper start - Fix cannons
+ if (world.paperConfig.fixCannons) {
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
@ -62,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
+ return;
+ }
+ // PaperSpigot end
+ // Paper end
EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
@ -70,8 +85,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (this.isOn) {
+ // PaperSpigot start - Fix cannons
+ if (world.paperSpigotConfig.fixCannons) {
+ // Paper start - Fix cannons
+ if (world.paperConfig.fixCannons) {
+ world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
@ -80,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
+ return;
+ }
+ // PaperSpigot end
+ // Paper end
EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
@ -91,27 +106,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BlockRedstoneWire extends Block {
}
this.R.add(blockposition);
+ // PaperSpigot start - Fix cannons
+ if (world.paperSpigotConfig.fixCannons) {
+ this.R.add(blockposition.shift(EnumDirection.WEST));
+ this.R.add(blockposition.shift(EnumDirection.EAST));
+ this.R.add(blockposition.shift(EnumDirection.DOWN));
+ this.R.add(blockposition.shift(EnumDirection.UP));
+ this.R.add(blockposition.shift(EnumDirection.NORTH));
+ this.R.add(blockposition.shift(EnumDirection.SOUTH));
this.B.add(blockposition);
+ // Paper start - Fix cannons
+ if (world.paperConfig.fixCannons) {
+ this.B.add(blockposition.shift(EnumDirection.WEST));
+ this.B.add(blockposition.shift(EnumDirection.EAST));
+ this.B.add(blockposition.shift(EnumDirection.DOWN));
+ this.B.add(blockposition.shift(EnumDirection.UP));
+ this.B.add(blockposition.shift(EnumDirection.NORTH));
+ this.B.add(blockposition.shift(EnumDirection.SOUTH));
+ return iblockdata;
+ }
+ // PaperSpigot end
+ // Paper end
EnumDirection[] aenumdirection = EnumDirection.values();
int i1 = aenumdirection.length;
@@ -0,0 +0,0 @@ public class BlockRedstoneWire extends Block {
private void e(World world, BlockPosition blockposition) {
private void b(World world, BlockPosition blockposition) {
if (world.getType(blockposition).getBlock() == this) {
world.applyPhysics(blockposition, this);
+ // PaperSpigot start - Fix cannons
+ if (world.paperSpigotConfig.fixCannons) {
+ // Paper start - Fix cannons
+ if (world.paperConfig.fixCannons) {
+ world.applyPhysics(blockposition.shift(EnumDirection.WEST), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.EAST), this);
+ world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this);
@ -120,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ world.applyPhysics(blockposition.shift(EnumDirection.UP), this);
+ return;
+ }
+ // PaperSpigot end
+ // Paper end
EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
@ -131,29 +146,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
if (!world.isClientSide) {
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
+ // PaperSpigot start - Fix cannons
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
+ // Paper start - Fix cannons
+ double y = blockposition.getY();
+ if (!world.paperSpigotConfig.fixCannons) y += 0.5;
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // PaperSpigot - add loc
+ // PaperSpigot end
+ if (!world.paperConfig.fixCannons) y += 0.5;
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc
+ // Paper end
entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
world.addEntity(entitytntprimed);
@@ -0,0 +0,0 @@ public class BlockTNT extends Block {
if (!world.isClientSide) {
if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
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
+ // PaperSpigot start - Fix cannons
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
+ // Paper start - Fix cannons
+ double y = blockposition.getY();
+ if (!world.paperSpigotConfig.fixCannons) y += 0.5;
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving); // PaperSpigot - add loc
+ // PaperSpigot end
+ if (!world.paperConfig.fixCannons) y += 0.5;
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc
+ // Paper end
world.addEntity(entitytntprimed);
world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
@ -162,12 +177,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, blockposition.getY() + 0.5, blockposition.getZ() + 0.5));
+ // PaperSpigot start - Fix cannons
- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
+ // Paper start - Fix cannons
+ double y = blockposition.getY();
+ if (!world.paperSpigotConfig.fixCannons) y += 0.5;
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, y, blockposition.getZ() + 0.5));
+ // PaperSpigot end
+ if (!world.paperConfig.fixCannons) y += 0.5;
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, y, (double) blockposition.getZ() + 0.5D));
+ // Paper end
if (!BlockDispenser.eventFired) {
world.getServer().getPluginManager().callEvent(event);
}
@ -176,14 +191,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
public IBlockData getBlock() {
return this.block;
public boolean br() {
return true;
}
+
+ // PaperSpigot start - Fix cannons
+ // Paper start - Fix cannons
+ @Override
+ public double f(double d0, double d1, double d2) {
+ if (!world.paperSpigotConfig.fixCannons) return super.f(d0, d1, d2);
+ if (!world.paperConfig.fixCannons) return super.f(d0, d1, d2);
+
+ double d3 = this.locX - d0;
+ double d4 = this.locY + this.getHeadHeight() - d1;
@ -194,9 +209,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public float getHeadHeight() {
+ return world.paperSpigotConfig.fixCannons ? this.length / 2 : super.getHeadHeight();
+ return world.paperConfig.fixCannons ? this.length / 2 : super.getHeadHeight();
+ }
+ // PaperSpigot end
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -206,18 +221,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lastY = d1;
this.lastZ = d2;
this.source = entityliving;
+ if (world.paperSpigotConfig.fixCannons) this.motX = this.motZ = 0.0F; // PaperSpigot - Fix cannons
+ if (world.paperConfig.fixCannons) this.motX = this.motZ = 0.0F; // Paper - Fix cannons
}
protected void h() {}
protected void i() {
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
return this.source;
}
+ // PaperSpigot start - Fix cannons
+ // Paper start - Fix cannons
+ @Override
+ public double f(double d0, double d1, double d2) {
+ if (!world.paperSpigotConfig.fixCannons) return super.f(d0, d1, d2);
+ if (!world.paperConfig.fixCannons) return super.f(d0, d1, d2);
+
+ double d3 = this.locX - d0;
+ double d4 = this.locY + this.getHeadHeight() - d1;
@ -227,29 +242,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public boolean aL() {
+ return !world.paperSpigotConfig.fixCannons && super.aL();
+ public boolean bd() {
+ return !world.paperConfig.fixCannons && super.bd();
+ }
+
+ @Override
public float getHeadHeight() {
- return 0.0F;
+ return world.paperSpigotConfig.fixCannons ? this.length / 2 : 0.0F;
}
+ return world.paperConfig.fixCannons ? this.length / 2 : 0.0F;
+ }
+
+ /**
+ * Author: Jedediah Smith <jedediah@silencegreys.com>
+ */
+ @Override
+ public boolean W() {
+ if (!world.paperSpigotConfig.fixCannons) return super.W();
+ public boolean aj() {
+ if (!world.paperConfig.fixCannons) return super.aj();
+
+ // Preserve velocity while calling the super method
+ double oldMotX = this.motX;
+ double oldMotY = this.motY;
+ double oldMotZ = this.motZ;
+
+ super.W();
+ super.aj();
+
+ this.motX = oldMotX;
+ this.motY = oldMotY;
@ -273,18 +288,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ return this.inWater;
+ }
+ // PaperSpigot end
}
}
+ // Paper end
public void setFuseTicks(int i) {
this.datawatcher.set(EntityTNTPrimed.FUSE_TICKS, Integer.valueOf(i));
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion {
// CraftBukkit end
double d14 = EnchantmentProtection.a(entity, d13);
d14 = entity instanceof EntityHuman && world.paperConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a((EntityLiving) entity, d13); // Paper - Disable explosion knockback
}
+ // PaperSpigot start - Fix cannons
+ // Paper start - Fix cannons
+ /*
entity.motX += d8 * d14;
entity.motY += d9 * d14;
@ -292,57 +309,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ // This impulse method sets the dirty flag, so clients will get an immediate velocity update
+ entity.g(d8 * d14, d9 * d14, d10 * d14);
+ // PaperSpigot end
+ // Paper end
+
if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable) {
this.k.put((EntityHuman) entity, new Vec3D(d8 * d13, d9 * d13, d10 * d13));
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
generateVillage = getBoolean( "generator-settings.village", true );
generateFlatBedrock = getBoolean( "generator-settings.flat-bedrock", false );
}
+
+ public boolean fixCannons;
+ private void fixCannons()
+ {
+ // TODO: Remove migrations after most users have upgraded.
+ if ( PaperSpigotConfig.version < 9 )
+ {
+ // Migrate default value
+
+ boolean value = config.getBoolean( "world-settings.default.fix-cannons", false );
+ if ( !value ) value = config.getBoolean( "world-settings.default.tnt-gameplay.fix-directional-bias", false );
+ if ( !value ) value = !config.getBoolean( "world-settings.default.tnt-gameplay.moves-in-water", true );
+ if ( !value ) value = config.getBoolean( "world-settings.default.tnt-gameplay.legacy-explosion-height", false );
+ if ( value ) config.set( "world-settings.default.fix-cannons", true );
+
+ if ( config.contains( "world-settings.default.tnt-gameplay" ) )
+ {
+ config.getDefaults().set( "world-settings.default.tnt-gameplay", null);
+ config.set( "world-settings.default.tnt-gameplay", null );
+ }
+
+ // Migrate world setting
+
+ value = config.getBoolean( "world-settings." + worldName + ".fix-cannons", false );
+ if ( !value ) value = config.getBoolean( "world-settings." + worldName + ".tnt-gameplay.fix-directional-bias", false );
+ if ( !value ) value = !config.getBoolean( "world-settings." + worldName + ".tnt-gameplay.moves-in-water", true );
+ if ( !value ) value = config.getBoolean( "world-settings." + worldName + ".tnt-gameplay.legacy-explosion-height", false );
+ if ( value ) config.set( "world-settings." + worldName + ".fix-cannons", true );
+
+ if ( config.contains( "world-settings." + worldName + ".tnt-gameplay" ) )
+ {
+ config.getDefaults().set( "world-settings." + worldName + ".tnt-gameplay", null);
+ config.set( "world-settings." + worldName + ".tnt-gameplay", null );
+ }
+ }
+
+ fixCannons = getBoolean( "fix-cannons", false );
+ log( "Fix TNT cannons: " + fixCannons );
+ }
}
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
--

View file

@ -1,38 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 4 Aug 2015 17:45:00 -0700
Subject: [PATCH] Configurable TNT explosion volume
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion {
}
public void a(boolean flag) {
- this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
+ // PaperSpigot start - Configurable TNT explosion volume.
+ float volume = source instanceof EntityTNTPrimed ? world.paperSpigotConfig.tntExplosionVolume : 4.0F;
+ this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", volume, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
+ // PaperSpigot end
if (this.size >= 2.0F && this.b) {
this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]);
} else {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
containerUpdateTickRate = getInt( "container-update-tick-rate", 1 );
}
+
+ public float tntExplosionVolume;
+ private void tntExplosionVolume()
+ {
+ tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F );
+ }
}
--

View file

@ -1,9 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
@ -12,19 +26,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.Random;
import java.util.concurrent.Callable;
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.Logger;
@@ -0,0 +0,0 @@ public class Chunk {
private int v;
private ConcurrentLinkedQueue<BlockPosition> w;
private int w;
private ConcurrentLinkedQueue<BlockPosition> x;
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 long lightUpdateTime;
+ // PaperSpigot end
+ // Paper end
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
private int neighbors = 0x1 << 12;
@ -33,29 +47,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) {
for (int i1 = k; i1 < l; ++i1) {
- 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;
@@ -0,0 +0,0 @@ public class Chunk {
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.recheckGaps(this.world.isClientSide); // PaperSpigot - Asynchronous lighting updates
+ this.recheckGaps(this.world.isClientSide); // Paper - Asynchronous lighting updates
}
this.p = true;
this.q = true;
@@ -0,0 +0,0 @@ public class Chunk {
}
+ /**
+ * PaperSpigot - Recheck gaps asynchronously.
+ * Paper- Recheck gaps asynchronously
+ */
+ public void recheckGaps(final boolean isClientSide) {
+ if (!world.paperSpigotConfig.useAsyncLighting) {
+ this.h(isClientSide);
+ if (!world.paperConfig.useAsyncLighting) {
+ this.h(this.world.isClientSide);
+ return;
+ }
+
@ -78,59 +92,59 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
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));
+ 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;
+ }
+ // PaperSpigot end
if (this.world.worldProvider.e()) {
if (!this.world.c(i, j)) {
// CraftBukkit start
+ // Paper end
if (this.world.worldProvider.c(i, j)) {
// 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator;
import java.util.*;
import java.util.concurrent.Callable;
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.generator.ChunkGenerator;
// CraftBukkit end
+// PaperSpigot start
+// Paper start
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+// PaperSpigot end
+// Paper end
+
// CraftBukkit start
// CraftBukkit end
public abstract class World implements IBlockAccess {
private int a = 63;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter;
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;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
if (!this.worldProvider.o()) {
if (!this.worldProvider.m()) {
for (i1 = k; i1 <= l; ++i1) {
- 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
}
}
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
boolean flag = false;
if (!this.worldProvider.o()) {
if (!this.worldProvider.m()) {
- 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.updateLight(EnumSkyBlock.BLOCK, blockposition); // PaperSpigot - Asynchronous lighting updates
+ flag |= this.updateLight(EnumSkyBlock.BLOCK, blockposition); // Paper - Asynchronous lighting updates
return flag;
}
@ -138,8 +152,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
- public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
+ public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition, Chunk chunk, List<Chunk> neighbors) { // PaperSpigot
+ // Paper start - Asynchronous lighting updates
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
- Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
- if (chunk == null || !chunk.areNeighborsLoaded(1) /*!this.areChunksLoaded(blockposition, 17, false)*/) {
@ -149,11 +167,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
} else {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
i = 0;
}
+ // PaperSpigot start - Asynchronous light updates
+ if (chunk.world.paperSpigotConfig.useAsyncLighting) {
+ // Paper start - Asynchronous light updates
+ if (chunk.world.paperConfig.useAsyncLighting) {
+ chunk.pendingLightUpdates.decrementAndGet();
+ if (neighbors != null) {
+ for (Chunk neighbor : neighbors) {
@ -161,14 +179,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ }
+ // PaperSpigot end
+ // Paper end
+
this.methodProfiler.b();
return true;
this.methodProfiler.a("checkedPosition < toCheckCount");
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
}
+ /**
+ * PaperSpigot - Asynchronous lighting updates
+ * Paper - Asynchronous lighting updates
+ */
+ public boolean updateLight(final EnumSkyBlock enumskyblock, final BlockPosition position) {
+ int x = position.getX();
@ -178,7 +199,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return false;
+ }
+
+ if (!chunk.world.paperSpigotConfig.useAsyncLighting) {
+ if (!chunk.world.paperConfig.useAsyncLighting) {
+ return this.c(enumskyblock, position, chunk, null);
+ }
+
@ -186,6 +207,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ chunk.lightUpdateTime = chunk.world.getTime();
+
+ final List<Chunk> neighbors = new ArrayList<Chunk>();
+
+ for (int cx = (x >> 4) - 1; cx <= (x >> 4) + 1; ++cx) {
+ for (int cz = (z >> 4) - 1; cz <= (z >> 4) + 1; ++cz) {
+ if (cx != x >> 4 && cz != z >> 4) {
@ -215,20 +237,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean a(boolean flag) {
return false;
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,9 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 7 Mar 2015 20:41:55 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
@ -13,23 +28,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +0,0 @@ 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
+ }
}
+ 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);
@@ -0,0 +0,0 @@ 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);
}
}
--

View file

@ -1,9 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 7 Mar 2015 20:32:13 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
@ -13,10 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- if (i < 3) {
+ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks) {
+ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
@ -26,26 +44,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- if (i < 3) {
+ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks) {
+ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
if (j >= (byte) range(3, (world.spigotConfig.caneModifier /100 * 15) + 0.5F, 15)) { // Spigot
--

View file

@ -1,50 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Thu, 23 Jul 2015 22:05:22 -0700
Date: Wed, 2 Mar 2016 23:34:44 -0600
Subject: [PATCH] Configurable container update tick rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
fixCannons = getBoolean("fix-cannons", false);
log("Fix TNT cannons: " + fixCannons);
}
+
+ public int containerUpdateTickRate;
+ private void containerUpdateTickRate() {
+ containerUpdateTickRate = getInt("container-update-tick-rate", 1);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// Spigot start
public boolean collidesWithEntities = true;
public int viewDistance; // PaperSpigot - Player view distance API
+ private int containerUpdateDelay; // PaperSpigot
public int ping;
public boolean viewingCredits;
public int viewDistance; // Paper - Player view distance API
+ private int containerUpdateDelay; // Paper
@Override
public boolean ad()
// CraftBukkit start
public String displayName;
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.noDamageTicks > 0) {
--this.noDamageTicks;
}
-
- this.activeContainer.b();
+
+ // PaperSpigot start - Configurable container update tick rate
+ // Paper start - Configurable container update tick rate
+ if (--containerUpdateDelay <= 0) {
+ this.activeContainer.b();
+ containerUpdateDelay = world.paperSpigotConfig.containerUpdateTickRate;
+ containerUpdateDelay = world.paperConfig.containerUpdateTickRate;
+ }
+ // PaperSpigot end
+ // Paper end
if (!this.world.isClientSide && !this.activeContainer.a((EntityHuman) this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
cacheChunkMaps = getBoolean( "cache-chunk-maps", false );
}
+
+ public int containerUpdateTickRate;
+ private void containerUpdateTickRate()
+ {
+ containerUpdateTickRate = getInt( "container-update-tick-rate", 1 );
+ }
}
--

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,91 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctorDark <doctordark11@gmail.com>
Date: Thu, 28 May 2015 20:12:38 -0500
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void c(int i) {
- if (this.dimension == 1 && i == 1) {
+ // PaperSpigot start - Allow configurable end portal credits
+ boolean endPortal = this.dimension == 1 && i == 1;
+ if (endPortal) {
this.b((Statistic) AchievementList.D);
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);
- this.viewingCredits = true;
- this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
+ if (!world.paperSpigotConfig.disableEndCredits) {
- if (!this.viewingCredits) {
+ if (!this.viewingCredits && !world.paperConfig.disableEndCredits) {
+ this.world.kill(this);
+ this.viewingCredits = true;
+ this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
+ }
+ // PaperSpigot end
} else {
if (this.dimension == 0 && i == 1) {
this.b((Statistic) AchievementList.C);
+ // Paper end
this.viewingCredits = true;
if (this.a(AchievementList.D)) {
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} else {
this.b((Statistic) AchievementList.y);
}
+ }
+ // PaperSpigot start - Allow configurable end portal credits
+ if (!endPortal || world.paperSpigotConfig.disableEndCredits) {
+ 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;
+ TeleportCause cause = (endPortal || (this.dimension == 1 || i == 1)) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
this.server.getPlayerList().changeDimension(this, i, cause);
// CraftBukkit end
this.lastSentExp = -1;
this.bM = -1.0F;
this.bN = -1;
TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.cb = -1;
return this;
}
+ // PaperSpigot end
+
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
}
TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
+ agent.setCanCreatePortal(cause != TeleportCause.END_PORTAL); // PaperSpigot - Configurable end credits, don't allow End Portals to create portals
+
PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause);
event.useTravelAgent(useTravelAgent);
Bukkit.getServer().getPluginManager().callEvent(event);
@@ -0,0 +0,0 @@ public abstract class PlayerList {
return;
}
- exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
+ // PaperSpigot - Configurable end credits, if a plugin sets to use a travel agent even if the cause is an end portal, ignore it
+ // 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;
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
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 );
+ }
}
--

View file

@ -1,37 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 7 Mar 2015 21:00:13 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
this.ax = MathHelper.nextInt(this.random, 20, 80);
this.aw = 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;
- 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;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,80 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -0,0 +0,0 @@ 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
}
@@ -0,0 +0,0 @@ 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
}
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,38 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 1 Jul 2015 00:38:10 -0700
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids {
* 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) {
+ if (this.getMaterial() == Material.LAVA) {
+ return world.worldProvider.o() ? world.paperSpigotConfig.lavaFlowSpeedNether : world.paperSpigotConfig.lavaFlowSpeedNormal;
+ if (this.material == Material.LAVA) {
+ return world.worldProvider.m() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.lavaFlowSpeedNormal;
+ }
if (this.getMaterial() == Material.WATER && (
world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA ||
world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA ||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
fastDrainLava = getBoolean( "fast-drain.lava", false );
fastDrainWater = getBoolean( "fast-drain.water", false );
}
+
+ public int lavaFlowSpeedNormal;
+ public int lavaFlowSpeedNether;
+ private void lavaFlowSpeed()
+ {
+ lavaFlowSpeedNormal = getInt( "lava-flow-speed.normal", 30 );
+ lavaFlowSpeedNether = getInt( "lava-flow-speed.nether", 10 );
+ }
}
if (this.material == Material.WATER && (
world.getType(blockposition.north(1)).getBlock().material == Material.LAVA ||
world.getType(blockposition.south(1)).getBlock().material == Material.LAVA ||
--

View file

@ -1,9 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:58:15 -0700
Date: Wed, 2 Mar 2016 15:03:53 -0600
Subject: [PATCH] Configurable mob spawner tick rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void disableIceAndSnow(){
disableIceAndSnow = getBoolean("disable-ice-and-snow", false);
}
+
+ public int mobSpawnerTickRate;
+ private void mobSpawnerTickRate() {
+ mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
+ }
}
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@ -12,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int maxNearbyEntities = 6;
private int requiredPlayerRange = 16;
private int spawnRange = 4;
+ private int tickDelay = 0; // PaperSpigot
+ private int tickDelay = 0; // Paper
public MobSpawnerAbstract() {}
@ -20,48 +34,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void c() {
+ // PaperSpigot start - Configurable mob spawner tick rate
+ // Paper start - Configurable mob spawner tick rate
+ if (spawnDelay > 0 && --tickDelay > 0) return;
+ tickDelay = this.a().paperSpigotConfig.mobSpawnerTickRate;
+ // PaperSpigot end
if (this.g()) {
BlockPosition blockposition = this.b();
double d0;
+ tickDelay = this.a().paperConfig.mobSpawnerTickRate;
+ // Paper end
if (!this.h()) {
this.e = this.d;
} else {
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
this.a().addParticle(EnumParticle.SMOKE_NORMAL, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]);
this.a().addParticle(EnumParticle.FLAME, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]);
this.a().addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
this.a().addParticle(EnumParticle.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
if (this.spawnDelay > 0) {
- --this.spawnDelay;
+ this.spawnDelay -= tickDelay; // PaperSpigot
+ this.spawnDelay -= tickDelay; // Paper
}
this.f = this.e;
this.e = (this.e + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
this.e = this.d;
this.d = (this.d + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
} else {
- if (this.spawnDelay == -1) {
+ if (this.spawnDelay < -tickDelay) { // PaperSpigot
this.h();
+ if (this.spawnDelay < -tickDelay) { // Paper
this.i();
}
if (this.spawnDelay > 0) {
- --this.spawnDelay;
+ this.spawnDelay -= tickDelay; // PaperSpigot
+ this.spawnDelay -= tickDelay; // Paper
return;
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
disableMoodSounds = getBoolean( "disable-mood-sounds", false );
}
+
+ public int mobSpawnerTickRate;
+ private void mobSpawnerTickRate()
+ {
+ mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 );
+ }
}
--

View file

@ -1,9 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
@ -13,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- int j = this.a(world);
+ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot
+ int j = this.getFlowSpeed(world, blockposition); // Paper
int k;
if (i > 0) {
@ -22,39 +37,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!this.e(world, blockposition, iblockdata)) {
- 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) {
+ if (this.getMaterial() == Material.WATER && (
+ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) {
+ return world.paperSpigotConfig.waterOverLavaFlowSpeed;
+ if (this.material == Material.WATER && (
+ world.getType(blockposition.north(1)).getBlock().material == Material.LAVA ||
+ world.getType(blockposition.south(1)).getBlock().material == Material.LAVA ||
+ world.getType(blockposition.west(1)).getBlock().material == Material.LAVA ||
+ world.getType(blockposition.east(1)).getBlock().material == Material.LAVA)) {
+ return world.paperConfig.waterOverLavaFlowSpeed;
+ }
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,9 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 7 Mar 2015 20:20:29 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
@ -11,29 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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 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) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,49 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 23 Feb 2015 14:57:28 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
this.K();
this.U();
}
+ /**
+ * PaperSpigot - Checks if the feature is enabled and the entity is above the nether world bedrock height
+ * Paper - 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;
+ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D;
+ }
+
public void K() {
public void U() {
this.world.methodProfiler.a("entityBaseTick");
if (this.vehicle != null && this.vehicle.dead) {
if (this.isPassenger() && this.by().dead) {
@@ -0,0 +0,0 @@ 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();
+ if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage)
this.Y();
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
}
+
+ public boolean netherVoidTopDamage;
+ private void nethervoidTopDamage()
+ {
+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false );
+ }
}
--

View file

@ -1,40 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 10 Jan 2016 20:40:33 -0600
Date: Thu, 3 Mar 2016 01:13:45 -0600
Subject: [PATCH] Disable chest cat detection
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void containerUpdateTickRate() {
containerUpdateTickRate = getInt("container-update-tick-rate", 1);
}
+
+ public boolean disableChestCatDetection;
+ private void disableChestCatDetection() {
+ disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockChest.java
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -0,0 +0,0 @@ public class BlockChest extends BlockContainer {
@@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity {
}
private boolean p(World world, BlockPosition blockposition) {
+ // PaperSpigot start - Option to disable chest's cat detection (Performance++)
+ if (world.paperSpigotConfig.disableChestCatDetection) {
private boolean j(World world, BlockPosition blockposition) {
+ // Paper start - Option ti dsiable chest cat detection
+ if (world.paperConfig.disableChestCatDetection) {
+ return false;
+ }
+ // PaperSpigot end
+ // Paper end
Iterator iterator = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))).iterator();
EntityOcelot entityocelot;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
public boolean boatsDropBoats;
public boolean disablePlayerCrits;
+ public boolean disableChestCatDetection;
private void mechanicsChanges()
{
boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
disablePlayerCrits = getBoolean( "game-mechanics.disable-player-crits", false );
+ disableChestCatDetection = getBoolean( "game-mechanics.disable-chest-cat-detection", false );
}
public boolean netherVoidTopDamage;
--

View file

@ -1,9 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:20:44 -0700
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
@ -12,58 +26,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
- if (flag) {
+ // PaperSpigot start - Disable explosion knockback
+ boolean knockbackCancelled = false;
+ if (flag && !(knockbackCancelled = world.paperSpigotConfig.disableExplosionKnockback && damagesource.isExplosion() && this instanceof EntityHuman)) {
+ // PaperSpigot end
this.world.broadcastEntityEffect(this, (byte) 2);
if (damagesource != DamageSource.DROWN) {
this.ac();
+ 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);
}
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
}
+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // PaperSpigot
+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback
+
String s;
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion {
continue;
}
// CraftBukkit end
- double d14 = EnchantmentProtection.a(entity, d13);
+ double d14 = entity instanceof EntityHuman && world.paperSpigotConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a(entity, d13); // PaperSpigot
double d14 = 1.0D;
// PaperSpigot start - Fix cannons
/*
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;
@@ -0,0 +0,0 @@ public class Explosion {
entity.g(d8 * d14, d9 * d14, d10 * d14);
// PaperSpigot end
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
- if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable) {
+ if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable && !world.paperSpigotConfig.disableExplosionKnockback) { // PaperSpigot
this.k.put((EntityHuman) entity, new Vec3D(d8 * d13, d9 * d13, d10 * d13));
- 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));
}
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
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 );
+ }
}
--

View file

@ -1,9 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:28:31 -0700
Date: Wed, 2 Mar 2016 14:57:24 -0600
Subject: [PATCH] Disable ice and snow
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void disableThunder() {
disableThunder = getBoolean("disable-thunder", false);
}
+
+ public boolean disableIceAndSnow;
+ private void disableIceAndSnow(){
+ disableIceAndSnow = getBoolean("disable-ice-and-snow", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
@ -13,23 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.c("iceandsnow");
- if (this.random.nextInt(16) == 0) {
+ if (!this.paperSpigotConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // PaperSpigot - Disable ice and snow
this.m = this.m * 3 + 1013904223;
i1 = this.m >> 2;
blockposition = this.q(new BlockPosition(k + (i1 & 15), 0, l + (i1 >> 8 & 15)));
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
disableThunder = getBoolean( "disable-thunder", false );
}
+
+ public boolean disableIceAndSnow;
+ private void disableIceAndSnow()
+ {
+ disableIceAndSnow = getBoolean( "disable-ice-and-snow", false );
+ }
}
+ if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
this.l = this.l * 3 + 1013904223;
l = this.l >> 2;
blockposition = this.p(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15)));
--

View file

@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:30:28 -0700
Subject: [PATCH] Disable mood sounds
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
protected void a(int i, int j, Chunk chunk) {
this.methodProfiler.c("moodSound");
- if (this.L == 0 && !this.isClientSide) {
+ if (!this.paperSpigotConfig.disableMoodSounds && this.L == 0 && !this.isClientSide) { // PaperSpigot - Disable mood sounds
this.m = this.m * 3 + 1013904223;
int k = this.m >> 2;
int l = k & 15;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
disableIceAndSnow = getBoolean( "disable-ice-and-snow", false );
}
+
+ public boolean disableMoodSounds;
+ private void disableMoodSounds()
+ {
+ disableMoodSounds = getBoolean( "disable-mood-sounds", false );
+ }
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 24 Oct 2015 01:16:22 -0500
Date: Wed, 2 Mar 2016 23:45:17 -0600
Subject: [PATCH] Disable spigot tick limiters
@ -16,22 +16,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- for (entityLimiter.initTick();
- entitiesThisCycle < entityList.size() && (entitiesThisCycle % 10 != 0 || entityLimiter.shouldContinue());
- tickPosition++, entitiesThisCycle++) {
+ // PaperSpigot start - Disable tick limiters
+ // Paper start - Disable tick limiters
+ //if (tickPosition < 0) tickPosition = 0;
+ for (tickPosition = 0; tickPosition < entityList.size(); tickPosition++) {
+ // PaperSpigot end
+ // Paper end
tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0;
entity = (Entity) this.entityList.get(this.tickPosition);
// CraftBukkit end
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
// Spigot start
// Iterator iterator = this.tileEntityListTick.iterator();
int tilesThisCycle = 0;
- for (tileLimiter.initTick();
- tilesThisCycle < tileEntityList.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue());
- tilesThisCycle < tileEntityListTick.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue());
- tileTickPosition++, tilesThisCycle++) {
+ for (tileTickPosition = 0; tileTickPosition < tileEntityList.size(); tileTickPosition++) { // PaperSpigot - Disable tick limiters
tileTickPosition = (tileTickPosition < tileEntityList.size()) ? tileTickPosition : 0;
TileEntity tileentity = (TileEntity) this.tileEntityList.get(tileTickPosition);
+ for (tileTickPosition = 0; tileTickPosition < tileEntityListTick.size(); tileTickPosition++) { // Paper - Disable tick limiters
tileTickPosition = (tileTickPosition < tileEntityListTick.size()) ? tileTickPosition : 0;
TileEntity tileentity = (TileEntity) this.tileEntityListTick.get(tileTickPosition);
// Spigot start
--

View file

@ -1,35 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:26:41 -0700
Date: Wed, 2 Mar 2016 14:52:43 -0600
Subject: [PATCH] Disable thunder
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void disableExplosionKnockback(){
disableExplosionKnockback = getBoolean("disable-explosion-knockback", false);
}
+
+ public boolean disableThunder;
+ private void disableThunder() {
+ disableThunder = getBoolean("disable-thunder", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
int i1;
int l;
BlockPosition blockposition;
- if (this.random.nextInt(100000) == 0 && this.S() && this.R()) {
+ if (!this.paperSpigotConfig.disableThunder && this.random.nextInt(100000) == 0 && this.S() && this.R()) { // PaperSpigot - Disable thunder
this.m = this.m * 3 + 1013904223;
i1 = this.m >> 2;
blockposition = this.a(new BlockPosition(k + (i1 & 15), 0, l + (i1 >> 8 & 15)));
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
disableExplosionKnockback = getBoolean( "disable-explosion-knockback", false );
}
+
+ public boolean disableThunder;
+ private void disableThunder()
+ {
+ disableThunder = getBoolean( "disable-thunder", false );
+ }
}
- if (flag && flag1 && this.random.nextInt(100000) == 0) {
+ // Paper - Disable thunder
+ if (!this.paperConfig.disableThunder && flag && flag1 && this.random.nextInt(100000) == 0) {
this.l = this.l * 3 + 1013904223;
l = this.l >> 2;
blockposition = this.a(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15)));
--

View file

@ -1,9 +1,9 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Nov 2015 21:05:41 -0500
Date: Wed, 2 Mar 2016 23:51:51 -0600
Subject: [PATCH] Don't create Region File's when checking if chunk exists
Plugins like Dynap can end up creating tons of emtpy Region Files
Plugins like Dynmap can end up creating tons of emtpy Region Files
when using chunkExists.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@ -15,8 +15,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31);
+ final RegionFile region = RegionFileCache.a(this.d, i, j, false); // PaperSpigot
+ return region != null && region.chunkExists(i & 31, j & 31); // PaperSpigot
+ // Paper start - Don't create region files when checking that they exist
+ final RegionFile region = RegionFileCache.a(this.d, i, j, false);
+ return region != null && region.chunkExists(i & 31, j & 31);
+ // Paper end
}
// CraftBukkit end
@ -28,12 +30,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static final Map<File, RegionFile> a = Maps.newHashMap(); // Spigot - private -> public
+ // PaperSpigot start
+ // Paper start
public static synchronized RegionFile a(File file, int i, int j) {
+ return a(file, i, j, true);
+ }
+
+ public static synchronized RegionFile a(File file, int i, int j, boolean create) {
+ // PaperSpigot end
+ // Paper end
File file1 = new File(file, "region");
File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2);
@ -41,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (regionfile != null) {
return regionfile;
} else {
+ if (!create && !file2.exists()) { return null; } // PaperSpigot
+ if (!create && !file2.exists()) { return null; } // Paper
if (!file1.exists()) {
file1.mkdirs();
}

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 15 Nov 2015 19:46:07 -0600
Date: Wed, 2 Mar 2016 23:55:20 -0600
Subject: [PATCH] Don't create a chunk just to unload it
@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
}
- net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
+ net.minecraft.server.Chunk chunk = world.chunkProviderServer.getChunkIfLoaded(x, z);
+ // PaperSpigot start - Don't create a chunk just to unload it
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z);
+ // Paper start - Don't create a chunk just to unload it
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z);
+ if (chunk == null) {
+ return false;
+ }
+ // PaperSpigot end
+ // Paper end
if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data
save = true;
}

View file

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 15 Nov 2015 19:35:31 -0600
Subject: [PATCH] Don't damage already dead ArmorStands
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
return false;
}
// CraftBukkit end
- if (this.world.isClientSide) {
+ if (this.world.isClientSide || this.dead) {
return false;
- } else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
+ } else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { // PaperSpigot
this.die();
return false;
} else if (!this.isInvulnerable(damagesource) && !this.h && !this.s()) {
--

View file

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 2 Mar 2016 23:58:29 -0600
Subject: [PATCH] Don't sleep between chunk saves
For some unknown reason, Minecraft is sleeping 10ms between every single chunk being saved to disk.
Under high chunk load/unload activity (lots of movement / teleporting), this causes the chunk unload queue
to build up in size.
This has multiple impacts:
1) Performance of the unload queue itself - The save thread is pretty ineffecient for how it accesses it
By letting the queue get larger, checking and popping work off the queue can get less performant.
2) Performance of chunk loading - As with #1, chunk loads also have to check this queue when loading
chunk data so that it doesn't load stale data if new data is pending write to disk.
3) Memory Usage - The entire chunk has been serialized to NBT, and now sits in this queue. This leads to
elevated memory usage, and then the objects used in the serialization sit around longer than needed,
resulting in promotion to Old Generation instead of dying young.
If there is work to do, then the thread should be doing its work, and only sleep when it is done.
diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/FileIOThread.java
+++ b/src/main/java/net/minecraft/server/FileIOThread.java
@@ -0,0 +0,0 @@ public class FileIOThread implements Runnable {
++this.d;
}
+ /* // Paper start - don't sleep in between chunks so we unload faster.
try {
Thread.sleep(this.e ? 0L : 10L);
} catch (InterruptedException interruptedexception) {
interruptedexception.printStackTrace();
- }
+ } */ // Paper end
}
if (this.b.isEmpty()) {
--

View file

@ -1,9 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sat, 7 Mar 2015 22:03:47 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
@ -13,15 +32,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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) {
+ // 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();
+ }
+ // PaperSpigot end
+ // Paper end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
@ -35,42 +54,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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) {
+ // Paper start - Configurable TNT entity height nerf
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY > this.world.paperConfig.entityTNTHeightNerf) {
+ this.die();
+ }
+ // PaperSpigot end
+ // Paper 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
+ }
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 22 Dec 2015 18:16:11 -0600
Date: Thu, 3 Mar 2016 00:07:23 -0600
Subject: [PATCH] EAR: Fix bug with teleporting entities
[17:53:15] <Aikar> had a reproduceable issue of losing entities on teleport, now resolved
@ -11,27 +11,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
protected DataWatcher datawatcher;
private double ar;
private double as;
- public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot // PAIL
- public int ae;
- public int af;
- public int ag;
+ public boolean ad;
+ // PaperSpigot start - EAR: Fix bug with teleporting entities
private static final DataWatcherObject<Boolean> aA = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
private static final DataWatcherObject<Boolean> aB = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
public boolean aa;
- public int ab;
- public int ac;
- public int ad;
+ // Paper start - EAR: Fix bug with teleporting entities
+ public boolean isAddedToChunk() {
+ int chunkX = MathHelper.floor(locX / 16.0D);
+ int chunkY = MathHelper.floor(locY / 16.0D);
+ int chunkZ = MathHelper.floor(locZ / 16.0D);
+
+ return ad && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ;
+ return aa && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ;
+ }
+ public int ae; public int getChunkX() { return ae; } // PAIL
+ public int af; public int getChunkY() { return af; } // PAIL
+ public int ag; public int getChunkZ() { return ag; } // PAIL
+ // PaperSpigot end
+ public int ab; public int getChunkX() { return ab; }
+ public int ac; public int getChunkY() { return ac; }
+ public int ad; public int getChunkZ() { return ad; }
+ // Paper end
public boolean ah;
public boolean ai;
public boolean impulse;
public int portalCooldown;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ public class ActivationRange
SpigotTimings.checkIfActiveTimer.startTiming();
// Never safe to skip fireworks or entities not yet added to chunk
// PAIL: inChunk
- if ( !entity.aa || entity instanceof EntityFireworks ) {
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities
SpigotTimings.checkIfActiveTimer.stopTiming();
return true;
}
--

View file

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -0,0 +0,0 @@ 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) {
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 8 Oct 2014 19:51:28 -0400
Date: Thu, 3 Mar 2016 01:17:12 -0600
Subject: [PATCH] Ensure commands are not ran async
Plugins calling Player.chat("/foo") or Server.dispatchCommand() could
@ -17,11 +17,11 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (!async && s.startsWith("/")) {
+ // PaperSpigot Start
+ // Paper Start
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ final String fCommandLine = s;
+ MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Command Dispatched Async: " + fCommandLine);
@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new RuntimeException("Exception processing chat command", e.getCause());
+ }
+ }
+ // PaperSpigot End
+ // Paper End
this.handleCommand(s);
} else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) {
// Do nothing, this is coming from a plugin
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(commandLine, "CommandLine cannot be null");
+ // PaperSpigot Start
+ // Paper Start
+ if (!Bukkit.isPrimaryThread()) {
+ final CommandSender fSender = sender;
+ final String fCommandLine = commandLine;
@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new RuntimeException("Exception processing dispatch command", e.getCause());
+ }
+ }
+ // PaperSpigot End
+ // Paper End
+
if (commandMap.dispatch(sender, commandLine)) {
return true;

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 02:19:31 -0500
Date: Thu, 3 Mar 2016 02:33:53 -0600
Subject: [PATCH] Ensure inv drag is in bounds
@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -0,0 +0,0 @@ public abstract class Container {
this.d();
}
} else if (this.g == 1) {
- Slot slot = (Slot) this.c.get(i);
+ Slot slot = i < this.c.size() ? this.c.get(i) : null; // Paper - Ensure drag in bounds
}
if (slot != null && a(slot, playerinventory.getCarried(), true) && slot.isAllowed(playerinventory.getCarried()) && playerinventory.getCarried().count > this.h.size() && this.b(slot)) {
this.h.add(slot);
public ItemStack b(EntityHuman entityhuman, int i) {
- Slot slot = (Slot) this.c.get(i);
+ Slot slot = i < this.c.size() ? this.c.get(i) : null; // Paper - Ensure drag in bounds
return slot != null ? slot.getItem() : null;
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
Date: Mon, 15 Feb 2016 07:11:28 -0800
Date: Thu, 3 Mar 2016 02:15:57 -0600
Subject: [PATCH] Expose server CommandMap
@ -17,5 +17,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return commandMap;
}
--
2.7.0.rc0.20.g4b9ab0e

View file

@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Fri, 5 Jun 2015 00:43:17 -0700
Subject: [PATCH] FallingBlock and TNT entities collide with specific blocks
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
if ( block != null )
{
- block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity);
+ // PaperSpigot start - FallingBlocks and TNT collide with specific non-collidable blocks
+ Block b = block.getBlock();
+ if (entity.world.paperSpigotConfig.fallingBlocksCollideWithSigns && (entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) && (b instanceof BlockSign || b instanceof BlockFenceGate || b instanceof BlockTorch || b instanceof BlockButtonAbstract || b instanceof BlockLever || b instanceof BlockTripwireHook || b instanceof BlockTripwire || b instanceof BlockChest || b instanceof BlockSlowSand || b instanceof BlockBed || b instanceof BlockEnderChest || b instanceof BlockEnchantmentTable || b instanceof BlockBrewingStand)) {
+ AxisAlignedBB aabb = AxisAlignedBB.a(x, y, z, x + 1.0, y + 1.0, z + 1.0);
+ if (axisalignedbb.b(aabb)) arraylist.add(aabb);
+ } else {
+ b.a(this, blockposition, block, axisalignedbb, arraylist, entity);
+ }
+ // PaperSpigot end
}
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
fixCannons = getBoolean( "fix-cannons", false );
log( "Fix TNT cannons: " + fixCannons );
}
+
+ public boolean fallingBlocksCollideWithSigns;
+ private void fallingBlocksCollideWithSigns()
+ {
+ fallingBlocksCollideWithSigns = getBoolean( "falling-blocks-collide-with-signs", false );
+ }
}
--

View file

@ -0,0 +1,265 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
@@ -0,0 +0,0 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return null;
}
+
+ // Paper start
+ @Override
+ public org.bukkit.Location getSourceLoc() {
+ return getHandle().sourceLoc;
+ }
+ // Paper end
}
--

View file

@ -1,9 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
@ -13,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- 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;
}
@ -22,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
i = i1;
- if (i1 < 0) {
+ if (i1 < 0 || canFastDrain(world, blockposition)) { // PaperSpigot - Fast draining
+ if (i1 < 0 || canFastDrain(world, blockposition)) { // Paper - Fast draining
world.setAir(blockposition);
} else {
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
@ -32,68 +48,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+
+ /**
+ * PaperSpigot - Data check method for fast draining
+ * Paper - Data check method for fast draining
+ */
+ 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;
+ }
+
+ /**
+ * 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) {
+ boolean result = false;
+ int data = getData(world, position);
+ if (this.material == Material.WATER) {
+ if (world.paperSpigotConfig.fastDrainWater) {
+ if (world.paperConfig.fastDrainWater) {
+ result = true;
+ if (getData(world, position.down()) < 0) {
+ 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;
+ } 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;
+ } 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;
+ } 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;
+ }
+ }
+ } else if (this.material == Material.LAVA) {
+ if (world.paperSpigotConfig.fastDrainLava) {
+ if (world.paperConfig.fastDrainLava) {
+ 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;
+ } 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;
+ } 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;
+ } 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;
+ } 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;
+ }
+ }
+ }
+ return result;
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
--

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Mon, 15 Feb 2016 23:16:00 -0600
Subject: [PATCH] Fix FurnaceMinecarts losing all of their velocity on certain
corners
diff --git a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
@@ -0,0 +0,0 @@ public class EntityMinecartFurnace extends EntityMinecartAbstract {
if (d0 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
d0 = (double) MathHelper.sqrt(d0);
- this.a /= d0;
- this.b /= d0;
- if (this.a * this.motX + this.b * this.motZ < 0.0D) {
- this.a = 0.0D;
- this.b = 0.0D;
- } else {
- double d1 = d0 / this.m();
-
- this.a *= d1;
- this.b *= d1;
- }
+ // PaperSpigot - Don't lose all your velocity on corners
+ // https://bugs.mojang.com/browse/MC-51053?focusedCommentId=223854
+ double d1 = (double) MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ this.a = (motX / d1) * d0;
+ this.b = (motZ / d1) * d0;
+ // PaperSpigot end
}
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Sun, 28 Feb 2016 18:33:06 +0000
Date: Thu, 3 Mar 2016 02:50:31 -0600
Subject: [PATCH] Fix inter-world teleportation glitches
People are able to abuse the way Bukkit handles teleportation across worlds since it provides a built in teleportation safety check.
@ -10,6 +10,20 @@ To abuse the safety check, players are required to get into a location deemed un
Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png
The wanted destination was on top of the emerald block however the player ended on top of the diamond block. This only is the case if the player is teleporting between worlds.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void portalSearchRadius() {
portalSearchRadius = getInt("portal-search-radius", 128);
}
+
+ public boolean disableTeleportationSuffocationCheck;
+ private void disableTeleportationSuffocationCheck() {
+ disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false);
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@ -19,23 +33,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity.playerConnection.teleport(to);
} else {
- server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
+ server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, !toWorld.paperSpigotConfig.disableTeleportationSuffocationCheck);
+ // Paper - Configurable suffocation check
+ server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck);
}
return true;
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
portalSearchRadius = getInt("portal-search-radius", 128);
}
+
+ public boolean disableTeleportationSuffocationCheck;
+ private void disableTeleportationSuffocationCheck()
+ {
+ disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false);
+ }
}
--

View file

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Thu, 30 Apr 2015 22:42:34 -0400
Subject: [PATCH] Fix jar being shaded multiple times
diff --git a/pom.xml b/pom.xml
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
+ <forceCreation>true</forceCreation> <!-- Required to prevent shading the jar multiple times -->
<archive>
<manifestEntries>
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int j1 = 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));
+ // 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>() {
+ @Override
+ public boolean apply(Entity entity) {
+ return IEntitySelector.d.apply(entity) && !entity.dead;
+ }
+ });
+ // PaperSpigot end
+ // Paper end
Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ);
for (int l1 = 0; l1 < list.size(); ++l1) {

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Tue, 4 Aug 2015 18:15:05 -0700
Date: Wed, 2 Mar 2016 23:38:52 -0600
Subject: [PATCH] Fix lava/water some times creating air instead of cobblestone
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- if (integer.intValue() <= 4) {
+ if (integer.intValue() > 0) { // PaperSpigot
+ if (integer.intValue() > 0) { // Paper
world.setTypeUpdate(blockposition, Blocks.COBBLESTONE.getBlockData());
this.fizz(world, blockposition);
return true;

View file

@ -1,9 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 13 Apr 2015 15:47:15 -0500
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
@ -12,64 +32,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (false) { // CraftBukkit
throw new IllegalStateException("TickNextTick list out of synch");
} else {
+ // PaperSpigot start - No, stop doing this, it affects things like redstone
+ // 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) {
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
i = 1000;
}
// CraftBukkit end
+ */
+ if (i > paperSpigotConfig.tickNextTickCap) {
+ i = paperSpigotConfig.tickNextTickCap;
}
+ // PaperSpigot end
+ */
+ if (i > paperConfig.tickNextTickCap) {
+ i = paperConfig.tickNextTickCap;
+ }
+ // Paper end
this.methodProfiler.a("cleaning");
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.V.add(nextticklistentry);
this.U.add(nextticklistentry);
}
+ // PaperSpigot start - Allow redstone ticks to bypass the tickNextTickListCap
+ if (paperSpigotConfig.tickNextTickListCapIgnoresRedstone) {
+ Iterator<NextTickListEntry> iterator = this.M.iterator();
+ // 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;
+ }
+
+ if (next.a().isPowerSource() || next.a() instanceof IContainer) {
+ IBlockData data = next.a().getBlockData();
+ if (next.a().isPowerSource(data) || next.a() instanceof IInventory) {
+ iterator.remove();
+ this.V.add(next);
+ this.U.add(next);
+ }
+ }
+ }
+ // PaperSpigot end
+ // Paper 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ 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 );
+ }
}
Iterator iterator = this.U.iterator();
--

View file

@ -1,204 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 30 Jun 2015 20:45:24 -0700
Subject: [PATCH] Force load chunks for specific entities that fly through
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
return;
}
// PaperSpigot end
+ // PaperSpigot start - Don't unload chunk if it contains an entity that loads chunks
+ if (chunk != null) {
+ for (List<Entity> entities : chunk.entitySlices) {
+ for (Entity entity : entities) {
+ if (entity.loadChunks) {
+ return;
+ }
+ }
+ }
+ }
+ // PaperSpigot end
if (this.world.worldProvider.e()) {
if (!this.world.c(i, j)) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
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
+ public boolean loadChunks = false; // PaperSpigot - Entities can load chunks they move through and keep them loaded
// Spigot start
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
return this.world.getCubes(this, axisalignedbb).isEmpty() && !this.world.containsLiquid(axisalignedbb);
}
+ /**
+ * PaperSpigot - Load surrounding chunks the entity is moving through
+ */
+ public void loadChunks() {
+ for (int cx = (int) locX >> 4; cx <= (int) (locX + motX) >> 4; ++cx) {
+ for (int cz = (int) locZ >> 4; cz <= (int) (locZ + motZ) >> 4; ++cz) {
+ ((ChunkProviderServer) world.chunkProvider).getChunkAt(cx, cz);
+ }
+ }
+ }
+
+
public void move(double d0, double d1, double d2) {
org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
+ if (this.loadChunks) loadChunks(); // PaperSpigot - Load chunks
if (this.noclip) {
this.a(this.getBoundingBox().c(d0, d1, d2));
this.recalcPosition();
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -0,0 +0,0 @@ public class EntityEnderPearl extends EntityProjectile {
public EntityEnderPearl(World world) {
super(world);
+ this.loadChunks = world.paperSpigotConfig.loadUnloadedEnderPearls; // PaperSpigot
}
public EntityEnderPearl(World world, EntityLiving entityliving) {
super(world, entityliving);
this.c = entityliving;
+ this.loadChunks = world.paperSpigotConfig.loadUnloadedEnderPearls; // PaperSpigot
}
protected void a(MovingObjectPosition movingobjectposition) {
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
public EntityFallingBlock(org.bukkit.Location loc, World world) {
super(world);
sourceLoc = loc;
+ this.loadChunks = world.paperSpigotConfig.loadUnloadedFallingBlocks; // PaperSpigot
}
public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) {
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
this.lastX = d0;
this.lastY = d1;
this.lastZ = d2;
+ this.loadChunks = world.paperSpigotConfig.loadUnloadedFallingBlocks; // PaperSpigot
}
protected boolean s_() {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
// PaperSpigot end
this.k = true;
this.setSize(0.98F, 0.98F);
+ this.loadChunks = world.paperSpigotConfig.loadUnloadedTNTEntities; // PaperSpigot
}
public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) {
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
private void explode() {
// CraftBukkit start
// float f = 4.0F;
-
+
+ // PaperSpigot start - Force load chunks during TNT explosions
+ ChunkProviderServer chunkProviderServer = ((ChunkProviderServer) world.chunkProvider);
+ boolean forceChunkLoad = chunkProviderServer.forceChunkLoad;
+ if (world.paperSpigotConfig.loadUnloadedTNTEntities) {
+ chunkProviderServer.forceChunkLoad = true;
+ }
+ // PaperSpigot end
+
org.bukkit.craftbukkit.CraftServer server = this.world.getServer();
ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
}
// CraftBukkit end
+
+ // PaperSpigot start - Force load chunks during TNT explosions
+ if (world.paperSpigotConfig.loadUnloadedTNTEntities) {
+ chunkProviderServer.forceChunkLoad = forceChunkLoad;
+ }
+ // PaperSpigot end
}
protected void b(NBTTagCompound nbttagcompound) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
{
if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
{
- entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
- continue;
+ // PaperSpigot start
+ if (entity.loadChunks) {
+ ((ChunkProviderServer) entity.world.chunkProvider).getChunkAt(chunkx, chunkz);
+ } else {
+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
+ continue;
+ }
+ // PaperSpigot end
}
int cz = chunkz << 4;
Chunk chunk = this.getChunkAt( chunkx, chunkz );
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.ad || entity.ae != k || entity.af != l || entity.ag != i1) {
+ if (entity.loadChunks) entity.loadChunks(); // PaperSpigot - Force load chunks
if (entity.ad && this.isChunkLoaded(entity.ae, entity.ag, true)) {
this.getChunkAt(entity.ae, entity.ag).a(entity, entity.af);
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
disableEndCredits = getBoolean( "game-mechanics.disable-end-credits", false );
}
+
+ public boolean loadUnloadedEnderPearls;
+ public boolean loadUnloadedTNTEntities;
+ public boolean loadUnloadedFallingBlocks;
+ private void loadUnloaded()
+ {
+ loadUnloadedEnderPearls = getBoolean( "load-chunks.enderpearls", false );
+ loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false );
+ loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false );
+ }
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ public class ActivationRange
{
SpigotTimings.checkIfActiveTimer.startTiming();
// Never safe to skip fireworks or entities not yet added to chunk
- if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) {
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks || entity.loadChunks ) { // PaperSpigot
SpigotTimings.checkIfActiveTimer.stopTiming();
return true;
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
Improves how the catchup buffer is handled, allowing it to roll both ways
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
public ConsoleReader reader;
- 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 java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public final double[] recentTps = new double[ 3 ];
- // 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
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.isRunning = false;
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private static double calcTps(double avg, double exp, double tps)
- {
- 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 long SEC_IN_NANO = 1000000000;
+ private static final long TICK_TIME = SEC_IN_NANO / TPS;
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final RollingAverage tps1 = new RollingAverage(60);
+ public final RollingAverage tps5 = new RollingAverage(60 * 5);
+ 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 {
+ private final int size;
@ -90,24 +90,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
}
- // Spigot End
+ // PaperSpigot End
+ // Paper End
public void run() {
try {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.a(this.r);
// Spigot start
+ // PaperSpigot start - Further improve tick loop
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 start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start;
+ // PaperSpigot end
+ long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop
while (this.isRunning) {
curTime = System.nanoTime();
- wait = TICK_TIME - (curTime - lastTick) - catchupTime;
+ // PaperSpigot start - Further improve tick loop
+ // Paper start - Further improve server tick loop
+ wait = TICK_TIME - (curTime - lastTick);
+ if (wait > 0) {
+ if (catchupTime < 2E6) {
@ -132,7 +128,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
+
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
{
- double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL;
@ -148,33 +143,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ recentTps[0] = tps1.getAverage();
+ recentTps[1] = tps5.getAverage();
+ recentTps[2] = tps15.getAverage();
+ // Paper end
tickSection = curTime;
+ // PaperSpigot end
}
lastTick = curTime;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ 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()
{
+ // 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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@ -197,21 +191,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- {
- sb.append( format( tps ) );
- sb.append( ", " );
+ // PaperSpigot start - Further improve tick handling
+ double[] tps = org.bukkit.Bukkit.spigot().getTPS();
+ // Paper start - Further improve tick handling
+ double[] tps = org.bukkit.Bukkit.getTPS();
+ String[] tpsAvg = new String[tps.length];
+
+ for ( int i = 0; i < tps.length; i++) {
+ tpsAvg[i] = format( tps[i] );
+ for ( int i = 0; i < tps.length; i++) {
+ tpsAvg[i] = format( tps[i] );
}
- 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, ", "));
+ // Paper end
return true;
}
- 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()
+ ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );

View file

@ -1,254 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 2 Jun 2015 00:41:23 -0700
Date: Wed, 2 Mar 2016 02:17:54 -0600
Subject: [PATCH] Generator Settings
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -0,0 +0,0 @@ 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.paperSpigotConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // PaperSpigot - Configurable flat bedrock
chunksnapshot.a(k1, l1, j1, Blocks.BEDROCK.getBlockData());
} 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BiomeMesa.java
+++ b/src/main/java/net/minecraft/server/BiomeMesa.java
@@ -0,0 +0,0 @@ public class BiomeMesa extends BiomeBase {
chunksnapshot.a(l, l1, k, Blocks.STONE.getBlockData());
}
- if (l1 <= random.nextInt(5)) {
+ if (l1 <= (world.paperSpigotConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // PaperSpigot - Configurable flat bedrock
chunksnapshot.a(l, l1, k, Blocks.BEDROCK.getBlockData());
} 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
@@ -0,0 +0,0 @@ public class ChunkProviderFlat implements IChunkProvider {
if (flag) {
Map map = this.d.b();
- if (map.containsKey("village")) {
+ if (map.containsKey("village") && world.paperSpigotConfig.generateVillage) { // PaperSpigot
Map map1 = (Map) map.get("village");
if (!map1.containsKey("size")) {
@@ -0,0 +0,0 @@ public class ChunkProviderFlat implements IChunkProvider {
this.e.add(new WorldGenVillage(map1));
}
- if (map.containsKey("biome_1")) {
+ if (map.containsKey("biome_1") && world.paperSpigotConfig.generateTemple) { // PaperSpigot
this.e.add(new WorldGenLargeFeature((Map) map.get("biome_1")));
}
- if (map.containsKey("mineshaft")) {
+ if (map.containsKey("mineshaft") && world.paperSpigotConfig.generateMineshaft) { // PaperSpigot
this.e.add(new WorldGenMineshaft((Map) map.get("mineshaft")));
}
- if (map.containsKey("stronghold")) {
+ if (map.containsKey("stronghold") && world.paperSpigotConfig.generateStronghold) { // PaperSpigot
this.e.add(new WorldGenStronghold((Map) map.get("stronghold")));
}
- if (map.containsKey("oceanmonument")) {
+ if (map.containsKey("oceanmonument") && world.paperSpigotConfig.generateMonument) { // PaperSpigot
this.e.add(new WorldGenMonument((Map) map.get("oceanmonument")));
}
}
@@ -0,0 +0,0 @@ public class ChunkProviderFlat implements IChunkProvider {
this.i = new WorldGenLakes(Blocks.LAVA);
}
- this.g = this.d.b().containsKey("dungeon");
+ this.g = world.paperSpigotConfig.generateDungeon && this.d.b().containsKey("dungeon"); // PaperSpigot
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements IChunkProvider {
this.a(i, j, chunksnapshot);
this.B = this.m.getWorldChunkManager().getBiomeBlock(this.B, i * 16, j * 16, 16, 16);
this.a(i, j, chunksnapshot, this.B);
- if (this.r.r) {
+ if (this.r.r && this.m.paperSpigotConfig.generateCaves) { // PaperSpigot
this.u.a(this, this.m, i, j, chunksnapshot);
}
- if (this.r.z) {
+ if (this.r.z && this.m.paperSpigotConfig.generateCanyon) { // PaperSpigot
this.z.a(this, this.m, i, j, chunksnapshot);
}
- if (this.r.w && this.n) {
+ if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot
this.x.a(this, this.m, i, j, chunksnapshot);
}
- if (this.r.v && this.n) {
+ if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot
this.w.a(this, this.m, i, j, chunksnapshot);
}
- if (this.r.u && this.n) {
+ if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot
this.v.a(this, this.m, i, j, chunksnapshot);
}
- if (this.r.x && this.n) {
+ if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot
this.y.a(this, this.m, i, j, chunksnapshot);
}
- if (this.r.y && this.n) {
+ if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot
this.A.a(this, this.m, i, j, chunksnapshot);
}
@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements IChunkProvider {
boolean flag = false;
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
- if (this.r.w && this.n) {
+ if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot
this.x.a(this.m, this.h, chunkcoordintpair);
}
- if (this.r.v && this.n) {
+ if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot
flag = this.w.a(this.m, this.h, chunkcoordintpair);
}
- if (this.r.u && this.n) {
+ if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot
this.v.a(this.m, this.h, chunkcoordintpair);
}
- if (this.r.x && this.n) {
+ if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot
this.y.a(this.m, this.h, chunkcoordintpair);
}
- if (this.r.y && this.n) {
+ if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot
this.A.a(this.m, this.h, chunkcoordintpair);
}
@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements IChunkProvider {
}
}
- if (this.r.s) {
+ if (this.r.s && this.m.paperSpigotConfig.generateDungeon) { // PaperSpigot
for (k1 = 0; k1 < this.r.t; ++k1) {
l1 = this.h.nextInt(16) + 8;
i2 = this.h.nextInt(256);
@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements IChunkProvider {
}
public void recreateStructures(Chunk chunk, int i, int j) {
- if (this.r.w && this.n) {
+ if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot
this.x.a(this, this.m, i, j, (ChunkSnapshot) null);
}
- if (this.r.v && this.n) {
+ if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot
this.w.a(this, this.m, i, j, (ChunkSnapshot) null);
}
- if (this.r.u && this.n) {
+ if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot
this.v.a(this, this.m, i, j, (ChunkSnapshot) null);
}
- if (this.r.x && this.n) {
+ if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot
this.y.a(this, this.m, i, j, (ChunkSnapshot) null);
}
- if (this.r.y && this.n) {
+ if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot
this.A.a(this, this.m, 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderHell.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java
@@ -0,0 +0,0 @@ public class ChunkProviderHell implements IChunkProvider {
IBlockData iblockdata1 = Blocks.NETHERRACK.getBlockData();
for (int l1 = 127; l1 >= 0; --l1) {
- if (l1 < 127 - this.j.nextInt(5) && l1 > this.j.nextInt(5)) {
+ // PaperSpigot start - Configurable flat bedrock worldgen
+ if (l1 < 127 - (h.paperSpigotConfig.generateFlatBedrock ? 0 : this.j.nextInt(5)) &&
+ l1 > (h.paperSpigotConfig.generateFlatBedrock ? 0 : this.j.nextInt(5))) {
+ // PaperSpigot end
IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l);
if (iblockdata2.getBlock() != null && iblockdata2.getBlock().getMaterial() != Material.AIR) {
@@ -0,0 +0,0 @@ public class ChunkProviderHell implements IChunkProvider {
this.a(i, j, chunksnapshot);
this.b(i, j, chunksnapshot);
- this.C.a(this, this.h, i, j, chunksnapshot);
- if (this.i) {
+ if (this.h.paperSpigotConfig.generateCaves) this.C.a(this, this.h, i, j, chunksnapshot); // PaperSpigot
+ if (this.i && this.h.paperSpigotConfig.generateFortress) { // PaperSpigot
this.B.a(this, this.h, i, j, chunksnapshot);
}
@@ -0,0 +0,0 @@ public class ChunkProviderHell implements IChunkProvider {
}
public void recreateStructures(Chunk chunk, int i, int j) {
- this.B.a(this, this.h, i, j, (ChunkSnapshot) null);
+ if (this.h.paperSpigotConfig.generateFortress) this.B.a(this, this.h, i, j, (ChunkSnapshot) null); // PaperSpigot
}
public Chunk getChunkAt(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
}
public boolean b(BlockPosition blockposition) {
+ if (this.c == null) return false; // PaperSpigot
this.a(this.c);
return this.c(blockposition) != null;
}
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
}
public boolean a(World world, BlockPosition blockposition) {
+ if (this.c == null) return false; // PaperSpigot
this.a(world);
Iterator iterator = this.e.values().iterator();
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false );
loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false );
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
log("End credits disabled: " + disableEndCredits);
}
+
+ public boolean generateCanyon;
@ -261,18 +23,254 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 );
+
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BiomeMesa.java
+++ b/src/main/java/net/minecraft/server/BiomeMesa.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
@@ -0,0 +0,0 @@ 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")) {
@@ -0,0 +0,0 @@ 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")));
}
}
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
@@ -0,0 +0,0 @@ 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);
}
}
@@ -0,0 +0,0 @@ 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);
}
}
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderHell.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ 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;
}
@@ -0,0 +0,0 @@ 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();
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 16 Feb 2016 19:15:30 -0600
Date: Thu, 3 Mar 2016 02:21:58 -0600
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nik Gil <nikmanG@users.noreply.github.com>
Date: Mon, 1 Feb 2016 23:47:24 -0700
Date: Thu, 3 Mar 2016 01:50:54 -0600
Subject: [PATCH] Made EntityDismountEvent Cancellable
@ -8,59 +8,25 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityPortalEvent;
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.plugin.PluginManager;
+import org.spigotmc.event.entity.EntityDismountEvent;
// CraftBukkit end
+// PaperSpigot start
+import org.spigotmc.event.entity.EntityDismountEvent;
+// PaperSpigot end
+
public abstract class Entity implements ICommandListener {
// CraftBukkit start
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
}
}
// CraftBukkit end
- pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
+ // PaperSpigot start - make EntityDismountEvent cancellable
+ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), this.vehicle.getBukkitEntity()); // Spigot
+ pluginManager.callEvent(dismountEvent);
+ if (dismountEvent.isCancelled()) return;
+ // PaperSpigot end
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null;
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ import org.bukkit.event.vehicle.VehicleExitEvent;
import co.aikar.timings.SpigotTimings; // Spigot
+// PaperSpigot start
+import org.bukkit.Bukkit;
+import org.spigotmc.event.entity.EntityDismountEvent;
+// PaperSpigot end
+
public abstract class EntityLiving extends Entity {
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
}
// CraftBukkit end
- org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
-
+ // PaperSpigot start - make dismountEvent cancellable
+ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), this.vehicle.getBukkitEntity()); // Spigot
- Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ) ); // Spigot
+ // Paper start - make EntityDismountEvent cancellable
+ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), entity.getBukkitEntity()); // Spigot
+ Bukkit.getPluginManager().callEvent(dismountEvent);
+ if (dismountEvent.isCancelled()) return;
+ // PaperSpigot end
+
if (!this.world.isClientSide) {
this.q(this.vehicle);
}
+ // Paper end
this.passengers.remove(entity);
entity.j = 60;
}
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Wed, 18 Mar 2015 22:55:25 -0600
Date: Tue, 1 Mar 2016 14:54:32 -0600
Subject: [PATCH] Metrics
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void postPlugin(final boolean isPing) throws IOException {
// Server software specific section
- 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
String pluginVersion = (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown";
String serverVersion = Bukkit.getVersion();

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Nov 2014 13:20:22 -0600
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 1 Mar 2016 23:12:03 -0600
Subject: [PATCH] Only refresh abilities if needed
@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
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) {
throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false");
}
getHandle().abilities.isFlying = value;
- getHandle().updateAbilities();
+ if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed
+ if (needsUpdate) getHandle().updateAbilities(); // Paper - Only refresh abilities if needed
}
@Override

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