Compare commits

...

10 Commits

Author SHA1 Message Date
sulu5890 2894af04dc
Update Log4J (1.8.8) (#7150)
* Update Upstream (Craftbukkit)

* update log4j
2021-12-19 16:10:08 -08:00
Zach Brown 4c7641d191 PaperMC/Paper/GH-166 2016-03-29 23:29:14 -05:00
Joseph Hirschfeld 010c651473 Add exception reporting events 2016-03-03 03:46:48 -06:00
Sudzzy 18b55ae547 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.

To abuse the safety check, players are required to get into a location deemed unsafe by Bukkit e.g. be within a chest or door block. While they are in this block, they accept a teleport request from a player within a different world. Once the player teleports, Minecraft will recursively search upwards for a safe location, this could eventually land within a player's skybase.

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.
2016-03-03 03:46:48 -06:00
md_5 e51180b777 SPIGOT-1499: Outdated server message not working 2016-03-03 03:46:48 -06:00
Aikar 4c5668268b Fix ServerListPingEvent flagging as Async 2016-03-03 03:46:48 -06:00
Aikar 9dbab1fcf8 More timings for scheduler 2016-03-03 03:46:48 -06:00
Aikar 0ba78fc192 Make Timings use less passes in its benchmark 2016-03-03 03:46:48 -06:00
Techcable dcad4c6ea7 Improve title API
Uses title objects instead of individual update methods
2016-03-03 03:46:48 -06:00
Joseph Hirschfeld c04cff4f82 Add velocity warnings
Issues #12 & #18
2016-02-22 21:31:56 -06:00
24 changed files with 2112 additions and 170 deletions

@ -1 +1 @@
Subproject commit e1ebe524a78e27f6a2829ed4574fded3779094e1
Subproject commit 741a1bdf3db8c4d5237407df2872d9857427bfaf

View File

@ -1,11 +1,11 @@
From 746ebed064e6b6e4ed3cb8dea091883103e34faa Mon Sep 17 00:00:00 2001
From 172258793066b82c106ae96b396420d0872326cb Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 19:21:58 +1000
Subject: [PATCH] Configurable Messages
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 2d937c1..53823c6 100644
index 2d937c1..a1cae86 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -62,11 +62,11 @@ public class HandshakeListener implements PacketHandshakingInListener {
@ -13,17 +13,17 @@ index 2d937c1..53823c6 100644
if (packethandshakinginsetprotocol.b() > 47) {
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8.8" ) ); // Spigot
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), "1.8.8" ) ); // Spigot
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext);
} else if (packethandshakinginsetprotocol.b() < 47) {
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8.8");
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8.8" ) ); // Spigot
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), "1.8.8" ) ); // Spigot
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext);
} else {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 3838c75..49b908d 100644
index dd3ccd9..4050dba 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -418,7 +418,7 @@ public abstract class PlayerList {
@ -45,7 +45,7 @@ index 3838c75..49b908d 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5ef5f5a..ff60351 100644
index 3be88a3..c0f1d3c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -623,11 +623,7 @@ public final class CraftServer implements Server {
@ -103,5 +103,5 @@ index ca001e9..3726ea5 100644
+ }
}
--
2.1.4
2.5.0

View File

@ -1,4 +1,4 @@
From 0204f55807902b26e73cbeacf9cc7b35e663feac Mon Sep 17 00:00:00 2001
From 39d77ba60351ae8c806c79b5c5d88a2aad25e58d Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Sun, 20 Apr 2014 13:18:55 +0100
Subject: [PATCH] Convert player skulls async
@ -195,7 +195,7 @@ index 0048b65..58014c5 100644
public int getSkullType() {
return this.a;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index ead8a98..ce5425f 100644
index 8355d6c..ee78d00 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -68,13 +68,27 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@ -206,7 +206,7 @@ index ead8a98..ce5425f 100644
+ void applyToItem(final NBTTagCompound tag) { // Spigot - make final
super.applyToItem(tag);
if (hasOwner()) {
if (profile != null) {
NBTTagCompound owner = new NBTTagCompound();
GameProfileSerializer.serialize(owner, profile);
- tag.set(SKULL_OWNER.NBT, owner);
@ -229,5 +229,5 @@ index ead8a98..ce5425f 100644
}
--
2.1.4
2.5.0

@ -1 +1 @@
Subproject commit 1b58efd4de067e40562ba01fefe70cc22a32ffeb
Subproject commit 2d4c7b3bbd322d8b7f3bbe2fe33ecf627251c828

View File

@ -1,11 +1,11 @@
From 5d7fe1d8ba54b000f583088bc50141a184818516 Mon Sep 17 00:00:00 2001
From dfb45aaa99af7c1c146d40b3e5ee4c1040b5e7b1 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Tue, 6 Jan 2015 22:12:31 -0600
Subject: [PATCH] POM changes
diff --git a/pom.xml b/pom.xml
index cb142f2..d63151f 100644
index cb142f21..d63151f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,35 +4,37 @@
@ -59,10 +59,11 @@ index cb142f2..d63151f 100644
</snapshotRepository>
</distributionManagement>
@@ -129,26 +131,6 @@
@@ -128,26 +130,6 @@
</dependency>
</dependencies>
</plugin>
<plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.13</version>
@ -82,10 +83,9 @@ index cb142f2..d63151f 100644
- </signature>
- </configuration>
- </plugin>
- <plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
--
2.7.1
2.34.0

View File

@ -1,30 +1,30 @@
From 445de7fb20febc456d819d052524c63393920b10 Mon Sep 17 00:00:00 2001
From b3325316cc10334a1d85171a8c22c6d9f5e44e57 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 8 Jan 2016 23:12:28 -0600
Subject: [PATCH] Timings v2
diff --git a/pom.xml b/pom.xml
index a2dd938..2f8fcf9 100644
index d63151f1..fe9d6d26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,6 +48,13 @@
@@ -47,6 +47,13 @@
</pluginRepositories>
<dependencies>
<dependency>
+ <dependency>
+ <groupId>net.sf.trove4j</groupId>
+ <artifactId>trove4j</artifactId>
+ <version>3.0.3</version>
+ <!-- Trove Provided by CraftBukkit -->
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
new file mode 100644
index 0000000..cb4e7ba
index 00000000..cb4e7ba8
--- /dev/null
+++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java
@@ -0,0 +1,79 @@
@ -109,7 +109,7 @@ index 0000000..cb4e7ba
+}
diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java
new file mode 100644
index 0000000..c73b617
index 00000000..c73b617c
--- /dev/null
+++ b/src/main/java/co/aikar/timings/NullTimingHandler.java
@@ -0,0 +1,61 @@
@ -176,7 +176,7 @@ index 0000000..c73b617
+}
diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java
new file mode 100644
index 0000000..e3da034
index 00000000..e3da034f
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java
@@ -0,0 +1,81 @@
@ -263,7 +263,7 @@ index 0000000..e3da034
+}
diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java
new file mode 100644
index 0000000..4d990b1
index 00000000..4d990b13
--- /dev/null
+++ b/src/main/java/co/aikar/timings/Timing.java
@@ -0,0 +1,72 @@
@ -341,7 +341,7 @@ index 0000000..4d990b1
+}
diff --git a/src/main/java/co/aikar/timings/TimingData.java b/src/main/java/co/aikar/timings/TimingData.java
new file mode 100644
index 0000000..b62e428
index 00000000..b62e428c
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingData.java
@@ -0,0 +1,105 @@
@ -452,7 +452,7 @@ index 0000000..b62e428
+}
diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java
new file mode 100644
index 0000000..4918a17
index 00000000..4918a17c
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHandler.java
@@ -0,0 +1,193 @@
@ -651,7 +651,7 @@ index 0000000..4918a17
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
new file mode 100644
index 0000000..7a04770
index 00000000..7a047709
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -0,0 +1,276 @@
@ -933,7 +933,7 @@ index 0000000..7a04770
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistoryEntry.java b/src/main/java/co/aikar/timings/TimingHistoryEntry.java
new file mode 100644
index 0000000..eac4e21
index 00000000..eac4e218
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistoryEntry.java
@@ -0,0 +1,59 @@
@ -998,7 +998,7 @@ index 0000000..eac4e21
+}
diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java
new file mode 100644
index 0000000..623dda4
index 00000000..623dda49
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingIdentifier.java
@@ -0,0 +1,102 @@
@ -1106,7 +1106,7 @@ index 0000000..623dda4
+}
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
new file mode 100644
index 0000000..0f7be03
index 00000000..0f7be036
--- /dev/null
+++ b/src/main/java/co/aikar/timings/Timings.java
@@ -0,0 +1,273 @@
@ -1385,7 +1385,7 @@ index 0000000..0f7be03
+}
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
new file mode 100644
index 0000000..3dba3aa
index 00000000..3dba3aa1
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
@@ -0,0 +1,110 @@
@ -1501,7 +1501,7 @@ index 0000000..3dba3aa
+}
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
new file mode 100644
index 0000000..dd78647
index 00000000..fe19ea00
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -0,0 +1,373 @@
@ -1717,7 +1717,7 @@ index 0000000..dd78647
+
+ static long getCost() {
+ // Benchmark the users System.nanotime() for cost basis
+ int passes = 500000;
+ int passes = 100;
+ TimingHandler SAMPLER1 = Timings.ofSafe("Timings Sampler 1");
+ TimingHandler SAMPLER2 = Timings.ofSafe("Timings Sampler 2");
+ TimingHandler SAMPLER3 = Timings.ofSafe("Timings Sampler 3");
@ -1880,7 +1880,7 @@ index 0000000..dd78647
+}
diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java
new file mode 100644
index 0000000..67c39df
index 00000000..67c39df8
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingsManager.java
@@ -0,0 +1,194 @@
@ -2080,7 +2080,7 @@ index 0000000..67c39df
+}
diff --git a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java
new file mode 100644
index 0000000..e3b0ed8
index 00000000..e3b0ed83
--- /dev/null
+++ b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java
@@ -0,0 +1,51 @@
@ -2137,7 +2137,7 @@ index 0000000..e3b0ed8
+}
diff --git a/src/main/java/co/aikar/util/JSONUtil.java b/src/main/java/co/aikar/util/JSONUtil.java
new file mode 100644
index 0000000..5fdf7c4
index 00000000..5fdf7c4c
--- /dev/null
+++ b/src/main/java/co/aikar/util/JSONUtil.java
@@ -0,0 +1,123 @@
@ -2266,7 +2266,7 @@ index 0000000..5fdf7c4
+}
diff --git a/src/main/java/co/aikar/util/LoadingIntMap.java b/src/main/java/co/aikar/util/LoadingIntMap.java
new file mode 100644
index 0000000..8d0f269
index 00000000..8d0f2691
--- /dev/null
+++ b/src/main/java/co/aikar/util/LoadingIntMap.java
@@ -0,0 +1,63 @@
@ -2335,7 +2335,7 @@ index 0000000..8d0f269
+}
diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java
new file mode 100644
index 0000000..a9f2919
index 00000000..a9f29199
--- /dev/null
+++ b/src/main/java/co/aikar/util/LoadingMap.java
@@ -0,0 +1,332 @@
@ -2673,7 +2673,7 @@ index 0000000..a9f2919
+}
diff --git a/src/main/java/co/aikar/util/MRUMapCache.java b/src/main/java/co/aikar/util/MRUMapCache.java
new file mode 100644
index 0000000..3a288d2
index 00000000..3a288d2a
--- /dev/null
+++ b/src/main/java/co/aikar/util/MRUMapCache.java
@@ -0,0 +1,100 @@
@ -2778,7 +2778,7 @@ index 0000000..3a288d2
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 584fe11..a4396e8 100644
index 584fe113..a4396e8b 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -533,7 +533,6 @@ public final class Bukkit {
@ -2790,7 +2790,7 @@ index 584fe11..a4396e8 100644
/**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 26acdda..ae75bd4 100644
index 26acdda0..ae75bd45 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -926,12 +926,27 @@ public interface Server extends PluginMessageRecipient {
@ -2823,7 +2823,7 @@ index 26acdda..ae75bd4 100644
* Sends the component to the player
*
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 0ba9b1c..548d570 100644
index 0ba9b1c9..548d5709 100644
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
@@ -31,7 +31,8 @@ public abstract class Command {
@ -2853,7 +2853,7 @@ index 0ba9b1c..548d570 100644
return true;
}
diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
index 3f07d7f..f89ad07 100644
index 3f07d7f4..f89ad075 100644
--- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java
+++ b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
@@ -14,6 +14,7 @@ public class FormattedCommandAlias extends Command {
@ -2875,7 +2875,7 @@ index 3f07d7f..f89ad07 100644
return i >= j && i <= k;
}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index a08a49d..a300ae7 100644
index a08a49da..a300ae7e 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -31,7 +31,7 @@ public class SimpleCommandMap implements CommandMap {
@ -2896,7 +2896,7 @@ index a08a49d..a300ae7 100644
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 9782a3b..80e0b0f 100644
index 9782a3bb..80e0b0f1 100644
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
@@ -33,87 +33,22 @@ import org.spigotmc.CustomTimingsHandler;
@ -3048,7 +3048,7 @@ index 9782a3b..80e0b0f 100644
- // Spigot end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7522d45..c0ebe65 100644
index 7522d455..c0ebe655 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1203,6 +1203,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
@ -3064,7 +3064,7 @@ index 7522d45..c0ebe65 100644
Spigot spigot();
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index c9d23d6..1325b03 100644
index c9d23d63..1325b032 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -295,7 +295,6 @@ public final class SimplePluginManager implements PluginManager {
@ -3121,7 +3121,7 @@ index c9d23d6..1325b03 100644
}
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 7bf2fa6..4983ea8 100644
index 7bf2fa6e..4983ea8f 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -39,7 +39,6 @@ import org.bukkit.plugin.PluginLoader;
@ -3170,7 +3170,7 @@ index 7bf2fa6..4983ea8 100644
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else {
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 4cffa13..b2cbf9e 100644
index 4cffa137..b2cbf9e4 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -15,7 +15,8 @@ import org.bukkit.plugin.PluginDescriptionFile;
@ -3184,7 +3184,7 @@ index 4cffa13..b2cbf9e 100644
private final Map<String, Class<?>> classes = new java.util.concurrent.ConcurrentHashMap<String, Class<?>>(); // Spigot
private final PluginDescriptionFile description;
diff --git a/src/main/java/org/bukkit/util/CachedServerIcon.java b/src/main/java/org/bukkit/util/CachedServerIcon.java
index 5ca863b..0480470 100644
index 5ca863b3..04804706 100644
--- a/src/main/java/org/bukkit/util/CachedServerIcon.java
+++ b/src/main/java/org/bukkit/util/CachedServerIcon.java
@@ -12,4 +12,6 @@ import org.bukkit.event.server.ServerListPingEvent;
@ -3196,7 +3196,7 @@ index 5ca863b..0480470 100644
+ public String getData(); // Spigot
+}
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
index 8d98297..7e89b97 100644
index 8d982974..7e89b97b 100644
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
@@ -1,165 +1,76 @@
@ -3426,5 +3426,5 @@ index 8d98297..7e89b97 100644
- }
}
--
2.7.0
2.34.0

View File

@ -1,14 +1,24 @@
From 42577385d23a22d17b6f80787db0bf27f8e970d7 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
From 9da88eae7c63d03c2303ddfa86cededaf1244d70 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Tue, 16 Feb 2016 19:51:11 -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 9ebfa47..78fd6dc 100644
index 9ebfa47..d02fe56 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -344,6 +344,78 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
@@ -19,6 +19,9 @@ import org.bukkit.conversations.Conversable;
import org.bukkit.map.MapView;
import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.scoreboard.Scoreboard;
+// PaperSpigot start
+import org.github.paperspigot.Title;
+// PaperSpigot end
/**
* Represents a player, connected or not
@@ -344,6 +347,112 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* @param components the components to send
*/
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components);
@ -30,32 +40,42 @@ index 9ebfa47..78fd6dc 100644
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer);
+
+ /**
+ * Set the times for titles displayed to the player
+ * 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);
+
+ /**
+ * Set the subtitle of titles displayed to the player
+ * 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);
+
+ /**
+ * Set the subtitle of titles displayed to the player
+ * 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);
+
+ /**
@ -66,7 +86,9 @@ index 9ebfa47..78fd6dc 100644
+ * @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);
+
+ /**
@ -77,17 +99,39 @@ index 9ebfa47..78fd6dc 100644
+ * @param fadeInTicks ticks to fade-in
+ * @param stayTicks ticks to stay visible
+ * @param fadeOutTicks ticks to fade-out
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
+ *
+ * <p>This method overrides any previous title, use {@link #updateTitle(Title)} to change the existing one.</p>
+ *
+ * @param title the title to send
+ * @throws NullPointerException if the title is null
+ */
+ void sendTitle(Title title);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
+ *
+ * <p>This method doesn't override previous titles, but changes their values.</p>
+ *
+ * @param title the title to send
+ * @throws NullPointerException if title is null
+ */
+ void updateTitle(Title title);
+
+ /**
+ * Hide any title that is currently visible to the player
+ */
+ public void hideTitle();
// Paper end
/**
@@ -1086,9 +1158,8 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
@@ -1086,9 +1195,8 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
/**
* Resets the title displayed to the player.
@ -98,6 +142,371 @@ index 9ebfa47..78fd6dc 100644
public void resetTitle();
// Spigot start
diff --git a/src/main/java/org/github/paperspigot/Title.java b/src/main/java/org/github/paperspigot/Title.java
new file mode 100644
index 0000000..27f9bc2
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/Title.java
@@ -0,0 +1,358 @@
+package org.github.paperspigot;
+
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.api.chat.TextComponent;
+
+import org.bukkit.entity.Player;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+/**
+ * Represents a title to may be sent to a {@link Player}.
+ * <p>
+ * <p>A title can be sent without subtitle text.</p>
+ */
+public final class Title {
+
+ /**
+ * The default number of ticks for the title to fade in.
+ */
+ public static final int DEFAULT_FADE_IN = 20;
+ /**
+ * The default number of ticks for the title to stay.
+ */
+ public static final int DEFAULT_STAY = 200;
+ /**
+ * The default number of ticks for the title to fade out.
+ */
+ public static final int DEFAULT_FADE_OUT = 20;
+
+ private final BaseComponent[] title;
+ private final BaseComponent[] subtitle;
+ private final int fadeIn;
+ private final int stay;
+ private final int fadeOut;
+
+ /**
+ * Create a title with the default time values and no subtitle.
+ * <p>
+ * <p>Times use default values.</p>
+ *
+ * @param title the main text of the title
+ * @throws NullPointerException if the title is null
+ */
+ public Title(BaseComponent title) {
+ this(title, null);
+ }
+
+ /**
+ * Create a title with the default time values and no subtitle.
+ * <p>
+ * <p>Times use default values.</p>
+ *
+ * @param title the main text of the title
+ * @throws NullPointerException if the title is null
+ */
+ public Title(BaseComponent[] title) {
+ this(title, null);
+ }
+
+ /**
+ * Create a title with the default time values and no subtitle.
+ * <p>
+ * <p>Times use default values.</p>
+ *
+ * @param title the main text of the title
+ * @throws NullPointerException if the title is null
+ */
+ public Title(String title) {
+ this(title, null);
+ }
+
+ /**
+ * Create a title with the default time values.
+ * <p>
+ * <p>Times use default values.</p>
+ *
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ */
+ public Title(BaseComponent title, BaseComponent subtitle) {
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
+ }
+
+ /**
+ * Create a title with the default time values.
+ * <p>
+ * <p>Times use default values.</p>
+ *
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ */
+ public Title(BaseComponent[] title, BaseComponent[] subtitle) {
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
+ }
+
+ /**
+ * Create a title with the default time values.
+ * <p>
+ * <p>Times use default values.</p>
+ *
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ */
+ public Title(String title, String subtitle) {
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
+ }
+
+ /**
+ * Creates a new title.
+ *
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ * @param fadeIn the number of ticks for the title to fade in
+ * @param stay the number of ticks for the title to stay on screen
+ * @param fadeOut the number of ticks for the title to fade out
+ * @throws IllegalArgumentException if any of the times are negative
+ */
+ public Title(BaseComponent title, BaseComponent subtitle, int fadeIn, int stay, int fadeOut) {
+ this(
+ new BaseComponent[]{checkNotNull(title, "title")},
+ subtitle == null ? null : new BaseComponent[]{subtitle},
+ fadeIn,
+ stay,
+ fadeOut
+ );
+ }
+
+ /**
+ * Creates a new title.
+ *
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ * @param fadeIn the number of ticks for the title to fade in
+ * @param stay the number of ticks for the title to stay on screen
+ * @param fadeOut the number of ticks for the title to fade out
+ * @throws IllegalArgumentException if any of the times are negative
+ */
+ public Title(BaseComponent[] title, BaseComponent[] subtitle, int fadeIn, int stay, int fadeOut) {
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
+ this.title = checkNotNull(title, "title");
+ this.subtitle = subtitle;
+ this.fadeIn = fadeIn;
+ this.stay = stay;
+ this.fadeOut = fadeOut;
+ }
+
+ /**
+ * Creates a new title.
+ * <p>
+ * <p>It is recommended to the {@link BaseComponent} constrctors.</p>
+ *
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ * @param fadeIn the number of ticks for the title to fade in
+ * @param stay the number of ticks for the title to stay on screen
+ * @param fadeOut the number of ticks for the title to fade out
+ */
+ public Title(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
+ this(
+ TextComponent.fromLegacyText(checkNotNull(title, "title")),
+ subtitle == null ? null : TextComponent.fromLegacyText(subtitle),
+ fadeIn,
+ stay,
+ fadeOut
+ );
+ }
+
+ /**
+ * Gets the text of this title
+ *
+ * @return the text
+ */
+ public BaseComponent[] getTitle() {
+ return this.title;
+ }
+
+ /**
+ * Gets the text of this title's subtitle
+ *
+ * @return the text
+ */
+ public BaseComponent[] getSubtitle() {
+ return this.subtitle;
+ }
+
+ /**
+ * Gets the number of ticks to fade in.
+ * <p>
+ * <p>The returned value is never negative.</p>
+ *
+ * @return the number of ticks to fade in
+ */
+ public int getFadeIn() {
+ return this.fadeIn;
+ }
+
+ /**
+ * Gets the number of ticks to stay.
+ * <p>
+ * <p>The returned value is never negative.</p>
+ *
+ * @return the number of ticks to stay
+ */
+ public int getStay() {
+ return this.stay;
+ }
+
+ /**
+ * Gets the number of ticks to fade out.
+ * <p>
+ * <p>The returned value is never negative.</p>
+ *
+ * @return the number of ticks to fade out
+ */
+ public int getFadeOut() {
+ return this.fadeOut;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * A builder for creating titles
+ */
+ public static final class Builder {
+
+ private BaseComponent[] title;
+ private BaseComponent[] subtitle;
+ private int fadeIn = DEFAULT_FADE_IN;
+ private int stay = DEFAULT_STAY;
+ private int fadeOut = DEFAULT_FADE_OUT;
+
+ /**
+ * Sets the title to the given text.
+ *
+ * @param title the title text
+ * @return this builder instance
+ * @throws NullPointerException if the title is null
+ */
+ public Builder title(BaseComponent title) {
+ return this.title(new BaseComponent[]{checkNotNull(title, "title")});
+ }
+
+ /**
+ * Sets the title to the given text.
+ *
+ * @param title the title text
+ * @return this builder instance
+ * @throws NullPointerException if the title is null
+ */
+ public Builder title(BaseComponent[] title) {
+ this.title = checkNotNull(title, "title");
+ return this;
+ }
+
+ /**
+ * Sets the title to the given text.
+ * <p>
+ * <p>It is recommended to the {@link BaseComponent} methods.</p>
+ *
+ * @param title the title text
+ * @return this builder instance
+ * @throws NullPointerException if the title is null
+ */
+ public Builder title(String title) {
+ return this.title(TextComponent.fromLegacyText(checkNotNull(title, "title")));
+ }
+
+ /**
+ * Sets the subtitle to the given text.
+ *
+ * @param subtitle the title text
+ * @return this builder instance
+ */
+ public Builder subtitle(BaseComponent subtitle) {
+ return this.subtitle(subtitle == null ? null : new BaseComponent[]{subtitle});
+ }
+
+ /**
+ * Sets the subtitle to the given text.
+ *
+ * @param subtitle the title text
+ * @return this builder instance
+ */
+ public Builder subtitle(BaseComponent[] subtitle) {
+ this.subtitle = subtitle;
+ return this;
+ }
+
+ /**
+ * Sets the subtitle to the given text.
+ * <p>
+ * <p>It is recommended to the {@link BaseComponent} methods.</p>
+ *
+ * @param subtitle the title text
+ * @return this builder instance
+ */
+ public Builder subtitle(String subtitle) {
+ return this.subtitle(subtitle == null ? null : TextComponent.fromLegacyText(subtitle));
+ }
+
+ /**
+ * Sets the number of ticks for the title to fade in
+ *
+ * @param fadeIn the number of ticks to fade in
+ * @return this builder instance
+ * @throws IllegalArgumentException if it is negative
+ */
+ public Builder fadeIn(int fadeIn) {
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
+ this.fadeIn = fadeIn;
+ return this;
+ }
+
+
+ /**
+ * Sets the number of ticks for the title to stay.
+ *
+ * @param stay the number of ticks to stay
+ * @return this builder instance
+ * @throws IllegalArgumentException if it is negative
+ */
+ public Builder stay(int stay) {
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
+ this.stay = stay;
+ return this;
+ }
+
+ /**
+ * Sets the number of ticks for the title to fade out.
+ *
+ * @param fadeOut the number of ticks to fade out
+ * @return this builder instance
+ * @throws IllegalArgumentException if it is negative
+ */
+ public Builder fadeOut(int fadeOut) {
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
+ this.fadeOut = fadeOut;
+ return this;
+ }
+
+ /**
+ * Create a title based on the values in the builder.
+ *
+ * @return a title from the values in this builder
+ * @throws IllegalStateException if title isn't specified
+ */
+ public Title build() {
+ checkState(title != null, "Title not specified");
+ return new Title(this.title, this.subtitle, this.fadeIn, this.stay, this.fadeOut);
+ }
+ }
+}
\ No newline at end of file
--
2.7.1

View File

@ -0,0 +1,615 @@
From 19bf0a56a0ee703d978da8e5f84999d1f5b20602 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 20:07:46 -0500
Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 12d9232..f35bc09 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -17,6 +17,9 @@ 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;
public class SimpleCommandMap implements CommandMap {
private static final Pattern PATTERN_ON_SPACE = Pattern.compile(" ", Pattern.LITERAL);
@@ -147,7 +150,9 @@ public class SimpleCommandMap implements CommandMap {
throw ex;
} catch (Throwable ex) {
target.timings.stopTiming(); // Spigot
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
+ throw new CommandException(msg, ex);
}
// return true as command was handled
@@ -224,7 +229,9 @@ public class SimpleCommandMap implements CommandMap {
} catch (CommandException ex) {
throw ex;
} catch (Throwable ex) {
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
+ throw new CommandException(msg, ex);
}
}
// PaperSpigot end
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 1325b03..ce9839e 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -33,6 +33,9 @@ import org.bukkit.permissions.PermissionDefault;
import org.bukkit.util.FileUtil;
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
@@ -403,7 +406,8 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while enabling "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin);
}
HandlerList.bakeAll();
@@ -422,36 +426,48 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while disabling "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
server.getScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
server.getServicesManager().unregisterAll(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
HandlerList.unregisterAll(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
server.getMessenger().unregisterIncomingPluginChannel(plugin);
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
} catch(Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
}
}
+ // Paper start
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
+ server.getLogger().log(Level.SEVERE, msg, ex);
+ callEvent(new ServerExceptionEvent(new ServerPluginEnableDisableException(msg, ex, plugin)));
+ }
+ // Paper end
+
public void clearPlugins() {
synchronized (this) {
disablePlugins();
@@ -513,7 +529,13 @@ public final class SimplePluginManager implements PluginManager {
));
}
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
+ // Paper start - error reporting
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
+ server.getLogger().log(Level.SEVERE, msg, ex);
+ if (!(event instanceof ServerExceptionEvent)) { // We don't want to cause an endless event loop
+ callEvent(new ServerExceptionEvent(new ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
+ }
+ // Paper end
}
}
}
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
index 4c171e8..9ef6525 100644
--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
@@ -8,6 +8,8 @@ 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}
@@ -427,7 +429,13 @@ 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 0000000..317e9d2
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java
@@ -0,0 +1,36 @@
+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 0000000..aae647a
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerCommandException.java
@@ -0,0 +1,64 @@
+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 0000000..d99cab8
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerEventException.java
@@ -0,0 +1,52 @@
+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 0000000..f7aad05
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerException.java
@@ -0,0 +1,23 @@
+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 0000000..17ad4cb
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerInternalException.java
@@ -0,0 +1,35 @@
+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 0000000..8c938d0
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java
@@ -0,0 +1,20 @@
+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 0000000..f9241ad
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginException.java
@@ -0,0 +1,39 @@
+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 0000000..b71303b
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java
@@ -0,0 +1,61 @@
+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 0000000..99757ee
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java
@@ -0,0 +1,37 @@
+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 0000000..6e1e2ab
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java
@@ -0,0 +1,22 @@
+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);
+ }
+}
--
2.5.0

View File

@ -0,0 +1,54 @@
From f77db2e56a6185471090b6cfeba2c441e19af096 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 24 Feb 2016 00:57:22 -0500
Subject: [PATCH] Fix ServerListPingEvent flagging as Async
This event can sometimes fire Async, set the proper boolean
diff --git a/src/main/java/org/bukkit/event/server/ServerEvent.java b/src/main/java/org/bukkit/event/server/ServerEvent.java
index eb00d6a..70416c8 100644
--- a/src/main/java/org/bukkit/event/server/ServerEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerEvent.java
@@ -1,9 +1,19 @@
package org.bukkit.event.server;
+import org.bukkit.Bukkit;
import org.bukkit.event.Event;
/**
* Miscellaneous server events
*/
public abstract class ServerEvent extends Event {
+ // Paper start
+ public ServerEvent(boolean isAsync) {
+ super(isAsync);
+ }
+
+ public ServerEvent() {
+ super(!Bukkit.isPrimaryThread());
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index 343f238..3c38d85 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -21,6 +21,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
private int maxPlayers;
public ServerListPingEvent(final InetAddress address, final String motd, final int numPlayers, final int maxPlayers) {
+ super(); // Paper - Is this event being fired async?
Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
this.address = address;
this.motd = motd;
@@ -38,6 +39,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param maxPlayers the max number of players
*/
protected ServerListPingEvent(final InetAddress address, final String motd, final int maxPlayers) {
+ super(); // Paper - Is this event being fired async?
this.numPlayers = MAGIC_PLAYER_COUNT;
this.address = address;
this.motd = motd;
--
2.7.1

View File

@ -0,0 +1,54 @@
From 8d551e5b699b7a24a24b6edbc7f014ce1ef9875d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 24 Feb 2016 00:57:22 -0500
Subject: [PATCH] Fix ServerListPingEvent flagging as Async
This event can sometimes fire Async, set the proper boolean
diff --git a/src/main/java/org/bukkit/event/server/ServerEvent.java b/src/main/java/org/bukkit/event/server/ServerEvent.java
index eb00d6af..70416c81 100644
--- a/src/main/java/org/bukkit/event/server/ServerEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerEvent.java
@@ -1,9 +1,19 @@
package org.bukkit.event.server;
+import org.bukkit.Bukkit;
import org.bukkit.event.Event;
/**
* Miscellaneous server events
*/
public abstract class ServerEvent extends Event {
+ // Paper start
+ public ServerEvent(boolean isAsync) {
+ super(isAsync);
+ }
+
+ public ServerEvent() {
+ super(!Bukkit.isPrimaryThread());
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index 343f238f..3c38d857 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -21,6 +21,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
private int maxPlayers;
public ServerListPingEvent(final InetAddress address, final String motd, final int numPlayers, final int maxPlayers) {
+ super(); // Paper - Is this event being fired async?
Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
this.address = address;
this.motd = motd;
@@ -38,6 +39,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param maxPlayers the max number of players
*/
protected ServerListPingEvent(final InetAddress address, final String motd, final int maxPlayers) {
+ super(); // Paper - Is this event being fired async?
this.numPlayers = MAGIC_PLAYER_COUNT;
this.address = address;
this.motd = motd;
--
2.34.0

View File

@ -1,11 +1,11 @@
From 9e315343a720a550c61568b70657ad2076501022 Mon Sep 17 00:00:00 2001
From 8ebd08301a02a9ac7ca1eb8d2022782fa1358559 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 19 Mar 2015 19:41:15 -0500
Subject: [PATCH] POM Changes
diff --git a/pom.xml b/pom.xml
index 91627ff..fd051da 100644
index a6641f15..32593a7f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,12 @@
@ -55,7 +55,7 @@ index 91627ff..fd051da 100644
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
@@ -96,6 +97,11 @@
@@ -102,6 +103,11 @@
<id>spigotmc-public</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</pluginRepository>
@ -67,7 +67,7 @@ index 91627ff..fd051da 100644
</pluginRepositories>
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
@@ -103,36 +109,22 @@
@@ -109,36 +115,22 @@
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
@ -120,7 +120,7 @@ index 91627ff..fd051da 100644
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -142,7 +134,7 @@
@@ -148,7 +140,7 @@
<manifestEntries>
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
<Implementation-Title>CraftBukkit</Implementation-Title>
@ -129,10 +129,11 @@ index 91627ff..fd051da 100644
<Implementation-Vendor>Bukkit Team</Implementation-Vendor>
<Specification-Title>Bukkit</Specification-Title>
<Specification-Version>${api.version}</Specification-Version>
@@ -172,26 +164,6 @@
@@ -177,26 +169,6 @@
</archive>
</configuration>
</plugin>
<plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.13</version>
@ -152,12 +153,11 @@ index 91627ff..fd051da 100644
- </signature>
- </configuration>
- </plugin>
- <plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
index c110e0c..5540dde 100644
index c110e0c2..5540dde5 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
@@ -11,7 +11,7 @@ public class PathfinderGoalNearestAttackableTarget<T extends EntityLiving> exten
@ -170,7 +170,7 @@ index c110e0c..5540dde 100644
public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class<T> oclass, boolean flag) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 9304637..3a4b142 100644
index 93046379..3a4b1424 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
@ -183,5 +183,5 @@ index 9304637..3a4b142 100644
if (stream != null) {
--
2.7.1
2.34.1

View File

@ -1,4 +1,4 @@
From e9f93a9efde92cdfd70b6d404621281f3761c519 Mon Sep 17 00:00:00 2001
From f7aa342f8b6f462e4f53b5e1770cde6f07bfec28 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 25 May 2015 15:37:00 -0500
Subject: [PATCH] mc-dev imports
@ -6,7 +6,7 @@ Subject: [PATCH] mc-dev imports
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
new file mode 100644
index 0000000..0b2277c
index 00000000..0b2277c3
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -0,0 +1,85 @@
@ -97,7 +97,7 @@ index 0000000..0b2277c
+}
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
new file mode 100644
index 0000000..b1ae67a
index 00000000..b1ae67ac
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -0,0 +1,489 @@
@ -592,7 +592,7 @@ index 0000000..b1ae67a
+}
diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java
new file mode 100644
index 0000000..fd827f2
index 00000000..fd827f2d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BiomeMesa.java
@@ -0,0 +1,264 @@
@ -862,7 +862,7 @@ index 0000000..fd827f2
+}
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
new file mode 100644
index 0000000..f725aea
index 00000000..f725aea8
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -0,0 +1,455 @@
@ -1323,7 +1323,7 @@ index 0000000..f725aea
+}
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
new file mode 100644
index 0000000..29f8554
index 00000000..29f85549
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -0,0 +1,75 @@
@ -1404,7 +1404,7 @@ index 0000000..29f8554
+}
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
new file mode 100644
index 0000000..b610450
index 00000000..b6104502
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
@@ -0,0 +1,212 @@
@ -1622,7 +1622,7 @@ index 0000000..b610450
+}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
new file mode 100644
index 0000000..2bd5499
index 00000000..2bd54991
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -0,0 +1,260 @@
@ -1888,7 +1888,7 @@ index 0000000..2bd5499
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
new file mode 100644
index 0000000..d1e10c6
index 00000000..d1e10c6e
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
@@ -0,0 +1,244 @@
@ -2138,7 +2138,7 @@ index 0000000..d1e10c6
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
new file mode 100644
index 0000000..e0be3c1
index 00000000..e0be3c12
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
@@ -0,0 +1,472 @@
@ -2616,7 +2616,7 @@ index 0000000..e0be3c1
+}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java
new file mode 100644
index 0000000..2f01bbf
index 00000000..2f01bbf5
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java
@@ -0,0 +1,393 @@
@ -3015,7 +3015,7 @@ index 0000000..2f01bbf
+}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
new file mode 100644
index 0000000..55f04b4
index 00000000..55f04b47
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
@@ -0,0 +1,145 @@
@ -3166,7 +3166,7 @@ index 0000000..55f04b4
+}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
new file mode 100644
index 0000000..57b3d9d
index 00000000..57b3d9d0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -0,0 +1,100 @@
@ -3272,7 +3272,7 @@ index 0000000..57b3d9d
+}
diff --git a/src/main/java/net/minecraft/server/ItemMilkBucket.java b/src/main/java/net/minecraft/server/ItemMilkBucket.java
new file mode 100644
index 0000000..91ea70d
index 00000000..91ea70d0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemMilkBucket.java
@@ -0,0 +1,35 @@
@ -3313,7 +3313,7 @@ index 0000000..91ea70d
+}
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
new file mode 100644
index 0000000..620685a
index 00000000..620685ad
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -0,0 +1,12 @@
@ -3331,7 +3331,7 @@ index 0000000..620685a
+}
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
new file mode 100644
index 0000000..d5eaa24
index 00000000..d5eaa241
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -0,0 +1,222 @@
@ -3557,9 +3557,50 @@ index 0000000..d5eaa24
+
+ protected abstract boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k);
+}
diff --git a/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java b/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java
new file mode 100644
index 00000000..1d2e8556
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java
@@ -0,0 +1,35 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+import java.security.PrivateKey;
+import javax.crypto.SecretKey;
+
+public class PacketLoginInEncryptionBegin implements Packet<PacketLoginInListener> {
+
+ private byte[] a = new byte[0];
+ private byte[] b = new byte[0];
+
+ public PacketLoginInEncryptionBegin() {}
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
+ this.a = packetdataserializer.a();
+ this.b = packetdataserializer.a();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
+ packetdataserializer.a(this.a);
+ packetdataserializer.a(this.b);
+ }
+
+ public void a(PacketLoginInListener packetlogininlistener) {
+ packetlogininlistener.a(this);
+ }
+
+ public SecretKey a(PrivateKey privatekey) {
+ return MinecraftEncryption.a(privatekey, this.a);
+ }
+
+ public byte[] b(PrivateKey privatekey) {
+ return privatekey == null ? this.b : MinecraftEncryption.b(privatekey, this.b);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
new file mode 100644
index 0000000..1606d6d
index 00000000..1606d6d9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
@@ -0,0 +1,33 @@
@ -3598,7 +3639,7 @@ index 0000000..1606d6d
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
new file mode 100644
index 0000000..2711298
index 00000000..27112986
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
@@ -0,0 +1,103 @@
@ -3707,7 +3748,7 @@ index 0000000..2711298
+}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
new file mode 100644
index 0000000..6014b09
index 00000000..6014b092
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
@@ -0,0 +1,23 @@
@ -3736,7 +3777,7 @@ index 0000000..6014b09
+}
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
new file mode 100644
index 0000000..0a14c9d
index 00000000..0a14c9d4
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -0,0 +1,219 @@
@ -3961,7 +4002,7 @@ index 0000000..0a14c9d
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
new file mode 100644
index 0000000..794cdc8
index 00000000..794cdc80
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -0,0 +1,87 @@
@ -4054,7 +4095,7 @@ index 0000000..794cdc8
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
new file mode 100644
index 0000000..f75e2de
index 00000000..f75e2de6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -0,0 +1,16 @@
@ -4075,5 +4116,5 @@ index 0000000..f75e2de
+ }
+}
--
2.7.1
2.34.0

View File

@ -1,14 +1,14 @@
From d50dae836a3d3f52e9c5be6089246adadbb71628 Mon Sep 17 00:00:00 2001
From 6f0ca74e6526a72310e6c0f06b4e2a3e21a375f9 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 19e47f4..68073c0 100644
index 32593a7fa..609000dfd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,6 +130,7 @@
@@ -136,6 +136,7 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
@ -17,5 +17,5 @@ index 19e47f4..68073c0 100644
<manifestEntries>
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
--
2.7.1
2.34.0

View File

@ -1,11 +1,11 @@
From 90cfceb6acf7723815e95fee4f9f6a24277bae50 Mon Sep 17 00:00:00 2001
From 4222b417aed27fedcce9ca54c96f63fa17e504bb Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Thu, 23 Apr 2015 17:26:21 -0400
Subject: [PATCH] Optimize Spigot's Anti X-Ray
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 06c7057..fb16a8a 100644
index 06c70578..fb16a8ad 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -252,6 +252,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -17,7 +17,7 @@ index 06c7057..fb16a8a 100644
timings.doChunkMap.startTiming(); // Spigot
this.manager.flush();
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
index 7221b50..5466a61 100644
index 7221b507..5466a61c 100644
--- a/src/main/java/org/spigotmc/AntiXray.java
+++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -8,6 +8,11 @@ import net.minecraft.server.Blocks;
@ -43,10 +43,11 @@ index 7221b50..5466a61 100644
public AntiXray(SpigotWorldConfig config)
{
@@ -44,6 +53,25 @@ public class AntiXray
@@ -43,6 +52,25 @@ public class AntiXray
replacementOres = blocks.toArray();
}
/**
+ /**
+ * PaperSpigot - Flush queued block updates for world.
+ */
+ public void flushUpdates(World world)
@ -65,10 +66,9 @@ index 7221b50..5466a61 100644
+ }
+ }
+
+ /**
/**
* Starts the timings handler, then updates all blocks within the set radius
* of the given coordinate, revealing them if they are hidden ores.
*/
@@ -51,6 +79,13 @@ public class AntiXray
{
if ( world.spigotConfig.antiXray )
@ -84,5 +84,5 @@ index 7221b50..5466a61 100644
updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower
update.stopTiming();
--
2.6.0
2.34.0

View File

@ -1,4 +1,4 @@
From 6ee5f9facbcd8fb924f76c21d31ab60a8e45b52f Mon Sep 17 00:00:00 2001
From d19bcfa1cb87ce084c3ddfe845cc7e3a99b270e4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 8 Jan 2016 23:36:39 -0600
Subject: [PATCH] Timings v2
@ -6,10 +6,10 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/SpigotTimings.java b/src/main/java/co/aikar/timings/SpigotTimings.java
new file mode 100644
index 0000000..a1aaaa2
index 00000000..b3cafafc
--- /dev/null
+++ b/src/main/java/co/aikar/timings/SpigotTimings.java
@@ -0,0 +1,110 @@
@@ -0,0 +1,111 @@
+package co.aikar.timings;
+
+import net.minecraft.server.*;
@ -23,7 +23,8 @@ index 0000000..a1aaaa2
+ public static final Timing playerListTimer = Timings.ofSafe("Player List");
+ public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
+ public static final Timing tickablesTimer = Timings.ofSafe("Tickables");
+ public static final Timing schedulerTimer = Timings.ofSafe("Scheduler");
+ public static final Timing minecraftSchedulerTimer = Timings.ofSafe("Minecraft Scheduler");
+ public static final Timing bukkitSchedulerTimer = Timings.ofSafe("Bukkit Scheduler");
+ public static final Timing chunkIOTickTimer = Timings.ofSafe("ChunkIOTick");
+ public static final Timing timeUpdateTimer = Timings.ofSafe("Time Update");
+ public static final Timing serverCommandTimer = Timings.ofSafe("Server Command");
@ -122,7 +123,7 @@ index 0000000..a1aaaa2
+}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644
index 0000000..9ebc710
index 00000000..9ebc710f
--- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +1,69 @@
@ -196,7 +197,7 @@ index 0000000..9ebc710
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index c26975a..a784e04 100644
index c26975a0..a784e04a 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -65,6 +65,16 @@ public class Block {
@ -217,7 +218,7 @@ index c26975a..a784e04 100644
protected double minY;
protected double minZ;
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 45cea14..088beb2 100644
index 45cea142..088beb22 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -20,7 +20,7 @@ import java.io.PrintStream;
@ -230,7 +231,7 @@ index 45cea14..088beb2 100644
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 20cc946..ef59b40 100644
index 20cc9469..ef59b402 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -16,7 +16,8 @@ import org.bukkit.entity.Hanging;
@ -269,7 +270,7 @@ index 20cc946..ef59b40 100644
private void recalcPosition() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0de13bb..19a743c 100644
index 0de13bb0..19a743c2 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -23,7 +23,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
@ -340,7 +341,7 @@ index 0de13bb..19a743c 100644
this.world.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index eac71e8..4a421ba 100644
index eac71e82..ee099222 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -45,7 +45,7 @@ import jline.console.ConsoleReader;
@ -370,7 +371,7 @@ index eac71e8..4a421ba 100644
long i = System.nanoTime();
++this.ticks;
@@ -757,8 +759,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
@@ -757,11 +759,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.methodProfiler.b();
this.methodProfiler.b();
org.spigotmc.WatchdogThread.tick(); // Spigot
@ -380,8 +381,29 @@ index eac71e8..4a421ba 100644
}
public void B() {
+ SpigotTimings.minecraftSchedulerTimer.startTiming(); // Spigot
this.methodProfiler.a("jobs");
Queue queue = this.j;
@@ -772,13 +774,14 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
SystemUtils.a(entry, MinecraftServer.LOGGER);
}
// Spigot end
+ SpigotTimings.minecraftSchedulerTimer.stopTiming(); // Spigot
this.methodProfiler.c("levels");
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ SpigotTimings.bukkitSchedulerTimer.startTiming(); // Spigot
// CraftBukkit start
this.server.getScheduler().mainThreadHeartbeat(this.ticks);
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
+ SpigotTimings.bukkitSchedulerTimer.stopTiming(); // Spigot
// Run tasks that are waiting on processing
SpigotTimings.processQueueTimer.startTiming(); // Spigot
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 2ab01a1..1138042 100644
index 2ab01a1f..11380423 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -60,6 +60,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
@ -429,7 +451,7 @@ index 2ab01a1..1138042 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 3fc6450..fdcbf44 100644
index 3fc6450a..fdcbf443 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -6,12 +6,13 @@ import java.util.concurrent.Callable;
@ -449,7 +471,7 @@ index 3fc6450..fdcbf44 100644
private static Map<String, Class<? extends TileEntity>> f = Maps.newHashMap();
private static Map<Class<? extends TileEntity>, String> g = Maps.newHashMap();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 13ab789..56cddeb 100644
index b957bd27..a76d83c7 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -7,13 +7,14 @@ import org.bukkit.Bukkit;
@ -559,7 +581,7 @@ index 13ab789..56cddeb 100644
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 6186f6c..ad51256 100644
index fb16a8ad..3a2ca89c 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -245,13 +245,13 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -643,7 +665,7 @@ index 6186f6c..ad51256 100644
this.methodProfiler.b();
this.V.clear();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7da8d67..97f9f96 100644
index 7da8d67d..97f9f96e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -329,6 +329,7 @@ public final class CraftServer implements Server {
@ -654,14 +676,14 @@ index 7da8d67..97f9f96 100644
}
}
@@ -1715,13 +1716,32 @@ public final class CraftServer implements Server {
@@ -1715,12 +1716,31 @@ public final class CraftServer implements Server {
}
// PaperSpigot end
+ @Deprecated
@Override
public YamlConfiguration getConfig()
{
+ {
+ return getBukkitConfig();
+ }
+
@ -673,23 +695,22 @@ index 7da8d67..97f9f96 100644
+
+ @Override
+ public YamlConfiguration getSpigotConfig()
+ {
{
return org.spigotmc.SpigotConfig.config;
}
@Override
+ @Override
+ public YamlConfiguration getPaperSpigotConfig()
+ {
+ return org.github.paperspigot.PaperSpigotConfig.config;
+ }
+
+ @Override
@Override
public void restart() {
org.spigotmc.RestartCommand.restart();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
deleted file mode 100644
index 41d2d87..0000000
index 41d2d87e..00000000
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
+++ /dev/null
@@ -1,173 +0,0 @@
@ -867,7 +888,7 @@ index 41d2d87..0000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1135f83..e8c6d5e 100644
index 1135f83c..e8c6d5ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1496,6 +1496,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -884,7 +905,7 @@ index 1135f83..e8c6d5e 100644
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 93d8d42..d76ec40 100644
index 93d8d424..d76ec40a 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -186,7 +186,7 @@ public class CraftScheduler implements BukkitScheduler {
@ -925,7 +946,7 @@ index 93d8d42..d76ec40 100644
task.getOwner().getLogger().log(
Level.WARNING,
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 220e39a..4b1e352 100644
index 220e39ab..4b1e3523 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -1,8 +1,8 @@
@ -1005,7 +1026,7 @@ index 220e39a..4b1e352 100644
- // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
index e52ef47..bd0b887 100644
index e52ef47b..bd0b8873 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
@@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon;
@ -1017,7 +1038,7 @@ index e52ef47..bd0b887 100644
this.value = value;
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 5b0c64d..d3767d2 100644
index 5b0c64d2..d3767d2a 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -31,8 +31,8 @@ import net.minecraft.server.EntityWither;
@ -1032,7 +1053,7 @@ index 5b0c64d..d3767d2 100644
public class ActivationRange
{
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
index 5466a61..c2ad90c 100644
index 5466a61c..c2ad90c8 100644
--- a/src/main/java/org/spigotmc/AntiXray.java
+++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -7,6 +7,7 @@ import net.minecraft.server.BlockPosition;
@ -1078,7 +1099,7 @@ index 5466a61..c2ad90c 100644
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index f6a67d6..93825d9 100644
index f6a67d68..b9d185d9 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -12,8 +12,10 @@ import java.util.HashSet;
@ -1142,5 +1163,5 @@ index f6a67d6..93825d9 100644
{
int count = getInt( "settings.netty-threads", 4 );
--
2.7.0.windows.2
2.34.0

View File

@ -1,4 +1,4 @@
From fc03f8e2a41a7fa9e6239985714d2509eb0a3e76 Mon Sep 17 00:00:00 2001
From 80b20092e304d27660bf79623f9187c93cf28984 Mon Sep 17 00:00:00 2001
From: DemonWav <demonwav@gmail.com>
Date: Sat, 30 Jan 2016 19:17:19 -0600
Subject: [PATCH] Add Location support to tab completers (vanilla feature
@ -6,10 +6,10 @@ Subject: [PATCH] Add Location support to tab completers (vanilla feature
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4a421ba..ff8770b 100644
index ee09922..b400ce0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1151,7 +1151,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
@@ -1153,7 +1153,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
return arraylist;
}
*/
@ -149,5 +149,5 @@ index 00057a1..c3c374d 100644
+ }
}
--
2.7.0.windows.2
2.7.1

View File

@ -1,11 +1,11 @@
From c27a95f1caa97ff1b026429367c16abd20e46ed2 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
From 88944a9edb0263524b98a1f1731831a360de0bd9 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Tue, 16 Feb 2016 19:45:55 -0600
Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
index 1606d6d..89a5056 100644
index 1606d6d..795e70a 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
@@ -4,6 +4,8 @@ import java.io.IOException;
@ -17,7 +17,7 @@ index 1606d6d..89a5056 100644
private IChatBaseComponent a;
private IChatBaseComponent b;
@@ -19,15 +21,22 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene
@@ -19,15 +21,30 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
@ -41,13 +41,17 @@ index 1606d6d..89a5056 100644
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
-
- public void a(PacketListener packetlistener) {
- this.a((PacketListenerPlayOut) packetlistener);
- }
+ // PaperSpigot start - fix compile error
+ /*
public void a(PacketListener packetlistener) {
this.a((PacketListenerPlayOut) packetlistener);
}
+ */
+ // PaperSpigot end
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
index 2711298..071215e 100644
index 2711298..20016b5 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
@@ -10,6 +10,18 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
@ -84,22 +88,35 @@ index 2711298..071215e 100644
}
if (this.a == EnumTitleAction.TIMES) {
@@ -60,10 +78,6 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
@@ -60,9 +78,13 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
packetlistenerplayout.a(this);
}
- public void a(PacketListener packetlistener) {
- this.a((PacketListenerPlayOut) packetlistener);
- }
-
+ // PaperSpigot start - fix compile error
+ /*
public void a(PacketListener packetlistener) {
this.a((PacketListenerPlayOut) packetlistener);
}
+ */
+ // PaperSpigot end
public static enum EnumTitleAction {
TITLE, SUBTITLE, TIMES, CLEAR, RESET;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index dba0520..cabef35 100644
index dba0520..3075076 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -176,6 +176,65 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -64,6 +64,9 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.StandardMessenger;
import org.bukkit.scoreboard.Scoreboard;
+// PaperSpigot start
+import org.github.paperspigot.Title;
+// PaperSpigot end
@DelegateDeserialization(CraftOfflinePlayer.class)
public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -176,6 +179,83 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
packet.components = components;
getHandle().playerConnection.sendPacket(packet);
}
@ -159,6 +176,24 @@ index dba0520..cabef35 100644
+ }
+
+ @Override
+ public void sendTitle(Title title) {
+ Preconditions.checkNotNull(title, "Title is null");
+ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut());
+ setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle());
+ showTitle(title.getTitle());
+ }
+
+ @Override
+ public void updateTitle(Title title) {
+ Preconditions.checkNotNull(title, "Title is null");
+ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut());
+ if (title.getSubtitle() != null) {
+ setSubtitle(title.getSubtitle());
+ }
+ showTitle(title.getTitle());
+ }
+
+ @Override
+ public void hideTitle() {
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, (BaseComponent[]) null, 0, 0, 0));
+ }

View File

@ -0,0 +1,52 @@
From 34a2d7adb137bd4481b238bc5a80aaf0cbbbc7db Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Mon, 22 Feb 2016 16:05:32 -0500
Subject: [PATCH] Add velocity warnings
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 5df3476..4f91799 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -25,6 +25,7 @@ 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() {
@@ -205,6 +206,15 @@ 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 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 ea5a427..d6d9899 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -216,4 +216,10 @@ public class PaperSpigotConfig
e.printStackTrace();
}
}
+
+ public static boolean warnForExcessiveVelocity;
+ private static void excessiveVelocityWarning()
+ {
+ warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true);
+ }
}
--
2.7.1

View File

@ -0,0 +1,43 @@
From bb89655d63addb4ee096d8cec88b4c54e2a2d383 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Sun, 28 Feb 2016 18:33:06 +0000
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.
To abuse the safety check, players are required to get into a location deemed unsafe by Bukkit e.g. be within a chest or door block. While they are in this block, they accept a teleport request from a player within a different world. Once the player teleports, Minecraft will recursively search upwards for a safe location, this could eventually land within a player's skybase.
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/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3075076..b7b3bd6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -565,7 +565,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (fromWorld == toWorld) {
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);
}
return true;
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 6ad8e81..3539c90 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -402,4 +402,10 @@ public class PaperSpigotWorldConfig
{
portalSearchRadius = getInt("portal-search-radius", 128);
}
+
+ public boolean disableTeleportationSuffocationCheck;
+ private void disableTeleportationSuffocationCheck()
+ {
+ disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false);
+ }
}
--
2.7.2

View File

@ -0,0 +1,466 @@
From 3222d65f280871d3cc7b9a3d0250934dcc5f456c Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 20:07:46 -0500
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 aa555f5..ab0d41c 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -18,6 +18,9 @@ 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 {
@@ -869,10 +872,15 @@ 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 0e6a37f..c4dab42 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -15,12 +15,15 @@ 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 {
@@ -215,11 +218,14 @@ 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;
@@ -244,7 +250,11 @@ 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 d67539c..4029109 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -25,6 +25,9 @@ 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 {
@@ -361,6 +364,7 @@ public class NameReferencingFileConverter {
root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1));
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
if (root != null) {
@@ -374,8 +378,9 @@ 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 451f481..6459594 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -2,6 +2,10 @@ 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;
@@ -103,6 +107,7 @@ public class PersistentCollection {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception);
}
}
@@ -176,6 +181,7 @@ 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 348706f..8165a50 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,6 +1,8 @@
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;
@@ -82,6 +84,7 @@ public class RegionFile {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
@@ -247,6 +250,7 @@ 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 5b000c4..4cfaf30 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -1,6 +1,8 @@
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;
@@ -53,6 +55,7 @@ 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 611b8fd..284f4bf 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -10,6 +10,7 @@ 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 {
@@ -171,6 +172,7 @@ 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;
}
@@ -276,6 +278,7 @@ 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 fdcbf44..f68b132 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -9,6 +9,7 @@ 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 {
@@ -76,6 +77,7 @@ 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 42d6737..01dbc98 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.github.paperspigot.exception.ServerInternalException;
+
import java.util.Iterator;
import java.util.List;
@@ -136,6 +138,7 @@ 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 f0cd810..8f3511f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -24,6 +24,8 @@ 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
@@ -1450,8 +1452,10 @@ 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
@@ -1513,8 +1517,10 @@ 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 e5124af..b4056a2 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -15,6 +15,7 @@ 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 {
@@ -96,6 +97,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
return new WorldData(nbttagcompound1);
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
@@ -107,6 +109,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
return new WorldData(nbttagcompound1);
} catch (Exception exception1) {
exception1.printStackTrace();
+ ServerInternalException.reportInternalException(exception1); // Paper
}
}
@@ -140,6 +143,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
} catch (Exception exception) {
exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper
}
}
@@ -171,6 +175,7 @@ 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 72c0b17..7640070 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -55,6 +55,7 @@ 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;
@@ -778,6 +779,7 @@ 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 d76ec40..f036709 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -21,6 +21,9 @@ 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:
@@ -348,18 +351,24 @@ 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
new file mode 100644
index 0000000..6499373
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java
@@ -0,0 +1,39 @@
+package org.github.paperspigot;
+
+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;
+
+/**
+ * Reporting wrapper to catch exceptions not natively
+ */
+public class ServerSchedulerReportingWrapper implements Runnable {
+
+ private final CraftTask internalTask;
+
+ public ServerSchedulerReportingWrapper(CraftTask internalTask) {
+ this.internalTask = Preconditions.checkNotNull(internalTask, "internalTask");
+ }
+
+ @Override
+ public void run() {
+ try {
+ internalTask.run();
+ } catch (RuntimeException e) {
+ internalTask.getOwner().getServer().getPluginManager().callEvent(
+ new ServerExceptionEvent(new ServerSchedulerException(e, internalTask))
+ );
+ throw e;
+ } catch (Throwable t) {
+ internalTask.getOwner().getServer().getPluginManager().callEvent(
+ new ServerExceptionEvent(new ServerSchedulerException(t, internalTask))
+ ); //Do not rethrow, since it is not permitted with Runnable#run
+ }
+ }
+
+ public CraftTask getInternalTask() {
+ return internalTask;
+ }
+}
--
2.5.0

View File

@ -0,0 +1,48 @@
From dc74220050b2649edcd76d58e5becfe9f8280d9d Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 29 Mar 2016 23:20:10 -0500
Subject: [PATCH] PaperMC/Paper/GH-166
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index f426c2e..e2eb305 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -46,8 +46,16 @@ public class PacketDataSerializer extends ByteBuf {
this.writeBytes(abyte);
}
+ // Paper start
public byte[] a() {
- byte[] abyte = new byte[this.e()];
+ return readByteArray(Short.MAX_VALUE);
+ }
+
+ public byte[]readByteArray(int limit) {
+ int len = this.e();
+ if (len > limit) throw new DecoderException("The received a byte array longer than allowed " + len + " > " + limit);
+ byte[] abyte = new byte[len];
+ // Paper end
this.readBytes(abyte);
return abyte;
diff --git a/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java b/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java
index 1d2e855..da9d4d8 100644
--- a/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java
+++ b/src/main/java/net/minecraft/server/PacketLoginInEncryptionBegin.java
@@ -12,8 +12,10 @@ public class PacketLoginInEncryptionBegin implements Packet<PacketLoginInListene
public PacketLoginInEncryptionBegin() {}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
- this.a = packetdataserializer.a();
- this.b = packetdataserializer.a();
+ // Paper start
+ this.a = packetdataserializer.readByteArray(256);
+ this.b = packetdataserializer.readByteArray(256);
+ // Paper end
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
--
2.7.4

View File

@ -0,0 +1,102 @@
From 58ba50518555c19119973f40dd18501b31330f39 Mon Sep 17 00:00:00 2001
From: sulu5890 <sulu@sulu.me>
Date: Fri, 17 Dec 2021 12:53:42 -0600
Subject: [PATCH] update log4j
diff --git a/pom.xml b/pom.xml
index 609000df..644305e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
<scope>compile</scope>
</dependency>
<dependency>
@@ -64,7 +64,7 @@
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
- <version>2.12</version>
+ <version>2.12.1</version> <!-- Paper - Update Log4j - use this specific version as it works on both aarch64 and windows -->
<type>jar</type>
<scope>compile</scope>
</dependency>
@@ -105,8 +105,8 @@
</pluginRepository>
<!-- PaperSpigot - Repo for gitdescribe -->
<pluginRepository>
- <id>destroystokyo</id>
- <url>https://ci.destroystokyo.com/plugin/repository/everything/</url>
+ <id>papermc</id> <!-- Paper - Update Log4j -->
+ <url>https://papermc.io/repo/repository/maven-public/</url> <!-- Paper - Update Log4j -->
</pluginRepository>
</pluginRepositories>
@@ -146,6 +146,7 @@
<Specification-Title>Bukkit</Specification-Title>
<Specification-Version>${api.version}</Specification-Version>
<Specification-Vendor>Bukkit Team</Specification-Vendor>
+ <Multi-Release>true</Multi-Release> <!-- Paper - update log4j -->
</manifestEntries>
<manifestSections>
<manifestSection>
@@ -173,7 +174,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>2.3</version>
+ <version>3.2.4</version> <!-- Paper - Update Log4j -->
<executions>
<execution>
<phase>package</phase>
@@ -181,6 +182,16 @@
<goal>shade</goal>
</goals>
<configuration>
+ <!-- Paper start - Update Log4j -->
+ <filters>
+ <filter>
+ <artifact>org.spigotmc:minecraft-server:**</artifact>
+ <excludes>
+ <exclude>org/apache/logging/log4j/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <!-- Paper end - Update Log4j -->
<relocations>
<relocation>
<pattern>joptsimple</pattern>
@@ -218,7 +229,7 @@
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
- <version>1.2.1</version>
+ <version>1.2.3</version> <!-- paper - bump log4j -->
<executions>
<execution>
<phase>package</phase>
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 0452fbc0..63cb069f 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -3,10 +3,10 @@
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<Queue name="TerminalConsole">
- <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg{nolookups}%n" />
+ <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" /> <!-- Paper - update log4j -->
</Queue>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
- <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
+ <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" /> <!-- Paper - update log4j -->
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
--
2.34.1

View File

@ -1,14 +1,16 @@
#!/usr/bin/env bash
basedir="$(cd "$1" && pwd -P)"
cp ./PaperSpigot-Server/target/paperspigot*-SNAPSHOT.jar ./Paperclip/paperspigot-1.8.8.jar
cp ./work/1.8.8/1.8.8.jar ./Paperclip/minecraft_server.1.8.8.jar
cd ./Paperclip
mvn clean package
mvn clean package -Dmcver=1.8.8 "-Dpaperjar=$basedir/Paperclip/paperspigot-1.8.8.jar" "-Dvanillajar=$basedir/Paperclip/minecraft_server.1.8.8.jar"
cd ..
cp ./Paperclip/target/paperclip*-SNAPSHOT.jar ./Paperclip.jar
cp ./Paperclip/assembly/target/paperclip*.jar ./paperclip.jar
echo ""
echo ""
echo ""
echo "Build success!"
echo "Copied final jar to $(pwd)/Paperclip.jar"
echo "Copied final jar to $(pwd)/paperclip.jar"

View File

@ -30,7 +30,7 @@
<repositories>
<repository>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
<url>https://repo.md-5.net/content/repositories/releases/</url>
</repository>
</repositories>
@ -44,4 +44,4 @@
<url>https://repo.destroystokyo.com/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
</project>