API patches

This commit is contained in:
Nassim Jahnke 2022-06-07 19:20:30 +02:00
parent 56e64243ed
commit 028e2d9f00
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
381 changed files with 263 additions and 311 deletions

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add FastUtil to Bukkit
Doesn't expose to plugins, just allows Paper-API to use it for optimization Doesn't expose to plugins, just allows Paper-API to use it for optimization
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index e49f4853e36f493754841231eeb5dd093b3788e0..98afa6a25131dc626ea7a5122f33df6bd2d39178 100644 index 8372fb4347113bc7dbd1bff738236b388a72e185..c37a91b393c6e64cfe04c7bdd404bc267d1d339e 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -19,6 +19,7 @@ dependencies { @@ -18,6 +18,7 @@ dependencies {
api("com.googlecode.json-simple:json-simple:1.1.1") { api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit isTransitive = false // includes junit
} }

View File

@ -7,10 +7,10 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 98afa6a25131dc626ea7a5122f33df6bd2d39178..eefc024acc3e14ae21855df7f2f358bd1e0a9e38 100644 index c37a91b393c6e64cfe04c7bdd404bc267d1d339e..9b3621a09bd37945877752c801cdd9283017522c 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -8,18 +8,37 @@ java { @@ -8,17 +8,36 @@ java {
withJavadocJar() withJavadocJar()
} }
@ -29,7 +29,6 @@ index 98afa6a25131dc626ea7a5122f33df6bd2d39178..eefc024acc3e14ae21855df7f2f358bd
+ +
dependencies { dependencies {
// api dependencies are listed transitively to API consumers // api dependencies are listed transitively to API consumers
api("commons-lang:commons-lang:2.6")
api("com.google.guava:guava:31.0.1-jre") api("com.google.guava:guava:31.0.1-jre")
api("com.google.code.gson:gson:2.8.9") api("com.google.code.gson:gson:2.8.9")
- api("net.md-5:bungeecord-chat:1.16-R0.4") - api("net.md-5:bungeecord-chat:1.16-R0.4")
@ -49,7 +48,7 @@ index 98afa6a25131dc626ea7a5122f33df6bd2d39178..eefc024acc3e14ae21855df7f2f358bd
// Paper end // Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.8.4") compileOnly("org.apache.maven:maven-resolver-provider:3.8.4")
@@ -77,9 +96,24 @@ tasks.withType<Javadoc> { @@ -76,9 +95,24 @@ tasks.withType<Javadoc> {
"https://guava.dev/releases/31.0.1-jre/api/docs/", "https://guava.dev/releases/31.0.1-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/1.30/", "https://javadoc.io/doc/org.yaml/snakeyaml/1.30/",
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations "https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations
@ -1046,7 +1045,7 @@ index cf53aead2eb5a52f1505ca694e95108fce28aa18..14b078e8fa4347dd0e186e5847693904
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
index 77553fe2e7c1b6a4a9c566e663beffd85bdbd21d..c6d09a8bf2157d4c1c8c40fbb78ddcbbef8b762a 100644 index 21b95d404fbdf7f972f8a13ecd07dc28481f2286..da844079a9d3efd1a92c892de79fc7b3aeecaf4b 100644
--- a/src/main/java/org/bukkit/Sound.java --- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java +++ b/src/main/java/org/bukkit/Sound.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
@ -1058,7 +1057,7 @@ index 77553fe2e7c1b6a4a9c566e663beffd85bdbd21d..c6d09a8bf2157d4c1c8c40fbb78ddcbb
AMBIENT_BASALT_DELTAS_ADDITIONS("ambient.basalt_deltas.additions"), AMBIENT_BASALT_DELTAS_ADDITIONS("ambient.basalt_deltas.additions"),
AMBIENT_BASALT_DELTAS_LOOP("ambient.basalt_deltas.loop"), AMBIENT_BASALT_DELTAS_LOOP("ambient.basalt_deltas.loop"),
@@ -1227,4 +1227,12 @@ public enum Sound implements Keyed { @@ -1345,4 +1345,12 @@ public enum Sound implements Keyed {
public NamespacedKey getKey() { public NamespacedKey getKey() {
return key; return key;
} }
@ -1284,7 +1283,7 @@ index ab6b0ec328e94bf65a0dafd0403e5ee3b870296c..c8d37184d8e882a4084a1bfef85faa33
/** /**
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 4bfc214685164a38ba4261b2bae7faa8a3bd297e..11af71edd7eaefb3cce3c2b59d390ff92e95ec64 100644 index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d02168acb567e 100644
--- a/src/main/java/org/bukkit/command/Command.java --- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java
@@ -32,8 +32,7 @@ public abstract class Command { @@ -32,8 +32,7 @@ public abstract class Command {
@ -1549,10 +1548,10 @@ index fcc34b640265f4dccb46b9f09466ab8e1d96043e..74599b4ee0518481c0e3a5f6ab2f5302
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
index b833ef63fbe01271ceb2bd83a9eb4a84c9912761..8eb0497c81744874809ebc4bc2e28b128e66a926 100644 index e2800dc97af5bbb02c555069285a0fa155a9799d..5744a9f432ec75f6b6b1991ff488dffb9591c934 100644
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java --- a/src/main/java/org/bukkit/enchantments/Enchantment.java
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
@@ -294,6 +294,19 @@ public abstract class Enchantment implements Keyed { @@ -299,6 +299,19 @@ public abstract class Enchantment implements Keyed {
* @return True if the enchantment may be applied, otherwise False * @return True if the enchantment may be applied, otherwise False
*/ */
public abstract boolean canEnchantItem(@NotNull ItemStack item); public abstract boolean canEnchantItem(@NotNull ItemStack item);
@ -2593,7 +2592,7 @@ index 9866c07c999f46cb585709804aaad710c3031d5a..c7c45e2de8cca1bf8b8e12752e08db62
/** /**
diff --git a/src/main/java/org/bukkit/event/player/PlayerChatEvent.java b/src/main/java/org/bukkit/event/player/PlayerChatEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerChatEvent.java b/src/main/java/org/bukkit/event/player/PlayerChatEvent.java
index 8ea56aac752544f798728b429e7152afbee497e4..213837794c603cb9f152f917941b912326a08030 100644 index a1f4261eaa1497554f1e51d1d5a072c2eb9226df..3a1da86e3dbf18c6e1040086c1df4b8976bc2b9d 100644
--- a/src/main/java/org/bukkit/event/player/PlayerChatEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerChatEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerChatEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerChatEvent.java
@@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull; @@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull;
@ -3219,7 +3218,7 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a0
/** /**
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index cc5e2fef75736e56420df4cf4f83152fa97926df..172697ac5dc0ea3551a61b5589416ac68f372cd1 100644 index b9abfdc61f76c5562de6649f8440aeaab536b3be..12cdae95c338d21684991d34aea5a643f4b4bcd3 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java --- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -21,15 +21,16 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player> @@ -21,15 +21,16 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
@ -3234,7 +3233,7 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..172697ac5dc0ea3551a61b5589416ac6
+ @Deprecated // Paper + @Deprecated // Paper
public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) { public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) {
super(true); super(true);
Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
this.address = address; this.address = address;
- this.motd = motd; - this.motd = motd;
+ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper + this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper
@ -3249,9 +3248,9 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..172697ac5dc0ea3551a61b5589416ac6
*/ */
+ @Deprecated // Paper + @Deprecated // Paper
protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int maxPlayers) { protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int maxPlayers) {
+ super(true); super(true);
+ this.numPlayers = MAGIC_PLAYER_COUNT; this.numPlayers = MAGIC_PLAYER_COUNT;
+ this.address = address; this.address = address;
+ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper + this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper
+ this.maxPlayers = maxPlayers; + this.maxPlayers = maxPlayers;
+ } + }
@ -3260,10 +3259,10 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..172697ac5dc0ea3551a61b5589416ac6
+ super(true); + super(true);
+ Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); + Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
+ this.address = address; + this.address = address;
+ this.motd = motd; this.motd = motd;
+ this.numPlayers = numPlayers; + this.numPlayers = numPlayers;
+ this.maxPlayers = maxPlayers; this.maxPlayers = maxPlayers;
+ } }
+ /** + /**
+ * This constructor is intended for implementations that provide the + * This constructor is intended for implementations that provide the
+ * {@link #iterator()} method, thus provided the {@link #getNumPlayers()} + * {@link #iterator()} method, thus provided the {@link #getNumPlayers()}
@ -3274,12 +3273,12 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..172697ac5dc0ea3551a61b5589416ac6
+ * @param maxPlayers the max number of players + * @param maxPlayers the max number of players
+ */ + */
+ protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int maxPlayers) { + protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int maxPlayers) {
super(true); + super(true);
this.numPlayers = MAGIC_PLAYER_COUNT; + this.numPlayers = MAGIC_PLAYER_COUNT;
this.address = address; + this.address = address;
this.motd = motd; + this.motd = motd;
this.maxPlayers = maxPlayers; + this.maxPlayers = maxPlayers;
} + }
+ /** + /**
+ * Get the message of the day message. + * Get the message of the day message.
+ * + *
@ -3386,7 +3385,7 @@ index f89d71b77d1200314df6ca23614d5ca6fb15ceb3..af4a7ce37eb10bab06eadb6583c7894b
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index f70a6a22b85ff0da76e67e9b223ad4e0b020b5c4..a15abec467bac70116a6fc21a300d4930b909f15 100644 index 7b904dd2c0a660df8874d4800919e16981877163..d168a836d655b369f67200d7afe101b56ff815b1 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable; @@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;

View File

@ -2888,7 +2888,7 @@ index 0000000000000000000000000000000000000000..f9a00aecca5ec41b460bf41dfe1c6969
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 11af71edd7eaefb3cce3c2b59d390ff92e95ec64..8d7a61b711cec7eff0e71b9ae942f3050196d955 100644 index 57ade3963faae3724d9a01eeeb6d02168acb567e..6fd341482d5250ad814e870360e40b52427f799a 100644
--- a/src/main/java/org/bukkit/command/Command.java --- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java
@@ -33,6 +33,8 @@ public abstract class Command { @@ -33,6 +33,8 @@ public abstract class Command {
@ -3082,7 +3082,7 @@ index 0000000000000000000000000000000000000000..f8f0aa688e337222f305fb07f57eec47
+ +
+} +}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 81e4fa57337f5a40c4b673136dd5eb595cce4629..f020cb04eba27a2e70fc7cf799ebbfb434b9d974 100644 index e195e74c48c69047aa825b75fad95419c505b41f..f99d71301ceaa3af07ff0525f7d657ac6253d0e6 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -15,7 +15,6 @@ import org.bukkit.command.defaults.BukkitCommand; @@ -15,7 +15,6 @@ import org.bukkit.command.defaults.BukkitCommand;
@ -3139,19 +3139,19 @@ index 81e4fa57337f5a40c4b673136dd5eb595cce4629..f020cb04eba27a2e70fc7cf799ebbfb4
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
deleted file mode 100644 deleted file mode 100644
index 2a145d851ce30360aa39549745bd87590c034584..0000000000000000000000000000000000000000 index 516d7fc7812aac343782861d0d567f54aa578c2a..0000000000000000000000000000000000000000
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java --- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ /dev/null +++ /dev/null
@@ -1,250 +0,0 @@ @@ -1,250 +0,0 @@
-package org.bukkit.command.defaults; -package org.bukkit.command.defaults;
- -
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableList;
-import java.io.File; -import java.io.File;
-import java.io.IOException; -import java.io.IOException;
-import java.io.PrintStream; -import java.io.PrintStream;
-import java.util.ArrayList; -import java.util.ArrayList;
-import java.util.List; -import java.util.List;
-import org.apache.commons.lang.Validate;
-import org.bukkit.Bukkit; -import org.bukkit.Bukkit;
-import org.bukkit.ChatColor; -import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender; -import org.bukkit.command.CommandSender;
@ -3337,9 +3337,9 @@ index 2a145d851ce30360aa39549745bd87590c034584..00000000000000000000000000000000
- @NotNull - @NotNull
- @Override - @Override
- public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) { - public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
- Validate.notNull(sender, "Sender cannot be null"); - Preconditions.checkArgument(sender != null, "Sender cannot be null");
- Validate.notNull(args, "Arguments cannot be null"); - Preconditions.checkArgument(args != null, "Arguments cannot be null");
- Validate.notNull(alias, "Alias cannot be null"); - Preconditions.checkArgument(alias != null, "Alias cannot be null");
- -
- if (args.length == 1) { - if (args.length == 1) {
- return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, new ArrayList<String>(TIMINGS_SUBCOMMANDS.size())); - return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, new ArrayList<String>(TIMINGS_SUBCOMMANDS.size()));
@ -3413,10 +3413,10 @@ index fcab7ff11d06ae712d56d1eead5dca33bde29296..ca678d83218cd3179ebf4a0d0675e643
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833466854c4 100644 index f5710d53296564eb4cd94382dc79f4c29769b672..fca73778c341df36becbf1ad1ad42ce8d1aa634c 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -358,7 +358,6 @@ public final class SimplePluginManager implements PluginManager { @@ -357,7 +357,6 @@ public final class SimplePluginManager implements PluginManager {
} }
} }
@ -3424,7 +3424,7 @@ index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833
return result.toArray(new Plugin[result.size()]); return result.toArray(new Plugin[result.size()]);
} }
@@ -397,9 +396,9 @@ public final class SimplePluginManager implements PluginManager { @@ -396,9 +395,9 @@ public final class SimplePluginManager implements PluginManager {
if (result != null) { if (result != null) {
plugins.add(result); plugins.add(result);
@ -3436,7 +3436,7 @@ index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833
} }
} }
@@ -428,7 +427,7 @@ public final class SimplePluginManager implements PluginManager { @@ -427,7 +426,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@Nullable @Nullable
public synchronized Plugin getPlugin(@NotNull String name) { public synchronized Plugin getPlugin(@NotNull String name) {
@ -3445,7 +3445,7 @@ index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833
} }
@Override @Override
@@ -646,7 +645,8 @@ public final class SimplePluginManager implements PluginManager { @@ -645,7 +644,8 @@ public final class SimplePluginManager implements PluginManager {
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
} }
@ -3455,7 +3455,7 @@ index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833
getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
} else { } else {
getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
@@ -861,7 +861,7 @@ public final class SimplePluginManager implements PluginManager { @@ -860,7 +860,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public boolean useTimings() { public boolean useTimings() {
@ -3464,7 +3464,7 @@ index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833
} }
/** /**
@@ -870,6 +870,6 @@ public final class SimplePluginManager implements PluginManager { @@ -869,6 +869,6 @@ public final class SimplePluginManager implements PluginManager {
* @param use True if per event timing code should be used * @param use True if per event timing code should be used
*/ */
public void useTimings(boolean use) { public void useTimings(boolean use) {
@ -3473,7 +3473,7 @@ index 77dcfe35e6a765c8ccb38bc5d900989dc0456b13..7548e40af8043c1b5716f2d7d0122833
} }
} }
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index a09c3f71ca563b6f40a118ce1344d0eb273bed40..cf2f517765d8f2a23cc4a17d9ee2dcd81f841b1b 100644 index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe400ab5a32 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -54,7 +54,6 @@ public final class JavaPluginLoader implements PluginLoader { @@ -54,7 +54,6 @@ public final class JavaPluginLoader implements PluginLoader {
@ -3516,7 +3516,7 @@ index a09c3f71ca563b6f40a118ce1344d0eb273bed40..cf2f517765d8f2a23cc4a17d9ee2dcd8
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else { } else {
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 930f3fe08c2acd70eaf7850d0b1b2890512defa0..24e3eaa008e53af8d77439e4f2ab9007285d7826 100644 index 2f74ec96ece706de23156ebabfe493211bc05391..6148b69af39344f758b05a28c7c572befa9b8f3f 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -29,7 +29,8 @@ import org.jetbrains.annotations.Nullable; @@ -29,7 +29,8 @@ import org.jetbrains.annotations.Nullable;

View File

@ -55,10 +55,10 @@ index bbb4eb3c4e46ade7dd939c2b0e4436161d6f8a1e..1dedbea03e259679e101a8443b662b20
* Used for all administrative messages, such as an operator using a * Used for all administrative messages, such as an operator using a
* command. * command.
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef70f2b67ec 100644 index fca73778c341df36becbf1ad1ad42ce8d1aa634c..50a2e8c138c677c91dad65c850acf840f7517e86 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -111,6 +111,12 @@ public final class SimplePluginManager implements PluginManager { @@ -110,6 +110,12 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@NotNull @NotNull
public Plugin[] loadPlugins(@NotNull File directory) { public Plugin[] loadPlugins(@NotNull File directory) {
@ -68,10 +68,10 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
+ @NotNull + @NotNull
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) { + public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
+ // Paper end + // Paper end
Validate.notNull(directory, "Directory cannot be null"); Preconditions.checkArgument(directory != null, "Directory cannot be null");
Validate.isTrue(directory.isDirectory(), "Directory must be a directory"); Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory");
@@ -128,7 +134,11 @@ public final class SimplePluginManager implements PluginManager { @@ -127,7 +133,11 @@ public final class SimplePluginManager implements PluginManager {
Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>(); Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>();
// This is where it figures out all possible plugins // This is where it figures out all possible plugins
@ -84,7 +84,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
PluginLoader loader = null; PluginLoader loader = null;
for (Pattern filter : filters) { for (Pattern filter : filters) {
Matcher match = filter.matcher(file.getName()); Matcher match = filter.matcher(file.getName());
@@ -144,14 +154,14 @@ public final class SimplePluginManager implements PluginManager { @@ -143,14 +153,14 @@ public final class SimplePluginManager implements PluginManager {
description = loader.getPluginDescription(file); description = loader.getPluginDescription(file);
String name = description.getName(); String name = description.getName();
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
@ -102,7 +102,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
continue; continue;
} }
@@ -162,7 +172,7 @@ public final class SimplePluginManager implements PluginManager { @@ -161,7 +171,7 @@ public final class SimplePluginManager implements PluginManager {
description.getName(), description.getName(),
file.getPath(), file.getPath(),
replacedFile.getPath(), replacedFile.getPath(),
@ -111,7 +111,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
)); ));
} }
@@ -183,7 +193,7 @@ public final class SimplePluginManager implements PluginManager { @@ -182,7 +192,7 @@ public final class SimplePluginManager implements PluginManager {
file.getPath(), file.getPath(),
provided, provided,
pluginFile.getPath(), pluginFile.getPath(),
@ -120,7 +120,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
)); ));
} else { } else {
String replacedPlugin = pluginsProvided.put(provided, description.getName()); String replacedPlugin = pluginsProvided.put(provided, description.getName());
@@ -265,7 +275,7 @@ public final class SimplePluginManager implements PluginManager { @@ -264,7 +274,7 @@ public final class SimplePluginManager implements PluginManager {
server.getLogger().log( server.getLogger().log(
Level.SEVERE, Level.SEVERE,
@ -129,7 +129,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin.")); new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin."));
break; break;
} }
@@ -304,11 +314,11 @@ public final class SimplePluginManager implements PluginManager { @@ -303,11 +313,11 @@ public final class SimplePluginManager implements PluginManager {
loadedPlugins.add(loadedPlugin.getName()); loadedPlugins.add(loadedPlugin.getName());
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides()); loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
} else { } else {
@ -143,7 +143,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
} }
} }
} }
@@ -335,11 +345,11 @@ public final class SimplePluginManager implements PluginManager { @@ -334,11 +344,11 @@ public final class SimplePluginManager implements PluginManager {
loadedPlugins.add(loadedPlugin.getName()); loadedPlugins.add(loadedPlugin.getName());
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides()); loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
} else { } else {
@ -157,7 +157,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
} }
} }
} }
@@ -352,7 +362,7 @@ public final class SimplePluginManager implements PluginManager { @@ -351,7 +361,7 @@ public final class SimplePluginManager implements PluginManager {
while (failedPluginIterator.hasNext()) { while (failedPluginIterator.hasNext()) {
File file = failedPluginIterator.next(); File file = failedPluginIterator.next();
failedPluginIterator.remove(); failedPluginIterator.remove();
@ -167,7 +167,7 @@ index 7548e40af8043c1b5716f2d7d0122833466854c4..83d3ee09cc6f91b095f6b8519a431ef7
} }
} }
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index cf2f517765d8f2a23cc4a17d9ee2dcd81f841b1b..9700ed558e65260264279b92dc661f39a0d0209c 100644 index 5c1b8b05d8a5408bb4830942c74ebfe400ab5a32..333c47a1f7e9d7ddf91aad5ec15163427f7b8039 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -91,7 +91,7 @@ public final class JavaPluginLoader implements PluginLoader { @@ -91,7 +91,7 @@ public final class JavaPluginLoader implements PluginLoader {

View File

@ -73,7 +73,7 @@ index c9ecd5b1908e05a1b39dadcded27241672adcddf..355c46f1c1f08072446f3cc92c0d2289
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9be1d3ff9 100644 index 04b4fb6859df0221f8f9f92c5a7ac2dda1073355..b50f614806f4634960d383e8a33f094c2f46935f 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -81,17 +81,9 @@ index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9
+import com.destroystokyo.paper.util.VersionFetcher; // Paper - version supplier +import com.destroystokyo.paper.util.VersionFetcher; // Paper - version supplier
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources; @@ -26,6 +27,15 @@ import org.bukkit.util.StringUtil;
@@ -16,6 +17,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
+import net.kyori.adventure.text.Component; // Paper
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -26,6 +28,15 @@ import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class VersionCommand extends BukkitCommand { public class VersionCommand extends BukkitCommand {
@ -107,7 +99,7 @@ index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9
public VersionCommand(@NotNull String name) { public VersionCommand(@NotNull String name) {
super(name); super(name);
@@ -40,7 +51,7 @@ public class VersionCommand extends BukkitCommand { @@ -40,7 +50,7 @@ public class VersionCommand extends BukkitCommand {
if (!testPermission(sender)) return true; if (!testPermission(sender)) return true;
if (args.length == 0) { if (args.length == 0) {
@ -116,12 +108,12 @@ index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9
sendVersion(sender); sendVersion(sender);
} else { } else {
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
@@ -146,14 +157,14 @@ public class VersionCommand extends BukkitCommand { @@ -146,14 +156,14 @@ public class VersionCommand extends BukkitCommand {
private final ReentrantLock versionLock = new ReentrantLock(); private final ReentrantLock versionLock = new ReentrantLock();
private boolean hasVersion = false; private boolean hasVersion = false;
- private String versionMessage = null; - private String versionMessage = null;
+ private Component versionMessage = null; // Paper + private net.kyori.adventure.text.Component versionMessage = null; // Paper
private final Set<CommandSender> versionWaiters = new HashSet<CommandSender>(); private final Set<CommandSender> versionWaiters = new HashSet<CommandSender>();
private boolean versionTaskStarted = false; private boolean versionTaskStarted = false;
private long lastCheck = 0; private long lastCheck = 0;
@ -133,22 +125,22 @@ index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9
lastCheck = System.currentTimeMillis(); lastCheck = System.currentTimeMillis();
hasVersion = false; hasVersion = false;
} else { } else {
@@ -168,7 +179,7 @@ public class VersionCommand extends BukkitCommand { @@ -168,7 +178,7 @@ public class VersionCommand extends BukkitCommand {
return; return;
} }
versionWaiters.add(sender); versionWaiters.add(sender);
- sender.sendMessage("Checking version, please wait..."); - sender.sendMessage("Checking version, please wait...");
+ sender.sendMessage(Component.text("Checking version, please wait...", net.kyori.adventure.text.format.NamedTextColor.WHITE, net.kyori.adventure.text.format.TextDecoration.ITALIC)); // Paper + sender.sendMessage(net.kyori.adventure.text.Component.text("Checking version, please wait...", net.kyori.adventure.text.format.NamedTextColor.WHITE, net.kyori.adventure.text.format.TextDecoration.ITALIC)); // Paper
if (!versionTaskStarted) { if (!versionTaskStarted) {
versionTaskStarted = true; versionTaskStarted = true;
new Thread(new Runnable() { new Thread(new Runnable() {
@@ -186,6 +197,13 @@ public class VersionCommand extends BukkitCommand { @@ -186,6 +196,13 @@ public class VersionCommand extends BukkitCommand {
private void obtainVersion() { private void obtainVersion() {
String version = Bukkit.getVersion(); String version = Bukkit.getVersion();
+ // Paper start + // Paper start
+ if (version.startsWith("null")) { // running from ide? + if (version.startsWith("null")) { // running from ide?
+ setVersionMessage(Component.text("Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.YELLOW)); + setVersionMessage(net.kyori.adventure.text.Component.text("Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
+ return; + return;
+ } + }
+ setVersionMessage(getVersionFetcher().getVersionMessage(version)); + setVersionMessage(getVersionFetcher().getVersionMessage(version));
@ -156,7 +148,7 @@ index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9
if (version == null) version = "Custom"; if (version == null) version = "Custom";
String[] parts = version.substring(0, version.indexOf(' ')).split("-"); String[] parts = version.substring(0, version.indexOf(' ')).split("-");
if (parts.length == 4) { if (parts.length == 4) {
@@ -215,11 +233,24 @@ public class VersionCommand extends BukkitCommand { @@ -215,11 +232,24 @@ public class VersionCommand extends BukkitCommand {
} else { } else {
setVersionMessage("Unknown version, custom build?"); setVersionMessage("Unknown version, custom build?");
} }
@ -166,17 +158,17 @@ index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9
- private void setVersionMessage(@NotNull String msg) { - private void setVersionMessage(@NotNull String msg) {
+ // Paper start + // Paper start
+ private void setVersionMessage(final @NotNull Component msg) { + private void setVersionMessage(final @NotNull net.kyori.adventure.text.Component msg) {
lastCheck = System.currentTimeMillis(); lastCheck = System.currentTimeMillis();
- versionMessage = msg; - versionMessage = msg;
+ final Component message = net.kyori.adventure.text.TextComponent.ofChildren( + final net.kyori.adventure.text.Component message = net.kyori.adventure.text.TextComponent.ofChildren(
+ Component.text("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")", net.kyori.adventure.text.format.NamedTextColor.WHITE), + net.kyori.adventure.text.Component.text("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")", net.kyori.adventure.text.format.NamedTextColor.WHITE),
+ Component.newline(), + net.kyori.adventure.text.Component.newline(),
+ msg + msg
+ ); + );
+ this.versionMessage = Component.text() + this.versionMessage = net.kyori.adventure.text.Component.text()
+ .append(message) + .append(message)
+ .hoverEvent(Component.text("Click to copy to clipboard", net.kyori.adventure.text.format.NamedTextColor.WHITE)) + .hoverEvent(net.kyori.adventure.text.Component.text("Click to copy to clipboard", net.kyori.adventure.text.format.NamedTextColor.WHITE))
+ .clickEvent(net.kyori.adventure.text.event.ClickEvent.copyToClipboard(net.kyori.adventure.text.serializer.plain.PlainComponentSerializer.plain().serialize(message))) + .clickEvent(net.kyori.adventure.text.event.ClickEvent.copyToClipboard(net.kyori.adventure.text.serializer.plain.PlainComponentSerializer.plain().serialize(message)))
+ .build(); + .build();
+ // Paper end + // Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Automatically disable plugins that fail to load
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 9700ed558e65260264279b92dc661f39a0d0209c..451fce7223834169751679ce6dc22de3df24eae9 100644 index 333c47a1f7e9d7ddf91aad5ec15163427f7b8039..5eb24f38f158d43fb42836b83c108f808c89512e 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -335,6 +335,10 @@ public final class JavaPluginLoader implements PluginLoader { @@ -335,6 +335,10 @@ public final class JavaPluginLoader implements PluginLoader {

View File

@ -464,63 +464,41 @@ index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index f020cb04eba27a2e70fc7cf799ebbfb434b9d974..adfc7aae2c0f49bbcdd358e83b04a0cf078a7d52 100644 index f99d71301ceaa3af07ff0525f7d657ac6253d0e6..2e23c124311b38aaea64dd274c33afcd52edcf43 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -8,6 +8,10 @@ import java.util.HashMap; @@ -155,11 +155,14 @@ public class SimpleCommandMap implements CommandMap {
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerCommandException;
+import com.destroystokyo.paper.exception.ServerTabCompleteException;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -155,11 +159,14 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
} // target.timings.stopTiming(); // Spigot // Paper } // target.timings.stopTiming(); // Spigot // Paper
} catch (CommandException ex) { } catch (CommandException ex) {
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper + server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
//target.timings.stopTiming(); // Spigot // Paper //target.timings.stopTiming(); // Spigot // Paper
throw ex; throw ex;
} catch (Throwable ex) { } catch (Throwable ex) {
//target.timings.stopTiming(); // Spigot // Paper //target.timings.stopTiming(); // Spigot // Paper
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); - throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target; + String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper + server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
+ throw new CommandException(msg, ex); + throw new CommandException(msg, ex);
} }
// return true as command was handled // return true as command was handled
@@ -238,7 +245,9 @@ public class SimpleCommandMap implements CommandMap { @@ -238,7 +241,9 @@ public class SimpleCommandMap implements CommandMap {
} catch (CommandException ex) { } catch (CommandException ex) {
throw ex; throw ex;
} catch (Throwable ex) { } catch (Throwable ex) {
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex); - throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target; + String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerTabCompleteException(msg, ex, target, sender, args))); // Paper + server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
+ throw new CommandException(msg, ex); + throw new CommandException(msg, ex);
} }
} }
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 83d3ee09cc6f91b095f6b8519a431ef70f2b67ec..1fbf690403eefe017b146c141c6d47d9b8d9d4bb 100644 index 50a2e8c138c677c91dad65c850acf840f7517e86..b7cd4b9e4fd5f98aafbc0fe5ad6883eeb50dea56 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -23,6 +23,10 @@ import java.util.WeakHashMap; @@ -487,7 +487,8 @@ public final class SimplePluginManager implements PluginManager {
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerEventException;
+import com.destroystokyo.paper.exception.ServerPluginEnableDisableException;
import org.apache.commons.lang.Validate;
import org.bukkit.Server;
import org.bukkit.World;
@@ -488,7 +492,8 @@ public final class SimplePluginManager implements PluginManager {
try { try {
plugin.getPluginLoader().enablePlugin(plugin); plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -530,7 +508,7 @@ index 83d3ee09cc6f91b095f6b8519a431ef70f2b67ec..1fbf690403eefe017b146c141c6d47d9
} }
HandlerList.bakeAll(); HandlerList.bakeAll();
@@ -509,32 +514,37 @@ public final class SimplePluginManager implements PluginManager { @@ -508,32 +509,37 @@ public final class SimplePluginManager implements PluginManager {
try { try {
plugin.getPluginLoader().disablePlugin(plugin); plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -573,21 +551,21 @@ index 83d3ee09cc6f91b095f6b8519a431ef70f2b67ec..1fbf690403eefe017b146c141c6d47d9
} }
try { try {
@@ -547,6 +557,13 @@ public final class SimplePluginManager implements PluginManager { @@ -546,6 +552,13 @@ public final class SimplePluginManager implements PluginManager {
} }
} }
+ // Paper start + // Paper start
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) { + private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
+ server.getLogger().log(Level.SEVERE, msg, ex); + server.getLogger().log(Level.SEVERE, msg, ex);
+ callEvent(new ServerExceptionEvent(new ServerPluginEnableDisableException(msg, ex, plugin))); + callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
+ } + }
+ // Paper end + // Paper end
+ +
@Override @Override
public void clearPlugins() { public void clearPlugins() {
synchronized (this) { synchronized (this) {
@@ -610,7 +627,13 @@ public final class SimplePluginManager implements PluginManager { @@ -609,7 +622,13 @@ public final class SimplePluginManager implements PluginManager {
)); ));
} }
} catch (Throwable ex) { } catch (Throwable ex) {
@ -595,8 +573,8 @@ index 83d3ee09cc6f91b095f6b8519a431ef70f2b67ec..1fbf690403eefe017b146c141c6d47d9
+ // Paper start - error reporting + // Paper start - error reporting
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(); + String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
+ server.getLogger().log(Level.SEVERE, msg, ex); + server.getLogger().log(Level.SEVERE, msg, ex);
+ if (!(event instanceof ServerExceptionEvent)) { // We don't want to cause an endless event loop + if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
+ callEvent(new ServerExceptionEvent(new ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); + callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
+ } + }
+ // Paper end + // Paper end
} }

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods. Uses method handles for private or static methods.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index eefc024acc3e14ae21855df7f2f358bd1e0a9e38..da7aa34850b39500f89f01a2969d3a1a5a80f80f 100644 index 9b3621a09bd37945877752c801cdd9283017522c..9ec782b00f9f2ac5a38a75667d36de4582a25a03 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -39,6 +39,9 @@ dependencies { @@ -38,6 +38,9 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-gson") apiAndDocs("net.kyori:adventure-text-serializer-gson")
apiAndDocs("net.kyori:adventure-text-serializer-legacy") apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain") apiAndDocs("net.kyori:adventure-text-serializer-plain")
@ -366,7 +366,7 @@ index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137be
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 451fce7223834169751679ce6dc22de3df24eae9..0cbac77e16fc36d805b79dd44837a38a79618c0b 100644 index 5eb24f38f158d43fb42836b83c108f808c89512e..5d74fab03a15d7099e5dacb780eade4cdc185797 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -291,21 +291,7 @@ public final class JavaPluginLoader implements PluginLoader { @@ -291,21 +291,7 @@ public final class JavaPluginLoader implements PluginLoader {

View File

@ -85,10 +85,10 @@ index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..5fa9d648bc780e874f658597f1a24715
} }
} }
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 1fbf690403eefe017b146c141c6d47d9b8d9d4bb..3ffe519b759f440f56f3054b0d3e4120b59f8c62 100644 index b7cd4b9e4fd5f98aafbc0fe5ad6883eeb50dea56..efe0e5e6b43c50c6a41ee3baa44beb7d883b551a 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -905,4 +905,13 @@ public final class SimplePluginManager implements PluginManager { @@ -900,4 +900,13 @@ public final class SimplePluginManager implements PluginManager {
public void useTimings(boolean use) { public void useTimings(boolean use) {
co.aikar.timings.Timings.setTimingsEnabled(use); // Paper co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
} }

View File

@ -8,7 +8,7 @@ limited synchronized portions to allow much higher concurrency in
MetadataStore as well as far less locking, especially on reads MetadataStore as well as far less locking, especially on reads
diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
index baf850226aed8545a5794deba6dff9603953b4b2..d363d517c05b3335101d829ce4ec22d049059c24 100644 index 6886a7003fb76d07e0fa9c1c352c56480f08a0db..a0698522f01619c9d37474f4bd55a17de58fff89 100644
--- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java --- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java +++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
@@ -12,7 +12,7 @@ import org.bukkit.plugin.Plugin; @@ -12,7 +12,7 @@ import org.bukkit.plugin.Plugin;
@ -61,7 +61,7 @@ index baf850226aed8545a5794deba6dff9603953b4b2..d363d517c05b3335101d829ce4ec22d0
*/ */
- public synchronized void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) { - public synchronized void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) {
+ public void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) { // Paper + public void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) { // Paper
Validate.notNull(owningPlugin, "Plugin cannot be null"); Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null");
String key = disambiguate(subject, metadataKey); String key = disambiguate(subject, metadataKey);
Map<Plugin, MetadataValue> entry = metadataMap.get(key); Map<Plugin, MetadataValue> entry = metadataMap.get(key);
if (entry == null) { if (entry == null) {
@ -85,6 +85,6 @@ index baf850226aed8545a5794deba6dff9603953b4b2..d363d517c05b3335101d829ce4ec22d0
*/ */
- public synchronized void invalidateAll(@NotNull Plugin owningPlugin) { - public synchronized void invalidateAll(@NotNull Plugin owningPlugin) {
+ public void invalidateAll(@NotNull Plugin owningPlugin) { // Paper + public void invalidateAll(@NotNull Plugin owningPlugin) { // Paper
Validate.notNull(owningPlugin, "Plugin cannot be null"); Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null");
for (Map<Plugin, MetadataValue> values : metadataMap.values()) { for (Map<Plugin, MetadataValue> values : metadataMap.values()) {
if (values.containsKey(owningPlugin)) { if (values.containsKey(owningPlugin)) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add MetadataStoreBase.removeAll(Plugin)
So that on reload, metadata will be cleared So that on reload, metadata will be cleared
diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
index d363d517c05b3335101d829ce4ec22d049059c24..abbe545af572687a0399c2387434863cd2b70f68 100644 index a0698522f01619c9d37474f4bd55a17de58fff89..dae60d0df3ccb28ab65214e205312afcd04aa770 100644
--- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java --- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java +++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
@@ -4,6 +4,7 @@ import java.util.ArrayList; @@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;

View File

@ -56,10 +56,10 @@ index bd2c7a6964722412148fae39e1b4951fc0002b9b..864c263bbd4dd6dd7c37a74b39b1a40a
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index adfc7aae2c0f49bbcdd358e83b04a0cf078a7d52..460fda05a62b12db2edcfb7ea8b2a5dd8e4b110d 100644 index 2e23c124311b38aaea64dd274c33afcd52edcf43..950a2d0b3b583c6b9a703190874bbc4df2783ab7 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -297,4 +297,11 @@ public class SimpleCommandMap implements CommandMap { @@ -293,4 +293,11 @@ public class SimpleCommandMap implements CommandMap {
} }
} }
} }

View File

@ -46,12 +46,12 @@ index 9c1cd95e125b1d7677daea1575a466a1b955053a..acd69a5d946974e0b50439a987127506
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 8d7a61b711cec7eff0e71b9ae942f3050196d955..fc5e398adc8f24187f1ffc0c4b3b429e3c6b25eb 100644 index 6fd341482d5250ad814e870360e40b52427f799a..a26df5f6341d22ecd5e71da59b8f091848e627ad 100644
--- a/src/main/java/org/bukkit/command/Command.java --- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java
@@ -99,7 +99,7 @@ public abstract class Command { @@ -99,7 +99,7 @@ public abstract class Command {
Validate.notNull(args, "Arguments cannot be null"); Preconditions.checkArgument(args != null, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null"); Preconditions.checkArgument(alias != null, "Alias cannot be null");
- if (args.length == 0) { - if (args.length == 0) {
+ if (args.length == 0 || !sender.getServer().suggestPlayerNamesWhenNullTabCompletions()) { // Paper - allow preventing player name suggestions by default) { + if (args.length == 0 || !sender.getServer().suggestPlayerNamesWhenNullTabCompletions()) { // Paper - allow preventing player name suggestions by default) {

View File

@ -32,7 +32,7 @@ index af4a7ce37eb10bab06eadb6583c7894b3ec55ae6..159e5a908b35b84b7fabc36581e093d9
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index a15abec467bac70116a6fc21a300d4930b909f15..dfd16531926e639231e93cb295de3d802d17413d 100644 index d168a836d655b369f67200d7afe101b56ff815b1..edf5cd3734011de9130139e542ebc44bcc67f396 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -611,5 +611,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor @@ -611,5 +611,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor

View File

@ -29,7 +29,7 @@ index 159e5a908b35b84b7fabc36581e093d9aa4c4b67..66ffc658dba85942f179760dc6c50258
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index dfd16531926e639231e93cb295de3d802d17413d..2581117ded5d91070bc9416eee53383e915a1564 100644 index edf5cd3734011de9130139e542ebc44bcc67f396..8b76d7ca596ea261c0ca3b9fe2fbf5507c3883e3 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -536,7 +536,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor @@ -536,7 +536,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor

View File

@ -14,10 +14,10 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction. several layers of logging abstraction.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index da7aa34850b39500f89f01a2969d3a1a5a80f80f..01798255d45f2a642df00156f11dd2bcd8108079 100644 index 9ec782b00f9f2ac5a38a75667d36de4582a25a03..ac0a4aea48436201b5712b166413bb7dc0d0b9d8 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -39,6 +39,8 @@ dependencies { @@ -38,6 +38,8 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-gson") apiAndDocs("net.kyori:adventure-text-serializer-gson")
apiAndDocs("net.kyori:adventure-text-serializer-legacy") apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain") apiAndDocs("net.kyori:adventure-text-serializer-plain")

View File

@ -17,7 +17,7 @@ The implementation should handle plugin prefixes by displaying
logger names when appropriate. logger names when appropriate.
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
index 50a479488917b4ce019fa71a496c41e843e9c5c4..f99d60ae4003f953b5680a997e9e43e63c035b0c 100644 index 669a70faa95d0d6525a731d73499ed6fb0b48320..1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
@@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase { @@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase {

View File

@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36
+ +
+} +}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
index f99d60ae4003f953b5680a997e9e43e63c035b0c..c943bd801b54519ba6cf5d45aec593d7b7438f99 100644 index 1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8..3bea5dd67ad0393160ccede4ac99a3c7baa1803b 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
@@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase { @@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase {
@ -87,7 +87,7 @@ index f99d60ae4003f953b5680a997e9e43e63c035b0c..c943bd801b54519ba6cf5d45aec593d7
/** /**
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 24e3eaa008e53af8d77439e4f2ab9007285d7826..684d7b1105350660fe7fc66f57a49db7f39610b4 100644 index 6148b69af39344f758b05a28c7c572befa9b8f3f..0db641f5d5e1293b236ad0d2e3a156802ffed839 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot @@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot

View File

@ -195,39 +195,24 @@ index 0000000000000000000000000000000000000000..619ed37169c126a8c75d02699a04728b
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
index d1a9956a1573dab54c5ff2e5d67ca86cfe1dc01a..f96c4ba53ab41ea66d4f9a4d54eeabb63f992b58 100644 index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9fc594c82 100644
--- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java --- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
+++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java +++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
@@ -1,5 +1,6 @@ @@ -29,6 +29,13 @@ public class TabCompleteEvent extends Event implements Cancellable {
package org.bukkit.event.server;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender;
@@ -8,6 +9,7 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerCommandSendEvent;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Called when a {@link CommandSender} of any description (ie: player or
@@ -29,6 +31,13 @@ public class TabCompleteEvent extends Event implements Cancellable {
private boolean cancelled; private boolean cancelled;
public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions) { public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions) {
+ // Paper start + // Paper start
+ this(sender, buffer, completions, sender instanceof org.bukkit.command.ConsoleCommandSender || buffer.startsWith("/"), null); + this(sender, buffer, completions, sender instanceof org.bukkit.command.ConsoleCommandSender || buffer.startsWith("/"), null);
+ } + }
+ public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions, boolean isCommand, @Nullable org.bukkit.Location location) { + public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions, boolean isCommand, @org.jetbrains.annotations.Nullable org.bukkit.Location location) {
+ this.isCommand = isCommand; + this.isCommand = isCommand;
+ this.loc = location; + this.loc = location;
+ // Paper end + // Paper end
Validate.notNull(sender, "sender"); Preconditions.checkArgument(sender != null, "sender");
Validate.notNull(buffer, "buffer"); Preconditions.checkArgument(buffer != null, "buffer");
Validate.notNull(completions, "completions"); Preconditions.checkArgument(completions != null, "completions");
@@ -69,14 +78,35 @@ public class TabCompleteEvent extends Event implements Cancellable { @@ -69,14 +76,35 @@ public class TabCompleteEvent extends Event implements Cancellable {
return completions; return completions;
} }
@ -244,7 +229,7 @@ index d1a9956a1573dab54c5ff2e5d67ca86cfe1dc01a..f96c4ba53ab41ea66d4f9a4d54eeabb6
+ /** + /**
+ * @return The position looked at by the sender, or null if none + * @return The position looked at by the sender, or null if none
+ */ + */
+ @Nullable + @org.jetbrains.annotations.Nullable
+ public org.bukkit.Location getLocation() { + public org.bukkit.Location getLocation() {
+ return loc; + return loc;
+ } + }
@ -258,9 +243,9 @@ index d1a9956a1573dab54c5ff2e5d67ca86cfe1dc01a..f96c4ba53ab41ea66d4f9a4d54eeabb6
* @param completions the new completions * @param completions the new completions
*/ */
public void setCompletions(@NotNull List<String> completions) { public void setCompletions(@NotNull List<String> completions) {
Validate.notNull(completions); Preconditions.checkArgument(completions != null);
- this.completions = completions; - this.completions = completions;
+ this.completions = new ArrayList<>(completions); // Paper + this.completions = new java.util.ArrayList<>(completions); // Paper
} }
@Override @Override

View File

@ -10,10 +10,10 @@ on the players login.
Plugin authors need to define a key to keep it consistent between server restarts. Plugin authors need to define a key to keep it consistent between server restarts.
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index d74b3114f535e1e5e36ae007f1fe0522916a0362..d742c4058ba9aed4fbe1591fd755a06608b06e98 100644 index fde34da0f7a13dee06e479fd6c5350a69beb3c95..ad2ab6e97ccf6900d19f8bfbe08181d4c7743a99 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -25,6 +25,7 @@ public class ShapedRecipe implements Recipe, Keyed { @@ -24,6 +24,7 @@ public class ShapedRecipe implements Recipe, Keyed {
public ShapedRecipe(@NotNull ItemStack result) { public ShapedRecipe(@NotNull ItemStack result) {
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result."); Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
this.key = NamespacedKey.randomKey(); this.key = NamespacedKey.randomKey();
@ -22,10 +22,10 @@ index d74b3114f535e1e5e36ae007f1fe0522916a0362..d742c4058ba9aed4fbe1591fd755a066
} }
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 68447fb8c12356e779b96ec98c54119045046751..84062dd719cb8a6142dc8c806777cb208c6b42b2 100644 index cc3f7cccfa06a92f3ca192cb88f30f8929c02dfd..75b47c608d0a902e4ea5f03c395667f47dec8980 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -26,6 +26,7 @@ public class ShapelessRecipe implements Recipe, Keyed { @@ -25,6 +25,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
public ShapelessRecipe(@NotNull ItemStack result) { public ShapelessRecipe(@NotNull ItemStack result) {
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result."); Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
this.key = NamespacedKey.randomKey(); this.key = NamespacedKey.randomKey();

View File

@ -7,7 +7,7 @@ Adds data about what Item related methods were used in InventoryMoveItem event
so that the server can improve the performance of this event. so that the server can improve the performance of this event.
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
index a8c48f5a416326e96c431e5fa22edee04825530e..04d4a83bfc4f86341f9d72128458154d08c8ec43 100644 index 919cc993e3cb1c14e2a3aebf90e6cc0fa6fbc17f..95e51bcf5dfd27cc9012d7542c4ed1bceca29626 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java --- a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java +++ b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
@@ -31,6 +31,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable { @@ -31,6 +31,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
@ -18,7 +18,7 @@ index a8c48f5a416326e96c431e5fa22edee04825530e..04d4a83bfc4f86341f9d72128458154d
+ public boolean calledSetItem; // Paper + public boolean calledSetItem; // Paper
public InventoryMoveItemEvent(@NotNull final Inventory sourceInventory, @NotNull final ItemStack itemStack, @NotNull final Inventory destinationInventory, final boolean didSourceInitiate) { public InventoryMoveItemEvent(@NotNull final Inventory sourceInventory, @NotNull final ItemStack itemStack, @NotNull final Inventory destinationInventory, final boolean didSourceInitiate) {
Validate.notNull(itemStack, "ItemStack cannot be null"); Preconditions.checkArgument(itemStack != null, "ItemStack cannot be null");
@@ -58,7 +60,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable { @@ -58,7 +60,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
*/ */
@NotNull @NotNull
@ -32,7 +32,7 @@ index a8c48f5a416326e96c431e5fa22edee04825530e..04d4a83bfc4f86341f9d72128458154d
@@ -70,6 +73,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable { @@ -70,6 +73,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
*/ */
public void setItem(@NotNull ItemStack itemStack) { public void setItem(@NotNull ItemStack itemStack) {
Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred."); Preconditions.checkArgument(itemStack != null, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
+ calledSetItem = true; // Paper - record this method was used for auto detection of mode + calledSetItem = true; // Paper - record this method was used for auto detection of mode
this.itemStack = itemStack.clone(); this.itemStack = itemStack.clone();
} }

View File

@ -500,10 +500,10 @@ index 0000000000000000000000000000000000000000..f45b8cfd1611345e8d81ecb8297a586f
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 8d048a8f1446f862dcc61952971b54bab9bb2ac3..60a70b9e7a613e64a31a127264f17485ed2aa76f 100644 index 9f646171b3ac617fb5217d5ab9c106c3100a8c8d..2315fffc4a1a5bebc50a703e9df59df8121c2200 100644
--- a/src/main/java/org/bukkit/Particle.java --- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java +++ b/src/main/java/org/bukkit/Particle.java
@@ -155,6 +155,17 @@ public enum Particle { @@ -160,6 +160,17 @@ public enum Particle {
return dataType; return dataType;
} }

View File

@ -66,10 +66,10 @@ index 41e26451fe12d8e6e0ef73c85731b24b4e3f200c..0d1b20f2b5580ea5505ccc2f003925db
* Gets a {@link Permission} from its fully qualified name * Gets a {@link Permission} from its fully qualified name
* *
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 3ffe519b759f440f56f3054b0d3e4120b59f8c62..c43d819bae5bc51bcf57a575bc22aee9d501c562 100644 index efe0e5e6b43c50c6a41ee3baa44beb7d883b551a..6b38b14bfd73f3b7d06b6f747d60373cedf1fa6f 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -508,6 +508,21 @@ public final class SimplePluginManager implements PluginManager { @@ -503,6 +503,21 @@ public final class SimplePluginManager implements PluginManager {
} }
} }
@ -92,7 +92,7 @@ index 3ffe519b759f440f56f3054b0d3e4120b59f8c62..c43d819bae5bc51bcf57a575bc22aee9
public void disablePlugin(@NotNull final Plugin plugin) { public void disablePlugin(@NotNull final Plugin plugin) {
if (plugin.isEnabled()) { if (plugin.isEnabled()) {
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 0cbac77e16fc36d805b79dd44837a38a79618c0b..47b306929654855944b1e95f81c641dea6102096 100644 index 5d74fab03a15d7099e5dacb780eade4cdc185797..032ed2aba7d47144d241d616ba27489ce22d6fea 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -366,6 +366,7 @@ public final class JavaPluginLoader implements PluginLoader { @@ -366,6 +366,7 @@ public final class JavaPluginLoader implements PluginLoader {

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