3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Please note that this build includes changes to meet upstreams
requirements for nullability annotations. While we aim for a level of
accuracy, these might not be 100% correct, if there are any issues,
please speak to us on discord, or open an issue on the tracker to
discuss.

Bukkit Changes:
9a6a1de3 Remove nullability annotations from enum constructors
3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API

CraftBukkit Changes:
8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep
8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals
39a287b7 Don't ignore newlines in PlayerListHeader/Footer

Spigot Changes:
cf694d87 Add nullability annotations
Dieser Commit ist enthalten in:
Shane Freeder 2019-03-20 00:28:15 +00:00
Ursprung c3c889523f
Commit 0976d52bbd
261 geänderte Dateien mit 3224 neuen und 2923 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 02d5007d081bde67f58dac3e04ce1df9e70ff9b4 Mon Sep 17 00:00:00 2001
From 16f2fa8f86ea4272386830faf08c84cde635a753 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 00:16:08 +0100
Subject: [PATCH] POM changes
diff --git a/pom.xml b/pom.xml
index 23fde9622..a613cf963 100644
index b3369ecf..c2ec40c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,33 +3,28 @@
@ -80,7 +80,7 @@ index 23fde9622..a613cf963 100644
<!-- bundled with Minecraft, should be kept in sync -->
<dependency>
<groupId>com.google.guava</groupId>
@@ -107,15 +113,12 @@
@@ -119,15 +125,12 @@
</dependencies>
<build>
@ -97,7 +97,7 @@ index 23fde9622..a613cf963 100644
<dependencies>
<!-- we need our custom version as it fixes some bugs on case sensitive file systems -->
<dependency>
@@ -150,6 +153,7 @@
@@ -162,6 +165,7 @@
</execution>
</executions>
<configuration>
@ -106,5 +106,5 @@ index 23fde9622..a613cf963 100644
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From d7927f758fcbaeb1c2bf4fa4debed90eb6f04991 Mon Sep 17 00:00:00 2001
From e7c9d3dadf38b1314ad78cce03635eec74035855 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 23 Feb 2019 11:26:21 -0500
Subject: [PATCH] Paper Utils
@ -6,24 +6,26 @@ Subject: [PATCH] Paper Utils
diff --git a/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
new file mode 100644
index 00000000..e5850967
index 000000000..9db0056ab
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
@@ -0,0 +1,14 @@
@@ -0,0 +1,16 @@
+package com.destroystokyo.paper.util;
+
+import org.jetbrains.annotations.NotNull;
+
+public class SneakyThrow {
+
+ public static void sneaky(Throwable exception) {
+ public static void sneaky(@NotNull Throwable exception) {
+ SneakyThrow.<RuntimeException>throwSneaky(exception);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends Throwable> void throwSneaky(Throwable exception) throws T {
+ private static <T extends Throwable> void throwSneaky(@NotNull Throwable exception) throws T {
+ throw (T) exception;
+ }
+
+}
--
2.20.1
2.21.0

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1,15 +1,15 @@
From 44c7da0daea1759a7b45d8e5393ca84216ed9c0a Mon Sep 17 00:00:00 2001
From 3fbe48f546b9da11b1e6baa07d639960dd30a9dc Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Mon, 29 Feb 2016 17:22:34 -0600
Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 75f21146..694254f1 100644
index 777994f7..95ebf016 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1444,6 +1444,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
@@ -1456,6 +1456,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@NotNull
public String getLocale();
+ // Paper start
@ -32,5 +32,5 @@ index 75f21146..694254f1 100644
* Update the list of commands sent to the client.
* <br>
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 55f158cbeaa2938c3bc32d50ddd023ab6a172f67 Mon Sep 17 00:00:00 2001
From 046a9cacf026fd179eba24607ba5401c03b45b42 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 17:24:57 -0600
Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 14e425d1..6055c801 100644
index cffa0c65f..2ad9a7d7f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1274,6 +1274,16 @@ public final class Bukkit {
@@ -1341,6 +1341,17 @@ public final class Bukkit {
return server.getEntity(uuid);
}
@ -17,6 +17,7 @@ index 14e425d1..6055c801 100644
+ * Gets the current server TPS
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public static double[] getTPS() {
+ return server.getTPS();
+ }
@ -26,12 +27,12 @@ index 14e425d1..6055c801 100644
* Get the advancement specified by this key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9d2326ca..1632af18 100644
index 9f7f760af..3ad70b92f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1056,6 +1056,15 @@ public interface Server extends PluginMessageRecipient {
*/
Entity getEntity(UUID uuid);
@@ -1122,6 +1122,16 @@ public interface Server extends PluginMessageRecipient {
@Nullable
Entity getEntity(@NotNull UUID uuid);
+ // Paper start
+ /**
@ -39,6 +40,7 @@ index 9d2326ca..1632af18 100644
+ *
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public double[] getTPS();
+ // Paper end
+
@ -46,5 +48,5 @@ index 9d2326ca..1632af18 100644
* Get the advancement specified by this key.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From ac7b32c1796b75c604e78cde4e691fbf4611df50 Mon Sep 17 00:00:00 2001
From c59a5c4c7d44ac1e718fb648531bdba8132dbe23 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 17:50:31 -0600
Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 236cddb2..015a4c56 100644
index 19dc1e6a8..69307e252 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -559,4 +559,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
@@ -580,4 +580,16 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
@Override
Spigot spigot();
// Spigot end
@ -21,14 +21,15 @@ index 236cddb2..015a4c56 100644
+ *
+ * @return Location where entity originates or null if not yet added
+ */
+ @Nullable
+ Location getOrigin();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index 0cd830d9..170a9aee 100644
index 64f9d3fd8..14cb0d770 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -51,4 +51,15 @@ public interface FallingBlock extends Entity {
@@ -54,4 +54,15 @@ public interface FallingBlock extends Entity {
* @param hurtEntities whether entities will be damaged by this block.
*/
void setHurtEntities(boolean hurtEntities);
@ -45,12 +46,12 @@ index 0cd830d9..170a9aee 100644
+ }
}
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
index a439eaf5..04cc23ef 100644
index 5a8789324..3022b4a27 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -37,4 +37,15 @@ public interface TNTPrimed extends Explosive {
* @return the source of this primed TNT
@@ -39,4 +39,15 @@ public interface TNTPrimed extends Explosive {
*/
@Nullable
public Entity getSource();
+
+ /**
@ -65,5 +66,5 @@ index a439eaf5..04cc23ef 100644
+ }
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 33f3804404e0c186f8cf33f8f3a226e0d84b7dfc Mon Sep 17 00:00:00 2001
From 1a30440641954b395935425e537a9b77857aacdc Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 17:58:01 -0600
Subject: [PATCH] Check Paper versions
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 5a994953..f38f6864 100644
index 0305548e..8e57aa91 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -26,6 +26,11 @@ import org.json.simple.JSONObject;
@@ -28,6 +28,11 @@ import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@ -18,18 +18,18 @@ index 5a994953..f38f6864 100644
+// Paper end
+
public class VersionCommand extends BukkitCommand {
public VersionCommand(String name) {
public VersionCommand(@NotNull String name) {
super(name);
@@ -149,7 +154,7 @@ public class VersionCommand extends BukkitCommand {
@@ -153,7 +158,7 @@ public class VersionCommand extends BukkitCommand {
private void sendVersion(CommandSender sender) {
private void sendVersion(@NotNull CommandSender sender) {
if (hasVersion) {
- if (System.currentTimeMillis() - lastCheck > 21600000) {
+ if (System.currentTimeMillis() - lastCheck > 7200000) { // Paper - Lower to 2 hours
lastCheck = System.currentTimeMillis();
hasVersion = false;
} else {
@@ -180,24 +185,28 @@ public class VersionCommand extends BukkitCommand {
@@ -184,24 +189,28 @@ public class VersionCommand extends BukkitCommand {
}
}
@ -70,13 +70,13 @@ index 5a994953..f38f6864 100644
version = version.substring("git-Bukkit-".length());
int cbVersions = getDistance("craftbukkit", version.substring(0, version.indexOf(' ')));
if (cbVersions == -1) {
@@ -230,8 +239,16 @@ public class VersionCommand extends BukkitCommand {
@@ -234,8 +243,16 @@ public class VersionCommand extends BukkitCommand {
}
}
- private static int getDistance(String repo, String hash) {
- private static int getDistance(@NotNull String repo, @NotNull String hash) {
+ // Paper start
+ private static int getDistance(String repo, String verInfo) {
+ private static int getDistance(@NotNull String repo, @NotNull String verInfo) {
try {
+ int currentVer = Integer.decode(verInfo);
+ return getFromJenkins(currentVer);
@ -88,7 +88,7 @@ index 5a994953..f38f6864 100644
BufferedReader reader = Resources.asCharSource(
new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
Charsets.UTF_8
@@ -245,9 +262,57 @@ public class VersionCommand extends BukkitCommand {
@@ -249,9 +266,57 @@ public class VersionCommand extends BukkitCommand {
} finally {
reader.close();
}
@ -147,5 +147,5 @@ index 5a994953..f38f6864 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From e802df27e5944819165eb81c78b5c6e4842a15dd Mon Sep 17 00:00:00 2001
From 331efa882680033d3d69d00d3717886572cf5051 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 18:05:37 -0600
Subject: [PATCH] Add player view distance API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 694254f1..d72a7e3d 100644
index 95ebf016..51a145a4 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1468,6 +1468,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1480,6 +1480,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void updateCommands();
@ -30,5 +30,5 @@ index 694254f1..d72a7e3d 100644
public class Spigot extends Entity.Spigot
{
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 41cb3feff77a6e684cefbc546f48245294a2d978 Mon Sep 17 00:00:00 2001
From 187c890c4b97f0664edd8959a7dd28e30ad611d4 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 18:09:40 -0600
Subject: [PATCH] Add BeaconEffectEvent
@ -6,10 +6,10 @@ Subject: [PATCH] Add BeaconEffectEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
new file mode 100644
index 00000000..6579ae99
index 000000000..978813b94
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
@@ -0,0 +1,81 @@
@@ -0,0 +1,86 @@
+package com.destroystokyo.paper.event.block;
+
+import org.bukkit.block.Block;
@ -18,6 +18,7 @@ index 00000000..6579ae99
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.bukkit.potion.PotionEffect;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a beacon effect is being applied to a player.
@ -29,7 +30,7 @@ index 00000000..6579ae99
+ private Player player;
+ private boolean primary;
+
+ public BeaconEffectEvent(Block block, PotionEffect effect, Player player, boolean primary) {
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
+ super(block);
+ this.effect = effect;
+ this.player = player;
@ -51,6 +52,7 @@ index 00000000..6579ae99
+ *
+ * @return Potion effect
+ */
+ @NotNull
+ public PotionEffect getEffect() {
+ return effect;
+ }
@ -60,7 +62,7 @@ index 00000000..6579ae99
+ *
+ * @param effect Potion effect
+ */
+ public void setEffect(PotionEffect effect) {
+ public void setEffect(@NotNull PotionEffect effect) {
+ this.effect = effect;
+ }
+
@ -69,6 +71,7 @@ index 00000000..6579ae99
+ *
+ * @return Affected player
+ */
+ @NotNull
+ public Player getPlayer() {
+ return player;
+ }
@ -82,15 +85,17 @@ index 00000000..6579ae99
+ return primary;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 31ed8767255c5f82dbb149e44a080e17a52d7f29 Mon Sep 17 00:00:00 2001
From 29f3d0354d4a1dd627e60c82bd78e01655df4dc3 Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com>
Date: Mon, 29 Feb 2016 18:13:58 -0600
Subject: [PATCH] Add PlayerInitialSpawnEvent
@ -7,22 +7,23 @@ For modifying a player's initial spawn location as they join the server
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
new file mode 100644
index 00000000..d1d6f33c
index 000000000..8e407eff1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
@@ -0,0 +1,43 @@
@@ -0,0 +1,47 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+public class PlayerInitialSpawnEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private Location spawnLocation;
+ @NotNull private Location spawnLocation;
+
+ public PlayerInitialSpawnEvent(final Player player, final Location spawnLocation) {
+ public PlayerInitialSpawnEvent(@NotNull final Player player, @NotNull final Location spawnLocation) {
+ super(player);
+ this.spawnLocation = spawnLocation;
+ }
@ -32,6 +33,7 @@ index 00000000..d1d6f33c
+ *
+ * @return Location current spawn location
+ */
+ @NotNull
+ public Location getSpawnLocation() {
+ return this.spawnLocation;
+ }
@ -41,19 +43,21 @@ index 00000000..d1d6f33c
+ *
+ * @param spawnLocation new location for the spawn
+ */
+ public void setSpawnLocation(Location spawnLocation) {
+ public void setSpawnLocation(@NotNull Location spawnLocation) {
+ this.spawnLocation = spawnLocation;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 022b86144f12f59ec72a1d51aa364d1dfecd590f Mon Sep 17 00:00:00 2001
From 42102ce2e5ad6be437319492744160cde67deed9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 19:45:21 -0600
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
index 54594546..bf972302 100644
index 5b29076f..ac0702df 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -332,6 +332,10 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -340,6 +340,10 @@ public final class JavaPluginLoader implements PluginLoader {
jPlugin.setEnabled(true);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
@ -20,5 +20,5 @@ index 54594546..bf972302 100644
// Perhaps abort here, rather than continue going, but as it stands,
--
2.20.1
2.21.0

Datei anzeigen

@ -1,36 +1,38 @@
From 1810c82d5d0939592b9bd28dff43af08b9913578 Mon Sep 17 00:00:00 2001
From b61d6612271e90b23b9ffeb9d5a16d9df184287a Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Mon, 29 Feb 2016 19:48:59 -0600
Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 6055c801..cb7dc068 100644
index 2ad9a7d7f..3a80f2e29 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1437,6 +1437,17 @@ public final class Bukkit {
@@ -1517,6 +1517,19 @@ public final class Bukkit {
return server.getUnsafe();
}
+
+ // Paper start
+ /**
+ * Gets the active {@link org.bukkit.command.CommandMap}
+ *
+ * @return the active command map
+ */
+ @NotNull
+ public static org.bukkit.command.CommandMap getCommandMap() {
+ return server.getCommandMap();
+ }
+ // Paper end
+
@NotNull
public static Server.Spigot spigot()
{
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1632af18..c4dc1de2 100644
index 3ad70b92f..4c3156071 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1065,6 +1065,14 @@ public interface Server extends PluginMessageRecipient {
@@ -1132,6 +1132,15 @@ public interface Server extends PluginMessageRecipient {
public double[] getTPS();
// Paper end
@ -40,11 +42,12 @@ index 1632af18..c4dc1de2 100644
+ *
+ * @return the active command map
+ */
+ @NotNull
+ org.bukkit.command.CommandMap getCommandMap();
+
/**
* Get the advancement specified by this key.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From fb9cdc4061e67e97aa4bb394408fa0ed58d5980d Mon Sep 17 00:00:00 2001
From 6bc816b2ea026b0d07a19fa4bb3453c03ed421e6 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 19:54:32 -0600
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
@ -6,10 +6,10 @@ Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
Change Javadoc to be accurate
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index cb7dc068..22704949 100644
index 3a80f2e29..e27bdb7bf 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -289,6 +289,26 @@ public final class Bukkit {
@@ -302,6 +302,26 @@ public final class Bukkit {
return server.broadcastMessage(message);
}
@ -19,7 +19,7 @@ index cb7dc068..22704949 100644
+ *
+ * @param component the component to send
+ */
+ public static void broadcast(net.md_5.bungee.api.chat.BaseComponent component) {
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ server.broadcast(component);
+ }
+
@ -28,7 +28,7 @@ index cb7dc068..22704949 100644
+ *
+ * @param components the components to send
+ */
+ public static void broadcast(net.md_5.bungee.api.chat.BaseComponent... components) {
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ server.broadcast(components);
+ }
+ // Paper end
@ -37,12 +37,12 @@ index cb7dc068..22704949 100644
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c4dc1de2..f4f4f291 100644
index 4c3156071..ab0438b81 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -237,6 +237,26 @@ public interface Server extends PluginMessageRecipient {
@@ -249,6 +249,26 @@ public interface Server extends PluginMessageRecipient {
*/
public int broadcastMessage(String message);
public int broadcastMessage(@NotNull String message);
+ // Paper start
+ /**
@ -50,7 +50,7 @@ index c4dc1de2..f4f4f291 100644
+ *
+ * @param component the component to send
+ */
+ public default void broadcast(net.md_5.bungee.api.chat.BaseComponent component) {
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ spigot().broadcast(component);
+ }
+
@ -59,7 +59,7 @@ index c4dc1de2..f4f4f291 100644
+ *
+ * @param components the components to send
+ */
+ public default void broadcast(net.md_5.bungee.api.chat.BaseComponent... components) {
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ spigot().broadcast(components);
+ }
+ // Paper end
@ -68,12 +68,12 @@ index c4dc1de2..f4f4f291 100644
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d72a7e3d..bf86eb67 100644
index 51a145a4a..5a741b41e 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -414,6 +414,36 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -421,6 +421,38 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendMap(MapView map);
public void sendMap(@NotNull MapView map);
+ // Paper start
+ /**
@ -81,7 +81,8 @@ index d72a7e3d..bf86eb67 100644
+ *
+ * @param component the components to send
+ */
+ public default void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) {
+ @Override
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ spigot().sendMessage(component);
+ }
+
@ -90,7 +91,8 @@ index d72a7e3d..bf86eb67 100644
+ *
+ * @param components the components to send
+ */
+ public default void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
+ @Override
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ spigot().sendMessage(components);
+ }
+
@ -109,5 +111,5 @@ index d72a7e3d..bf86eb67 100644
* Forces an update of the player's entire inventory.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 4a3c14108319be72d10d723765208489faeade93 Mon Sep 17 00:00:00 2001
From cc380b206c9722db4792168359563441f224663a Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Mon, 29 Feb 2016 20:02:40 -0600
Subject: [PATCH] Player Tab List and Title APIs
@ -6,16 +6,18 @@ Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/com/destroystokyo/paper/Title.java b/src/main/java/com/destroystokyo/paper/Title.java
new file mode 100644
index 00000000..3c2b63db
index 000000000..4fe18540f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/Title.java
@@ -0,0 +1,358 @@
@@ -0,0 +1,373 @@
+package com.destroystokyo.paper;
+
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.api.chat.TextComponent;
+
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
@ -55,7 +57,7 @@ index 00000000..3c2b63db
+ * @param title the main text of the title
+ * @throws NullPointerException if the title is null
+ */
+ public Title(BaseComponent title) {
+ public Title(@NotNull BaseComponent title) {
+ this(title, null);
+ }
+
@ -67,7 +69,7 @@ index 00000000..3c2b63db
+ * @param title the main text of the title
+ * @throws NullPointerException if the title is null
+ */
+ public Title(BaseComponent[] title) {
+ public Title(@NotNull BaseComponent[] title) {
+ this(title, null);
+ }
+
@ -79,7 +81,7 @@ index 00000000..3c2b63db
+ * @param title the main text of the title
+ * @throws NullPointerException if the title is null
+ */
+ public Title(String title) {
+ public Title(@NotNull String title) {
+ this(title, null);
+ }
+
@ -91,7 +93,7 @@ index 00000000..3c2b63db
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ */
+ public Title(BaseComponent title, BaseComponent subtitle) {
+ public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle) {
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
+ }
+
@ -103,7 +105,7 @@ index 00000000..3c2b63db
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ */
+ public Title(BaseComponent[] title, BaseComponent[] subtitle) {
+ public Title(@NotNull BaseComponent[] title, @Nullable BaseComponent[] subtitle) {
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
+ }
+
@ -115,7 +117,7 @@ index 00000000..3c2b63db
+ * @param title the main text of the title
+ * @param subtitle the secondary text of the title
+ */
+ public Title(String title, String subtitle) {
+ public Title(@NotNull String title, @Nullable String subtitle) {
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
+ }
+
@ -129,7 +131,7 @@ index 00000000..3c2b63db
+ * @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) {
+ public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle, int fadeIn, int stay, int fadeOut) {
+ this(
+ new BaseComponent[]{checkNotNull(title, "title")},
+ subtitle == null ? null : new BaseComponent[]{subtitle},
@ -149,7 +151,7 @@ index 00000000..3c2b63db
+ * @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) {
+ public Title(@Nullable BaseComponent[] title, @NotNull 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);
@ -171,7 +173,7 @@ index 00000000..3c2b63db
+ * @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) {
+ public Title(@NotNull String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) {
+ this(
+ TextComponent.fromLegacyText(checkNotNull(title, "title")),
+ subtitle == null ? null : TextComponent.fromLegacyText(subtitle),
@ -186,6 +188,7 @@ index 00000000..3c2b63db
+ *
+ * @return the text
+ */
+ @NotNull
+ public BaseComponent[] getTitle() {
+ return this.title;
+ }
@ -195,6 +198,7 @@ index 00000000..3c2b63db
+ *
+ * @return the text
+ */
+ @Nullable
+ public BaseComponent[] getSubtitle() {
+ return this.subtitle;
+ }
@ -232,6 +236,7 @@ index 00000000..3c2b63db
+ return this.fadeOut;
+ }
+
+ @NotNull
+ public static Builder builder() {
+ return new Builder();
+ }
@ -254,7 +259,8 @@ index 00000000..3c2b63db
+ * @return this builder instance
+ * @throws NullPointerException if the title is null
+ */
+ public Builder title(BaseComponent title) {
+ @NotNull
+ public Builder title(@NotNull BaseComponent title) {
+ return this.title(new BaseComponent[]{checkNotNull(title, "title")});
+ }
+
@ -265,7 +271,8 @@ index 00000000..3c2b63db
+ * @return this builder instance
+ * @throws NullPointerException if the title is null
+ */
+ public Builder title(BaseComponent[] title) {
+ @NotNull
+ public Builder title(@NotNull BaseComponent[] title) {
+ this.title = checkNotNull(title, "title");
+ return this;
+ }
@ -279,7 +286,8 @@ index 00000000..3c2b63db
+ * @return this builder instance
+ * @throws NullPointerException if the title is null
+ */
+ public Builder title(String title) {
+ @NotNull
+ public Builder title(@NotNull String title) {
+ return this.title(TextComponent.fromLegacyText(checkNotNull(title, "title")));
+ }
+
@ -289,7 +297,8 @@ index 00000000..3c2b63db
+ * @param subtitle the title text
+ * @return this builder instance
+ */
+ public Builder subtitle(BaseComponent subtitle) {
+ @NotNull
+ public Builder subtitle(@Nullable BaseComponent subtitle) {
+ return this.subtitle(subtitle == null ? null : new BaseComponent[]{subtitle});
+ }
+
@ -299,7 +308,8 @@ index 00000000..3c2b63db
+ * @param subtitle the title text
+ * @return this builder instance
+ */
+ public Builder subtitle(BaseComponent[] subtitle) {
+ @NotNull
+ public Builder subtitle(@Nullable BaseComponent[] subtitle) {
+ this.subtitle = subtitle;
+ return this;
+ }
@ -312,7 +322,8 @@ index 00000000..3c2b63db
+ * @param subtitle the title text
+ * @return this builder instance
+ */
+ public Builder subtitle(String subtitle) {
+ @NotNull
+ public Builder subtitle(@Nullable String subtitle) {
+ return this.subtitle(subtitle == null ? null : TextComponent.fromLegacyText(subtitle));
+ }
+
@ -323,6 +334,7 @@ index 00000000..3c2b63db
+ * @return this builder instance
+ * @throws IllegalArgumentException if it is negative
+ */
+ @NotNull
+ public Builder fadeIn(int fadeIn) {
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
+ this.fadeIn = fadeIn;
@ -337,6 +349,7 @@ index 00000000..3c2b63db
+ * @return this builder instance
+ * @throws IllegalArgumentException if it is negative
+ */
+ @NotNull
+ public Builder stay(int stay) {
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
+ this.stay = stay;
@ -350,6 +363,7 @@ index 00000000..3c2b63db
+ * @return this builder instance
+ * @throws IllegalArgumentException if it is negative
+ */
+ @NotNull
+ public Builder fadeOut(int fadeOut) {
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
+ this.fadeOut = fadeOut;
@ -362,6 +376,7 @@ index 00000000..3c2b63db
+ * @return a title from the values in this builder
+ * @throws IllegalStateException if title isn't specified
+ */
+ @NotNull
+ public Title build() {
+ checkState(title != null, "Title not specified");
+ return new Title(this.title, this.subtitle, this.fadeIn, this.stay, this.fadeOut);
@ -369,7 +384,7 @@ index 00000000..3c2b63db
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index bf86eb67..959add05 100644
index 5a741b41e..1de43bd33 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2,6 +2,7 @@ package org.bukkit.entity;
@ -378,9 +393,9 @@ index bf86eb67..959add05 100644
+import com.destroystokyo.paper.Title;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@@ -442,6 +443,116 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
import org.bukkit.GameMode;
@@ -451,6 +452,116 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
spigot().sendMessage(position, components);
}
@ -391,7 +406,7 @@ index bf86eb67..959add05 100644
+ * @param header content for the top of the player list
+ * @param footer content for the bottom of the player list
+ */
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer);
+ public void setPlayerListHeaderFooter(@Nullable net.md_5.bungee.api.chat.BaseComponent[] header, @Nullable net.md_5.bungee.api.chat.BaseComponent[] footer);
+
+ /**
+ * Set the text displayed in the player list header and footer for this player
@ -399,7 +414,7 @@ index bf86eb67..959add05 100644
+ * @param header content for the top of the player list
+ * @param footer content for the bottom of the player list
+ */
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer);
+ public void setPlayerListHeaderFooter(@Nullable net.md_5.bungee.api.chat.BaseComponent header, @Nullable net.md_5.bungee.api.chat.BaseComponent footer);
+
+ /**
+ * Update the times for titles displayed to the player
@ -434,7 +449,7 @@ index bf86eb67..959add05 100644
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title);
+ public void showTitle(@Nullable 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
@ -442,7 +457,7 @@ index bf86eb67..959add05 100644
+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
+ */
+ @Deprecated
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title);
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title);
+
+ /**
+ * Show the given title and subtitle to the player using the given times
@ -455,7 +470,7 @@ index bf86eb67..959add05 100644
+ * @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);
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] title, @Nullable net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
+
+ /**
+ * Show the given title and subtitle to the player using the given times
@ -468,7 +483,7 @@ index bf86eb67..959add05 100644
+ * @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);
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title, @Nullable 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.
@ -478,7 +493,7 @@ index bf86eb67..959add05 100644
+ * @param title the title to send
+ * @throws NullPointerException if the title is null
+ */
+ void sendTitle(Title title);
+ void sendTitle(@NotNull Title title);
+
+ /**
+ * Show the title to the player, overriding any previously displayed title.
@ -488,7 +503,7 @@ index bf86eb67..959add05 100644
+ * @param title the title to send
+ * @throws NullPointerException if title is null
+ */
+ void updateTitle(Title title);
+ void updateTitle(@NotNull Title title);
+
+ /**
+ * Hide any title that is currently visible to the player
@ -498,5 +513,5 @@ index bf86eb67..959add05 100644
/**
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From e2ae8da9f75fcb1125eb4b5d155f87c10402abdc Mon Sep 17 00:00:00 2001
From 6c5e4653f78507a8553b8e9f915449a0ca3aa50f Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 20:24:35 -0600
Subject: [PATCH] Add exception reporting event
@ -6,10 +6,10 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
new file mode 100644
index 00000000..4109454a
index 000000000..d3b00f741
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
@@ -0,0 +1,37 @@
@@ -0,0 +1,41 @@
+package com.destroystokyo.paper.event.server;
+
+import com.google.common.base.Preconditions;
@ -17,15 +17,16 @@ index 00000000..4109454a
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import com.destroystokyo.paper.exception.ServerException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * 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;
+ @NotNull private ServerException exception;
+
+ public ServerExceptionEvent(ServerException exception) {
+ public ServerExceptionEvent(@NotNull ServerException exception) {
+ this.exception = Preconditions.checkNotNull(exception, "exception");
+ }
+
@ -34,22 +35,25 @@ index 00000000..4109454a
+ *
+ * @return Exception thrown
+ */
+ @NotNull
+ public ServerException getException() {
+ return exception;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
new file mode 100644
index 00000000..6fb39af0
index 000000000..6fb39af04
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
@@ -0,0 +1,64 @@
@ -119,7 +123,7 @@ index 00000000..6fb39af0
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
new file mode 100644
index 00000000..410b2413
index 000000000..410b24139
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
@@ -0,0 +1,52 @@
@ -177,7 +181,7 @@ index 00000000..410b2413
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
new file mode 100644
index 00000000..c06ea394
index 000000000..c06ea3942
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
@@ -0,0 +1,23 @@
@ -206,7 +210,7 @@ index 00000000..c06ea394
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
new file mode 100644
index 00000000..e762ed0d
index 000000000..e762ed0db
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
@@ -0,0 +1,35 @@
@ -247,7 +251,7 @@ index 00000000..e762ed0d
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
new file mode 100644
index 00000000..f016ba3b
index 000000000..f016ba3b1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
@@ -0,0 +1,20 @@
@ -274,7 +278,7 @@ index 00000000..f016ba3b
\ No newline at end of file
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
new file mode 100644
index 00000000..6defac28
index 000000000..6defac287
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
@@ -0,0 +1,38 @@
@ -318,7 +322,7 @@ index 00000000..6defac28
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
new file mode 100644
index 00000000..89e13252
index 000000000..89e132525
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
@@ -0,0 +1,64 @@
@ -388,7 +392,7 @@ index 00000000..89e13252
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
new file mode 100644
index 00000000..2d0b2d4a
index 000000000..2d0b2d4a9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
@@ -0,0 +1,37 @@
@ -431,7 +435,7 @@ index 00000000..2d0b2d4a
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
new file mode 100644
index 00000000..5582999f
index 000000000..5582999fe
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
@@ -0,0 +1,22 @@
@ -458,7 +462,7 @@ index 00000000..5582999f
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 43e52a77..65ad78c4 100644
index f7ec2e55f..f52d91d19 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -9,6 +9,9 @@ import java.util.Iterator;
@ -471,7 +475,7 @@ index 43e52a77..65ad78c4 100644
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -146,11 +149,14 @@ public class SimpleCommandMap implements CommandMap {
@@ -148,11 +151,14 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
target.timings.stopTiming(); // Spigot
} catch (CommandException ex) {
@ -487,7 +491,7 @@ index 43e52a77..65ad78c4 100644
}
// return true as command was handled
@@ -222,7 +228,9 @@ public class SimpleCommandMap implements CommandMap {
@@ -227,7 +233,9 @@ public class SimpleCommandMap implements CommandMap {
} catch (CommandException ex) {
throw ex;
} catch (Throwable ex) {
@ -499,7 +503,7 @@ index 43e52a77..65ad78c4 100644
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 0185934b..b7627e39 100644
index fe5725519..4c55f5f8c 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -19,6 +19,9 @@ import java.util.logging.Level;
@ -512,7 +516,7 @@ index 0185934b..b7627e39 100644
import org.apache.commons.lang.Validate;
import org.bukkit.Server;
import org.bukkit.command.Command;
@@ -402,7 +405,8 @@ public final class SimplePluginManager implements PluginManager {
@@ -408,7 +411,8 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) {
@ -522,7 +526,7 @@ index 0185934b..b7627e39 100644
}
HandlerList.bakeAll();
@@ -421,36 +425,48 @@ public final class SimplePluginManager implements PluginManager {
@@ -427,36 +431,48 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) {
@ -576,7 +580,7 @@ index 0185934b..b7627e39 100644
public void clearPlugins() {
synchronized (this) {
disablePlugins();
@@ -512,7 +528,13 @@ public final class SimplePluginManager implements PluginManager {
@@ -518,7 +534,13 @@ public final class SimplePluginManager implements PluginManager {
));
}
} catch (Throwable ex) {
@ -592,5 +596,5 @@ index 0185934b..b7627e39 100644
}
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 53967b181e239d26686641531567dd5ca810eaef Mon Sep 17 00:00:00 2001
From 1b07518a82ecb065e8b048fbf5dee4498d15c1be Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 20:26:39 -0600
Subject: [PATCH] Fix ServerListPingEvent flagging as Async
@ -30,25 +30,25 @@ index eb00d6af..70416c81 100644
+ // 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
index d873763d..b68d7b2f 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>
@@ -23,6 +23,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) {
public ServerListPingEvent(@NotNull final InetAddress address, @NotNull 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>
@@ -40,6 +41,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) {
protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull 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.20.1
2.21.0

Datei anzeigen

@ -1,15 +1,15 @@
From 325fb41de3f83292cb643328dca9fe1cf88a4285 Mon Sep 17 00:00:00 2001
From 38ce360e0c5d461a283fd77ec5ebea7849e42728 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Tue, 8 Mar 2016 13:05:59 -0800
Subject: [PATCH] Add BaseComponent sendMessage methods to CommandSender
diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java
index abf68a2c..fcb03b83 100644
index 74816c63f..be11d52a0 100644
--- a/src/main/java/org/bukkit/command/CommandSender.java
+++ b/src/main/java/org/bukkit/command/CommandSender.java
@@ -58,4 +58,30 @@ public interface CommandSender extends Permissible {
@@ -62,4 +62,30 @@ public interface CommandSender extends Permissible {
@NotNull
Spigot spigot();
// Spigot end
+
@ -22,7 +22,7 @@ index abf68a2c..fcb03b83 100644
+ *
+ * @param component the component to send
+ */
+ default void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) {
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ this.sendMessage(component.toLegacyText());
+ }
+
@ -34,31 +34,11 @@ index abf68a2c..fcb03b83 100644
+ *
+ * @param components the components to send
+ */
+ default void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText());
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 959add05..5109a0c3 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -421,6 +421,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param component the components to send
*/
+ @Override
public default void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) {
spigot().sendMessage(component);
}
@@ -430,6 +431,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param components the components to send
*/
+ @Override
public default void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
spigot().sendMessage(components);
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From b7ed9b6398099edd1abbd197e97f6ccd0f3bf446 Mon Sep 17 00:00:00 2001
From 23b2c19d3d32bb5b75160c6aaab8cde7331b8068 Mon Sep 17 00:00:00 2001
From: mrapple <tony@oc.tc>
Date: Sun, 25 Nov 2012 13:47:27 -0600
Subject: [PATCH] Add methods for working with arrows stuck in living entities
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 8cf98673..f67711fd 100644
index af8ea5ca..1100e305 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -453,4 +453,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@@ -468,4 +468,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @return collision status
*/
boolean isCollidable();
@ -29,5 +29,5 @@ index 8cf98673..f67711fd 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,24 +1,24 @@
From 84cb83edc3529a5d89c634cf92d88e36ea7b051a Mon Sep 17 00:00:00 2001
From 3006cdc9d1fe4ed39e0cbf17b4a2726245c0efa6 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 22:59:54 -0400
Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5109a0c3..96d97bf3 100644
index 1de43bd33..c237073a3 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1204,7 +1204,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1212,7 +1212,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the URL is null.
* @throws IllegalArgumentException Thrown if the URL is too long. The
* length restriction is an implementation specific arbitrary value.
+ * @deprecated use {@link #setResourcePack(String, String)}
*/
+ @Deprecated // Paper
public void setResourcePack(String url);
public void setResourcePack(@NotNull String url);
/**
@@ -1625,6 +1627,60 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1637,6 +1639,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void setViewDistance(int viewDistance);
@ -52,12 +52,13 @@ index 5109a0c3..96d97bf3 100644
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ */
+ void setResourcePack(String url, String hash);
+ void setResourcePack(@NotNull String url, @NotNull String hash);
+
+ /**
+ * @return the most recent resource pack status received from the player,
+ * or null if no status has ever been received from this player.
+ */
+ @Nullable
+ org.bukkit.event.player.PlayerResourcePackStatusEvent.Status getResourcePackStatus();
+
+ /**
@ -66,6 +67,7 @@ index 5109a0c3..96d97bf3 100644
+ *
+ * @deprecated This is no longer sent from the client and will always be null
+ */
+ @Nullable
+ @Deprecated
+ String getResourcePackHash();
+
@ -80,10 +82,10 @@ index 5109a0c3..96d97bf3 100644
public class Spigot extends Entity.Spigot
{
diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
index 4c498016..aa18a766 100644
index b98195650..4c2102a11 100644
--- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
@@ -10,13 +10,32 @@ import org.bukkit.event.HandlerList;
@@ -11,13 +11,32 @@ import org.jetbrains.annotations.NotNull;
public class PlayerResourcePackStatusEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
@ -91,7 +93,7 @@ index 4c498016..aa18a766 100644
+ private final String hash; // Paper
private final Status status;
public PlayerResourcePackStatusEvent(final Player who, Status resourcePackStatus) {
public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull Status resourcePackStatus) {
super(who);
+ this.hash = null; // Paper
this.status = resourcePackStatus;
@ -117,5 +119,5 @@ index 4c498016..aa18a766 100644
* Gets the status of this pack.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From c3ff7d3fbb2e568bfc8c25a3c3f0857e73c2c184 Mon Sep 17 00:00:00 2001
From 5fda55b242bfa249aed8325120b652cc33f04288 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Thu, 3 Mar 2016 13:20:33 -0700
Subject: [PATCH] Use ASM for event executors.
@ -6,33 +6,33 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/pom.xml b/pom.xml
index f8f12595..84ba2076 100644
index 524231ecc..082f2f0c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,6 +116,17 @@
<version>1.3</version>
@@ -128,6 +128,17 @@
<version>7.1</version>
<scope>test</scope>
</dependency>
+ <!-- ASM -->
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>6.1.1</version>
+ <version>7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ <version>6.1.1</version>
+ <version>7.1</version>
+ </dependency>
</dependencies>
<build>
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
new file mode 100644
index 00000000..9ff99e3b
index 000000000..72318d42d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
@@ -0,0 +1,40 @@
@@ -0,0 +1,41 @@
+package com.destroystokyo.paper.event.executor;
+
+import java.lang.invoke.MethodHandle;
@ -43,17 +43,18 @@ index 00000000..9ff99e3b
+import org.bukkit.event.EventException;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class MethodHandleEventExecutor implements EventExecutor {
+ private final Class<? extends Event> eventClass;
+ private final MethodHandle handle;
+
+ public MethodHandleEventExecutor(Class<? extends Event> eventClass, MethodHandle handle) {
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull MethodHandle handle) {
+ this.eventClass = eventClass;
+ this.handle = handle;
+ }
+
+ public MethodHandleEventExecutor(Class<? extends Event> eventClass, Method m) {
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
+ this.eventClass = eventClass;
+ try {
+ m.setAccessible(true);
@ -64,7 +65,7 @@ index 00000000..9ff99e3b
+ }
+
+ @Override
+ public void execute(Listener listener, Event event) throws EventException {
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
+ if (!eventClass.isInstance(event)) return;
+ try {
+ handle.invoke(listener, event);
@ -75,10 +76,10 @@ index 00000000..9ff99e3b
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
new file mode 100644
index 00000000..bac04fd8
index 000000000..c83672427
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
@@ -0,0 +1,41 @@
@@ -0,0 +1,43 @@
+package com.destroystokyo.paper.event.executor;
+
+import java.lang.invoke.MethodHandle;
@ -94,13 +95,15 @@ index 00000000..bac04fd8
+import org.bukkit.event.EventException;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class StaticMethodHandleEventExecutor implements EventExecutor {
+ private final Class<? extends Event> eventClass;
+ private final MethodHandle handle;
+
+ public StaticMethodHandleEventExecutor(Class<? extends Event> eventClass, Method m) {
+ public StaticMethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
+ Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
+ Preconditions.checkArgument(eventClass != null, "eventClass is null");
+ this.eventClass = eventClass;
+ try {
+ m.setAccessible(true);
@ -111,7 +114,7 @@ index 00000000..bac04fd8
+ }
+
+ @Override
+ public void execute(Listener listener, Event event) throws EventException {
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
+ if (!eventClass.isInstance(event)) return;
+ try {
+ handle.invoke(event);
@ -122,16 +125,17 @@ index 00000000..bac04fd8
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
new file mode 100644
index 00000000..140cf0ad
index 000000000..b6e7d8ee8
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
@@ -0,0 +1,44 @@
@@ -0,0 +1,47 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.GeneratorAdapter;
@ -139,7 +143,8 @@ index 00000000..140cf0ad
+import static org.objectweb.asm.Opcodes.*;
+
+public class ASMEventExecutorGenerator {
+ public static byte[] generateEventExecutor(Method m, String name) {
+ @NotNull
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
+ // Generate constructor
@ -165,6 +170,7 @@ index 00000000..140cf0ad
+ }
+
+ public static AtomicInteger NEXT_ID = new AtomicInteger(1);
+ @NotNull
+ public static String generateName() {
+ int id = NEXT_ID.getAndIncrement();
+ return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
@ -172,13 +178,14 @@ index 00000000..140cf0ad
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
new file mode 100644
index 00000000..6941d9fb
index 000000000..beed9e6e0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
@@ -0,0 +1,32 @@
@@ -0,0 +1,35 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import com.destroystokyo.paper.utils.UnsafeUtils;
+import org.jetbrains.annotations.NotNull;
+
+public interface ClassDefiner {
+
@ -201,8 +208,10 @@ index 00000000..6941d9fb
+ * @throws ClassFormatError if the class data is invalid
+ * @throws NullPointerException if any of the arguments are null
+ */
+ public Class<?> defineClass(ClassLoader parentLoader, String name, byte[] data);
+ @NotNull
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
+
+ @NotNull
+ public static ClassDefiner getInstance() {
+ return SafeClassDefiner.INSTANCE;
+ }
@ -210,10 +219,10 @@ index 00000000..6941d9fb
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
new file mode 100644
index 00000000..1473ff8c
index 000000000..ac99477e9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
@@ -0,0 +1,63 @@
@@ -0,0 +1,66 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import java.util.concurrent.ConcurrentHashMap;
@ -222,6 +231,7 @@ index 00000000..1473ff8c
+import com.google.common.base.Preconditions;
+
+import com.google.common.collect.MapMaker;
+import org.jetbrains.annotations.NotNull;
+import org.objectweb.asm.Type;
+
+public class SafeClassDefiner implements ClassDefiner {
@ -231,8 +241,9 @@ index 00000000..1473ff8c
+
+ private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
+
+ @NotNull
+ @Override
+ public Class<?> defineClass(ClassLoader parentLoader, String name, byte[] data) {
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
+ GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
+ synchronized (loader.getClassLoadingLock(name)) {
+ Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
@ -247,11 +258,11 @@ index 00000000..1473ff8c
+ ClassLoader.registerAsParallelCapable();
+ }
+
+ protected GeneratedClassLoader(ClassLoader parent) {
+ protected GeneratedClassLoader(@NotNull ClassLoader parent) {
+ super(parent);
+ }
+
+ private Class<?> define(String name, byte[] data) {
+ private Class<?> define(@NotNull String name, byte[] data) {
+ synchronized (getClassLoadingLock(name)) {
+ assert !hasClass(name);
+ Class<?> c = defineClass(name, data, 0, data.length);
@ -261,11 +272,12 @@ index 00000000..1473ff8c
+ }
+
+ @Override
+ public Object getClassLoadingLock(String name) {
+ @NotNull
+ public Object getClassLoadingLock(@NotNull String name) {
+ return super.getClassLoadingLock(name);
+ }
+
+ public boolean hasClass(String name) {
+ public boolean hasClass(@NotNull String name) {
+ synchronized (getClassLoadingLock(name)) {
+ try {
+ Class.forName(name);
@ -279,12 +291,13 @@ index 00000000..1473ff8c
+}
diff --git a/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java b/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java
new file mode 100644
index 00000000..62acbf82
index 000000000..72e48e8ef
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java
@@ -0,0 +1,33 @@
@@ -0,0 +1,35 @@
+package com.destroystokyo.paper.utils;
+
+import org.jetbrains.annotations.Nullable;
+import sun.misc.Unsafe;
+
+import java.lang.reflect.Field;
@ -312,22 +325,22 @@ index 00000000..62acbf82
+ return UNSAFE != null;
+ }
+
+ @Nullable
+ public static Unsafe getUnsafe() {
+ return UNSAFE;
+ }
+}
diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java
index 3b2c99ea..b11c6ce6 100644
index a850f0780..9026e108c 100644
--- a/src/main/java/org/bukkit/plugin/EventExecutor.java
+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java
@@ -4,9 +4,74 @@ import org.bukkit.event.Event;
import org.bukkit.event.EventException;
@@ -5,9 +5,75 @@ import org.bukkit.event.EventException;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
+// Paper start
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
@ -343,12 +356,13 @@ index 3b2c99ea..b11c6ce6 100644
* Interface which defines the class for event call backs to plugins
*/
public interface EventExecutor {
public void execute(Listener listener, Event event) throws EventException;
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException;
+
+ // Paper start
+ ConcurrentMap<Method, Class<? extends EventExecutor>> eventExecutorMap = new ConcurrentHashMap<Method, Class<? extends EventExecutor>>() {
+ @NotNull
+ @Override
+ public Class<? extends EventExecutor> computeIfAbsent(Method key, Function<? super Method, ? extends Class<? extends EventExecutor>> mappingFunction) {
+ public Class<? extends EventExecutor> computeIfAbsent(@NotNull Method key, @NotNull Function<? super Method, ? extends Class<? extends EventExecutor>> mappingFunction) {
+ Class<? extends EventExecutor> executorClass = get(key);
+ if (executorClass != null)
+ return executorClass;
@ -364,7 +378,8 @@ index 3b2c99ea..b11c6ce6 100644
+ }
+ };
+
+ public static EventExecutor create(Method m, Class<? extends Event> eventClass) {
+ @NotNull
+ public static EventExecutor create(@NotNull Method m, @NotNull Class<? extends Event> eventClass) {
+ Preconditions.checkNotNull(m, "Null method");
+ Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount());
+ Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass);
@ -396,15 +411,15 @@ index 3b2c99ea..b11c6ce6 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index bf972302..77207f14 100644
index ac0702dfb..b9bf2124b 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -290,20 +290,7 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -298,20 +298,7 @@ public final class JavaPluginLoader implements PluginLoader {
}
}
- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Spigot
- public void execute(Listener listener, Event event) throws EventException {
- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper
- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper
- try {
- if (!eventClass.isAssignableFrom(event.getClass())) {
- return;
@ -416,11 +431,11 @@ index bf972302..77207f14 100644
- throw new EventException(t);
- }
- }
- }, plugin, method, eventClass); // Spigot
+ EventExecutor executor = new co.aikar.timings.TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); // Spigot // Paper - Use factory method `EventExecutor.create()`
- }, plugin, method, eventClass); // Paper
+ EventExecutor executor = new co.aikar.timings.TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); // Paper // Paper (Yes.) - Use factory method `EventExecutor.create()`
if (false) { // Spigot - RL handles useTimings check now
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else {
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 39a9d269c567db7d72040f7bd62befb4c4a09482 Mon Sep 17 00:00:00 2001
From cce6ae851ef26907674e191596d14c4769c953f2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 May 2013 20:36:58 -0400
Subject: [PATCH] Add a call helper to Event
@ -6,17 +6,10 @@ Subject: [PATCH] Add a call helper to Event
Reduces diff in Server patches
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
index 6677e1bd..e7061112 100644
index 18d0636b..8ec56cd6 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -1,5 +1,6 @@
package org.bukkit.event;
+import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
/**
@@ -33,6 +34,22 @@ public abstract class Event {
@@ -35,6 +35,22 @@ public abstract class Event {
this.async = isAsync;
}
@ -27,7 +20,7 @@ index 6677e1bd..e7061112 100644
+ * @return false if event was cancelled, if cancellable. otherwise true.
+ */
+ public boolean callEvent() {
+ Bukkit.getPluginManager().callEvent(this);
+ org.bukkit.Bukkit.getPluginManager().callEvent(this);
+ if (this instanceof Cancellable) {
+ return !((Cancellable) this).isCancelled();
+ } else {
@ -40,5 +33,5 @@ index 6677e1bd..e7061112 100644
* Convenience method for providing a user-friendly identifier. By
* default, it is the event's class's {@linkplain Class#getSimpleName()
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 01aa5305d302cfcdfdd2fb0ba3726cf5f3e7f8cd Mon Sep 17 00:00:00 2001
From 897b248eb3ad7bb683e285b8c144942bc9e8e951 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 22 Jul 2015 18:50:41 -0400
Subject: [PATCH] Add sender name to commands.yml replacement
@ -7,20 +7,19 @@ This allows you to use $sender in commands.yml definitions to make
commands that auto target self.
diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
index 9c80f464..631be1cb 100644
index 982f0fb4..3276879d 100644
--- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java
+++ b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
@@ -1,6 +1,9 @@
@@ -1,6 +1,8 @@
package org.bukkit.command;
import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher; // Paper
+import java.util.regex.Pattern; // Paper
import org.bukkit.Bukkit;
@@ -19,7 +22,7 @@ public class FormattedCommandAlias extends Command {
import org.jetbrains.annotations.NotNull;
@@ -20,7 +22,7 @@ public class FormattedCommandAlias extends Command {
ArrayList<String> commands = new ArrayList<String>();
for (String formatString : formatStrings) {
try {
@ -29,12 +28,12 @@ index 9c80f464..631be1cb 100644
} catch (Throwable throwable) {
if (throwable instanceof IllegalArgumentException) {
sender.sendMessage(throwable.getMessage());
@@ -37,7 +40,10 @@ public class FormattedCommandAlias extends Command {
@@ -38,7 +40,10 @@ public class FormattedCommandAlias extends Command {
return result;
}
- private String buildCommand(String formatString, String[] args) {
+ private String buildCommand(CommandSender sender, String formatString, String[] args) { // Paper
- private String buildCommand(@NotNull String formatString, @NotNull String[] args) {
+ private String buildCommand(@NotNull CommandSender sender, @NotNull String formatString, @NotNull String[] args) { // Paper
+ if (formatString.contains("$sender")) { // Paper
+ formatString = formatString.replaceAll(Pattern.quote("$sender"), Matcher.quoteReplacement(sender.getName())); // Paper
+ } // Paper
@ -42,5 +41,5 @@ index 9c80f464..631be1cb 100644
while (index != -1) {
int start = index;
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 0e952a407295877a6c5dd1afc482fc75ef8ba8f9 Mon Sep 17 00:00:00 2001
From 9ffedfc9f2e8b401d42cf593c943f35d508d828e Mon Sep 17 00:00:00 2001
From: William <admin@domnian.com>
Date: Fri, 18 Mar 2016 03:28:07 -0400
Subject: [PATCH] Add command to reload permissions.yml and require confirm to
@ -6,10 +6,10 @@ Subject: [PATCH] Add command to reload permissions.yml and require confirm to
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 22704949..2d588c6b 100644
index e27bdb7bf..d009aebd6 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1466,6 +1466,13 @@ public final class Bukkit {
@@ -1548,6 +1548,13 @@ public final class Bukkit {
public static org.bukkit.command.CommandMap getCommandMap() {
return server.getCommandMap();
}
@ -22,24 +22,24 @@ index 22704949..2d588c6b 100644
+ }
// Paper end
public static Server.Spigot spigot()
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f4f4f291..18e5dd48 100644
index ab0438b81..e7e7dab8c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1279,4 +1279,6 @@ public interface Server extends PluginMessageRecipient {
@@ -1366,4 +1366,6 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Spigot spigot();
// Spigot end
+
+ void reloadPermissions(); // Paper
}
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
index 0ab7e295..f331a442 100644
index 1104c6037..ba118dbfe 100644
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
@@ -13,15 +13,36 @@ public class ReloadCommand extends BukkitCommand {
public ReloadCommand(String name) {
@@ -14,15 +14,35 @@ public class ReloadCommand extends BukkitCommand {
public ReloadCommand(@NotNull String name) {
super(name);
this.description = "Reloads the server configuration and plugins";
- this.usageMessage = "/reload";
@ -49,8 +49,8 @@ index 0ab7e295..f331a442 100644
}
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
+
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
+ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper
if (!testPermission(sender)) return true;
+ // Paper start - Reload permissions.yml & require confirm
@ -76,23 +76,21 @@ index 0ab7e295..f331a442 100644
Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins.");
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
Bukkit.reload();
@@ -31,7 +52,7 @@ public class ReloadCommand extends BukkitCommand {
}
@@ -34,6 +54,6 @@ public class ReloadCommand extends BukkitCommand {
@NotNull
@Override
- public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
- return Collections.emptyList();
+ public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
+ return java.util.Collections.singletonList("permissions"); // Paper
}
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index b7627e39..5034215a 100644
index 4c55f5f8c..12e17709c 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -764,4 +764,13 @@ public final class SimplePluginManager implements PluginManager {
@@ -777,4 +777,13 @@ public final class SimplePluginManager implements PluginManager {
public void useTimings(boolean use) {
co.aikar.timings.Timings.setTimingsEnabled(use); // Spigot
co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
}
+
+ // Paper start
@ -105,5 +103,5 @@ index b7627e39..5034215a 100644
+
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,23 +1,14 @@
From ecd8d3e4642c78e5943717aed64df470aa7f83c9 Mon Sep 17 00:00:00 2001
From 3221e9c9ac4d74ffe7e815253fc93a2bd323a958 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sun, 21 Jun 2015 15:05:21 -0400
Subject: [PATCH] Custom replacement for eaten items
diff --git a/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
index 8ab76b1d..7d28155b 100644
index ee0f95b1..864c0a9e 100644
--- a/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
@@ -6,6 +6,8 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
+import javax.annotation.Nullable;
+
/**
* This event will fire when a player is finishing consuming an item (food,
* potion, milk bucket).
@@ -20,6 +22,7 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
@@ -22,6 +22,7 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isCancelled = false;
private ItemStack item;
@ -25,7 +16,7 @@ index 8ab76b1d..7d28155b 100644
/**
* @param player the player consuming
@@ -55,6 +58,29 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
@@ -58,6 +59,29 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
}
}
@ -56,5 +47,5 @@ index 8ab76b1d..7d28155b 100644
return this.isCancelled;
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,16 +1,16 @@
From 1d864e4056e3e6dbfbdc8675781c0310b9215925 Mon Sep 17 00:00:00 2001
From 14d0514052df4c676af720494e3e328846fa3483 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sun, 20 Mar 2016 06:44:49 -0400
Subject: [PATCH] Access items by EquipmentSlot
diff --git a/src/main/java/org/bukkit/inventory/PlayerInventory.java b/src/main/java/org/bukkit/inventory/PlayerInventory.java
index fc5772e8..d56f6e00 100644
index ef55b1463..eb71f01e4 100644
--- a/src/main/java/org/bukkit/inventory/PlayerInventory.java
+++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java
@@ -202,4 +202,22 @@ public interface PlayerInventory extends Inventory {
public void setHeldItemSlot(int slot);
@@ -214,4 +214,23 @@ public interface PlayerInventory extends Inventory {
@Nullable
public HumanEntity getHolder();
+
+ // Paper start
@ -20,7 +20,8 @@ index fc5772e8..d56f6e00 100644
+ * @param slot The slot
+ * @return The item stack in the slot
+ */
+ ItemStack getItem(EquipmentSlot slot);
+ @Nullable
+ ItemStack getItem(@NotNull EquipmentSlot slot);
+
+ /**
+ * Sets the {@link ItemStack} at the given {@link EquipmentSlot}.
@ -28,9 +29,9 @@ index fc5772e8..d56f6e00 100644
+ * @param slot The slot for the stack
+ * @param stack The item stack to set
+ */
+ void setItem(EquipmentSlot slot, ItemStack stack);
+ void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack stack);
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 317c71255861fe7a849577db4f289473425bd0d6 Mon Sep 17 00:00:00 2001
From a07f747027ae1079c6e620e5881667686c265c13 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:26:34 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
@ -6,16 +6,17 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
new file mode 100644
index 00000000..18b158cd
index 000000000..07660202e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
@@ -0,0 +1,29 @@
@@ -0,0 +1,32 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired any time an entity is being added to the world for any reason.
@ -25,52 +26,57 @@ index 00000000..18b158cd
+ */
+public class EntityAddToWorldEvent extends EntityEvent {
+
+ public EntityAddToWorldEvent(Entity entity) {
+ public EntityAddToWorldEvent(@NotNull Entity entity) {
+ super(entity);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
new file mode 100644
index 00000000..800be6aa
index 000000000..e5dbbd660
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
@@ -0,0 +1,26 @@
@@ -0,0 +1,29 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired any time an entity is being removed from a world for any reason
+ */
+public class EntityRemoveFromWorldEvent extends EntityEvent {
+
+ public EntityRemoveFromWorldEvent(Entity entity) {
+ public EntityRemoveFromWorldEvent(@NotNull Entity entity) {
+ super(entity);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From b9ed451873b6f1026308d423f636604f07fcf31c Mon Sep 17 00:00:00 2001
From fa357068acea340946c5984451c2889eb725c7ac Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 21:15:34 -0400
Subject: [PATCH] EntityPathfindEvent
@ -7,10 +7,10 @@ Fires when an Entity decides to start moving to a location.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
new file mode 100644
index 00000000..0e4902d9
index 000000000..63e46b2fb
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
@@ -0,0 +1,74 @@
@@ -0,0 +1,82 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.Location;
@ -18,6 +18,8 @@ index 00000000..0e4902d9
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Fired when an Entity decides to start moving towards a location.
@ -26,9 +28,10 @@ index 00000000..0e4902d9
+ * is choosing to start moving to a location.
+ */
+public class EntityPathfindEvent extends EntityEvent implements Cancellable {
+ private final Entity targetEntity;
+ private final Location loc;
+ public EntityPathfindEvent(Entity entity, Location loc, Entity targetEntity) {
+ @Nullable private final Entity targetEntity;
+ @NotNull private final Location loc;
+
+ public EntityPathfindEvent(@NotNull Entity entity, @NotNull Location loc, @Nullable Entity targetEntity) {
+ super(entity);
+ this.targetEntity = targetEntity;
+ this.loc = loc;
@ -38,6 +41,7 @@ index 00000000..0e4902d9
+ * The Entity that is pathfinding.
+ * @return The Entity that is pathfinding.
+ */
+ @NotNull
+ public Entity getEntity() {
+ return entity;
+ }
@ -49,6 +53,7 @@ index 00000000..0e4902d9
+ *
+ * @return The entity target or null
+ */
+ @Nullable
+ public Entity getTargetEntity() {
+ return targetEntity;
+ }
@ -59,16 +64,19 @@ index 00000000..0e4902d9
+ * Note that if the target happened to of been an entity
+ * @return Location of where the entity is trying to pathfind to.
+ */
+ @NotNull
+ public Location getLoc() {
+ return loc;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -86,5 +94,5 @@ index 00000000..0e4902d9
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 6c27ed542ca4cd73af3d8ae98f29511c827003f3 Mon Sep 17 00:00:00 2001
From 3fe3136ff948b8361bfadeb5e0acd6836bf8831c Mon Sep 17 00:00:00 2001
From: crast <contact@jamescrasta.com>
Date: Sat, 1 Jun 2013 13:52:30 -0600
Subject: [PATCH] Reduce thread synchronization in MetadataStoreBase
@ -8,31 +8,22 @@ limited synchronized portions to allow much higher concurrency in
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
index 093c1445..64c0f0a7 100644
index 9dbc32d8..32728628 100644
--- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
@@ -4,9 +4,10 @@ import org.apache.commons.lang.Validate;
import org.bukkit.plugin.Plugin;
@@ -5,9 +5,10 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
public abstract class MetadataStoreBase<T> {
- private Map<String, Map<Plugin, MetadataValue>> metadataMap = new HashMap<String, Map<Plugin, MetadataValue>>();
+ private Map<String, Map<Plugin, MetadataValue>> metadataMap = new ConcurrentHashMap<String, Map<Plugin, MetadataValue>>();
+ private Map<String, Map<Plugin, MetadataValue>> metadataMap = new ConcurrentHashMap<String, Map<Plugin, MetadataValue>>(); // Paper
/**
* Adds a metadata value to an object. Each metadata value is owned by a
@@ -30,7 +31,7 @@ public abstract class MetadataStoreBase<T> {
* @throws IllegalArgumentException If value is null, or the owning plugin
* is null
*/
- public synchronized void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) {
+ public void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) {
Validate.notNull(newMetadataValue, "Value cannot be null");
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
Validate.notNull(owningPlugin, "Plugin cannot be null");
@@ -40,7 +41,9 @@ public abstract class MetadataStoreBase<T> {
@@ -41,7 +42,9 @@ public abstract class MetadataStoreBase<T> {
entry = new WeakHashMap<Plugin, MetadataValue>(1);
metadataMap.put(key, entry);
}
@ -43,12 +34,12 @@ index 093c1445..64c0f0a7 100644
}
/**
@@ -53,10 +56,11 @@ public abstract class MetadataStoreBase<T> {
* requested value.
@@ -55,10 +58,11 @@ public abstract class MetadataStoreBase<T> {
* @see MetadataStore#getMetadata(Object, String)
*/
- public synchronized List<MetadataValue> getMetadata(T subject, String metadataKey) {
+ public List<MetadataValue> getMetadata(T subject, String metadataKey) {
@NotNull
- public synchronized List<MetadataValue> getMetadata(@NotNull T subject, @NotNull String metadataKey) {
+ public List<MetadataValue> getMetadata(@NotNull T subject, @NotNull String metadataKey) { // Paper
String key = disambiguate(subject, metadataKey);
- if (metadataMap.containsKey(key)) {
- Collection<MetadataValue> values = metadataMap.get(key).values();
@ -58,21 +49,21 @@ index 093c1445..64c0f0a7 100644
return Collections.unmodifiableList(new ArrayList<MetadataValue>(values));
} else {
return Collections.emptyList();
@@ -71,7 +75,7 @@ public abstract class MetadataStoreBase<T> {
@@ -73,7 +77,7 @@ public abstract class MetadataStoreBase<T> {
* @param metadataKey the unique metadata key being queried.
* @return the existence of the metadataKey within subject.
*/
- public synchronized boolean hasMetadata(T subject, String metadataKey) {
+ public boolean hasMetadata(T subject, String metadataKey) {
- public synchronized boolean hasMetadata(@NotNull T subject, @NotNull String metadataKey) {
+ public boolean hasMetadata(@NotNull T subject, @NotNull String metadataKey) { // Paper
String key = disambiguate(subject, metadataKey);
return metadataMap.containsKey(key);
}
@@ -87,17 +91,18 @@ public abstract class MetadataStoreBase<T> {
@@ -89,17 +93,18 @@ public abstract class MetadataStoreBase<T> {
* org.bukkit.plugin.Plugin)
* @throws IllegalArgumentException If plugin is null
*/
- public synchronized void removeMetadata(T subject, String metadataKey, Plugin owningPlugin) {
+ public void removeMetadata(T subject, String metadataKey, 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
Validate.notNull(owningPlugin, "Plugin cannot be null");
String key = disambiguate(subject, metadataKey);
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
@ -91,15 +82,15 @@ index 093c1445..64c0f0a7 100644
}
}
@@ -110,7 +115,7 @@ public abstract class MetadataStoreBase<T> {
@@ -112,7 +117,7 @@ public abstract class MetadataStoreBase<T> {
* @see MetadataStore#invalidateAll(org.bukkit.plugin.Plugin)
* @throws IllegalArgumentException If plugin is null
*/
- public synchronized void invalidateAll(Plugin owningPlugin) {
+ public void invalidateAll(Plugin owningPlugin) {
- public synchronized void invalidateAll(@NotNull Plugin owningPlugin) {
+ public void invalidateAll(@NotNull Plugin owningPlugin) { // Paper
Validate.notNull(owningPlugin, "Plugin cannot be null");
for (Map<Plugin, MetadataValue> values : metadataMap.values()) {
if (values.containsKey(owningPlugin)) {
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 28cef08075786587ecc702ad3dab4bc06d3ce624 Mon Sep 17 00:00:00 2001
From 0ae676c5ab5d5819d3e94e9ec554162a34fffa28 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 16 Jul 2013 21:26:50 -0400
Subject: [PATCH] Add MetadataStoreBase.removeAll(Plugin)
@ -6,10 +6,10 @@ Subject: [PATCH] Add MetadataStoreBase.removeAll(Plugin)
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
index 64c0f0a7..6da6abd8 100644
index 32728628e..b634b124e 100644
--- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
@@ -124,6 +124,26 @@ public abstract class MetadataStoreBase<T> {
@@ -126,6 +126,26 @@ public abstract class MetadataStoreBase<T> {
}
}
@ -20,7 +20,7 @@ index 64c0f0a7..6da6abd8 100644
+ * @param owningPlugin the plugin requesting the invalidation.
+ * @throws IllegalArgumentException If plugin is null
+ */
+ public void removeAll(Plugin owningPlugin) {
+ public void removeAll(@NotNull Plugin owningPlugin) {
+ Validate.notNull(owningPlugin, "Plugin cannot be null");
+ for (Iterator<Map<Plugin, MetadataValue>> iterator = metadataMap.values().iterator(); iterator.hasNext(); ) {
+ Map<Plugin, MetadataValue> values = iterator.next();
@ -37,5 +37,5 @@ index 64c0f0a7..6da6abd8 100644
* Creates a unique name for the object receiving metadata by combining
* unique data from the subject with a metadataKey.
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 0e2bcd42ff189af6160bf962e5c8371b067d9cd9 Mon Sep 17 00:00:00 2001
From adf141eaef52e9506de1c92a9145d884468f277f Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 2 Apr 2016 05:08:36 -0400
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
@ -6,25 +6,26 @@ Subject: [PATCH] Add PlayerUseUnknownEntityEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
new file mode 100644
index 00000000..70eeaf5c
index 000000000..09cfdf48e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
@@ -0,0 +1,42 @@
@@ -0,0 +1,46 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.jetbrains.annotations.NotNull;
+
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final int entityId;
+ private final boolean attack;
+ private final EquipmentSlot hand;
+ @NotNull private final EquipmentSlot hand;
+
+ public PlayerUseUnknownEntityEvent(Player who, int entityId, boolean attack, EquipmentSlot hand) {
+ public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand) {
+ super(who);
+ this.entityId = entityId;
+ this.attack = attack;
@ -39,19 +40,22 @@ index 00000000..70eeaf5c
+ return this.attack;
+ }
+
+ @NotNull
+ public EquipmentSlot getHand() {
+ return this.hand;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 9cab068579819105524d58de846e54b9a4050bb2 Mon Sep 17 00:00:00 2001
From 55a53dc9696b2fa72c0d886729547b776cd0a76a Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 13 Apr 2016 20:20:18 -0700
Subject: [PATCH] Add handshake event to allow plugins to handle client
@ -7,10 +7,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
new file mode 100644
index 00000000..e44d03a2
index 000000000..46d6f6ad6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
@@ -0,0 +1,211 @@
@@ -0,0 +1,221 @@
+package com.destroystokyo.paper.event.player;
+
+import org.apache.commons.lang.Validate;
@ -19,6 +19,8 @@ index 00000000..e44d03a2
+import org.bukkit.event.HandlerList;
+
+import java.util.UUID;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * This event is fired during a player handshake.
@ -31,12 +33,12 @@ index 00000000..e44d03a2
+public class PlayerHandshakeEvent extends Event implements Cancellable {
+
+ private static final HandlerList HANDLERS = new HandlerList();
+ private final String originalHandshake;
+ @NotNull private final String originalHandshake;
+ private boolean cancelled;
+ private String serverHostname;
+ private String socketAddressHostname;
+ private UUID uniqueId;
+ private String propertiesJson;
+ @Nullable private String serverHostname;
+ @Nullable private String socketAddressHostname;
+ @Nullable private UUID uniqueId;
+ @Nullable private String propertiesJson;
+ private boolean failed;
+ private String failMessage = "If you wish to use IP forwarding, please enable it in your BungeeCord config as well!";
+
@ -46,7 +48,7 @@ index 00000000..e44d03a2
+ * @param originalHandshake the original handshake string
+ * @param cancelled if this event is enabled
+ */
+ public PlayerHandshakeEvent(String originalHandshake, boolean cancelled) {
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
+ this.originalHandshake = originalHandshake;
+ this.cancelled = cancelled;
+ }
@ -82,6 +84,7 @@ index 00000000..e44d03a2
+ *
+ * @return the original handshake string
+ */
+ @NotNull
+ public String getOriginalHandshake() {
+ return this.originalHandshake;
+ }
@ -93,6 +96,7 @@ index 00000000..e44d03a2
+ *
+ * @return the server hostname string
+ */
+ @Nullable
+ public String getServerHostname() {
+ return this.serverHostname;
+ }
@ -104,7 +108,7 @@ index 00000000..e44d03a2
+ *
+ * @param serverHostname the server hostname string
+ */
+ public void setServerHostname(String serverHostname) {
+ public void setServerHostname(@NotNull String serverHostname) {
+ this.serverHostname = serverHostname;
+ }
+
@ -115,6 +119,7 @@ index 00000000..e44d03a2
+ *
+ * @return the socket address hostname string
+ */
+ @Nullable
+ public String getSocketAddressHostname() {
+ return this.socketAddressHostname;
+ }
@ -126,7 +131,7 @@ index 00000000..e44d03a2
+ *
+ * @param socketAddressHostname the socket address hostname string
+ */
+ public void setSocketAddressHostname(String socketAddressHostname) {
+ public void setSocketAddressHostname(@NotNull String socketAddressHostname) {
+ this.socketAddressHostname = socketAddressHostname;
+ }
+
@ -135,6 +140,7 @@ index 00000000..e44d03a2
+ *
+ * @return the unique id
+ */
+ @Nullable
+ public UUID getUniqueId() {
+ return this.uniqueId;
+ }
@ -144,7 +150,7 @@ index 00000000..e44d03a2
+ *
+ * @param uniqueId the unique id
+ */
+ public void setUniqueId(UUID uniqueId) {
+ public void setUniqueId(@NotNull UUID uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
@ -155,6 +161,7 @@ index 00000000..e44d03a2
+ *
+ * @return the profile properties, as JSON
+ */
+ @Nullable
+ public String getPropertiesJson() {
+ return this.propertiesJson;
+ }
@ -190,7 +197,7 @@ index 00000000..e44d03a2
+ *
+ * @param propertiesJson the profile properties, as JSON
+ */
+ public void setPropertiesJson(String propertiesJson) {
+ public void setPropertiesJson(@NotNull String propertiesJson) {
+ this.propertiesJson = propertiesJson;
+ }
+
@ -199,6 +206,7 @@ index 00000000..e44d03a2
+ *
+ * @return the message to display to the client
+ */
+ @NotNull
+ public String getFailMessage() {
+ return this.failMessage;
+ }
@ -208,20 +216,22 @@ index 00000000..e44d03a2
+ *
+ * @param failMessage the message to display to the client
+ */
+ public void setFailMessage(String failMessage) {
+ public void setFailMessage(@NotNull String failMessage) {
+ Validate.notEmpty(failMessage, "fail message cannot be null or empty");
+ this.failMessage = failMessage;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLERS;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLERS;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 14622209c86028ac63d81543497dfa48290ba377 Mon Sep 17 00:00:00 2001
From 2286649eb07e4a21436f8d660059dd6fa2f47641 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 4 Mar 2016 03:13:18 -0500
Subject: [PATCH] Arrow pickup rule API
diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java
index b74d5f9d..99a44006 100644
index 99f73a2b..b63f2fd9 100644
--- a/src/main/java/org/bukkit/entity/Arrow.java
+++ b/src/main/java/org/bukkit/entity/Arrow.java
@@ -144,4 +144,38 @@ public interface Arrow extends Projectile {
@@ -149,4 +149,38 @@ public interface Arrow extends Projectile {
@Override
Spigot spigot();
// Spigot end
@ -48,5 +48,5 @@ index b74d5f9d..99a44006 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,25 +1,25 @@
From 927a3bee043bc15d1c0c0f60be3e4afb3f440ab6 Mon Sep 17 00:00:00 2001
From e7360254c9b8b35b93943d7608685f5c7ffd20e1 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
diff --git a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
index 976b80b7..a5ac3edf 100644
index 8feb6698..d51d2ec1 100644
--- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
@@ -12,12 +12,31 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
@@ -13,12 +13,31 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
private boolean cancelled;
private double amount;
private final RegainReason regainReason;
+ private final boolean isFastRegen; // Paper
public EntityRegainHealthEvent(final Entity entity, final double amount, final RegainReason regainReason) {
public EntityRegainHealthEvent(@NotNull final Entity entity, final double amount, @NotNull final RegainReason regainReason) {
+ // Paper start - Forward
+ this(entity, amount, regainReason, false);
+ }
+
+ public EntityRegainHealthEvent(final Entity entity, final double amount, final RegainReason regainReason, boolean isFastRegen) {
+ public EntityRegainHealthEvent(@NotNull final Entity entity, final double amount, @NotNull final RegainReason regainReason, boolean isFastRegen) {
+ // Paper end
super(entity);
this.amount = amount;
@ -41,5 +41,5 @@ index 976b80b7..a5ac3edf 100644
/**
* Gets the amount of regained health
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 8c74a2e04e4a744068d564312cd647bc53898a59 Mon Sep 17 00:00:00 2001
From fe6d16006ce532f553e149aa9943ba4776afad0b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 15:19:49 -0400
Subject: [PATCH] LootTable API
@ -12,13 +12,14 @@ Provides methods to determine players looted state for an object
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java
new file mode 100644
index 00000000..9095df61
index 000000000..92d7b853a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java
@@ -0,0 +1,15 @@
@@ -0,0 +1,17 @@
+package com.destroystokyo.paper.loottable;
+
+import org.bukkit.block.Block;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents an Inventory that can generate loot, such as Chests inside of Fortresses and Mineshafts
@ -29,17 +30,19 @@ index 00000000..9095df61
+ * Gets the block that is lootable
+ * @return The Block
+ */
+ @NotNull
+ Block getBlock();
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java
new file mode 100644
index 00000000..a389f74c
index 000000000..b387894fe
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java
@@ -0,0 +1,15 @@
@@ -0,0 +1,17 @@
+package com.destroystokyo.paper.loottable;
+
+import org.bukkit.entity.Entity;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents an Inventory that can generate loot, such as Minecarts inside of Mineshafts
@ -50,20 +53,23 @@ index 00000000..a389f74c
+ * Gets the entity that is lootable
+ * @return The Entity
+ */
+ @NotNull
+ Entity getEntity();
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java
new file mode 100644
index 00000000..2fc3e8a1
index 000000000..97815eeb2
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java
@@ -0,0 +1,112 @@
@@ -0,0 +1,116 @@
+package com.destroystokyo.paper.loottable;
+
+import org.bukkit.entity.Player;
+import org.bukkit.loot.Lootable;
+
+import java.util.UUID;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents an Inventory that contains a Loot Table associated to it that will
@ -95,7 +101,7 @@ index 00000000..2fc3e8a1
+ * @param player The player to check
+ * @return Whether or not this player has looted this block
+ */
+ default boolean hasPlayerLooted(Player player) {
+ default boolean hasPlayerLooted(@NotNull Player player) {
+ return hasPlayerLooted(player.getUniqueId());
+ }
+
@ -104,7 +110,7 @@ index 00000000..2fc3e8a1
+ * @param player The player to check
+ * @return Whether or not this player has looted this block
+ */
+ boolean hasPlayerLooted(UUID player);
+ boolean hasPlayerLooted(@NotNull UUID player);
+
+ /**
+ * Gets the timestamp, in milliseconds, of when the player last looted this object
@ -112,7 +118,8 @@ index 00000000..2fc3e8a1
+ * @param player The player to check
+ * @return Timestamp last looted, or null if player has not looted this object
+ */
+ default Long getLastLooted(Player player) {
+ @Nullable
+ default Long getLastLooted(@NotNull Player player) {
+ return getLastLooted(player.getUniqueId());
+ }
+
@ -122,7 +129,8 @@ index 00000000..2fc3e8a1
+ * @param player The player to check
+ * @return Timestamp last looted, or null if player has not looted this object
+ */
+ Long getLastLooted(UUID player);
+ @Nullable
+ Long getLastLooted(@NotNull UUID player);
+
+ /**
+ * Change the state of whether or not a player has looted this block
@ -130,7 +138,7 @@ index 00000000..2fc3e8a1
+ * @param looted true to add player to looted list, false to remove
+ * @return The previous state of whether the player had looted this or not
+ */
+ default boolean setHasPlayerLooted(Player player, boolean looted) {
+ default boolean setHasPlayerLooted(@NotNull Player player, boolean looted) {
+ return setHasPlayerLooted(player.getUniqueId(), looted);
+ }
+
@ -140,7 +148,7 @@ index 00000000..2fc3e8a1
+ * @param looted true to add player to looted list, false to remove
+ * @return The previous state of whether the player had looted this or not
+ */
+ boolean setHasPlayerLooted(UUID player, boolean looted);
+ boolean setHasPlayerLooted(@NotNull UUID player, boolean looted);
+
+ /**
+ * Returns Whether or not this object has been filled and now has a pending refill
@ -172,35 +180,39 @@ index 00000000..2fc3e8a1
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java b/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
new file mode 100644
index 00000000..2169493d
index 000000000..fd184f13f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
@@ -0,0 +1,41 @@
@@ -0,0 +1,45 @@
+package com.destroystokyo.paper.loottable;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+public class LootableInventoryReplenishEvent extends PlayerEvent implements Cancellable {
+ private final LootableInventory inventory;
+ @NotNull private final LootableInventory inventory;
+
+ public LootableInventoryReplenishEvent(Player player, LootableInventory inventory) {
+ public LootableInventoryReplenishEvent(@NotNull Player player, @NotNull LootableInventory inventory) {
+ super(player);
+ this.inventory = inventory;
+ }
+
+ @NotNull
+ public LootableInventory getInventory() {
+ return inventory;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -218,7 +230,7 @@ index 00000000..2169493d
+ }
+}
diff --git a/src/main/java/org/bukkit/block/Chest.java b/src/main/java/org/bukkit/block/Chest.java
index 815d79a5..b68ab881 100644
index c553891e0..eb475ec84 100644
--- a/src/main/java/org/bukkit/block/Chest.java
+++ b/src/main/java/org/bukkit/block/Chest.java
@@ -1,5 +1,6 @@
@ -228,7 +240,7 @@ index 815d79a5..b68ab881 100644
import org.bukkit.Nameable;
import org.bukkit.inventory.Inventory;
import org.bukkit.loot.Lootable;
@@ -7,7 +8,7 @@ import org.bukkit.loot.Lootable;
@@ -8,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a chest.
*/
@ -238,7 +250,7 @@ index 815d79a5..b68ab881 100644
/**
* Gets the inventory of the chest block represented by this block state.
diff --git a/src/main/java/org/bukkit/block/Dispenser.java b/src/main/java/org/bukkit/block/Dispenser.java
index 2741625d..6d180117 100644
index 74cd194c9..07af1a3f0 100644
--- a/src/main/java/org/bukkit/block/Dispenser.java
+++ b/src/main/java/org/bukkit/block/Dispenser.java
@@ -1,5 +1,6 @@
@ -248,7 +260,7 @@ index 2741625d..6d180117 100644
import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
import org.bukkit.projectiles.BlockProjectileSource;
@@ -7,7 +8,7 @@ import org.bukkit.projectiles.BlockProjectileSource;
@@ -8,7 +9,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a captured state of a dispenser.
*/
@ -258,7 +270,7 @@ index 2741625d..6d180117 100644
/**
* Gets the BlockProjectileSource object for the dispenser.
diff --git a/src/main/java/org/bukkit/block/Dropper.java b/src/main/java/org/bukkit/block/Dropper.java
index 2e8c3f71..47737b59 100644
index 2e8c3f711..47737b590 100644
--- a/src/main/java/org/bukkit/block/Dropper.java
+++ b/src/main/java/org/bukkit/block/Dropper.java
@@ -1,12 +1,13 @@
@ -277,7 +289,7 @@ index 2e8c3f71..47737b59 100644
/**
* Tries to drop a randomly selected item from the dropper's inventory,
diff --git a/src/main/java/org/bukkit/block/Hopper.java b/src/main/java/org/bukkit/block/Hopper.java
index 73fce5f3..221123e8 100644
index 73fce5f33..221123e8c 100644
--- a/src/main/java/org/bukkit/block/Hopper.java
+++ b/src/main/java/org/bukkit/block/Hopper.java
@@ -1,9 +1,10 @@
@ -293,7 +305,7 @@ index 73fce5f3..221123e8 100644
-public interface Hopper extends Container, Nameable, Lootable { }
+public interface Hopper extends Container, Nameable, LootableBlockInventory { } // Paper
diff --git a/src/main/java/org/bukkit/block/ShulkerBox.java b/src/main/java/org/bukkit/block/ShulkerBox.java
index 8e061e4a..1c02c6e1 100644
index 5a6bed64a..8c8811d4d 100644
--- a/src/main/java/org/bukkit/block/ShulkerBox.java
+++ b/src/main/java/org/bukkit/block/ShulkerBox.java
@@ -1,5 +1,6 @@
@ -303,7 +315,7 @@ index 8e061e4a..1c02c6e1 100644
import org.bukkit.DyeColor;
import org.bukkit.Nameable;
import org.bukkit.loot.Lootable;
@@ -7,7 +8,7 @@ import org.bukkit.loot.Lootable;
@@ -8,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a ShulkerBox.
*/
@ -313,7 +325,7 @@ index 8e061e4a..1c02c6e1 100644
/**
* Get the {@link DyeColor} corresponding to this ShulkerBox
diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
index 8ced5403..86588550 100644
index 8ced54039..865885501 100644
--- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
+++ b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
@@ -1,5 +1,6 @@
@ -333,7 +345,7 @@ index 8ced5403..86588550 100644
/**
* Checks whether or not this Minecart will pick up
diff --git a/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java b/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java
index 9ea403e6..238d118f 100644
index 9ea403e6f..238d118f7 100644
--- a/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java
+++ b/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java
@@ -1,5 +1,6 @@
@ -351,11 +363,11 @@ index 9ea403e6..238d118f 100644
+public interface StorageMinecart extends Minecart, InventoryHolder, LootableEntityInventory { // Paper
}
diff --git a/src/main/java/org/bukkit/loot/Lootable.java b/src/main/java/org/bukkit/loot/Lootable.java
index f4b3d021..9f1c830f 100644
index 24a3d989d..901db8524 100644
--- a/src/main/java/org/bukkit/loot/Lootable.java
+++ b/src/main/java/org/bukkit/loot/Lootable.java
@@ -33,6 +33,34 @@ public interface Lootable {
*/
@@ -36,6 +36,34 @@ public interface Lootable {
@Nullable
LootTable getLootTable();
+ // Paper start
@ -365,7 +377,7 @@ index f4b3d021..9f1c830f 100644
+ * @param table the Loot Table this {@link org.bukkit.block.Container} or {@link org.bukkit.entity.Mob} will have.
+ * @param seed the seed to used to generate loot. Default is 0.
+ */
+ default void setLootTable(LootTable table, long seed) {
+ default void setLootTable(@Nullable LootTable table, long seed) {
+ setLootTable(table);
+ setSeed(seed);
+ }
@ -390,5 +402,5 @@ index f4b3d021..9f1c830f 100644
* Set the seed used when this Loot Table generates loot.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From a520009d4480e4b49846a57681d065a651c45419 Mon Sep 17 00:00:00 2001
From d83973b95e1f261cb7d70b06771709d73a73624f Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Sun, 16 Oct 2016 23:19:34 -0700
Subject: [PATCH] Add EntityZapEvent
@ -6,10 +6,10 @@ Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
new file mode 100644
index 00000000..c8f0bb05
index 000000000..3b725a489
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
@@ -0,0 +1,63 @@
@@ -0,0 +1,65 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.apache.commons.lang.Validate;
@ -20,8 +20,8 @@ index 00000000..c8f0bb05
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.event.entity.EntityTransformEvent;
+
+import javax.annotation.Nonnull;
+import java.util.Collections;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when lightning strikes an entity
@ -29,9 +29,9 @@ index 00000000..c8f0bb05
+public class EntityZapEvent extends EntityTransformEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private final LightningStrike bolt;
+ @NotNull private final LightningStrike bolt;
+
+ public EntityZapEvent(final Entity entity, @Nonnull final LightningStrike bolt, @Nonnull final Entity replacementEntity) {
+ public EntityZapEvent(@NotNull final Entity entity, @NotNull final LightningStrike bolt, @NotNull final Entity replacementEntity) {
+ super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING);
+ Validate.notNull(bolt);
+ Validate.notNull(replacementEntity);
@ -50,7 +50,7 @@ index 00000000..c8f0bb05
+ * Gets the lightning bolt that is striking the entity.
+ * @return The lightning bolt responsible for this event
+ */
+ @Nonnull
+ @NotNull
+ public LightningStrike getBolt() {
+ return bolt;
+ }
@ -59,22 +59,24 @@ index 00000000..c8f0bb05
+ * Gets the entity that will replace the struck entity.
+ * @return The entity that will replace the struck entity
+ */
+ @Nonnull
+ @NotNull
+ public Entity getReplacementEntity() {
+ return getTransformedEntity();
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/entity/PigZapEvent.java b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
index c1d4b30a..de8cad81 100644
index 0074423fd..0eaa8df94 100644
--- a/src/main/java/org/bukkit/event/entity/PigZapEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
@ -85,7 +87,7 @@ index c1d4b30a..de8cad81 100644
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.Pig;
import org.bukkit.entity.PigZombie;
@@ -11,14 +12,14 @@ import org.bukkit.event.HandlerList;
@@ -12,14 +13,14 @@ import org.jetbrains.annotations.NotNull;
/**
* Stores data for pigs being zapped
*/
@ -97,22 +99,22 @@ index c1d4b30a..de8cad81 100644
private final PigZombie pigzombie;
private final LightningStrike bolt;
public PigZapEvent(final Pig pig, final LightningStrike bolt, final PigZombie pigzombie) {
public PigZapEvent(@NotNull final Pig pig, @NotNull final LightningStrike bolt, @NotNull final PigZombie pigzombie) {
- super(pig, Collections.singletonList((Entity) pigzombie), TransformReason.LIGHTNING);
+ super(pig, bolt, pigzombie);
this.bolt = bolt;
this.pigzombie = pigzombie;
}
@@ -57,6 +58,8 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
@@ -61,6 +62,8 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
return pigzombie;
}
+ // Paper start
+ /*
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
@@ -65,4 +68,6 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
@@ -71,4 +74,6 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
@ -120,5 +122,5 @@ index c1d4b30a..de8cad81 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 3fabac75e83331f5b4ac0cefaa42b16441a2956e Mon Sep 17 00:00:00 2001
From a3d13870daf8d1b11309cbbf8947ae5324aed6b5 Mon Sep 17 00:00:00 2001
From: vemacs <d@nkmem.es>
Date: Wed, 23 Nov 2016 12:53:43 -0500
Subject: [PATCH] Misc Utils
@ -6,20 +6,22 @@ Subject: [PATCH] Misc Utils
diff --git a/src/main/java/com/destroystokyo/paper/utils/CachedSizeConcurrentLinkedQueue.java b/src/main/java/com/destroystokyo/paper/utils/CachedSizeConcurrentLinkedQueue.java
new file mode 100644
index 00000000..d60ecbb1
index 000000000..5bb677ce5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/utils/CachedSizeConcurrentLinkedQueue.java
@@ -0,0 +1,31 @@
@@ -0,0 +1,34 @@
+package com.destroystokyo.paper.utils;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.LongAdder;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class CachedSizeConcurrentLinkedQueue<E> extends ConcurrentLinkedQueue<E> {
+ private final LongAdder cachedSize = new LongAdder();
+
+ @Override
+ public boolean add(E e) {
+ public boolean add(@NotNull E e) {
+ boolean result = super.add(e);
+ if (result) {
+ cachedSize.increment();
@ -27,6 +29,7 @@ index 00000000..d60ecbb1
+ return result;
+ }
+
+ @Nullable
+ @Override
+ public E poll() {
+ E result = super.poll();
@ -42,5 +45,5 @@ index 00000000..d60ecbb1
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From a7f30eb6aff66658a5731d0ee906374a2a823788 Mon Sep 17 00:00:00 2001
From ad0c8ca9e48518bfdc7f2d0b624298e45ab22aae Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 28 Nov 2016 10:16:39 -0500
Subject: [PATCH] Allow Reloading of Command Aliases
@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 2d588c6b..5715057a 100644
index d009aebd6..8e0cbbf15 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1473,6 +1473,15 @@ public final class Bukkit {
@@ -1555,6 +1555,15 @@ public final class Bukkit {
public static void reloadPermissions() {
server.reloadPermissions();
}
@ -24,12 +24,12 @@ index 2d588c6b..5715057a 100644
+ }
// Paper end
public static Server.Spigot spigot()
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 18e5dd48..259a0fbe 100644
index e7e7dab8c..8f61619a3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1281,4 +1281,6 @@ public interface Server extends PluginMessageRecipient {
@@ -1368,4 +1368,6 @@ public interface Server extends PluginMessageRecipient {
// Spigot end
void reloadPermissions(); // Paper
@ -37,13 +37,13 @@ index 18e5dd48..259a0fbe 100644
+ boolean reloadCommandAliases(); // Paper
}
diff --git a/src/main/java/org/bukkit/command/CommandMap.java b/src/main/java/org/bukkit/command/CommandMap.java
index 30d60247..938959aa 100644
index bd2c7a696..864c263bb 100644
--- a/src/main/java/org/bukkit/command/CommandMap.java
+++ b/src/main/java/org/bukkit/command/CommandMap.java
@@ -123,4 +123,13 @@ public interface CommandMap {
* @throws IllegalArgumentException if either sender or cmdLine are null
@@ -128,4 +128,14 @@ public interface CommandMap {
*/
public List<String> tabComplete(CommandSender sender, String cmdLine, Location location) throws IllegalArgumentException;
@Nullable
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) throws IllegalArgumentException;
+
+ // Paper start - Expose Known Commands
+ /**
@ -51,30 +51,32 @@ index 30d60247..938959aa 100644
+ *
+ * @return known commands
+ */
+ @NotNull
+ public java.util.Map<String, Command> getKnownCommands();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 65ad78c4..41e95692 100644
index f52d91d19..d7ca4fa3f 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -279,4 +279,10 @@ public class SimpleCommandMap implements CommandMap {
@@ -285,4 +285,11 @@ public class SimpleCommandMap implements CommandMap {
}
}
}
+
+ // Paper start - Expose Known Commands
+ @NotNull
+ public Map<String, Command> getKnownCommands() {
+ return knownCommands;
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
index f331a442..a977045d 100644
index ba118dbfe..607323a83 100644
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
@@ -13,7 +13,7 @@ public class ReloadCommand extends BukkitCommand {
public ReloadCommand(String name) {
@@ -14,7 +14,7 @@ public class ReloadCommand extends BukkitCommand {
public ReloadCommand(@NotNull String name) {
super(name);
this.description = "Reloads the server configuration and plugins";
- this.usageMessage = "/reload [permissions]"; // Paper
@ -97,5 +99,5 @@ index f331a442..a977045d 100644
confirmed = true;
} else {
--
2.20.1
2.21.0

Datei anzeigen

@ -1,21 +1,22 @@
From 089130d865363f60ffce7794d8ba7080e9475a81 Mon Sep 17 00:00:00 2001
From 50250b4955c5c76238ed4e75479dfa1aa751ba02 Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Thu, 8 Sep 2016 08:47:08 -0700
Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
index f37491d7..30882559 100644
index c99c9281e..7c340f539 100644
--- a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java
@@ -1,20 +1,42 @@
@@ -1,21 +1,43 @@
package org.bukkit.event.player;
+import org.bukkit.entity.Entity; // Paper
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nullable; // Paper
+import org.jetbrains.annotations.Nullable; // Paper
+
/**
* Called when a players experience changes naturally
@ -27,11 +28,11 @@ index f37491d7..30882559 100644
+ private final Entity source;
private int exp;
public PlayerExpChangeEvent(final Player player, final int expAmount) {
public PlayerExpChangeEvent(@NotNull final Player player, final int expAmount) {
+ this(player, null, expAmount);
+ }
+
+ public PlayerExpChangeEvent(final Player player, @Nullable final Entity sourceEntity, final int expAmount) {
+ public PlayerExpChangeEvent(@NotNull final Player player, @Nullable final Entity sourceEntity, final int expAmount) {
super(player);
+ source = sourceEntity;
exp = expAmount;
@ -52,5 +53,5 @@ index f37491d7..30882559 100644
* Get the amount of experience the player will receive
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 0d310faa3823420b08c8d77d29833c910e196c51 Mon Sep 17 00:00:00 2001
From b82e438ee56e44088151a3448d9c6ea578145238 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Fri, 16 Dec 2016 21:25:39 -0600
Subject: [PATCH] Add ProjectileCollideEvent
@ -6,10 +6,10 @@ Subject: [PATCH] Add ProjectileCollideEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
new file mode 100644
index 00000000..f42e9851
index 000000000..453663893
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
@@ -0,0 +1,62 @@
@@ -0,0 +1,67 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
@ -17,6 +17,7 @@ index 00000000..f42e9851
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when an projectile collides with an entity
@ -24,18 +25,19 @@ index 00000000..f42e9851
+ * This event is called <b>before</b> {@link org.bukkit.event.entity.EntityDamageByEntityEvent}, and cancelling it will allow the projectile to continue flying
+ */
+public class ProjectileCollideEvent extends EntityEvent implements Cancellable {
+ private final Entity collidedWith;
+ @NotNull private final Entity collidedWith;
+
+ /**
+ * Get the entity the projectile collided with
+ *
+ * @return the entity collided with
+ */
+ @NotNull
+ public Entity getCollidedWith() {
+ return collidedWith;
+ }
+
+ public ProjectileCollideEvent(Projectile what, Entity collidedWith) {
+ public ProjectileCollideEvent(@NotNull Projectile what, @NotNull Entity collidedWith) {
+ super(what);
+ this.collidedWith = collidedWith;
+ }
@ -45,16 +47,19 @@ index 00000000..f42e9851
+ *
+ * @return the projectile that collided
+ */
+ @NotNull
+ public Projectile getEntity() {
+ return (Projectile) super.getEntity();
+ }
+
+ private static final HandlerList handlerList = new HandlerList();
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlerList;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlerList;
@ -73,5 +78,5 @@ index 00000000..f42e9851
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,15 +1,15 @@
From 64e90092e25dfcb2093727229eabe28f667ee6aa Mon Sep 17 00:00:00 2001
From 5867309b06bfe09471d79910963d912d588e860d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 20 Dec 2016 15:55:55 -0500
Subject: [PATCH] Add String based Action Bar API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 96d97bf3..d9965ddc 100644
index c237073a3..219556ed5 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -416,6 +416,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(MapView map);
@@ -423,6 +423,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(@NotNull MapView map);
// Paper start
+
@ -20,7 +20,7 @@ index 96d97bf3..d9965ddc 100644
+ *
+ * @param message The message to send
+ */
+ public void sendActionBar(String message);
+ public void sendActionBar(@NotNull String message);
+
+ /**
+ * Sends an Action Bar message to the client.
@ -30,12 +30,12 @@ index 96d97bf3..d9965ddc 100644
+ * @param alternateChar Alternate symbol such as '&'
+ * @param message The message to send
+ */
+ public void sendActionBar(char alternateChar, String message);
+ public void sendActionBar(char alternateChar, @NotNull String message);
+
/**
* Sends the component to the player
*
@@ -439,9 +459,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -446,9 +466,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends an array of components as a single message to the specified screen position of this player
*
@ -47,7 +47,7 @@ index 96d97bf3..d9965ddc 100644
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
spigot().sendMessage(position, components);
}
@@ -1764,9 +1786,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1781,9 +1803,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends the component to the specified screen position of this player
*
@ -56,10 +56,10 @@ index 96d97bf3..d9965ddc 100644
* @param component the components to send
*/
+ @Deprecated
public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent component) {
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1774,9 +1798,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1791,9 +1815,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends an array of components as a single message to the specified screen position of this player
*
@ -68,9 +68,9 @@ index 96d97bf3..d9965ddc 100644
* @param components the components to send
*/
+ @Deprecated
public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From c8592d0fed70ee265eb9bc9c2aa45cf3efacf890 Mon Sep 17 00:00:00 2001
From 6edfd35a599174ec0bc6a869b274e5f7e74b54fb Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 21 Dec 2016 11:47:25 -0600
Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index b4f04517..099da6ce 100644
index d04e52fb..387d04e5 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -258,4 +258,22 @@ public interface ArmorStand extends LivingEntity {
@@ -271,4 +271,22 @@ public interface ArmorStand extends LivingEntity {
* @param marker whether this is a marker
*/
void setMarker(boolean marker);
@ -32,5 +32,5 @@ index b4f04517..099da6ce 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From df9951c426373976f105802670f755706705761d Mon Sep 17 00:00:00 2001
From 1f9c546f72d454fff0de581f0c64cdd552520787 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 01:19:14 -0500
Subject: [PATCH] IllegalPacketEvent
@ -9,24 +9,26 @@ Lets plugins change the kick message and if it should kick or not.
diff --git a/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java b/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java
new file mode 100644
index 00000000..e11f74fc
index 000000000..37a17f0bb
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/IllegalPacketEvent.java
@@ -0,0 +1,63 @@
@@ -0,0 +1,70 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class IllegalPacketEvent extends PlayerEvent {
+ private final String type;
+ private final String ex;
+ private String kickMessage;
+ @Nullable private final String type;
+ @Nullable private final String ex;
+ @Nullable private String kickMessage;
+ private boolean shouldKick = true;
+
+ public IllegalPacketEvent(Player player, String type, String kickMessage, Exception e) {
+ public IllegalPacketEvent(@NotNull Player player, @Nullable String type, @Nullable String kickMessage, @NotNull Exception e) {
+ super(player);
+ this.type = type;
+ this.kickMessage = kickMessage;
@ -41,33 +43,38 @@ index 00000000..e11f74fc
+ this.shouldKick = shouldKick;
+ }
+
+ @Nullable
+ public String getKickMessage() {
+ return kickMessage;
+ }
+
+ public void setKickMessage(String kickMessage) {
+ public void setKickMessage(@Nullable String kickMessage) {
+ this.kickMessage = kickMessage;
+ }
+
+ @Nullable
+ public String getType() {
+ return type;
+ }
+
+ @Nullable
+ public String getExceptionMessage() {
+ return ex;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public static void process(Player player, String type, String kickMessage, Exception exception) {
+ public static void process(@NotNull Player player, @Nullable String type, @Nullable String kickMessage, @NotNull Exception exception) {
+ IllegalPacketEvent event = new IllegalPacketEvent(player, type, kickMessage, exception);
+ event.callEvent();
+ if (event.shouldKick) {
@ -77,5 +84,5 @@ index 00000000..e11f74fc
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 03c53cfd5436f75a613567236c4c97f9a0859497 Mon Sep 17 00:00:00 2001
From 598ca05d30454f06b4b08c9080ad038b0ffcb8d5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 28 Dec 2016 01:18:55 -0500
Subject: [PATCH] Fireworks API's
@ -7,32 +7,35 @@ Get the Entity being boosted
Get the firework launcher
diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java
index b8a8c075..8c087bb7 100644
index 1c55f0338..7df26cf7f 100644
--- a/src/main/java/org/bukkit/entity/Firework.java
+++ b/src/main/java/org/bukkit/entity/Firework.java
@@ -2,6 +2,8 @@ package org.bukkit.entity;
@@ -3,6 +3,9 @@ package org.bukkit.entity;
import org.bukkit.inventory.meta.FireworkMeta;
import org.jetbrains.annotations.NotNull;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
public interface Firework extends Entity {
/**
@@ -23,4 +25,13 @@ public interface Firework extends Entity {
@@ -25,4 +28,15 @@ public interface Firework extends Entity {
* remaining fuse.
*/
void detonate();
+
+ // Paper start
+ @Nullable
+ public UUID getSpawningEntity();
+ /**
+ * If this firework is boosting an entity, return it
+ * @return The entity being boosted
+ */
+ @Nullable
+ public LivingEntity getBoostedEntity();
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From b1cdd9cf910f3b9b6c0adb16d110a9f32b5fa87d Mon Sep 17 00:00:00 2001
From 21f79b080ee93ae3e8f46411349e84b6bb1f87f3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 31 Dec 2016 20:29:33 -0500
Subject: [PATCH] PlayerTeleportEndGatewayEvent
@ -7,24 +7,25 @@ Allows you to access the Gateway being used in a teleport event
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java
new file mode 100644
index 00000000..bdefbc9f
index 000000000..b64ab6eec
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerTeleportEndGatewayEvent.java
@@ -0,0 +1,27 @@
@@ -0,0 +1,29 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Location;
+import org.bukkit.block.EndGateway;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerTeleportEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when a teleport is triggered for an End Gateway
+ */
+public class PlayerTeleportEndGatewayEvent extends PlayerTeleportEvent {
+ private final EndGateway gateway;
+ @NotNull private final EndGateway gateway;
+
+ public PlayerTeleportEndGatewayEvent(Player player, Location from, Location to, EndGateway gateway) {
+ public PlayerTeleportEndGatewayEvent(@NotNull Player player, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
+ super(player, from, to, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
+ this.gateway = gateway;
+ }
@ -34,10 +35,11 @@ index 00000000..bdefbc9f
+ *
+ * @return EndGateway used
+ */
+ @NotNull
+ public EndGateway getGateway() {
+ return gateway;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From fe9d5c94dc4df94951b626e28eeb13a0a4fbbeaa Mon Sep 17 00:00:00 2001
From 689c6a8f4240960a10dbfce71ad4b2c1dd456251 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 Jan 2017 15:23:03 -0500
Subject: [PATCH] Provide E/TE/Chunk count stat methods
@ -7,10 +7,10 @@ Provides counts without the ineffeciency of using .getEntities().size()
which creates copy of the collections.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index d62277de..8a0f992f 100644
index ffae53d6..846b0619 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -28,6 +28,33 @@ import org.bukkit.util.Vector;
@@ -31,6 +31,33 @@ import org.jetbrains.annotations.Nullable;
*/
public interface World extends PluginMessageRecipient, Metadatable {
@ -45,5 +45,5 @@ index d62277de..8a0f992f 100644
* Gets the {@link Block} at the given coordinates
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 0115c934227d7ae971e287367407bd7a72a186ba Mon Sep 17 00:00:00 2001
From 92864aea93c48d6757f3ec929d235f61563bf0b6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:28:32 -0500
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
@ -8,18 +8,19 @@ Adds lots of information about why this orb exists.
Replaces isFromBottle() with logic that persists entity reloads too.
diff --git a/src/main/java/org/bukkit/entity/ExperienceOrb.java b/src/main/java/org/bukkit/entity/ExperienceOrb.java
index c286edfd..f847543b 100644
index c286edfd8..57029d9bc 100644
--- a/src/main/java/org/bukkit/entity/ExperienceOrb.java
+++ b/src/main/java/org/bukkit/entity/ExperienceOrb.java
@@ -1,5 +1,7 @@
@@ -1,5 +1,8 @@
package org.bukkit.entity;
+import javax.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable; // Paper
+
/**
* Represents an Experience Orb.
*/
@@ -18,4 +20,94 @@ public interface ExperienceOrb extends Entity {
@@ -18,4 +21,95 @@ public interface ExperienceOrb extends Entity {
* @param value Amount of experience
*/
public void setExperience(int value);
@ -111,9 +112,10 @@ index c286edfd..f847543b 100644
+ * do not know, such as orbs spawned before this API was added, UNKNOWN is returned.
+ * @return The reason for this orb being spawned.
+ */
+ @NotNull
+ SpawnReason getSpawnReason();
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,17 +1,17 @@
From bd7776459d0b309752fcdc6b0169ac8508a34989 Mon Sep 17 00:00:00 2001
From 4e9c8caa8395d98ee682ff83f656c5128a5801d0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 21 Jan 2017 17:03:10 -0600
Subject: [PATCH] Expose WorldBorder#isInBounds(Location) check
diff --git a/src/main/java/org/bukkit/WorldBorder.java b/src/main/java/org/bukkit/WorldBorder.java
index 4dc18edc..41b7fae6 100644
index 7e8f5649..afb7b136 100644
--- a/src/main/java/org/bukkit/WorldBorder.java
+++ b/src/main/java/org/bukkit/WorldBorder.java
@@ -114,4 +114,18 @@ public interface WorldBorder {
@@ -117,4 +117,18 @@ public interface WorldBorder {
* @return if this location is inside the border or not
*/
public boolean isInside(Location location);
public boolean isInside(@NotNull Location location);
+
+ // Paper start
+ /**
@ -22,11 +22,11 @@ index 4dc18edc..41b7fae6 100644
+ * @deprecated use {@link #isInside(Location)} for an upstream compatible replacement
+ */
+ @Deprecated
+ public default boolean isInBounds(Location location) {
+ public default boolean isInBounds(@NotNull Location location) {
+ return this.isInside(location);
+ }
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From e8a0fcc32795014e18a8be640522fecddc8f4541 Mon Sep 17 00:00:00 2001
From c74ed751192df73e8d8ee4ccc6c8cec0d44a2116 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Fri, 9 Jun 2017 07:24:24 -0700
Subject: [PATCH] Add configuration option to prevent player names from being
@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5715057a..eb180374 100644
index 8e0cbbf15..90b41fd25 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1482,6 +1482,16 @@ public final class Bukkit {
@@ -1564,6 +1564,16 @@ public final class Bukkit {
public static boolean reloadCommandAliases() {
return server.reloadCommandAliases();
}
@ -25,12 +25,12 @@ index 5715057a..eb180374 100644
+ }
// Paper end
public static Server.Spigot spigot()
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 259a0fbe..c57f81fd 100644
index 8f61619a3..fe3144c00 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1283,4 +1283,14 @@ public interface Server extends PluginMessageRecipient {
@@ -1370,4 +1370,14 @@ public interface Server extends PluginMessageRecipient {
void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper
@ -46,10 +46,10 @@ index 259a0fbe..c57f81fd 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java
index 2abe1208..c660c178 100644
index 92c23424e..e420b7902 100644
--- a/src/main/java/org/bukkit/command/PluginCommand.java
+++ b/src/main/java/org/bukkit/command/PluginCommand.java
@@ -145,6 +145,7 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
@@ -151,6 +151,7 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
}
if (completions == null) {
@ -58,5 +58,5 @@ index 2abe1208..c660c178 100644
}
return completions;
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 7c8eed2edc8e4783ed66f36cb206b95a1f3039de Mon Sep 17 00:00:00 2001
From 0073358c87abe5e1b89363c51a06ff694a01f965 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 10 Jun 2017 16:59:40 -0500
Subject: [PATCH] Fix upstream javadoc warnings and errors
@ -6,10 +6,10 @@ Subject: [PATCH] Fix upstream javadoc warnings and errors
Upstream still refuses to use Java 8 with the API so they are likely unaware these are even issues.
diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java
index 43239f84..fe8d3468 100644
index ffebffd8b..f5e3929aa 100644
--- a/src/main/java/org/bukkit/NamespacedKey.java
+++ b/src/main/java/org/bukkit/NamespacedKey.java
@@ -38,8 +38,8 @@ public final class NamespacedKey {
@@ -39,8 +39,8 @@ public final class NamespacedKey {
/**
* Create a key in a specific namespace.
*
@ -21,78 +21,78 @@ index 43239f84..fe8d3468 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 8a0f992f..d499e41b 100644
index 846b0619a..84abeb216 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1606,6 +1606,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1666,6 +1666,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param count the number of particles
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, T data);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, @Nullable T data);
@@ -1621,6 +1622,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1681,6 +1682,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param count the number of particles
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, @Nullable T data);
@@ -1670,6 +1672,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1730,6 +1732,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param offsetZ the maximum random offset on the Z axis
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data);
@@ -1689,6 +1692,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1749,6 +1752,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param offsetZ the maximum random offset on the Z axis
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data);
@@ -1744,6 +1748,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1804,6 +1808,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* particle used (normally speed)
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
@@ -1765,6 +1770,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1825,6 +1830,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* particle used (normally speed)
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
@@ -1787,6 +1793,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1847,6 +1853,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param force whether to send the particle to players within an extended
* range and encourage their client to render it regardless of
* settings
+ * @param <T> Particle data type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
@@ -1811,6 +1818,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1871,6 +1878,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param force whether to send the particle to players within an extended
* range and encourage their client to render it regardless of
* settings
+ * @param <T> Particle data type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
index 10757454..6d5410ea 100644
index 2f1956724..234aa9dd2 100644
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java
@@ -22,7 +22,7 @@ public interface AbstractHorse extends Animals, Vehicle, InventoryHolder, Tameab
@@ -25,7 +25,7 @@ public interface AbstractHorse extends Animals, Vehicle, InventoryHolder, Tameab
public Horse.Variant getVariant();
/**
@ -102,19 +102,19 @@ index 10757454..6d5410ea 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/entity/AreaEffectCloud.java b/src/main/java/org/bukkit/entity/AreaEffectCloud.java
index 9a569d3a..8c5efd17 100644
index d258e734e..123d87954 100644
--- a/src/main/java/org/bukkit/entity/AreaEffectCloud.java
+++ b/src/main/java/org/bukkit/entity/AreaEffectCloud.java
@@ -138,6 +138,7 @@ public interface AreaEffectCloud extends Entity {
@@ -141,6 +141,7 @@ public interface AreaEffectCloud extends Entity {
* @param particle the new particle type
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> the particle data type // Paper
*/
<T> void setParticle(Particle particle, T data);
<T> void setParticle(@NotNull Particle particle, @Nullable T data);
diff --git a/src/main/java/org/bukkit/entity/Guardian.java b/src/main/java/org/bukkit/entity/Guardian.java
index 98af0563..ec6890ae 100644
index 98af0563c..ec6890ae6 100644
--- a/src/main/java/org/bukkit/entity/Guardian.java
+++ b/src/main/java/org/bukkit/entity/Guardian.java
@@ -12,7 +12,7 @@ public interface Guardian extends Monster {
@ -127,10 +127,10 @@ index 98af0563..ec6890ae 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/entity/Horse.java b/src/main/java/org/bukkit/entity/Horse.java
index cfce8fa5..8660070b 100644
index 734f5ac7b..5efa4e606 100644
--- a/src/main/java/org/bukkit/entity/Horse.java
+++ b/src/main/java/org/bukkit/entity/Horse.java
@@ -151,7 +151,7 @@ public interface Horse extends AbstractHorse {
@@ -154,7 +154,7 @@ public interface Horse extends AbstractHorse {
public boolean isCarryingChest();
/**
@ -140,10 +140,10 @@ index cfce8fa5..8660070b 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d9965ddc..bf284f2c 100644
index 219556ed5..c21785d58 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -431,7 +431,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -438,7 +438,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* Use supplied alternative character to the section symbol to represent legacy color codes.
*
@ -151,8 +151,8 @@ index d9965ddc..bf284f2c 100644
+ * @param alternateChar Alternate symbol such as '&amp;'
* @param message The message to send
*/
public void sendActionBar(char alternateChar, String message);
@@ -498,6 +498,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendActionBar(char alternateChar, @NotNull String message);
@@ -505,6 +505,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Update the subtitle of titles displayed to the player
*
@ -160,7 +160,7 @@ index d9965ddc..bf284f2c 100644
* @deprecated Use {@link #updateTitle(Title)}
*/
@Deprecated
@@ -506,6 +507,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -513,6 +514,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Update the subtitle of titles displayed to the player
*
@ -168,7 +168,7 @@ index d9965ddc..bf284f2c 100644
* @deprecated Use {@link #updateTitle(Title)}
*/
@Deprecated
@@ -514,6 +516,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -521,6 +523,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Show the given title to the player, along with the last subtitle set, using the last set times
*
@ -176,7 +176,7 @@ index d9965ddc..bf284f2c 100644
* @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
*/
@Deprecated
@@ -522,6 +525,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -529,6 +532,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Show the given title to the player, along with the last subtitle set, using the last set times
*
@ -184,59 +184,59 @@ index d9965ddc..bf284f2c 100644
* @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)}
*/
@Deprecated
@@ -1418,6 +1422,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1428,6 +1432,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param count the number of particles
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, T data);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, @Nullable T data);
@@ -1433,6 +1438,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1443,6 +1448,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param count the number of particles
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, @Nullable T data);
@@ -1482,6 +1488,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1492,6 +1498,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param offsetZ the maximum random offset on the Z axis
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data);
@@ -1501,6 +1508,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1511,6 +1518,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param offsetZ the maximum random offset on the Z axis
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data);
@@ -1556,6 +1564,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1566,6 +1574,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* particle used (normally speed)
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
@@ -1577,6 +1586,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1587,6 +1596,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* particle used (normally speed)
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
*/
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
index 2a02ab85..e33d00b3 100644
index 2a0b01097..2ac30c0f6 100644
--- a/src/main/java/org/bukkit/entity/Skeleton.java
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
@@ -15,6 +15,7 @@ public interface Skeleton extends Monster {
@@ -19,6 +19,7 @@ public interface Skeleton extends Monster {
public SkeletonType getSkeletonType();
/**
@ -245,10 +245,10 @@ index 2a02ab85..e33d00b3 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java
index bdc6206a..48034198 100644
index 756f285eb..ee2e70c67 100644
--- a/src/main/java/org/bukkit/entity/Zombie.java
+++ b/src/main/java/org/bukkit/entity/Zombie.java
@@ -29,14 +29,14 @@ public interface Zombie extends Monster {
@@ -32,7 +32,7 @@ public interface Zombie extends Monster {
public boolean isVillager();
/**
@ -257,6 +257,7 @@ index bdc6206a..48034198 100644
* @deprecated must spawn {@link ZombieVillager}.
*/
@Deprecated
@@ -40,7 +40,7 @@ public interface Zombie extends Monster {
public void setVillager(boolean flag);
/**
@ -266,30 +267,30 @@ index bdc6206a..48034198 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
index 6532c24f..ee0b1273 100644
index 8d4c70031..b493173e2 100644
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
@@ -28,6 +28,7 @@ public class PlayerLoginEvent extends PlayerEvent {
@@ -29,6 +29,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param hostname The hostname that was used to connect to the server
* @param address The address the player used to connect, provided for
* timing issues
+ * @param realAddress The unspoofed, actual address, that the player used to connect
*/
public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address, final InetAddress realAddress) { // Spigot
public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address, final @NotNull InetAddress realAddress) { // Spigot
super(player);
@@ -51,6 +52,7 @@ public class PlayerLoginEvent extends PlayerEvent {
@@ -52,6 +53,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* timing issues
* @param result The result status for this event
* @param message The message to be displayed if result denies login
+ * @param realAddress The unspoofed, actual address, that the player used to connect
*/
public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message, final InetAddress realAddress) { // Spigot
public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot
this(player, hostname, address, realAddress); // Spigot
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 762c43d6..ec2b8b8e 100644
index 07d2b4cfe..cbcbe8c8a 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -126,10 +126,10 @@ public interface ItemFactory {
@@ -132,10 +132,10 @@ public interface ItemFactory {
* Apply a material change for an item meta. Do not use under any
* circumstances.
*
@ -304,32 +305,32 @@ index 762c43d6..ec2b8b8e 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/inventory/Merchant.java b/src/main/java/org/bukkit/inventory/Merchant.java
index c8e68570..45431b36 100644
index 668e91958..5ff1f93d1 100644
--- a/src/main/java/org/bukkit/inventory/Merchant.java
+++ b/src/main/java/org/bukkit/inventory/Merchant.java
@@ -32,7 +32,7 @@ public interface Merchant {
@@ -35,7 +35,7 @@ public interface Merchant {
*
* @param i the index
* @return the recipe
- * @throws IndexOutOfBoundsException
+ * @throws IndexOutOfBoundsException Throws when specified index is larger than Merchant's inventory
*/
@NotNull
MerchantRecipe getRecipe(int i) throws IndexOutOfBoundsException;
@@ -41,7 +41,7 @@ public interface Merchant {
@@ -45,7 +45,7 @@ public interface Merchant {
*
* @param i the index
* @param recipe the recipe
- * @throws IndexOutOfBoundsException
+ * @throws IndexOutOfBoundsException Throws when specified index is larger than Merchant's inventory
*/
void setRecipe(int i, MerchantRecipe recipe) throws IndexOutOfBoundsException;
void setRecipe(int i, @NotNull MerchantRecipe recipe) throws IndexOutOfBoundsException;
diff --git a/src/main/java/org/bukkit/potion/Potion.java b/src/main/java/org/bukkit/potion/Potion.java
index 1413b361..b4a8051c 100644
index 63b7c70ce..a57f70ec6 100644
--- a/src/main/java/org/bukkit/potion/Potion.java
+++ b/src/main/java/org/bukkit/potion/Potion.java
@@ -78,6 +78,7 @@ public class Potion {
@@ -79,6 +79,7 @@ public class Potion {
}
/**
@ -338,10 +339,10 @@ index 1413b361..b4a8051c 100644
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/org/bukkit/potion/PotionBrewer.java
index 40f8d12b..33d19228 100644
index 9f913e1ee..254bd6f3e 100644
--- a/src/main/java/org/bukkit/potion/PotionBrewer.java
+++ b/src/main/java/org/bukkit/potion/PotionBrewer.java
@@ -34,6 +34,8 @@ public interface PotionBrewer {
@@ -38,6 +38,8 @@ public interface PotionBrewer {
* a potion with the given type.
*
* @param type The type of the potion
@ -349,12 +350,12 @@ index 40f8d12b..33d19228 100644
+ * @param extended Whether the potion is extended
* @return The list of effects
*/
public Collection<PotionEffect> getEffects(PotionType type, boolean upgraded, boolean extended);
@NotNull
diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java
index 034421a7..f1a54c23 100644
index 9b0fcf2da..e83e4b4fd 100644
--- a/src/main/java/org/bukkit/potion/PotionType.java
+++ b/src/main/java/org/bukkit/potion/PotionType.java
@@ -68,6 +68,7 @@ public enum PotionType {
@@ -72,6 +72,7 @@ public enum PotionType {
}
/**
@ -362,7 +363,7 @@ index 034421a7..f1a54c23 100644
* @deprecated Non-functional
*/
@Deprecated
@@ -80,6 +81,8 @@ public enum PotionType {
@@ -84,6 +85,8 @@ public enum PotionType {
}
/**
@ -371,7 +372,7 @@ index 034421a7..f1a54c23 100644
* @deprecated Non-functional
*/
@Deprecated
@@ -88,6 +91,8 @@ public enum PotionType {
@@ -94,6 +97,8 @@ public enum PotionType {
}
/**
@ -380,19 +381,6 @@ index 034421a7..f1a54c23 100644
* @deprecated Misleading
*/
@Deprecated
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
index ab71f3c3..358ea386 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -84,7 +84,7 @@ public interface Team {
* names are handled by prefixes / suffixes.
*
* @return team color, defaults to {@link ChatColor#RESET}
- * @throws IllegalStateException
+ * @throws IllegalStateException if this team has been unregistered
*/
ChatColor getColor() throws IllegalStateException;
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 717972d0fe8f0692924a0818c12d44f078ef63fc Mon Sep 17 00:00:00 2001
From 437d485cd0d2633307712d9f0c05e5ad4d809bf9 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 5 May 2017 03:57:08 -0500
Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
index 90260b7e..2e98e4f9 100644
index 00c58c1d..cb9e9f36 100644
--- a/src/main/java/org/bukkit/entity/Item.java
+++ b/src/main/java/org/bukkit/entity/Item.java
@@ -34,4 +34,20 @@ public interface Item extends Entity {
@@ -37,4 +37,20 @@ public interface Item extends Entity {
* @param delay New delay
*/
public void setPickupDelay(int delay);
@ -30,5 +30,5 @@ index 90260b7e..2e98e4f9 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 7e146962920f6d97ea5d9505e4351731dda96483 Mon Sep 17 00:00:00 2001
From bfb751c0cc1a9b5d9e913c1334d2fd5b67045402 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 May 2017 06:26:01 -0500
Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
index c76f423e..46c6d519 100644
index c7599116..5777d380 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
@@ -16,6 +16,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent;
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Item item;
@ -16,7 +16,7 @@ index c76f423e..46c6d519 100644
private boolean cancel = false;
private final int remaining;
@@ -43,12 +44,34 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
@@ -45,12 +46,34 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
return remaining;
}
@ -50,7 +50,7 @@ index c76f423e..46c6d519 100644
+ this.flyAtPlayer = !cancel; // Paper
}
@Override
@NotNull
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From feb2578249055b5ea84eefea5352074314225f0d Mon Sep 17 00:00:00 2001
From 75757b48a916e1c8b4d1dd2d543baae0526525e2 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 11 Jun 2017 16:30:37 -0500
Subject: [PATCH] PlayerAttemptPickupItemEvent
@ -6,33 +6,34 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java
new file mode 100644
index 00000000..480293e9
index 000000000..fb5cb3dc4
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerAttemptPickupItemEvent.java
@@ -0,0 +1,85 @@
@@ -0,0 +1,89 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Item;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Thrown when a player attempts to pick an item up from the ground
+ */
+public class PlayerAttemptPickupItemEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Item item;
+ @NotNull private final Item item;
+ private final int remaining;
+ private boolean flyAtPlayer = true;
+ private boolean isCancelled = false;
+
+ @Deprecated // Remove in 1.13
+ public PlayerAttemptPickupItemEvent(final Player player, final Item item) {
+ @Deprecated // Remove in 1.13 // Remove in 1.14?
+ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item) {
+ this(player, item, 0);
+ }
+
+ public PlayerAttemptPickupItemEvent(final Player player, final Item item, final int remaining) {
+ public PlayerAttemptPickupItemEvent(@NotNull final Player player, @NotNull final Item item, final int remaining) {
+ super(player);
+ this.item = item;
+ this.remaining = remaining;
@ -43,6 +44,7 @@ index 00000000..480293e9
+ *
+ * @return Item
+ */
+ @NotNull
+ public Item getItem() {
+ return item;
+ }
@ -86,15 +88,17 @@ index 00000000..480293e9
+ this.isCancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 4c16ebe8f181e90a58c0d8546eec8bed09fbb5f7 Mon Sep 17 00:00:00 2001
From 935c2498cb5d9d4920e90ab90ff786114a1d114f Mon Sep 17 00:00:00 2001
From: Sweepyoface <github@sweepy.pw>
Date: Sat, 17 Jun 2017 18:48:06 -0400
Subject: [PATCH] Add UnknownCommandEvent
@ -6,28 +6,29 @@ Subject: [PATCH] Add UnknownCommandEvent
diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
new file mode 100644
index 00000000..19d634c3
index 000000000..251342c3c
--- /dev/null
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
@@ -0,0 +1,77 @@
@@ -0,0 +1,82 @@
+package org.bukkit.event.command;
+
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Event;
+
+import javax.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Thrown when a player executes a command that is not defined
+ */
+public class UnknownCommandEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private CommandSender sender;
+ private String commandLine;
+ private String message;
+ @NotNull private CommandSender sender;
+ @NotNull private String commandLine;
+ @Nullable private String message;
+
+ public UnknownCommandEvent(final CommandSender sender, final String commandLine, final String message) {
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) {
+ super(false);
+ this.sender = sender;
+ this.commandLine = commandLine;
@ -40,6 +41,7 @@ index 00000000..19d634c3
+ *
+ * @return Sender of the command
+ */
+ @NotNull
+ public CommandSender getSender() {
+ return sender;
+ }
@ -50,6 +52,7 @@ index 00000000..19d634c3
+ *
+ * @return Command sent
+ */
+ @NotNull
+ public String getCommandLine() {
+ return commandLine;
+ }
@ -73,20 +76,22 @@ index 00000000..19d634c3
+ *
+ * @param message the message to be returned, or null
+ */
+ public void setMessage(String message) {
+ public void setMessage(@Nullable String message) {
+ this.message = message;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
+
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 61c8f560cab2b9ca2664390d3284a22a9578d775 Mon Sep 17 00:00:00 2001
From cccc14b25c7e3a218b057172eb111bcb5b89ca27 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 21:46:46 -0500
Subject: [PATCH] Basic PlayerProfile API
@ -7,17 +7,17 @@ Provides basic elements of a PlayerProfile to be used by future API/events
diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
new file mode 100644
index 00000000..529c5376
index 000000000..476151d2a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
@@ -0,0 +1,142 @@
@@ -0,0 +1,145 @@
+package com.destroystokyo.paper.profile;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.Collection;
+import java.util.Set;
+import java.util.UUID;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a players profile for the game, such as UUID, Name, and textures.
@ -27,7 +27,8 @@ index 00000000..529c5376
+ /**
+ * @return The players name, if set
+ */
+ @Nullable String getName();
+ @Nullable
+ String getName();
+
+ /**
+ * Sets this profiles Name
@ -35,6 +36,7 @@ index 00000000..529c5376
+ * @param name The new Name
+ * @return The previous Name
+ */
+ @NotNull
+ String setName(@Nullable String name);
+
+ /**
@ -48,46 +50,47 @@ index 00000000..529c5376
+ * @param uuid The new UUID
+ * @return The previous UUID
+ */
+ @Nullable
+ UUID setId(@Nullable UUID uuid);
+
+ /**
+ * @return A Mutable set of this players properties, such as textures.
+ * Values specified here are subject to implementation details.
+ */
+ @Nonnull Set<ProfileProperty> getProperties();
+ @NotNull Set<ProfileProperty> getProperties();
+
+ /**
+ * Check if the Profile has the specified property
+ * @param property Property name to check
+ * @return If the property is set
+ */
+ boolean hasProperty(String property);
+ boolean hasProperty(@Nullable String property);
+
+ /**
+ * Sets a property. If the property already exists, the previous one will be replaced
+ * @param property Property to set.
+ */
+ void setProperty(ProfileProperty property);
+ void setProperty(@NotNull ProfileProperty property);
+
+ /**
+ * Sets multiple properties. If any of the set properties already exist, it will be replaced
+ * @param properties The properties to set
+ */
+ void setProperties(Collection<ProfileProperty> properties);
+ void setProperties(@NotNull Collection<ProfileProperty> properties);
+
+ /**
+ * Removes a specific property from this profile
+ * @param property The property to remove
+ * @return If a property was removed
+ */
+ boolean removeProperty(String property);
+ boolean removeProperty(@Nullable String property);
+
+ /**
+ * Removes a specific property from this profile
+ * @param property The property to remove
+ * @return If a property was removed
+ */
+ default boolean removeProperty(@Nonnull ProfileProperty property) {
+ default boolean removeProperty(@NotNull ProfileProperty property) {
+ return removeProperty(property.getName());
+ }
+
@ -96,7 +99,7 @@ index 00000000..529c5376
+ * @param properties The properties to remove
+ * @return If any property was removed
+ */
+ default boolean removeProperties(Collection<ProfileProperty> properties) {
+ default boolean removeProperties(@NotNull Collection<ProfileProperty> properties) {
+ boolean removed = false;
+ for (ProfileProperty property : properties) {
+ if (removeProperty(property)) {
@ -155,7 +158,7 @@ index 00000000..529c5376
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java b/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java
new file mode 100644
index 00000000..d17061e6
index 000000000..7b3b6ef53
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java
@@ -0,0 +1,72 @@
@ -163,9 +166,9 @@ index 00000000..d17061e6
+
+import com.google.common.base.Preconditions;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.Objects;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a property on a {@link PlayerProfile}
@ -175,11 +178,11 @@ index 00000000..d17061e6
+ private final String value;
+ private final String signature;
+
+ public ProfileProperty(@Nonnull String name, @Nonnull String value) {
+ public ProfileProperty(@NotNull String name, @NotNull String value) {
+ this(name, value, null);
+ }
+
+ public ProfileProperty(@Nonnull String name, @Nonnull String value, @Nullable String signature) {
+ public ProfileProperty(@NotNull String name, @NotNull String value, @Nullable String signature) {
+ this.name = Preconditions.checkNotNull(name, "ProfileProperty name can not be null");
+ this.value = Preconditions.checkNotNull(value, "ProfileProperty value can not be null");
+ this.signature = signature;
@ -188,7 +191,7 @@ index 00000000..d17061e6
+ /**
+ * @return The property name, ie "textures"
+ */
+ @Nonnull
+ @NotNull
+ public String getName() {
+ return name;
+ }
@ -196,7 +199,7 @@ index 00000000..d17061e6
+ /**
+ * @return The property value, likely to be base64 encoded
+ */
+ @Nonnull
+ @NotNull
+ public String getValue() {
+ return value;
+ }
@ -232,20 +235,10 @@ index 00000000..d17061e6
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index eb180374..75634a8d 100644
index 90b41fd25..16fa78b86 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -51,6 +51,9 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.meta.ItemMeta;
+import javax.annotation.Nullable; // Paper
+import javax.annotation.Nonnull; // Paper
+
/**
* Represents the Bukkit core, for version and Server singleton handling
*/
@@ -1492,6 +1495,37 @@ public final class Bukkit {
@@ -1574,6 +1574,40 @@ public final class Bukkit {
public static boolean suggestPlayerNamesWhenNullTabCompletions() {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
@ -255,7 +248,8 @@ index eb180374..75634a8d 100644
+ * @param uuid UUID to create profile for
+ * @return A PlayerProfile object
+ */
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) {
+ @NotNull
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull UUID uuid) {
+ return server.createProfile(uuid);
+ }
+
@ -264,7 +258,8 @@ index eb180374..75634a8d 100644
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ */
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull String name) {
+ @NotNull
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull String name) {
+ return server.createProfile(name);
+ }
+
@ -277,27 +272,18 @@ index eb180374..75634a8d 100644
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ */
+ @NotNull
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
+ return server.createProfile(uuid, name);
+ }
// Paper end
public static Server.Spigot spigot()
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c57f81fd..1d1f7784 100644
index fe3144c00..edbfa3fdc 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -52,6 +52,9 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.meta.ItemMeta;
+import javax.annotation.Nullable; // Paper
+import javax.annotation.Nonnull; // Paper
+
/**
* Represents a server implementation.
*/
@@ -1292,5 +1295,30 @@ public interface Server extends PluginMessageRecipient {
@@ -1379,5 +1379,33 @@ public interface Server extends PluginMessageRecipient {
* @return true if player names should be suggested
*/
boolean suggestPlayerNamesWhenNullTabCompletions();
@ -307,14 +293,16 @@ index c57f81fd..1d1f7784 100644
+ * @param uuid UUID to create profile for
+ * @return A PlayerProfile object
+ */
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid);
+ @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull UUID uuid);
+
+ /**
+ * Creates a PlayerProfile for the specified name, with UUID as null
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ */
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull String name);
+ @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull String name);
+
+ /**
+ * Creates a PlayerProfile for the specified name/uuid
@ -325,9 +313,10 @@ index c57f81fd..1d1f7784 100644
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ */
+ @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
// Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 20ce1d6f58eaa8aa7b041d8f0588ab9505d035ae Mon Sep 17 00:00:00 2001
From 5fcee5665b665276220dc2a9eedb5588880b2f9d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 Jun 2017 15:04:51 -0400
Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 8fc5c83c..040562eb 100644
index f76bc85c4..037e23930 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -312,6 +312,24 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -331,6 +331,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
public int getExpToLevel();
@ -19,6 +19,7 @@ index 8fc5c83c..040562eb 100644
+ *
+ * @return The released entity, or null
+ */
+ @Nullable
+ public Entity releaseLeftShoulderEntity();
+
+ /**
@ -27,6 +28,7 @@ index 8fc5c83c..040562eb 100644
+ *
+ * @return The released entity, or null
+ */
+ @Nullable
+ public Entity releaseRightShoulderEntity();
+ // Paper end
+
@ -34,5 +36,5 @@ index 8fc5c83c..040562eb 100644
* Discover a recipe for this player such that it has not already been
* discovered. This method will add the key's associated recipe to the
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From cbcd37fcba051f9148b24a33e042f21093ed9f2e Mon Sep 17 00:00:00 2001
From 0e47d3ccc037ae116f442c963aef0ff5115a4186 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 Jun 2017 16:30:44 -0400
Subject: [PATCH] Profile Lookup Events
@ -8,10 +8,10 @@ profiles that had to be looked up.
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
new file mode 100644
index 00000000..160c98fe
index 000000000..8df37c07c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
@@ -0,0 +1,44 @@
@@ -0,0 +1,46 @@
+package com.destroystokyo.paper.event.profile;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
@ -19,7 +19,7 @@ index 00000000..160c98fe
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Allows a plugin to be notified anytime AFTER a Profile has been looked up from the Mojang API
@ -32,9 +32,9 @@ index 00000000..160c98fe
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private final PlayerProfile profile;
+ @NotNull private final PlayerProfile profile;
+
+ public LookupProfileEvent(@Nonnull PlayerProfile profile) {
+ public LookupProfileEvent(@NotNull PlayerProfile profile) {
+ super(!Bukkit.isPrimaryThread());
+ this.profile = profile;
+ }
@ -42,26 +42,28 @@ index 00000000..160c98fe
+ /**
+ * @return The profile that was recently looked up. This profile can be mutated
+ */
+ @Nonnull
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
new file mode 100644
index 00000000..e5a5986a
index 000000000..4dcf6242c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
@@ -0,0 +1,105 @@
@@ -0,0 +1,108 @@
+package com.destroystokyo.paper.event.profile;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
@ -71,11 +73,11 @@ index 00000000..e5a5986a
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Allows a plugin to intercept a Profile Lookup for a Profile by name
@ -90,11 +92,11 @@ index 00000000..e5a5986a
+public class PreLookupProfileEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final String name;
+ @NotNull private final String name;
+ private UUID uuid;
+ private Set<ProfileProperty> properties = new HashSet<>();
+ @NotNull private Set<ProfileProperty> properties = new HashSet<>();
+
+ public PreLookupProfileEvent(@Nonnull String name) {
+ public PreLookupProfileEvent(@NotNull String name) {
+ super(!Bukkit.isPrimaryThread());
+ this.name = name;
+ }
@ -102,7 +104,7 @@ index 00000000..e5a5986a
+ /**
+ * @return Name of the profile
+ */
+ @Nonnull
+ @NotNull
+ public String getName() {
+ return name;
+ }
@ -134,6 +136,7 @@ index 00000000..e5a5986a
+ * @return The currently pending prepopulated properties.
+ * Any property in this Set will be automatically prefilled on this Profile
+ */
+ @NotNull
+ public Set<ProfileProperty> getProfileProperties() {
+ return this.properties;
+ }
@ -143,7 +146,7 @@ index 00000000..e5a5986a
+ * Any property in this Set will be automatically prefilled on this Profile
+ * @param properties The properties to add
+ */
+ public void setProfileProperties(Set<ProfileProperty> properties) {
+ public void setProfileProperties(@NotNull Set<ProfileProperty> properties) {
+ this.properties = new HashSet<>();
+ this.properties.addAll(properties);
+ }
@ -153,20 +156,22 @@ index 00000000..e5a5986a
+ * Any property in this Set will be automatically prefilled on this Profile
+ * @param properties The properties to add
+ */
+ public void addProfileProperties(Set<ProfileProperty> properties) {
+ public void addProfileProperties(@NotNull Set<ProfileProperty> properties) {
+ this.properties.addAll(properties);
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,16 +1,16 @@
From e5a62fbf4f51754de1e49ce6046eefc76c317a73 Mon Sep 17 00:00:00 2001
From c98cd92d19f14a732e1ac7e3e3922047e4dbf817 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 18 Jun 2017 18:17:05 -0500
Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 015a4c56..13de2d74 100644
index 69307e252..373204d37 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -569,5 +569,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
* @return Location where entity originates or null if not yet added
@@ -591,5 +591,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
*/
@Nullable
Location getOrigin();
+
+ /**
@ -22,5 +22,5 @@ index 015a4c56..13de2d74 100644
// Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 9185b0d77ba37d0e88629037967032c2b4ba3761 Mon Sep 17 00:00:00 2001
From 01ff2f70c2ef6bafe4b99eb940d63bb256526819 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Dec 2016 16:12:48 -0500
Subject: [PATCH] Improve the Saddle API for Horses
@ -8,12 +8,14 @@ and access their saddle state separately from an interface shared with Armor.
diff --git a/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java b/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java
new file mode 100644
index 00000000..a39b9544
index 000000000..163ffe8ff
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java
@@ -0,0 +1,18 @@
@@ -0,0 +1,21 @@
+package org.bukkit.inventory;
+
+import org.jetbrains.annotations.Nullable;
+
+public interface ArmoredHorseInventory extends AbstractHorseInventory {
+
+ /**
@ -21,6 +23,7 @@ index 00000000..a39b9544
+ *
+ * @return the armor item
+ */
+ @Nullable
+ ItemStack getArmor();
+
+ /**
@ -28,13 +31,13 @@ index 00000000..a39b9544
+ *
+ * @param stack the new item
+ */
+ void setArmor(ItemStack stack);
+ void setArmor(@Nullable ItemStack stack);
+}
diff --git a/src/main/java/org/bukkit/inventory/HorseInventory.java b/src/main/java/org/bukkit/inventory/HorseInventory.java
index a73c9850..e14c1277 100644
index 608e99c42..53498debe 100644
--- a/src/main/java/org/bukkit/inventory/HorseInventory.java
+++ b/src/main/java/org/bukkit/inventory/HorseInventory.java
@@ -3,19 +3,4 @@ package org.bukkit.inventory;
@@ -5,20 +5,4 @@ import org.jetbrains.annotations.Nullable;
/**
* An interface to the inventory of a Horse.
*/
@ -45,6 +48,7 @@ index a73c9850..e14c1277 100644
- *
- * @return the armor item
- */
- @Nullable
- ItemStack getArmor();
-
- /**
@ -52,25 +56,25 @@ index a73c9850..e14c1277 100644
- *
- * @param stack the new item
- */
- void setArmor(ItemStack stack);
- void setArmor(@Nullable ItemStack stack);
-}
+public interface HorseInventory extends AbstractHorseInventory, ArmoredHorseInventory {}
diff --git a/src/main/java/org/bukkit/inventory/LlamaInventory.java b/src/main/java/org/bukkit/inventory/LlamaInventory.java
index 9b3dcf3f..7856a7f2 100644
index 2fa2c9d07..5ac1afb8a 100644
--- a/src/main/java/org/bukkit/inventory/LlamaInventory.java
+++ b/src/main/java/org/bukkit/inventory/LlamaInventory.java
@@ -5,7 +5,7 @@ import org.bukkit.entity.Llama;
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
/**
* An interface to the inventory of a {@link Llama}.
*/
-public interface LlamaInventory extends AbstractHorseInventory {
+public interface LlamaInventory extends SaddledHorseInventory {
/*
/**
* Gets the item in the llama's decor slot.
diff --git a/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java b/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java
new file mode 100644
index 00000000..7944f26a
index 000000000..7944f26a3
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java
@@ -0,0 +1,3 @@
@ -78,5 +82,5 @@ index 00000000..7944f26a
+
+public interface SaddledHorseInventory extends AbstractHorseInventory {}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From c6f53269f00ebf72dfb63f9e60fe9d96762faf50 Mon Sep 17 00:00:00 2001
From 4c5a58a93cd324de4bbb929a3feac630cd3a758d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 23:55:48 -0400
Subject: [PATCH] ensureServerConversions API
@ -7,13 +7,13 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index ec2b8b8e..3012aec2 100644
index cbcbe8c8a..8e602cf51 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -134,4 +134,16 @@ public interface ItemFactory {
*/
@@ -141,4 +141,17 @@ public interface ItemFactory {
@Deprecated
Material updateMaterial(final ItemMeta meta, final Material material) throws IllegalArgumentException;
@NotNull
Material updateMaterial(@NotNull final ItemMeta meta, @NotNull final Material material) throws IllegalArgumentException;
+ // Paper start
+ /**
+ * Minecart updates are converting simple item stacks into more complex NBT oriented Item Stacks.
@ -24,14 +24,15 @@ index ec2b8b8e..3012aec2 100644
+ * @param item The item to process conversions on
+ * @return A potentially Data Converted ItemStack
+ */
+ ItemStack ensureServerConversions(ItemStack item);
+ @NotNull
+ ItemStack ensureServerConversions(@NotNull ItemStack item);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index c744799f..5e8de115 100644
index 7b709457f..e8f97c949 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -506,7 +506,12 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
@@ -517,7 +517,12 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
}
}
@ -45,7 +46,7 @@ index c744799f..5e8de115 100644
}
/**
@@ -564,4 +569,18 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
@@ -576,4 +581,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
return true;
}
@ -59,11 +60,12 @@ index c744799f..5e8de115 100644
+ *
+ * @return A potentially Data Converted ItemStack
+ */
+ @NotNull
+ public ItemStack ensureServerConversions() {
+ return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
+ }
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From f31c0b3a4d3fe17a7fd04057156089d7db81dc3a Mon Sep 17 00:00:00 2001
From c2814c3f3d70e2834f47c4bb3beafb0d591d4985 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 23:55:48 -0400
Subject: [PATCH] Add getI18NDisplayName API
@ -8,13 +8,13 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 3012aec2..63dd1b32 100644
index 8e602cf51..dca77bbaf 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -145,5 +145,15 @@ public interface ItemFactory {
* @return A potentially Data Converted ItemStack
@@ -153,5 +153,16 @@ public interface ItemFactory {
*/
ItemStack ensureServerConversions(ItemStack item);
@NotNull
ItemStack ensureServerConversions(@NotNull ItemStack item);
+
+ /**
+ * Gets the Display name as seen in the Client.
@ -24,14 +24,15 @@ index 3012aec2..63dd1b32 100644
+ * @param item Item to return Display name of
+ * @return Display name of Item
+ */
+ String getI18NDisplayName(ItemStack item);
+ @Nullable
+ String getI18NDisplayName(@Nullable ItemStack item);
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 5e8de115..c3cb1247 100644
index e8f97c949..b1c02ac0d 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -582,5 +582,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
@@ -595,5 +595,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
public ItemStack ensureServerConversions() {
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
}
@ -43,11 +44,12 @@ index 5e8de115..c3cb1247 100644
+ *
+ * @return Display name of Item
+ */
+ @Nullable
+ public String getI18NDisplayName() {
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
+ }
// Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From ad76debcffa4a9ef371ba7f2d8b9c1034f16fba4 Mon Sep 17 00:00:00 2001
From c76cd792c71b03975683e5660613d55613c025f8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 3 Jul 2017 18:11:34 -0500
Subject: [PATCH] ProfileWhitelistVerifyEvent
@ -9,10 +9,10 @@ Allows you to do dynamic whitelisting and change of kick message
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
new file mode 100644
index 00000000..b57fff9f
index 000000000..b10176289
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
@@ -0,0 +1,111 @@
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2017 - Daniel Ennis (Aikar) - MIT License
+ *
@ -41,6 +41,8 @@ index 00000000..b57fff9f
+import com.destroystokyo.paper.profile.PlayerProfile;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Fires when the server needs to verify if a player is whitelisted.
@ -51,13 +53,13 @@ index 00000000..b57fff9f
+ */
+public class ProfileWhitelistVerifyEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private final PlayerProfile profile;
+ @NotNull private final PlayerProfile profile;
+ private final boolean whitelistEnabled;
+ private boolean whitelisted;
+ private final boolean isOp;
+ private String kickMessage;
+ @Nullable private String kickMessage;
+
+ public ProfileWhitelistVerifyEvent(final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, String kickMessage) {
+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) {
+ this.profile = profile;
+ this.whitelistEnabled = whitelistEnabled;
+ this.whitelisted = whitelisted;
@ -68,6 +70,7 @@ index 00000000..b57fff9f
+ /**
+ * @return the currently planned message to send to the user if they are not whitelisted
+ */
+ @Nullable
+ public String getKickMessage() {
+ return kickMessage;
+ }
@ -75,13 +78,14 @@ index 00000000..b57fff9f
+ /**
+ * @param kickMessage The message to send to the player on kick if not whitelisted. May set to null to use the server configured default
+ */
+ public void setKickMessage(String kickMessage) {
+ public void setKickMessage(@Nullable String kickMessage) {
+ this.kickMessage = kickMessage;
+ }
+
+ /**
+ * @return The profile of the player trying to connect
+ */
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ }
@ -115,15 +119,17 @@ index 00000000..b57fff9f
+ return whitelistEnabled;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,11 +1,11 @@
From 37c5379af867301839590856be1d68cdf1a0b4de Mon Sep 17 00:00:00 2001
From 482ec24d923b8dc78080d5edcfe1422087035346 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 02:08:55 -0500
Subject: [PATCH] Make /plugins list alphabetical
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
index e40b03a7..b1d384e8 100644
index 6f95bf3c..d4e74d29 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -3,6 +3,8 @@ package org.bukkit.command.defaults;
@ -17,9 +17,9 @@ index e40b03a7..b1d384e8 100644
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -32,19 +34,24 @@ public class PluginsCommand extends BukkitCommand {
}
@@ -35,19 +37,24 @@ public class PluginsCommand extends BukkitCommand {
@NotNull
private String getPluginList() {
- StringBuilder pluginList = new StringBuilder();
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
@ -50,5 +50,5 @@ index e40b03a7..b1d384e8 100644
}
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,24 +1,15 @@
From 66621223158643139e2189afc257009daf70f05e Mon Sep 17 00:00:00 2001
From 8b825df13b6aaa53037a89ec4c1c05b4b6ea4173 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:49:43 -0500
Subject: [PATCH] LivingEntity#setKiller
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index f67711fd..3f93b70c 100644
index 1100e305..706d8f52 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -17,6 +17,8 @@ import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
+import javax.annotation.Nullable;
+
/**
* Represents a living entity, such as a monster or player
*/
@@ -239,6 +241,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
@@ -250,6 +250,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@Nullable
public Player getKiller();
+ // Paper start
@ -34,5 +25,5 @@ index f67711fd..3f93b70c 100644
* Adds the given {@link PotionEffect} to the living entity.
* <p>
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 950732e4f72ad1ebd0983638df104c7957ecc3ef Mon Sep 17 00:00:00 2001
From 6b3735bc5ec6609bb14a78335eaa7ea5c5574db4 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:14:13 +0200
Subject: [PATCH] Handle plugin prefixes in implementation logging
@ -17,10 +17,10 @@ The implementation should handle plugin prefixes by displaying
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
index 67887806..a81dae43 100644
index 7c934899..9a342788 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
@@ -42,7 +42,7 @@ public abstract class JavaPlugin extends PluginBase {
@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase {
private boolean naggable = true;
private FileConfiguration newConfig = null;
private File configFile = null;
@ -29,7 +29,7 @@ index 67887806..a81dae43 100644
public JavaPlugin() {
final ClassLoader classLoader = this.getClass().getClassLoader();
@@ -267,7 +267,8 @@ public abstract class JavaPlugin extends PluginBase {
@@ -278,7 +278,8 @@ public abstract class JavaPlugin extends PluginBase {
this.dataFolder = dataFolder;
this.classLoader = classLoader;
this.configFile = new File(dataFolder, "config.yml");
@ -40,5 +40,5 @@ index 67887806..a81dae43 100644
/**
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 83b0d804b7335d31c3ff87a7070c401dc869d824 Mon Sep 17 00:00:00 2001
From 4d33389d2be22a2955605e09a43ffd1109a3eddb Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:33:12 +0200
Subject: [PATCH] Allow plugins to use SLF4J for logging
@ -14,13 +14,13 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction.
diff --git a/pom.xml b/pom.xml
index 84ba2076..3ebc6287 100644
index 082f2f0c5..13cdc25f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,6 +103,14 @@
<scope>compile</scope>
@@ -109,6 +109,13 @@
<version>17.0.0</version>
<scope>provided</scope>
</dependency>
+ <!-- Paper - Add SLF4J -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
@ -28,19 +28,19 @@ index 84ba2076..3ebc6287 100644
+ <version>1.7.25</version>
+ <scope>compile</scope>
+ </dependency>
+
<!-- testing -->
<dependency>
<groupId>junit</groupId>
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
index 55debf5d..8d2999ac 100644
index 076ec041f..b4882f48b 100644
--- a/src/main/java/org/bukkit/plugin/Plugin.java
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
@@ -157,6 +157,12 @@ public interface Plugin extends TabExecutor {
*/
@@ -167,6 +167,13 @@ public interface Plugin extends TabExecutor {
@NotNull
public Logger getLogger();
+ // Paper start - Add SLF4J logger
+ @NotNull
+ default org.slf4j.Logger getSLF4JLogger() {
+ return org.slf4j.LoggerFactory.getLogger(getLogger().getName());
+ }
@ -50,5 +50,5 @@ index 55debf5d..8d2999ac 100644
* Returns the name of the plugin.
* <p>
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From ab1ab274192f3fbc229d5480bf989597e383f1c2 Mon Sep 17 00:00:00 2001
From ab3fa3cb5c5e5389c8fb4900b9e5fb6800e11be1 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 19:41:20 +0200
Subject: [PATCH] Add workaround for plugins modifying the parent of the plugin
@ -14,10 +14,10 @@ parent of the plugin logger to avoid this.
diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java
new file mode 100644
index 00000000..d052b2f5
index 000000000..76f2cb9cd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java
@@ -0,0 +1,39 @@
@@ -0,0 +1,41 @@
+package com.destroystokyo.paper.utils;
+
+import org.bukkit.plugin.PluginDescriptionFile;
@ -25,13 +25,15 @@ index 00000000..d052b2f5
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Prevents plugins (e.g. Essentials) from changing the parent of the plugin logger.
+ */
+public class PaperPluginLogger extends Logger {
+
+ public static Logger getLogger(PluginDescriptionFile description) {
+ @NotNull
+ public static Logger getLogger(@NotNull PluginDescriptionFile description) {
+ Logger logger = new PaperPluginLogger(description);
+ if (!LogManager.getLogManager().addLogger(logger)) {
+ // Disable this if it's going to happen across reloads anyways...
@ -42,12 +44,12 @@ index 00000000..d052b2f5
+ return logger;
+ }
+
+ private PaperPluginLogger(PluginDescriptionFile description) {
+ private PaperPluginLogger(@NotNull PluginDescriptionFile description) {
+ super(description.getPrefix() != null ? description.getPrefix() : description.getName(), null);
+ }
+
+ @Override
+ public void setParent(Logger parent) {
+ public void setParent(@NotNull Logger parent) {
+ if (getParent() != null) {
+ warning("Ignoring attempt to change parent of plugin logger");
+ } else {
@ -58,10 +60,10 @@ index 00000000..d052b2f5
+
+}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
index a81dae43..15f22ade 100644
index 9a3427882..96ebe72ca 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
@@ -42,7 +42,7 @@ public abstract class JavaPlugin extends PluginBase {
@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase {
private boolean naggable = true;
private FileConfiguration newConfig = null;
private File configFile = null;
@ -70,7 +72,7 @@ index a81dae43..15f22ade 100644
public JavaPlugin() {
final ClassLoader classLoader = this.getClass().getClassLoader();
@@ -267,8 +267,11 @@ public abstract class JavaPlugin extends PluginBase {
@@ -278,8 +278,11 @@ public abstract class JavaPlugin extends PluginBase {
this.dataFolder = dataFolder;
this.classLoader = classLoader;
this.configFile = new File(dataFolder, "config.yml");
@ -85,10 +87,10 @@ index a81dae43..15f22ade 100644
/**
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index bc33ff33..213f6234 100644
index c39fcac5a..0df1926fa 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -36,6 +36,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
@@ -38,6 +38,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
final JavaPlugin plugin;
private JavaPlugin pluginInit;
private IllegalStateException pluginState;
@ -96,7 +98,7 @@ index bc33ff33..213f6234 100644
static {
ClassLoader.registerAsParallelCapable();
@@ -53,6 +54,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
@@ -55,6 +56,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
this.manifest = jar.getManifest();
this.url = file.toURI().toURL();
@ -105,7 +107,7 @@ index bc33ff33..213f6234 100644
try {
Class<?> jarClass;
try {
@@ -169,6 +172,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
@@ -172,6 +175,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
pluginState = new IllegalStateException("Initial initialization");
this.pluginInit = javaPlugin;
@ -114,5 +116,5 @@ index bc33ff33..213f6234 100644
}
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From f260a9837d5bc3512ba711e4612fb095e71a0c23 Mon Sep 17 00:00:00 2001
From c6b1a2b8f11a56eb2d4e78d492fc679cc20fbed1 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 Sep 2017 17:21:32 -0400
Subject: [PATCH] Add PlayerJumpEvent
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
new file mode 100644
index 00000000..dd24f9b0
index 000000000..289a0d784
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
@@ -0,0 +1,101 @@
@@ -0,0 +1,106 @@
+package com.destroystokyo.paper.event.player;
+
+import com.google.common.base.Preconditions;
@ -18,6 +18,7 @@ index 00000000..dd24f9b0
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when the server detects the player is jumping.
@ -29,10 +30,10 @@ index 00000000..dd24f9b0
+public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel = false;
+ private Location from;
+ private Location to;
+ @NotNull private Location from;
+ @NotNull private Location to;
+
+ public PlayerJumpEvent(final Player player, final Location from, final Location to) {
+ public PlayerJumpEvent(@NotNull final Player player, @NotNull final Location from, @NotNull final Location to) {
+ super(player);
+ this.from = from;
+ this.to = to;
@ -71,6 +72,7 @@ index 00000000..dd24f9b0
+ *
+ * @return Location the player jumped from
+ */
+ @NotNull
+ public Location getFrom() {
+ return from;
+ }
@ -80,7 +82,7 @@ index 00000000..dd24f9b0
+ *
+ * @param from New location to mark as the players previous location
+ */
+ public void setFrom(Location from) {
+ public void setFrom(@NotNull Location from) {
+ validateLocation(from);
+ this.from = from;
+ }
@ -93,6 +95,7 @@ index 00000000..dd24f9b0
+ *
+ * @return Location the player jumped to
+ */
+ @NotNull
+ public Location getTo() {
+ return to;
+ }
@ -102,15 +105,17 @@ index 00000000..dd24f9b0
+ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use location with null world!");
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 16cc6fb4885d1c34e7c05dad55cd53b16931ca41 Mon Sep 17 00:00:00 2001
From 288a297fa9c66575aca683e0f2cb693bc119a3c2 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Tue, 10 Oct 2017 18:44:42 +0200
Subject: [PATCH] Expose client protocol version and virtual host
@ -11,15 +11,16 @@ Add a NetworkClient interface that provides access to:
diff --git a/src/main/java/com/destroystokyo/paper/network/NetworkClient.java b/src/main/java/com/destroystokyo/paper/network/NetworkClient.java
new file mode 100644
index 00000000..9072e384
index 000000000..7b2af1bd7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/NetworkClient.java
@@ -0,0 +1,39 @@
@@ -0,0 +1,41 @@
+package com.destroystokyo.paper.network;
+
+import java.net.InetSocketAddress;
+
+import javax.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a client connected to the server.
@ -31,6 +32,7 @@ index 00000000..9072e384
+ *
+ * @return The client's socket address
+ */
+ @NotNull
+ InetSocketAddress getAddress();
+
+ /**
@ -55,10 +57,10 @@ index 00000000..9072e384
+
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index bf284f2c..5e65657a 100644
index 4b59f8feb..eeed2e796 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -30,7 +30,7 @@ import org.bukkit.scoreboard.Scoreboard;
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a player, connected or not
*/
@ -68,5 +70,5 @@ index bf284f2c..5e65657a 100644
/**
* Gets the "friendly" name to display of this player. This may include
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From fa9d75620f187b39ddf397a8a37e951768f1a1f5 Mon Sep 17 00:00:00 2001
From 72e0411e853da36205ab8e3d24041de5d7b80ac5 Mon Sep 17 00:00:00 2001
From: pkt77 <parkerkt77@gmail.com>
Date: Fri, 10 Nov 2017 23:45:59 -0500
Subject: [PATCH] Add PlayerArmorChangeEvent
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
new file mode 100644
index 00000000..0783ac82
index 000000000..2827a1002
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
@@ -0,0 +1,135 @@
@@ -0,0 +1,137 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Material;
@ -18,12 +18,12 @@ index 00000000..0783ac82
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.bukkit.Material.*;
+
@ -35,11 +35,11 @@ index 00000000..0783ac82
+public class PlayerArmorChangeEvent extends PlayerEvent {
+ private static final HandlerList HANDLERS = new HandlerList();
+
+ private final SlotType slotType;
+ private final ItemStack oldItem;
+ private final ItemStack newItem;
+ @NotNull private final SlotType slotType;
+ @Nullable private final ItemStack oldItem;
+ @Nullable private final ItemStack newItem;
+
+ public PlayerArmorChangeEvent(Player player, SlotType slotType, ItemStack oldItem, ItemStack newItem) {
+ public PlayerArmorChangeEvent(@NotNull Player player, @NotNull SlotType slotType, @Nullable ItemStack oldItem, @Nullable ItemStack newItem) {
+ super(player);
+ this.slotType = slotType;
+ this.oldItem = oldItem;
@ -51,7 +51,7 @@ index 00000000..0783ac82
+ *
+ * @return type of slot being altered
+ */
+ @Nonnull
+ @NotNull
+ public SlotType getSlotType() {
+ return this.slotType;
+ }
@ -81,11 +81,13 @@ index 00000000..0783ac82
+ return "ArmorChangeEvent{" + "player=" + player + ", slotType=" + slotType + ", oldItem=" + oldItem + ", newItem=" + newItem + '}';
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLERS;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLERS;
+ }
@ -109,7 +111,7 @@ index 00000000..0783ac82
+ *
+ * @return immutable set of material types
+ */
+ @Nonnull
+ @NotNull
+ public Set<Material> getTypes() {
+ if (immutableTypes == null) {
+ immutableTypes = Collections.unmodifiableSet(mutableTypes);
@ -125,7 +127,7 @@ index 00000000..0783ac82
+ * @return slot type the material will go in, or null if it won't
+ */
+ @Nullable
+ public static SlotType getByMaterial(Material material) {
+ public static SlotType getByMaterial(@NotNull Material material) {
+ for (SlotType slotType : values()) {
+ if (slotType.getTypes().contains(material)) {
+ return slotType;
@ -140,11 +142,11 @@ index 00000000..0783ac82
+ * @param material material to check
+ * @return whether or not this material can be equipped
+ */
+ public static boolean isEquipable(Material material) {
+ public static boolean isEquipable(@NotNull Material material) {
+ return getByMaterial(material) != null;
+ }
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 4196a2419eb0aef7c2d79bc5373c2fc3bd38c81e Mon Sep 17 00:00:00 2001
From f88c6e674e15899aa75a38b121eda2ee7e3f8cd2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 6 Nov 2017 21:10:01 -0500
Subject: [PATCH] API to get a BlockState without a snapshot
@ -9,11 +9,11 @@ on the real tile entity.
This is useful for where performance is needed
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 7664728a..064acf32 100644
index c88088c0f..708288e99 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -254,6 +254,15 @@ public interface Block extends Metadatable {
*/
@@ -269,6 +269,16 @@ public interface Block extends Metadatable {
@NotNull
BlockState getState();
+ // Paper start
@ -22,6 +22,7 @@ index 7664728a..064acf32 100644
+ * @param useSnapshot if this block is a TE, should we create a fully copy of the TileEntity
+ * @return BlockState with the current state of this block
+ */
+ @NotNull
+ BlockState getState(boolean useSnapshot);
+ // Paper end
+
@ -29,5 +30,5 @@ index 7664728a..064acf32 100644
* Returns the biome that this block resides in
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From e45cd02ad7224199d008068ce464d820e036130c Mon Sep 17 00:00:00 2001
From aaede4321cd33af05db4d80ad1e75d17782fd65b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:17:09 -0500
Subject: [PATCH] AsyncTabCompleteEvent
@ -13,10 +13,10 @@ completion, such as offline players.
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
new file mode 100644
index 00000000..3c51aaf9
index 000000000..619ed3716
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
@@ -0,0 +1,168 @@
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
@ -53,6 +53,8 @@ index 00000000..3c51aaf9
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Allows plugins to compute tab completion results asynchronously. If this event provides completions, then the standard synchronous process will not be fired to populate the results. However, the synchronous TabCompleteEvent will fire with the Async results.
@ -60,16 +62,17 @@ index 00000000..3c51aaf9
+ * Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
+ */
+public class AsyncTabCompleteEvent extends Event implements Cancellable {
+ private final CommandSender sender;
+ private final String buffer;
+ @NotNull private final CommandSender sender;
+ @NotNull private final String buffer;
+ private final boolean isCommand;
+ @Nullable
+ private final Location loc;
+ private List<String> completions;
+ @NotNull private List<String> completions;
+ private boolean cancelled;
+ private boolean handled = false;
+ private boolean fireSyncHandler = true;
+
+ public AsyncTabCompleteEvent(CommandSender sender, List<String> completions, String buffer, boolean isCommand, Location loc) {
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List<String> completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
+ super(true);
+ this.sender = sender;
+ this.completions = completions;
@ -83,6 +86,7 @@ index 00000000..3c51aaf9
+ *
+ * @return the {@link CommandSender} instance
+ */
+ @NotNull
+ public CommandSender getSender() {
+ return sender;
+ }
@ -97,6 +101,7 @@ index 00000000..3c51aaf9
+ *
+ * @return a list of offered completions
+ */
+ @NotNull
+ public List<String> getCompletions() {
+ return completions;
+ }
@ -111,7 +116,7 @@ index 00000000..3c51aaf9
+ *
+ * @param completions the new completions
+ */
+ public void setCompletions(List<String> completions) {
+ public void setCompletions(@NotNull List<String> completions) {
+ Validate.notNull(completions);
+ this.completions = new ArrayList<>(completions);
+ }
@ -121,6 +126,7 @@ index 00000000..3c51aaf9
+ *
+ * @return command buffer, as entered
+ */
+ @NotNull
+ public String getBuffer() {
+ return buffer;
+ }
@ -135,6 +141,7 @@ index 00000000..3c51aaf9
+ /**
+ * @return The position looked at by the sender, or null if none
+ */
+ @Nullable
+ public Location getLocation() {
+ return loc;
+ }
@ -177,16 +184,18 @@ index 00000000..3c51aaf9
+ this.cancelled = cancelled;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
index a6229839..f0bc3563 100644
index d1a9956a1..f96c4ba53 100644
--- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
+++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
@@ -1,5 +1,6 @@
@ -196,21 +205,29 @@ index a6229839..f0bc3563 100644
import java.util.List;
import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender;
@@ -28,6 +29,13 @@ public class TabCompleteEvent extends Event implements Cancellable {
@@ -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;
public TabCompleteEvent(CommandSender sender, String buffer, List<String> completions) {
public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions) {
+ // Paper start
+ this(sender, buffer, completions, sender instanceof org.bukkit.command.ConsoleCommandSender || buffer.startsWith("/"), null);
+ }
+ public TabCompleteEvent(CommandSender sender, String buffer, List<String> completions, boolean isCommand, org.bukkit.Location location) {
+ public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions, boolean isCommand, @Nullable org.bukkit.Location location) {
+ this.isCommand = isCommand;
+ this.loc = location;
+ // Paper end
Validate.notNull(sender, "sender");
Validate.notNull(buffer, "buffer");
Validate.notNull(completions, "completions");
@@ -65,14 +73,34 @@ public class TabCompleteEvent extends Event implements Cancellable {
@@ -69,14 +78,35 @@ public class TabCompleteEvent extends Event implements Cancellable {
return completions;
}
@ -227,6 +244,7 @@ index a6229839..f0bc3563 100644
+ /**
+ * @return The position looked at by the sender, or null if none
+ */
+ @Nullable
+ public org.bukkit.Location getLocation() {
+ return loc;
+ }
@ -239,7 +257,7 @@ index a6229839..f0bc3563 100644
+ *
* @param completions the new completions
*/
public void setCompletions(List<String> completions) {
public void setCompletions(@NotNull List<String> completions) {
Validate.notNull(completions);
- this.completions = completions;
+ this.completions = new ArrayList<>(completions); // Paper
@ -247,5 +265,5 @@ index a6229839..f0bc3563 100644
@Override
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 906da795cc0a27b10fcb9cea756bbc7b8556d9e4 Mon Sep 17 00:00:00 2001
From fdf1b7fd4ed6b12ec92df144e1961d3e5b198d61 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 9 Dec 2017 12:40:25 -0500
Subject: [PATCH] Display warning on deprecated recipe API
@ -10,29 +10,29 @@ on the players login.
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
index 90d6d50c..80af6cf5 100644
index 77e6ccf5..64a43f42 100644
--- a/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 {
@@ -26,6 +26,7 @@ public class ShapedRecipe implements Recipe, Keyed {
@Deprecated
public ShapedRecipe(ItemStack result) {
public ShapedRecipe(@NotNull ItemStack result) {
this.key = NamespacedKey.randomKey();
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace();
this.output = new ItemStack(result);
}
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index ea359c54..7347e746 100644
index a8d5f330..46a398e8 100644
--- a/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 {
@@ -27,6 +27,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
@Deprecated
public ShapelessRecipe(ItemStack result) {
public ShapelessRecipe(@NotNull ItemStack result) {
this.key = NamespacedKey.randomKey();
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace();
this.output = new ItemStack(result);
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 0b16ea6c94ad803083f1689c590e516a3d609ef4 Mon Sep 17 00:00:00 2001
From 0bd98a68ee81d13dcf28e6f6ef85eb63920b46f4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:00:41 -0500
Subject: [PATCH] PlayerPickupExperienceEvent
@ -7,10 +7,10 @@ Allows plugins to cancel a player picking up an experience orb
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java
new file mode 100644
index 00000000..f9ef95cd
index 000000000..f7beb22d5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPickupExperienceEvent.java
@@ -0,0 +1,76 @@
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
@ -42,14 +42,15 @@ index 00000000..f9ef95cd
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when a player is attempting to pick up an experience orb
+ */
+public class PlayerPickupExperienceEvent extends PlayerEvent implements Cancellable {
+ private final ExperienceOrb experienceOrb;
+ @NotNull private final ExperienceOrb experienceOrb;
+
+ public PlayerPickupExperienceEvent(Player player, ExperienceOrb experienceOrb) {
+ public PlayerPickupExperienceEvent(@NotNull Player player, @NotNull ExperienceOrb experienceOrb) {
+ super(player);
+ this.experienceOrb = experienceOrb;
+ }
@ -57,16 +58,19 @@ index 00000000..f9ef95cd
+ /**
+ * @return Returns the Orb that the player is picking up
+ */
+ @NotNull
+ public ExperienceOrb getExperienceOrb() {
+ return experienceOrb;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -88,5 +92,5 @@ index 00000000..f9ef95cd
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From f25f9e92ad692775de20a8953c170896bfb86cb4 Mon Sep 17 00:00:00 2001
From 014342436b9d0a522d4948efe3f699fef8b8cc15 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:56:24 -0500
Subject: [PATCH] ExperienceOrbMergeEvent
@ -9,10 +9,10 @@ metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java
new file mode 100644
index 00000000..fb5b4b86
index 000000000..0ce3e3977
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ExperienceOrbMergeEvent.java
@@ -0,0 +1,82 @@
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
@ -42,15 +42,16 @@ index 00000000..fb5b4b86
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired anytime the server is about to merge 2 experience orbs into one
+ */
+public class ExperienceOrbMergeEvent extends EntityEvent implements Cancellable {
+ private final ExperienceOrb mergeTarget;
+ private final ExperienceOrb mergeSource;
+ @NotNull private final ExperienceOrb mergeTarget;
+ @NotNull private final ExperienceOrb mergeSource;
+
+ public ExperienceOrbMergeEvent(ExperienceOrb mergeTarget, ExperienceOrb mergeSource) {
+ public ExperienceOrbMergeEvent(@NotNull ExperienceOrb mergeTarget, @NotNull ExperienceOrb mergeSource) {
+ super(mergeTarget);
+ this.mergeTarget = mergeTarget;
+ this.mergeSource = mergeSource;
@ -59,6 +60,7 @@ index 00000000..fb5b4b86
+ /**
+ * @return The orb that will absorb the other experience orb
+ */
+ @NotNull
+ public ExperienceOrb getMergeTarget() {
+ return mergeTarget;
+ }
@ -66,16 +68,19 @@ index 00000000..fb5b4b86
+ /**
+ * @return The orb that is subject to being removed and merged into the target orb
+ */
+ @NotNull
+ public ExperienceOrb getMergeSource() {
+ return mergeSource;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -96,5 +101,5 @@ index 00000000..fb5b4b86
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 7cf615732878ee88a9ae3c84136211222235cd03 Mon Sep 17 00:00:00 2001
From e86f55218e61959a7851efd9453a5785e1eaef93 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 17:38:07 -0500
Subject: [PATCH] Ability to apply mending to XP API
@ -10,10 +10,10 @@ of giving the player experience points.
Both an API To standalone mend, and apply mending logic to .giveExp has been added.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5e65657a..c273b9dc 100644
index 7be6778a..f19b8b99 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -938,12 +938,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -946,12 +946,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void resetPlayerWeather();
@ -49,5 +49,5 @@ index 5e65657a..c273b9dc 100644
/**
* Gives the player the amount of experience levels specified. Levels can
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 000a19b1709aa65092d49ea8a248d252b43f3390 Mon Sep 17 00:00:00 2001
From 35452d656b653b45dd767d53bae2d6c1e87a81d9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 16:59:43 -0500
Subject: [PATCH] PreCreatureSpawnEvent
@ -16,10 +16,10 @@ See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
new file mode 100644
index 00000000..bac1cef3
index 000000000..d5edde9cd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
@@ -0,0 +1,98 @@
@@ -0,0 +1,104 @@
+package com.destroystokyo.paper.event.entity;
+
+import com.google.common.base.Preconditions;
@ -29,6 +29,7 @@ index 00000000..bac1cef3
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * WARNING: This event only fires for a limited number of cases, and not for every case that CreatureSpawnEvent does.
@ -40,12 +41,12 @@ index 00000000..bac1cef3
+ * Also, Plugins that replace Entity Registrations with their own custom entities might not fire this event.
+ */
+public class PreCreatureSpawnEvent extends Event implements Cancellable {
+ private final Location location;
+ private final EntityType type;
+ private final CreatureSpawnEvent.SpawnReason reason;
+ @NotNull private final Location location;
+ @NotNull private final EntityType type;
+ @NotNull private final CreatureSpawnEvent.SpawnReason reason;
+ private boolean shouldAbortSpawn;
+
+ public PreCreatureSpawnEvent(Location location, EntityType type, CreatureSpawnEvent.SpawnReason reason) {
+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
+ this.location = Preconditions.checkNotNull(location, "Location may not be null").clone();
+ this.type = Preconditions.checkNotNull(type, "Type may not be null");
+ this.reason = Preconditions.checkNotNull(reason, "Reason may not be null");
@ -54,6 +55,7 @@ index 00000000..bac1cef3
+ /**
+ * @return The location this creature is being spawned at
+ */
+ @NotNull
+ public Location getSpawnLocation() {
+ return location;
+ }
@ -61,6 +63,7 @@ index 00000000..bac1cef3
+ /**
+ * @return The type of creature being spawned
+ */
+ @NotNull
+ public EntityType getType() {
+ return type;
+ }
@ -68,6 +71,7 @@ index 00000000..bac1cef3
+ /**
+ * @return Reason this creature is spawning (ie, NATURAL vs SPAWNER)
+ */
+ @NotNull
+ public CreatureSpawnEvent.SpawnReason getReason() {
+ return reason;
+ }
@ -91,10 +95,12 @@ index 00000000..bac1cef3
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -119,5 +125,5 @@ index 00000000..bac1cef3
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 32783783cd18b9019b4bb321c8b41df12e9bfebf Mon Sep 17 00:00:00 2001
From 1f5cbf18a8beea7d63e03e6c2fb786985f581f03 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:31:37 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
@ -10,10 +10,10 @@ Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
new file mode 100644
index 00000000..7c6953a7
index 000000000..112a0dbf5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
@@ -0,0 +1,61 @@
@@ -0,0 +1,64 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Player;
@ -21,6 +21,7 @@ index 00000000..7c6953a7
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when the server is calculating what chunks to try to spawn monsters in every Monster Spawn Tick event
@ -28,7 +29,7 @@ index 00000000..7c6953a7
+public class PlayerNaturallySpawnCreaturesEvent extends PlayerEvent implements Cancellable {
+ private byte radius;
+
+ public PlayerNaturallySpawnCreaturesEvent(Player player, byte radius) {
+ public PlayerNaturallySpawnCreaturesEvent(@NotNull Player player, byte radius) {
+ super(player);
+ this.radius = radius;
+ }
@ -49,10 +50,12 @@ index 00000000..7c6953a7
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -76,5 +79,5 @@ index 00000000..7c6953a7
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 6df1eea3118148d343e2ba943ed0e79e3272e981 Mon Sep 17 00:00:00 2001
From 907a0b84b6a2bfa31356bf1d72f7a8210be4e612 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 19 Jan 2018 00:29:28 -0500
Subject: [PATCH] Add setPlayerProfile API for Skulls
@ -7,28 +7,27 @@ This allows you to create already filled textures on Skulls to avoid texture loo
which commonly cause rate limit issues with Mojang API
diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java
index 499a153e..3c75341e 100644
index 6325f583..27675ecd 100644
--- a/src/main/java/org/bukkit/block/Skull.java
+++ b/src/main/java/org/bukkit/block/Skull.java
@@ -4,6 +4,8 @@ import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.SkullType;
import org.bukkit.block.data.BlockData;
+import com.destroystokyo.paper.profile.PlayerProfile;
+import javax.annotation.Nullable;
@@ -7,6 +7,7 @@ import org.bukkit.block.data.BlockData;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import com.destroystokyo.paper.profile.PlayerProfile; // Paper
/**
* Represents a captured state of a skull block.
@@ -55,6 +57,20 @@ public interface Skull extends BlockState {
@@ -61,6 +62,20 @@ public interface Skull extends BlockState {
*/
public void setOwningPlayer(OfflinePlayer player);
public void setOwningPlayer(@NotNull OfflinePlayer player);
+ // Paper start
+ /**
+ * Sets this skull to use the supplied Player Profile, which can include textures already prefilled.
+ * @param profile The profile to set this Skull to use, may not be null
+ */
+ void setPlayerProfile(PlayerProfile profile);
+ void setPlayerProfile(@NotNull PlayerProfile profile);
+
+ /**
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link PlayerProfile}
@ -41,23 +40,24 @@ index 499a153e..3c75341e 100644
* Gets the rotation of the skull in the world (or facing direction if this
* is a wall mounted skull).
diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
index 15c1dfd9..a458000f 100644
index 1583764b..43cdc4c6 100644
--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
@@ -1,7 +1,10 @@
@@ -1,9 +1,11 @@
package org.bukkit.inventory.meta;
+import com.destroystokyo.paper.profile.PlayerProfile;
+import javax.annotation.Nullable;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+
/**
* Represents a skull that can have an owner.
*/
@@ -36,6 +39,20 @@ public interface SkullMeta extends ItemMeta {
@@ -36,6 +38,20 @@ public interface SkullMeta extends ItemMeta {
@Deprecated
boolean setOwner(String owner);
boolean setOwner(@Nullable String owner);
+ // Paper start
+ /**
@ -77,5 +77,5 @@ index 15c1dfd9..a458000f 100644
* Gets the owner of the skull.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 18c2f27c07c4ae9d951ecf9a7685a0af1b6433fa Mon Sep 17 00:00:00 2001
From 53a81651f2f57c8d8b5a104b7d95a5c7287881f7 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 2 Jan 2018 00:31:08 -0500
Subject: [PATCH] Fill Profile Property Events
@ -12,10 +12,10 @@ This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
new file mode 100644
index 00000000..182bd661
index 000000000..71f36e9ca
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
@@ -0,0 +1,72 @@
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -46,16 +46,16 @@ index 00000000..182bd661
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import javax.annotation.Nonnull;
+import java.util.Set;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired once a profiles additional properties (such as textures) has been filled
+ */
+public class FillProfileEvent extends Event {
+ private final PlayerProfile profile;
+ @NotNull private final PlayerProfile profile;
+
+ public FillProfileEvent(@Nonnull PlayerProfile profile) {
+ public FillProfileEvent(@NotNull PlayerProfile profile) {
+ super(!org.bukkit.Bukkit.isPrimaryThread());
+ this.profile = profile;
+ }
@ -63,7 +63,7 @@ index 00000000..182bd661
+ /**
+ * @return The Profile that had properties filled
+ */
+ @Nonnull
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ }
@ -74,26 +74,29 @@ index 00000000..182bd661
+ * @see PlayerProfile#getProperties()
+ * @return The new properties on the profile.
+ */
+ @NotNull
+ public Set<ProfileProperty> getProperties() {
+ return profile.getProperties();
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
new file mode 100644
index 00000000..aba0c087
index 000000000..021bc8631
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
@@ -0,0 +1,74 @@
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -124,8 +127,8 @@ index 00000000..aba0c087
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import javax.annotation.Nonnull;
+import java.util.Collection;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when the server is requesting to fill in properties of an incomplete profile, such as textures.
@ -133,9 +136,9 @@ index 00000000..aba0c087
+ * Allows plugins to pre populate cached properties and avoid a call to the Mojang API
+ */
+public class PreFillProfileEvent extends Event {
+ private final PlayerProfile profile;
+ @NotNull private final PlayerProfile profile;
+
+ public PreFillProfileEvent(PlayerProfile profile) {
+ public PreFillProfileEvent(@NotNull PlayerProfile profile) {
+ super(!org.bukkit.Bukkit.isPrimaryThread());
+ this.profile = profile;
+ }
@ -143,6 +146,7 @@ index 00000000..aba0c087
+ /**
+ * @return The profile that needs its properties filled
+ */
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ }
@ -154,20 +158,22 @@ index 00000000..aba0c087
+ * @see PlayerProfile#setProperties(Collection)
+ * @param properties The properties to set/append
+ */
+ public void setProperties(@Nonnull Collection<ProfileProperty> properties) {
+ public void setProperties(@NotNull Collection<ProfileProperty> properties) {
+ profile.setProperties(properties);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 96c07697f9a38156b9d1cf552b0796f60ff807b4 Mon Sep 17 00:00:00 2001
From c53db31449879e3307930215473d83a9e14440f7 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 19 Jan 2018 08:15:14 -0600
Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
@ -6,10 +6,10 @@ Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
new file mode 100644
index 00000000..b65ee9e5
index 000000000..bb8d7c959
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
@@ -0,0 +1,58 @@
@@ -0,0 +1,63 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.advancement.Advancement;
@ -17,17 +17,18 @@ index 00000000..b65ee9e5
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player is granted a criteria in an advancement.
+ */
+public class PlayerAdvancementCriterionGrantEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Advancement advancement;
+ private final String criterion;
+ @NotNull private final Advancement advancement;
+ @NotNull private final String criterion;
+ private boolean cancel = false;
+
+ public PlayerAdvancementCriterionGrantEvent(Player who, Advancement advancement, String criterion) {
+ public PlayerAdvancementCriterionGrantEvent(@NotNull Player who, @NotNull Advancement advancement, @NotNull String criterion) {
+ super(who);
+ this.advancement = advancement;
+ this.criterion = criterion;
@ -38,6 +39,7 @@ index 00000000..b65ee9e5
+ *
+ * @return affected advancement
+ */
+ @NotNull
+ public Advancement getAdvancement() {
+ return advancement;
+ }
@ -47,6 +49,7 @@ index 00000000..b65ee9e5
+ *
+ * @return granted criterion
+ */
+ @NotNull
+ public String getCriterion() {
+ return criterion;
+ }
@ -59,15 +62,17 @@ index 00000000..b65ee9e5
+ this.cancel = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 05f491b4b41e5682ea37eec688ab9f37d0a4d4e3 Mon Sep 17 00:00:00 2001
From 881a02abeb1dd87d2aa9ac12483907e236dbeab9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 18 Jan 2018 01:00:27 -0500
Subject: [PATCH] Optimize Hoppers
@ -7,21 +7,21 @@ Adds data about what Item related methods were used in InventoryMoveItem 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
index 06ec99ae..b44cc45b 100644
index 2bb57d23..f0a16d3c 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
@@ -30,6 +30,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
@@ -31,6 +31,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
private final Inventory destinationInventory;
private ItemStack itemStack;
private final boolean didSourceInitiate;
+ public boolean calledGetItem; // Paper
+ public boolean calledSetItem; // Paper
public InventoryMoveItemEvent(final Inventory sourceInventory, final ItemStack itemStack, 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");
@@ -55,7 +57,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
* @return ItemStack
@@ -58,7 +60,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
*/
@NotNull
public ItemStack getItem() {
- return itemStack.clone();
+ calledGetItem = true; // Paper - record this method was used for auto detection of mode
@ -29,14 +29,14 @@ index 06ec99ae..b44cc45b 100644
}
/**
@@ -67,6 +70,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
@@ -70,6 +73,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
*/
public void setItem(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.");
+ calledSetItem = true; // Paper - record this method was used for auto detection of mode
this.itemStack = itemStack.clone();
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 1cbb7e853c6b79fe56bb48056ef19cbf83e4a85f Mon Sep 17 00:00:00 2001
From ec25fb2dc8987362a3aa99baf07baa8fd2a79ba9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 24 Feb 2018 00:55:52 -0500
Subject: [PATCH] Tameable#getOwnerUniqueId API
@ -7,10 +7,17 @@ This is faster if all you need is the UUID, as .getOwner() will cause
an OfflinePlayer to be loaded from disk.
diff --git a/src/main/java/org/bukkit/entity/Tameable.java b/src/main/java/org/bukkit/entity/Tameable.java
index 44497aa3..0987c1e8 100644
index 0c066bdfc..be436f8df 100644
--- a/src/main/java/org/bukkit/entity/Tameable.java
+++ b/src/main/java/org/bukkit/entity/Tameable.java
@@ -23,9 +23,21 @@ public interface Tameable extends Entity {
@@ -1,5 +1,6 @@
package org.bukkit.entity;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface Tameable extends Entity {
@@ -25,9 +26,22 @@ public interface Tameable extends Entity {
*/
public void setTamed(boolean tame);
@ -20,6 +27,7 @@ index 44497aa3..0987c1e8 100644
+ *
+ * @return the owners UUID, or null if not owned
+ */
+ @NotNull
+ public java.util.UUID getOwnerUniqueId();
+ // Paper end
+
@ -31,7 +39,7 @@ index 44497aa3..0987c1e8 100644
+ *
* @return the owning AnimalTamer, or null if not owned
*/
public AnimalTamer getOwner();
@Nullable
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 596ebbbd59baec68f0614f1e3d91e04dd5125562 Mon Sep 17 00:00:00 2001
From fce0f6f5b837d223e55e3a0fd3a4420fc8a4d146 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 11:43:30 -0400
Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index 1d571889..0c16128e 100644
index a0909736..6c09ea6c 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -3,6 +3,8 @@ package org.bukkit.event.player;
@ -17,11 +17,11 @@ index 1d571889..0c16128e 100644
+import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -25,7 +27,31 @@ public class AsyncPlayerPreLoginEvent extends Event {
import org.jetbrains.annotations.NotNull;
@@ -26,7 +28,32 @@ public class AsyncPlayerPreLoginEvent extends Event {
}
public AsyncPlayerPreLoginEvent(final String name, final InetAddress ipAddress, final UUID uniqueId) {
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
+ // Paper start
+ this(name, ipAddress, uniqueId, Bukkit.createProfile(uniqueId, name));
+ }
@ -31,6 +31,7 @@ index 1d571889..0c16128e 100644
+ * Gets the PlayerProfile of the player logging in
+ * @return The Profile
+ */
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ }
@ -39,11 +40,11 @@ index 1d571889..0c16128e 100644
+ * Changes the PlayerProfile the player will login as
+ * @param profile The profile to use
+ */
+ public void setPlayerProfile(PlayerProfile profile) {
+ public void setPlayerProfile(@NotNull PlayerProfile profile) {
+ this.profile = profile;
+ }
+
+ public AsyncPlayerPreLoginEvent(final String name, final InetAddress ipAddress, final UUID uniqueId, PlayerProfile profile) {
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
super(true);
+ this.profile = profile;
+ // Paper end
@ -51,5 +52,5 @@ index 1d571889..0c16128e 100644
this.message = "";
this.name = name;
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 62f34963ecb11533fab2828dfd058a95235bdb67 Mon Sep 17 00:00:00 2001
From 0b00d6b950008cb1c68ae0758344a9e270ae766a Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:55:38 +0200
Subject: [PATCH] Add extended PaperServerListPingEvent
@ -8,10 +8,10 @@ and allows full control of the response sent to the client.
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
new file mode 100644
index 00000000..b2a8476c
index 000000000..0cc5dd573
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
@@ -0,0 +1,320 @@
@@ -0,0 +1,323 @@
+package com.destroystokyo.paper.event.server;
+
+import static java.util.Objects.requireNonNull;
@ -30,8 +30,8 @@ index 00000000..b2a8476c
+import java.util.NoSuchElementException;
+import java.util.UUID;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Extended version of {@link ServerListPingEvent} that allows full control
@ -39,13 +39,13 @@ index 00000000..b2a8476c
+ */
+public class PaperServerListPingEvent extends ServerListPingEvent implements Cancellable {
+
+ @Nonnull private final StatusClient client;
+ @NotNull private final StatusClient client;
+
+ private int numPlayers;
+ private boolean hidePlayers;
+ @Nonnull private final List<PlayerProfile> playerSample = new ArrayList<>();
+ @NotNull private final List<PlayerProfile> playerSample = new ArrayList<>();
+
+ @Nonnull private String version;
+ @NotNull private String version;
+ private int protocolVersion;
+
+ @Nullable private CachedServerIcon favicon;
@ -55,8 +55,8 @@ index 00000000..b2a8476c
+ private boolean originalPlayerCount = true;
+ private Object[] players;
+
+ public PaperServerListPingEvent(@Nonnull StatusClient client, String motd, int numPlayers, int maxPlayers,
+ @Nonnull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers,
+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
+ super(client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
+ this.client = client;
+ this.numPlayers = numPlayers;
@ -70,7 +70,7 @@ index 00000000..b2a8476c
+ *
+ * @return The client
+ */
+ @Nonnull
+ @NotNull
+ public StatusClient getClient() {
+ return this.client;
+ }
@ -157,7 +157,7 @@ index 00000000..b2a8476c
+ *
+ * @return The mutable player sample list
+ */
+ @Nonnull
+ @NotNull
+ public List<PlayerProfile> getPlayerSample() {
+ return this.playerSample;
+ }
@ -167,7 +167,7 @@ index 00000000..b2a8476c
+ *
+ * @return The server version
+ */
+ @Nonnull
+ @NotNull
+ public String getVersion() {
+ return version;
+ }
@ -177,7 +177,7 @@ index 00000000..b2a8476c
+ *
+ * @param version The server version
+ */
+ public void setVersion(@Nonnull String version) {
+ public void setVersion(@NotNull String version) {
+ this.version = requireNonNull(version, "version");
+ }
+
@ -263,7 +263,7 @@ index 00000000..b2a8476c
+ * the removed player (based on their {@link UUID}).</li>
+ * </ul>
+ */
+ @Nonnull
+ @NotNull
+ @Override
+ public Iterator<Player> iterator() {
+ if (this.players == null) {
@ -273,11 +273,13 @@ index 00000000..b2a8476c
+ return new PlayerIterator();
+ }
+
+ @NotNull
+ protected Object[] getOnlinePlayers() {
+ return Bukkit.getOnlinePlayers().toArray();
+ }
+
+ protected Player getBukkitPlayer(Object player) {
+ @NotNull
+ protected Player getBukkitPlayer(@NotNull Object player) {
+ return (Player) player;
+ }
+
@ -298,6 +300,7 @@ index 00000000..b2a8476c
+ return false;
+ }
+
+ @NotNull
+ @Override
+ public Player next() {
+ if (!hasNext()) {
@ -334,7 +337,7 @@ index 00000000..b2a8476c
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
new file mode 100644
index 00000000..517d1523
index 000000000..517d15238
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
@@ -0,0 +1,13 @@
@ -352,14 +355,13 @@ index 00000000..517d1523
+
+}
diff --git a/src/main/java/org/bukkit/util/CachedServerIcon.java b/src/main/java/org/bukkit/util/CachedServerIcon.java
index 04804706..44563482 100644
index 612958a33..bb4f7702c 100644
--- a/src/main/java/org/bukkit/util/CachedServerIcon.java
+++ b/src/main/java/org/bukkit/util/CachedServerIcon.java
@@ -14,4 +14,10 @@ import org.bukkit.event.server.ServerListPingEvent;
*/
public interface CachedServerIcon {
public String getData(); // Spigot
+
@@ -18,4 +18,9 @@ public interface CachedServerIcon {
@Nullable
public String getData(); // Paper
+ // Paper start
+ default boolean isEmpty() {
+ return getData() == null;
@ -367,5 +369,5 @@ index 04804706..44563482 100644
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From efed9414eb7c7ae2509d89bb10a338a0a49347ce Mon Sep 17 00:00:00 2001
From cf924a9f32433bc44b212dcf3315d73869bbd45b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 12:28:55 -0400
Subject: [PATCH] Player.setPlayerProfile API
@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c273b9dc..5dc04f47 100644
index c7bc13e7d..06154a5c5 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3,6 +3,7 @@ package org.bukkit.entity;
@ -15,9 +15,9 @@ index c273b9dc..5dc04f47 100644
import com.destroystokyo.paper.Title;
+import com.destroystokyo.paper.profile.PlayerProfile;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@@ -1732,6 +1733,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
import org.bukkit.GameMode;
@@ -1746,6 +1747,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}
*/
boolean hasResourcePack();
@ -26,6 +26,7 @@ index c273b9dc..5dc04f47 100644
+ * Gets a copy of this players profile
+ * @return The players profile object
+ */
+ @NotNull
+ PlayerProfile getPlayerProfile();
+
+ /**
@ -33,10 +34,10 @@ index c273b9dc..5dc04f47 100644
+ * to be reregistered to all clients that can currently see this player
+ * @param profile The new profile to use
+ */
+ void setPlayerProfile(PlayerProfile profile);
+ void setPlayerProfile(@NotNull PlayerProfile profile);
// Paper end
// Spigot start
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From e5672f4f22bb0f9012699159f3ea469d020439be Mon Sep 17 00:00:00 2001
From 5a99ab919ced0b8030d9ffd958fc14ebace28152 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 22 Mar 2018 01:39:28 -0400
Subject: [PATCH] getPlayerUniqueId API
@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 75634a8d..cbabd807 100644
index 16fa78b86..19fb0e5d2 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -435,6 +435,20 @@ public final class Bukkit {
@@ -451,6 +451,20 @@ public final class Bukkit {
return server.getPlayer(id);
}
@ -25,7 +25,7 @@ index 75634a8d..cbabd807 100644
+ * @return A UUID, or null if that player name is not registered with Minecraft and the server is in online mode
+ */
+ @Nullable
+ public static UUID getPlayerUniqueId(String playerName) {
+ public static UUID getPlayerUniqueId(@NotNull String playerName) {
+ return server.getPlayerUniqueId(playerName);
+ }
+ // Paper end
@ -34,12 +34,12 @@ index 75634a8d..cbabd807 100644
* Gets the plugin manager for interfacing with plugins.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1d1f7784..9c5049cd 100644
index edbfa3fdc..1df58f72a 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -365,6 +365,18 @@ public interface Server extends PluginMessageRecipient {
*/
public Player getPlayer(UUID id);
@@ -380,6 +380,18 @@ public interface Server extends PluginMessageRecipient {
@Nullable
public Player getPlayer(@NotNull UUID id);
+ // Paper start
+ /**
@ -50,12 +50,12 @@ index 1d1f7784..9c5049cd 100644
+ * @return A UUID, or null if that player name is not registered with Minecraft and the server is in online mode
+ */
+ @Nullable
+ public UUID getPlayerUniqueId(String playerName);
+ public UUID getPlayerUniqueId(@NotNull String playerName);
+ // Paper end
+
/**
* Gets the plugin manager for interfacing with plugins.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,17 +1,17 @@
From 30c6337b2360b9771076eecc17f04d913e8b9267 Mon Sep 17 00:00:00 2001
From 43e7d691ff499a8af5b95c032e5149ab518da36d Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Sun, 1 Apr 2018 02:28:43 +0300
Subject: [PATCH] Add method to open already placed sign
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 040562eb..b5ed8447 100644
index 037e23930..04f0e08fd 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -442,4 +442,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@@ -465,4 +465,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
@Deprecated
public void setShoulderEntityRight(Entity entity);
public void setShoulderEntityRight(@Nullable Entity entity);
+
+ // Paper start - Add method to open already placed sign
+ /**
@ -19,9 +19,9 @@ index 040562eb..b5ed8447 100644
+ *
+ * @param sign The sign to open
+ */
+ void openSign(org.bukkit.block.Sign sign);
+ void openSign(@NotNull org.bukkit.block.Sign sign);
+ // Paper end
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 0a63d922250d7a43024aab5ea89b511396cde43a Mon Sep 17 00:00:00 2001
From 37e05486e349c20d73a9a695c8ddb4f4f2933425 Mon Sep 17 00:00:00 2001
From: Kyle Wood <demonwav@gmail.com>
Date: Thu, 1 Mar 2018 19:37:52 -0600
Subject: [PATCH] Add version history to version command
@ -6,10 +6,10 @@ Subject: [PATCH] Add version history to version command
diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
new file mode 100644
index 00000000..1daaca2f
index 000000000..648b247ef
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
@@ -0,0 +1,143 @@
@@ -0,0 +1,144 @@
+package com.destroystokyo.paper;
+
+import com.google.common.base.MoreObjects;
@ -26,8 +26,9 @@ index 00000000..1daaca2f
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.annotation.Nullable;
+import org.bukkit.Bukkit;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public enum VersionHistoryManager {
+ INSTANCE;
@ -84,7 +85,7 @@ index 00000000..1daaca2f
+ }
+ }
+
+ private void writeFile(final Path path) {
+ private void writeFile(@NotNull final Path path) {
+ try (final BufferedWriter writer = Files.newBufferedWriter(
+ path,
+ StandardCharsets.UTF_8,
@ -103,7 +104,7 @@ index 00000000..1daaca2f
+ return currentData;
+ }
+
+ public class VersionData {
+ public static class VersionData {
+ private String oldVersion;
+
+ private String currentVersion;
@ -135,7 +136,7 @@ index 00000000..1daaca2f
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ public boolean equals(@Nullable Object o) {
+ if (this == o) {
+ return true;
+ }
@ -154,10 +155,10 @@ index 00000000..1daaca2f
+ }
+}
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index f38f6864..5cebb245 100644
index 8e57aa911..746cedd87 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -29,6 +29,7 @@ import org.json.simple.parser.ParseException;
@@ -31,6 +31,7 @@ import org.json.simple.parser.ParseException;
// Paper start
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
@ -165,7 +166,7 @@ index f38f6864..5cebb245 100644
// Paper end
public class VersionCommand extends BukkitCommand {
@@ -47,6 +48,7 @@ public class VersionCommand extends BukkitCommand {
@@ -49,6 +50,7 @@ public class VersionCommand extends BukkitCommand {
if (args.length == 0) {
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
@ -173,7 +174,7 @@ index f38f6864..5cebb245 100644
sendVersion(sender);
} else {
StringBuilder name = new StringBuilder();
@@ -83,6 +85,22 @@ public class VersionCommand extends BukkitCommand {
@@ -85,6 +87,22 @@ public class VersionCommand extends BukkitCommand {
return true;
}
@ -193,9 +194,9 @@ index f38f6864..5cebb245 100644
+ }
+ // Paper end
+
private void describeToSender(Plugin plugin, CommandSender sender) {
private void describeToSender(@NotNull Plugin plugin, @NotNull CommandSender sender) {
PluginDescriptionFile desc = plugin.getDescription();
sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From b2247dff46727c6576f4943354996ff552e21791 Mon Sep 17 00:00:00 2001
From 86cd792a0e247654f4bfc56f712a1b2ea4a05ae6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Apr 2018 10:28:50 -0400
Subject: [PATCH] Add Ban Methods to Player Objects
@ -8,10 +8,10 @@ Allows a more logical API for banning players.
player.banPlayer("Breaking the rules");
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index d8279071..658eac26 100644
index cf8a2cb8a..919d1b66a 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -39,6 +39,56 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@@ -43,6 +43,61 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return true if banned, otherwise false
*/
public boolean isBanned();
@ -23,7 +23,8 @@ index d8279071..658eac26 100644
+ * @param reason Reason for Ban
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayer(String reason) {
+ @NotNull
+ public default BanEntry banPlayer(@Nullable String reason) {
+ return banPlayer(reason, null, null);
+ }
+
@ -33,7 +34,8 @@ index d8279071..658eac26 100644
+ * @param source Source of the ban, or null for default
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayer(String reason, String source) {
+ @NotNull
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) {
+ return banPlayer(reason, null, source);
+ }
+
@ -43,7 +45,8 @@ index d8279071..658eac26 100644
+ * @param expires When to expire the ban
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayer(String reason, java.util.Date expires) {
+ @NotNull
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) {
+ return banPlayer(reason, expires, null);
+ }
+
@ -54,10 +57,12 @@ index d8279071..658eac26 100644
+ * @param source Source of the ban or null for default
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayer(String reason, java.util.Date expires, String source) {
+ @NotNull
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
+ return banPlayer(reason, expires, source, true);
+ }
+ public default BanEntry banPlayer(String reason, java.util.Date expires, String source, boolean kickIfOnline) {
+ @NotNull
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) {
+ BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source);
+ if (kickIfOnline && isOnline()) {
+ getPlayer().kickPlayer(reason);
@ -69,10 +74,10 @@ index d8279071..658eac26 100644
/**
* Checks if this player is whitelisted or not
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5dc04f47..ddf226a4 100644
index 06154a5c5..a840b49d4 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1,10 +1,14 @@
@@ -1,10 +1,15 @@
package org.bukkit.entity;
import java.net.InetSocketAddress;
@ -84,11 +89,12 @@ index 5dc04f47..ddf226a4 100644
+import org.bukkit.BanEntry;
+import org.bukkit.BanList;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
+import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
@@ -417,6 +421,139 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(MapView map);
import org.bukkit.Instrument;
@@ -424,6 +429,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(@NotNull MapView map);
// Paper start
+ /**
@ -97,7 +103,9 @@ index 5dc04f47..ddf226a4 100644
+ * @param reason Reason for ban
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerFull(String reason) {
+ // For reference, Bukkit defines this as nullable, while they impl isn't, we'll follow API.
+ @Nullable
+ public default BanEntry banPlayerFull(@Nullable String reason) {
+ return banPlayerFull(reason, null, null);
+ }
+
@ -108,7 +116,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param source Source of ban, or null for default
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerFull(String reason, String source) {
+ @Nullable
+ public default BanEntry banPlayerFull(@Nullable String reason, @Nullable String source) {
+ return banPlayerFull(reason, null, source);
+ }
+
@ -119,7 +128,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param expires When to expire the ban
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerFull(String reason, Date expires) {
+ @Nullable
+ public default BanEntry banPlayerFull(@Nullable String reason, @Nullable Date expires) {
+ return banPlayerFull(reason, expires, null);
+ }
+
@ -131,7 +141,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param source Source of the ban, or null for default
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerFull(String reason, Date expires, String source) {
+ @Nullable
+ public default BanEntry banPlayerFull(@Nullable String reason, @Nullable Date expires, @Nullable String source) {
+ banPlayer(reason, expires, source);
+ return banPlayerIP(reason, expires, source, true);
+ }
@ -144,7 +155,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param kickPlayer Whether or not to kick the player afterwards
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason, boolean kickPlayer) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, boolean kickPlayer) {
+ return banPlayerIP(reason, null, null, kickPlayer);
+ }
+
@ -156,7 +168,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param kickPlayer Whether or not to kick the player afterwards
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason, String source, boolean kickPlayer) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable String source, boolean kickPlayer) {
+ return banPlayerIP(reason, null, source, kickPlayer);
+ }
+
@ -168,7 +181,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param kickPlayer Whether or not to kick the player afterwards
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason, Date expires, boolean kickPlayer) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable Date expires, boolean kickPlayer) {
+ return banPlayerIP(reason, expires, null, kickPlayer);
+ }
+
@ -179,7 +193,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param reason Reason for ban
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason) {
+ return banPlayerIP(reason, null, null);
+ }
+
@ -190,7 +205,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param source Source of ban, or null for default
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason, String source) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable String source) {
+ return banPlayerIP(reason, null, source);
+ }
+
@ -201,7 +217,8 @@ index 5dc04f47..ddf226a4 100644
+ * @param expires When to expire the ban
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason, Date expires) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable Date expires) {
+ return banPlayerIP(reason, expires, null);
+ }
+
@ -213,10 +230,22 @@ index 5dc04f47..ddf226a4 100644
+ * @param source Source of the banm or null for default
+ * @return Ban Entry
+ */
+ public default BanEntry banPlayerIP(String reason, Date expires, String source) {
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable Date expires, @Nullable String source) {
+ return banPlayerIP(reason, expires, source, true);
+ }
+ public default BanEntry banPlayerIP(String reason, Date expires, String source, boolean kickPlayer) {
+
+ /**
+ * Bans the IP address currently used by the player.
+ * Does not ban the Profile, use {@link #banPlayerFull(String, Date, String)}
+ * @param reason Reason for Ban
+ * @param expires When to expire the ban
+ * @param source Source of the banm or null for default
+ * @param kickPlayer if the targeted player should be kicked
+ * @return Ban Entry
+ */
+ @Nullable
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer) {
+ BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.IP).addBan(getAddress().getAddress().getHostAddress(), reason, expires, source);
+ if (kickPlayer && isOnline()) {
+ getPlayer().kickPlayer(reason);
@ -228,5 +257,5 @@ index 5dc04f47..ddf226a4 100644
/**
* Sends an Action Bar message to the client.
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 66cc32083b1330586dff52b36c17828d0ed2d6e7 Mon Sep 17 00:00:00 2001
From 839ae04d99c14516adbd82e7bc0c0d56c05e8795 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 13:14:30 -0400
Subject: [PATCH] EndermanEscapeEvent
@ -9,10 +9,10 @@ You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
new file mode 100644
index 00000000..0d15a8ab
index 000000000..806112a8b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
@@ -0,0 +1,82 @@
@@ -0,0 +1,87 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Enderman;
@ -21,15 +21,17 @@ index 00000000..0d15a8ab
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
+ private final Reason reason;
+ @NotNull private final Reason reason;
+
+ public EndermanEscapeEvent(Enderman entity, Reason reason) {
+ public EndermanEscapeEvent(@NotNull Enderman entity, @NotNull Reason reason) {
+ super(entity);
+ this.reason = reason;
+ }
+
+ @NotNull
+ @Override
+ public Enderman getEntity() {
+ return (Enderman) super.getEntity();
@ -38,16 +40,19 @@ index 00000000..0d15a8ab
+ /**
+ * @return The reason the enderman is trying to escape
+ */
+ @NotNull
+ public Reason getReason() {
+ return reason;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -96,5 +101,5 @@ index 00000000..0d15a8ab
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 1020cf1bb231062418dfebbf41aff92e762a470e Mon Sep 17 00:00:00 2001
From 9bf60b25592269e84c14ab957c0274f625587ce2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 13:29:15 -0400
Subject: [PATCH] Enderman.teleportRandomly()
@ -6,10 +6,10 @@ Subject: [PATCH] Enderman.teleportRandomly()
Ability to trigger the vanilla "teleport randomly" mechanic of an enderman.
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
index edb49a20..1ea289b5 100644
index bb325d9c..821c690f 100644
--- a/src/main/java/org/bukkit/entity/Enderman.java
+++ b/src/main/java/org/bukkit/entity/Enderman.java
@@ -8,6 +8,17 @@ import org.bukkit.material.MaterialData;
@@ -10,6 +10,17 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Enderman extends Monster {
@ -28,5 +28,5 @@ index edb49a20..1ea289b5 100644
* Gets the id and data of the block that the Enderman is carrying.
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From fd36072a3ce6839ef977bedd24f3b459a0933f3d Mon Sep 17 00:00:00 2001
From 7a42ac94e33e48aa35d35f1457c6cdca12edb8c9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 17:55:28 -0400
Subject: [PATCH] Additional world.getNearbyEntities API's
@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's
Provides more methods to get nearby entities, and filter by types and predicates
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index d499e41b..bc6a51d7 100644
index 84abeb216..0dcdbb59a 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2,6 +2,8 @@ package org.bukkit;
@ -18,9 +18,9 @@ index d499e41b..bc6a51d7 100644
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -483,6 +485,238 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Collection<Entity> getEntitiesByClasses(Class<?>... classes);
@@ -507,6 +509,256 @@ public interface World extends PluginMessageRecipient, Metadatable {
@NotNull
public Collection<Entity> getEntitiesByClasses(@NotNull Class<?>... classes);
+ // Paper start
+ /**
@ -29,7 +29,8 @@ index d499e41b..bc6a51d7 100644
+ * @param radius Radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double radius) {
+ @NotNull
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius);
+ }
+
@ -40,7 +41,8 @@ index d499e41b..bc6a51d7 100644
+ * @param yRadius Y Radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xzRadius, double yRadius) {
+ @NotNull
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius);
+ }
+
@ -52,7 +54,8 @@ index d499e41b..bc6a51d7 100644
+ * @param zRadius Z radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xRadius, double yRadius, double zRadius) {
+ @NotNull
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius);
+ }
+
@ -63,7 +66,8 @@ index d499e41b..bc6a51d7 100644
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double radius, Predicate<LivingEntity> predicate) {
+ @NotNull
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double radius, @Nullable Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius, predicate);
+ }
+
@ -75,7 +79,8 @@ index d499e41b..bc6a51d7 100644
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xzRadius, double yRadius, Predicate<LivingEntity> predicate) {
+ @NotNull
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate);
+ }
+
@ -88,7 +93,8 @@ index d499e41b..bc6a51d7 100644
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xRadius, double yRadius, double zRadius, Predicate<LivingEntity> predicate) {
+ @NotNull
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate);
+ }
+
@ -98,7 +104,8 @@ index d499e41b..bc6a51d7 100644
+ * @param radius X/Y/Z Radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double radius) {
+ @NotNull
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius);
+ }
+
@ -109,7 +116,8 @@ index d499e41b..bc6a51d7 100644
+ * @param yRadius Y Radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xzRadius, double yRadius) {
+ @NotNull
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius);
+ }
+
@ -121,7 +129,8 @@ index d499e41b..bc6a51d7 100644
+ * @param zRadius Z Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xRadius, double yRadius, double zRadius) {
+ @NotNull
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius);
+ }
+
@ -132,7 +141,8 @@ index d499e41b..bc6a51d7 100644
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double radius, Predicate<Player> predicate) {
+ @NotNull
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double radius, @Nullable Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius, predicate);
+ }
+
@ -144,7 +154,8 @@ index d499e41b..bc6a51d7 100644
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xzRadius, double yRadius, Predicate<Player> predicate) {
+ @NotNull
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius, predicate);
+ }
+
@ -157,7 +168,8 @@ index d499e41b..bc6a51d7 100644
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xRadius, double yRadius, double zRadius, Predicate<Player> predicate) {
+ @NotNull
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius, predicate);
+ }
+
@ -169,7 +181,8 @@ index d499e41b..bc6a51d7 100644
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double radius) {
+ @NotNull
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double radius) {
+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null);
+ }
+
@ -182,7 +195,8 @@ index d499e41b..bc6a51d7 100644
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double xzRadius, double yRadius) {
+ @NotNull
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null);
+ }
+
@ -196,7 +210,8 @@ index d499e41b..bc6a51d7 100644
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double xRadius, double yRadius, double zRadius) {
+ @NotNull
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null);
+ }
+
@ -209,7 +224,8 @@ index d499e41b..bc6a51d7 100644
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double radius, Predicate<T> predicate) {
+ @NotNull
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double radius, @Nullable Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate);
+ }
+
@ -223,7 +239,8 @@ index d499e41b..bc6a51d7 100644
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double xzRadius, double yRadius, Predicate<T> predicate) {
+ @NotNull
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate);
+ }
+
@ -238,7 +255,8 @@ index d499e41b..bc6a51d7 100644
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends Entity> clazz, Location loc, double xRadius, double yRadius, double zRadius, Predicate<T> predicate) {
+ @NotNull
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate) {
+ if (clazz == null) {
+ clazz = Entity.class;
+ }
@ -258,5 +276,5 @@ index d499e41b..bc6a51d7 100644
* Get a list of all players in this World
*
--
2.20.1
2.21.0

Datei anzeigen

@ -1,14 +1,14 @@
From 2b2f63ce1bf3c15f8688b6fb80eed9a83b292114 Mon Sep 17 00:00:00 2001
From d6c9115f6181f8d5f7a3e9e9633726599d1b384e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 19:27:31 -0400
Subject: [PATCH] Location.isChunkLoaded() API
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 5c3d42cc..1ddebf3c 100644
index 6cffda15..a2dfad2f 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -491,6 +491,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
@@ -506,6 +506,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
return this;
}
@ -17,5 +17,5 @@ index 5c3d42cc..1ddebf3c 100644
public boolean equals(Object obj) {
if (obj == null) {
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From c367daf8d4c29ed21bd88d582dc21bd9abc1c4a7 Mon Sep 17 00:00:00 2001
From eaaaf19013f78b47c4cf32a9dec4ac0e5c5a5c61 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 29 Aug 2017 23:58:48 -0400
Subject: [PATCH] Expand World.spawnParticle API and add Builder
@ -10,10 +10,10 @@ This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
new file mode 100644
index 00000000..50b52d6b
index 000000000..06f1602f5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
@@ -0,0 +1,416 @@
@@ -0,0 +1,478 @@
+package com.destroystokyo.paper;
+
+import com.google.common.collect.Lists;
@ -24,9 +24,10 @@ index 00000000..50b52d6b
+import org.bukkit.entity.Player;
+import org.bukkit.util.NumberConversions;
+
+import javax.annotation.Nullable;
+import java.util.Collection;
+import java.util.List;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Helps prepare a particle to be sent to players.
@ -34,6 +35,7 @@ index 00000000..50b52d6b
+ * Usage of the builder is preferred over the super long {@link World#spawnParticle(Particle, Location, int, double, double, double, double, Object)} API
+ */
+public class ParticleBuilder {
+
+ private Particle particle;
+ private List<Player> receivers;
+ private Player source;
@ -44,16 +46,17 @@ index 00000000..50b52d6b
+ private Object data;
+ private boolean force = true;
+
+ public ParticleBuilder(Particle particle) {
+ public ParticleBuilder(@NotNull Particle particle) {
+ this.particle = particle;
+ }
+
+ /**
+ * Sends the particle to all receiving players (or all).
+ * This method is safe to use Asynchronously
+ * Sends the particle to all receiving players (or all). This method is safe to use
+ * Asynchronously
+ *
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder spawn() {
+ if (this.location == null) {
+ throw new IllegalStateException("Please specify location for this particle");
@ -68,16 +71,19 @@ index 00000000..50b52d6b
+ /**
+ * @return The particle going to be sent
+ */
+ @NotNull
+ public Particle particle() {
+ return particle;
+ }
+
+ /**
+ * Changes what particle will be sent
+ *
+ * @param particle The particle
+ * @return a reference to this object.
+ */
+ public ParticleBuilder particle(Particle particle) {
+ @NotNull
+ public ParticleBuilder particle(@NotNull Particle particle) {
+ this.particle = particle;
+ return this;
+ }
@ -93,31 +99,35 @@ index 00000000..50b52d6b
+ /**
+ * Example use:
+ *
+ * builder.receivers(16);
+ * if (builder.hasReceivers()) {
+ * sendParticleAsync(builder);
+ * }
+ * builder.receivers(16); if (builder.hasReceivers()) { sendParticleAsync(builder); }
+ *
+ * @return If this particle is going to be sent to someone
+ */
+ public boolean hasReceivers() {
+ return (receivers == null && !location.getWorld().getPlayers().isEmpty()) || (receivers != null && !receivers.isEmpty());
+ return (receivers == null && !location.getWorld().getPlayers().isEmpty()) || (
+ receivers != null && !receivers.isEmpty());
+ }
+
+ /**
+ * Sends this particle to all players in the world. This is rather silly and you should likely not be doing this.
+ * Sends this particle to all players in the world. This is rather silly and you should likely not
+ * be doing this.
+ *
+ * Just be a logical person and use receivers by radius or collection.
+ *
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder allPlayers() {
+ this.receivers = null;
+ return this;
+ this.receivers = null;
+ return this;
+ }
+
+ /**
+ * @param receivers List of players to receive this particle, or null for all players in the world
+ * @param receivers List of players to receive this particle, or null for all players in the
+ * world
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(@Nullable List<Player> receivers) {
+ // Had to keep this as we first made API List<> and not Collection, but removing this may break plugins compiled on older jars
+ // TODO: deprecate?
@ -126,48 +136,57 @@ index 00000000..50b52d6b
+ }
+
+ /**
+ * @param receivers List of players to receive this particle, or null for all players in the world
+ * @param receivers List of players to receive this particle, or null for all players in the
+ * world
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(@Nullable Collection<Player> receivers) {
+ this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
+ return this;
+ }
+
+ /**
+ * @param receivers List of players to be receive this particle, or null for all players in the world
+ * @param receivers List of players to be receive this particle, or null for all players in the
+ * world
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(Player... receivers) {
+ @NotNull
+ public ParticleBuilder receivers(@Nullable Player... receivers) {
+ this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
+ return this;
+ }
+
+ /**
+ * Selects all players within a cuboid selection around the particle location, within the specified bounding box.
+ * If you want a more spherical check, see {@link #receivers(int, boolean)}
+ * Selects all players within a cuboid selection around the particle location, within the
+ * specified bounding box. If you want a more spherical check, see {@link #receivers(int,
+ * boolean)}
+ *
+ * @param radius amount to add on all axis
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(int radius) {
+ return receivers(radius, radius);
+ }
+
+ /**
+ * Selects all players within the specified radius around the particle location.
+ * If byDistance is false, behavior uses cuboid selection the same as {@link #receivers(int, int)}
+ * If byDistance is true, radius is tested by distance in a spherical shape
+ * @param radius amount to add on each axis
+ * Selects all players within the specified radius around the particle location. If byDistance is
+ * false, behavior uses cuboid selection the same as {@link #receivers(int, int)} If byDistance is
+ * true, radius is tested by distance in a spherical shape
+ *
+ * @param radius amount to add on each axis
+ * @param byDistance true to use a spherical radius, false to use a cuboid
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(int radius, boolean byDistance) {
+ if (!byDistance) {
+ return receivers(radius, radius, radius);
+ } else {
+ this.receivers = Lists.newArrayList();
+ for (Player nearbyPlayer : location.getWorld().getNearbyPlayers(location, radius, radius, radius)) {
+ for (Player nearbyPlayer : location.getWorld()
+ .getNearbyPlayers(location, radius, radius, radius)) {
+ Location loc = nearbyPlayer.getLocation();
+ double x = NumberConversions.square(location.getX() - loc.getX());
+ double y = NumberConversions.square(location.getY() - loc.getY());
@ -182,34 +201,38 @@ index 00000000..50b52d6b
+ }
+
+ /**
+ * Selects all players within a cuboid selection around the particle location, within the specified bounding box.
+ * Allows specifying a different Y size than X and Z
+ * If you want a more cylinder check, see {@link #receivers(int, int, boolean)}
+ * If you want a more spherical check, see {@link #receivers(int, boolean)}
+ * Selects all players within a cuboid selection around the particle location, within the
+ * specified bounding box. Allows specifying a different Y size than X and Z If you want a more
+ * cylinder check, see {@link #receivers(int, int, boolean)} If you want a more spherical check,
+ * see {@link #receivers(int, boolean)}
+ *
+ * @param xzRadius amount to add on the x/z axis
+ * @param yRadius amount to add on the y axis
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(int xzRadius, int yRadius) {
+ return receivers(xzRadius, yRadius, xzRadius);
+ }
+
+ /**
+ * Selects all players within the specified radius around the particle location.
+ * If byDistance is false, behavior uses cuboid selection the same as {@link #receivers(int, int)}
+ * If byDistance is true, radius is tested by distance on the y plane and on the x/z plane, in a cylinder shape.
+ * Selects all players within the specified radius around the particle location. If byDistance is
+ * false, behavior uses cuboid selection the same as {@link #receivers(int, int)} If byDistance is
+ * true, radius is tested by distance on the y plane and on the x/z plane, in a cylinder shape.
+ *
+ * @param xzRadius amount to add on the x/z axis
+ * @param yRadius amount to add on the y axis
+ * @param byDistance true to use a cylinder shape, false to use cuboid
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(int xzRadius, int yRadius, boolean byDistance) {
+ if (!byDistance) {
+ return receivers(xzRadius, yRadius, xzRadius);
+ } else {
+ this.receivers = Lists.newArrayList();
+ for (Player nearbyPlayer : location.getWorld().getNearbyPlayers(location, xzRadius, yRadius, xzRadius)) {
+ for (Player nearbyPlayer : location.getWorld()
+ .getNearbyPlayers(location, xzRadius, yRadius, xzRadius)) {
+ Location loc = nearbyPlayer.getLocation();
+ if (Math.abs(loc.getY() - this.location.getY()) > yRadius) {
+ continue;
@ -226,15 +249,16 @@ index 00000000..50b52d6b
+ }
+
+ /**
+ * Selects all players within a cuboid selection around the particle location, within the specified bounding box.
+ * If you want a more cylinder check, see {@link #receivers(int, int, boolean)}
+ * If you want a more spherical check, see {@link #receivers(int, boolean)}
+ * Selects all players within a cuboid selection around the particle location, within the
+ * specified bounding box. If you want a more cylinder check, see {@link #receivers(int, int,
+ * boolean)} If you want a more spherical check, see {@link #receivers(int, boolean)}
+ *
+ * @param xRadius amount to add on the x axis
+ * @param yRadius amount to add on the y axis
+ * @param zRadius amount to add on the z axis
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder receivers(int xRadius, int yRadius, int zRadius) {
+ if (location == null) {
+ throw new IllegalStateException("Please set location first");
@ -245,16 +269,19 @@ index 00000000..50b52d6b
+ /**
+ * @return The player considered the source of this particle (for Visibility concerns), or null
+ */
+ @Nullable
+ public Player source() {
+ return source;
+ }
+
+ /**
+ * Sets the source of this particle for visibility concerns (Vanish API)
+ *
+ * @param source The player who is considered the source
+ * @return a reference to this object.
+ */
+ public ParticleBuilder source(Player source) {
+ @NotNull
+ public ParticleBuilder source(@Nullable Player source) {
+ this.source = source;
+ return this;
+ }
@ -262,29 +289,34 @@ index 00000000..50b52d6b
+ /**
+ * @return Location of where the particle will spawn
+ */
+ @Nullable
+ public Location location() {
+ return location;
+ }
+
+ /**
+ * Sets the location of where to spawn the particle
+ *
+ * @param location The location of the particle
+ * @return a reference to this object.
+ */
+ public ParticleBuilder location(Location location) {
+ @NotNull
+ public ParticleBuilder location(@NotNull Location location) {
+ this.location = location.clone();
+ return this;
+ }
+
+ /**
+ * Sets the location of where to spawn the particle
+ *
+ * @param world World to spawn particle in
+ * @param x X location
+ * @param y Y location
+ * @param z Z location
+ * @return a reference to this object.
+ */
+ public ParticleBuilder location(World world, double x, double y, double z) {
+ @NotNull
+ public ParticleBuilder location(@NotNull World world, double x, double y, double z) {
+ this.location = new Location(world, x, y, z);
+ return this;
+ }
@ -298,9 +330,11 @@ index 00000000..50b52d6b
+
+ /**
+ * Sets the number of particles to spawn
+ *
+ * @param count Number of particles
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder count(int count) {
+ this.count = count;
+ return this;
@ -308,20 +342,25 @@ index 00000000..50b52d6b
+
+ /**
+ * Particle offset X. Varies by particle on how this is used
+ *
+ * @return Particle offset X.
+ */
+ public double offsetX() {
+ return offsetX;
+ }
+
+ /**
+ * Particle offset Y. Varies by particle on how this is used
+ *
+ * @return Particle offset Y.
+ */
+ public double offsetY() {
+ return offsetY;
+ }
+
+ /**
+ * Particle offset Z. Varies by particle on how this is used
+ *
+ * @return Particle offset Z.
+ */
+ public double offsetZ() {
@ -330,11 +369,13 @@ index 00000000..50b52d6b
+
+ /**
+ * Sets the particle offset. Varies by particle on how this is used
+ *
+ * @param offsetX Particle offset X
+ * @param offsetY Particle offset Y
+ * @param offsetZ Particle offset Z
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder offset(double offsetX, double offsetY, double offsetZ) {
+ this.offsetX = offsetX;
+ this.offsetY = offsetY;
@ -344,6 +385,7 @@ index 00000000..50b52d6b
+
+ /**
+ * Gets the Particle extra data. Varies by particle on how this is used
+ *
+ * @return the extra particle data
+ */
+ public double extra() {
@ -352,9 +394,11 @@ index 00000000..50b52d6b
+
+ /**
+ * Sets the particle extra data. Varies by particle on how this is used
+ *
+ * @param extra the extra particle data
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder extra(double extra) {
+ this.extra = extra;
+ return this;
@ -362,9 +406,11 @@ index 00000000..50b52d6b
+
+ /**
+ * Gets the particle custom data. Varies by particle on how this is used
+ *
+ * @param <T> The Particle data type
+ * @return the ParticleData for this particle
+ */
+ @Nullable
+ public <T> T data() {
+ //noinspection unchecked
+ return (T) data;
@ -372,49 +418,64 @@ index 00000000..50b52d6b
+
+ /**
+ * Sets the particle custom data. Varies by particle on how this is used
+ *
+ * @param data The new particle data
+ * @param <T> The Particle data type
+ * @return a reference to this object.
+ */
+ public <T> ParticleBuilder data(T data) {
+ @NotNull
+ public <T> ParticleBuilder data(@Nullable T data) {
+ this.data = data;
+ return this;
+ }
+
+ /**
+ * Sets whether the particle is forcefully shown to the player.
+ * If forced, the particle will show faraway, as far as the player's view distance allows.
+ * If false, the particle will show according to the client's particle settings.
+ * Sets whether the particle is forcefully shown to the player. If forced, the particle will show
+ * faraway, as far as the player's view distance allows. If false, the particle will show
+ * according to the client's particle settings.
+ *
+ * @param force true to force, false for normal
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder force(boolean force) {
+ this.force = force;
+ return this;
+ }
+
+ /**
+ * Sets the particle Color.
+ * Only valid for REDSTONE.
+ * Sets the particle Color. Only valid for REDSTONE.
+ *
+ * @param color the new particle color
+ * @return a reference to this object.
+ */
+ public ParticleBuilder color(Color color) {
+ @NotNull
+ public ParticleBuilder color(@Nullable Color color) {
+ return color(color, 1);
+ }
+
+ /**
+ * Sets the particle Color and size.
+ * Only valid for REDSTONE.
+ * Sets the particle Color and size. Only valid for REDSTONE.
+ *
+ * @param color the new particle color
+ * @param size the size of the particle
+ * @return a reference to this object.
+ */
+ public ParticleBuilder color(Color color, float size) {
+ if (particle != Particle.REDSTONE) {
+ @NotNull
+ public ParticleBuilder color(@Nullable Color color, float size) {
+ if (particle != Particle.REDSTONE && color != null) {
+ throw new IllegalStateException("Color may only be set on REDSTONE");
+ }
+
+ // We don't officially support reusing these objects, but here we go
+ if (color == null) {
+ if (data instanceof Particle.DustOptions) {
+ return data(null);
+ } else {
+ return this;
+ }
+ }
+
+ return data(new Particle.DustOptions(color, size));
+ }
+
@ -426,15 +487,16 @@ index 00000000..50b52d6b
+ * @param b blue color component
+ * @return a reference to this object.
+ */
+ @NotNull
+ public ParticleBuilder color(int r, int g, int b) {
+ return color(Color.fromRGB(r, g, b));
+ }
+}
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 4d0acaf5..827aa00c 100644
index 3b2314a94..a919c6d5b 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -82,6 +82,16 @@ public enum Particle {
@@ -84,6 +84,17 @@ public enum Particle {
return dataType;
}
@ -444,6 +506,7 @@ index 4d0acaf5..827aa00c 100644
+ *
+ * @return a {@link com.destroystokyo.paper.ParticleBuilder} for the particle
+ */
+ @NotNull
+ public com.destroystokyo.paper.ParticleBuilder builder() {
+ return new com.destroystokyo.paper.ParticleBuilder(this);
+ }
@ -452,15 +515,15 @@ index 4d0acaf5..827aa00c 100644
* Options which can be applied to redstone dust particles - a particle
* color and size.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index bc6a51d7..6b7eeeac 100644
index 0dcdbb59a..bec405feb 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2006,7 +2006,57 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -2084,7 +2084,57 @@ public interface World extends PluginMessageRecipient, Metadatable {
* the type of this depends on {@link Particle#getDataType()}
* @param <T> Type
*/
- public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
+ public default <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) { spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }// Paper start - Expand Particle API
- public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
+ public default <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) { spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }// Paper start - Expand Particle API
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
@ -483,7 +546,7 @@ index bc6a51d7..6b7eeeac 100644
+ * the type of this depends on {@link Particle#getDataType()}
+ * @param <T> Type
+ */
+ public default <T> void spawnParticle(Particle particle, List<Player> receivers, Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) { spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }
+ public default <T> void spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) { spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
@ -508,12 +571,12 @@ index bc6a51d7..6b7eeeac 100644
+ * @param force allows the particle to be seen further away from the player
+ * and shows to players using any vanilla client particle settings
+ */
+ public <T> void spawnParticle(Particle particle, List<Player> receivers, Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force);
+ public <T> void spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
+ // Paper end
+
/**
* Spawns the particle (the number of times specified by count)
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 75e762447840834a7c3f6e3c48af2136be41b1dc Mon Sep 17 00:00:00 2001
From 525854c7970c2715c32cb5cd3a961d0471372f16 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 1 May 2018 20:17:44 -0400
Subject: [PATCH] EndermanAttackPlayerEvent
@ -9,10 +9,10 @@ This allows you to override/extend the pumpkin/stare logic.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
new file mode 100644
index 00000000..ab5a7a6b
index 000000000..f530a3d93
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
@@ -0,0 +1,96 @@
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -45,6 +45,7 @@ index 00000000..ab5a7a6b
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when an Enderman determines if it should attack a player or not.
@ -53,9 +54,9 @@ index 00000000..ab5a7a6b
+ *
+ */
+public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable {
+ private final Player player;
+ @NotNull private final Player player;
+
+ public EndermanAttackPlayerEvent(Enderman entity, Player player) {
+ public EndermanAttackPlayerEvent(@NotNull Enderman entity, @NotNull Player player) {
+ super(entity);
+ this.player = player;
+ }
@ -65,6 +66,7 @@ index 00000000..ab5a7a6b
+ *
+ * @return The enderman considering attacking
+ */
+ @NotNull
+ @Override
+ public Enderman getEntity() {
+ return (Enderman) super.getEntity();
@ -75,16 +77,19 @@ index 00000000..ab5a7a6b
+ *
+ * @return The player the Enderman is considering attacking
+ */
+ @NotNull
+ public Player getPlayer() {
+ return player;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -110,5 +115,5 @@ index 00000000..ab5a7a6b
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From e6848b857dc953c4ab20b2d1c9697597488abbf5 Mon Sep 17 00:00:00 2001
From 01b125b0fe0165e700c81c3211f8510da00461a5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 1 May 2018 21:33:35 -0400
Subject: [PATCH] Close Plugin Class Loaders on Disable
@ -7,14 +7,13 @@ This should close more memory leaks from /reload and disabling plugins,
by closing the class loader and the jar file.
diff --git a/src/main/java/org/bukkit/plugin/PluginLoader.java b/src/main/java/org/bukkit/plugin/PluginLoader.java
index e7981a1d..d34756f1 100644
index da7839aa9..fbd65e8b0 100644
--- a/src/main/java/org/bukkit/plugin/PluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/PluginLoader.java
@@ -73,4 +73,19 @@ public interface PluginLoader {
@@ -78,4 +78,18 @@ public interface PluginLoader {
* @param plugin Plugin to disable
*/
public void disablePlugin(Plugin plugin);
+
public void disablePlugin(@NotNull Plugin plugin);
+ // Paper start - close Classloader on disable
+ /**
+ * Disables the specified plugin
@ -25,18 +24,18 @@ index e7981a1d..d34756f1 100644
+ * @param closeClassloader if the classloader for the Plugin should be closed
+ */
+ // provide default to allow other PluginLoader implementations to work
+ default public void disablePlugin(Plugin plugin, boolean closeClassloader) {
+ default public void disablePlugin(@NotNull Plugin plugin, boolean closeClassloader) {
+ disablePlugin(plugin);
+ }
+ // Paper end - close Classloader on disable
}
diff --git a/src/main/java/org/bukkit/plugin/PluginManager.java b/src/main/java/org/bukkit/plugin/PluginManager.java
index e5638d56..b72d5a9b 100644
index a468467b4..ba4ed7ed7 100644
--- a/src/main/java/org/bukkit/plugin/PluginManager.java
+++ b/src/main/java/org/bukkit/plugin/PluginManager.java
@@ -154,6 +154,18 @@ public interface PluginManager {
@@ -162,6 +162,18 @@ public interface PluginManager {
*/
public void disablePlugin(Plugin plugin);
public void disablePlugin(@NotNull Plugin plugin);
+ // Paper start - close Classloader on disable
+ /**
@ -47,17 +46,17 @@ index e5638d56..b72d5a9b 100644
+ * @param plugin Plugin to disable
+ * @param closeClassloader if the classloader for the Plugin should be closed
+ */
+ public void disablePlugin(Plugin plugin, boolean closeClassloader);
+ public void disablePlugin(@NotNull Plugin plugin, boolean closeClassloader);
+ // Paper end - close Classloader on disable
+
/**
* 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
index 5034215a..d925423d 100644
index 12e17709c..7d4ca43b5 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -413,17 +413,29 @@ public final class SimplePluginManager implements PluginManager {
@@ -419,17 +419,29 @@ public final class SimplePluginManager implements PluginManager {
}
}
@ -75,13 +74,12 @@ index 5034215a..d925423d 100644
}
}
- public void disablePlugin(final Plugin plugin) {
+ // Paper start - close Classloader on disable
+ public void disablePlugin(Plugin plugin) {
public void disablePlugin(@NotNull final Plugin plugin) {
+ disablePlugin(plugin, false);
+ }
+
+ public void disablePlugin(final Plugin plugin, boolean closeClassloader) {
+ public void disablePlugin(@NotNull final Plugin plugin, boolean closeClassloader) {
+ // Paper end - close Classloader on disable
if (plugin.isEnabled()) {
try {
@ -90,7 +88,7 @@ index 5034215a..d925423d 100644
} catch (Throwable ex) {
handlePluginException("Error occurred (in the plugin loader) while disabling "
+ plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
@@ -469,7 +481,7 @@ public final class SimplePluginManager implements PluginManager {
@@ -475,7 +487,7 @@ public final class SimplePluginManager implements PluginManager {
public void clearPlugins() {
synchronized (this) {
@ -100,10 +98,10 @@ index 5034215a..d925423d 100644
lookupNames.clear();
HandlerList.unregisterAll();
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 77207f14..c7782e7d 100644
index b9bf2124b..095448fe7 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -320,7 +320,7 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -328,7 +328,7 @@ public final class JavaPluginLoader implements PluginLoader {
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
// Paper start - Disable plugins that fail to load
@ -112,21 +110,20 @@ index 77207f14..c7782e7d 100644
return;
// Paper end
}
@@ -331,7 +331,13 @@ public final class JavaPluginLoader implements PluginLoader {
}
@@ -340,6 +340,12 @@ public final class JavaPluginLoader implements PluginLoader {
}
public void disablePlugin(@NotNull Plugin plugin) {
+ // Paper start - close Classloader on disable
public void disablePlugin(Plugin plugin) {
+ disablePlugin(plugin, false); // Retain old behavior unless requested
+ }
+
+ public void disablePlugin(Plugin plugin, boolean closeClassloader) {
+ public void disablePlugin(@NotNull Plugin plugin, boolean closeClassloader) {
+ // Paper end - close Class Loader on disable
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
if (plugin.isEnabled()) {
@@ -358,6 +364,16 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -366,6 +372,16 @@ public final class JavaPluginLoader implements PluginLoader {
for (String name : names) {
removeClass(name);
}
@ -144,5 +141,5 @@ index 77207f14..c7782e7d 100644
}
}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From ba6dedde58f6f28c09dc1d8226c3e8269b956597 Mon Sep 17 00:00:00 2001
From d9c3debc9d0a4123e4a6d56fc4b7154b5f2fb1e8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:26:16 -0400
Subject: [PATCH] WitchConsumePotionEvent
@ -7,10 +7,10 @@ Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
new file mode 100644
index 00000000..79021899
index 000000000..fbbace36d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
@@ -0,0 +1,64 @@
@@ -0,0 +1,70 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Witch;
@ -18,18 +18,21 @@ index 00000000..79021899
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Fired when a witch consumes the potion in their hand to buff themselves.
+ */
+public class WitchConsumePotionEvent extends EntityEvent implements Cancellable {
+ private ItemStack potion;
+ @Nullable private ItemStack potion;
+
+ public WitchConsumePotionEvent(Witch witch, ItemStack potion) {
+ public WitchConsumePotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
+ super(witch);
+ this.potion = potion;
+ }
+
+ @NotNull
+ @Override
+ public Witch getEntity() {
+ return (Witch) super.getEntity();
@ -38,6 +41,7 @@ index 00000000..79021899
+ /**
+ * @return the potion the witch will consume and have the effects applied.
+ */
+ @Nullable
+ public ItemStack getPotion() {
+ return potion;
+ }
@ -46,16 +50,18 @@ index 00000000..79021899
+ * Sets the potion to be consumed and applied to the witch.
+ * @param potion The potion
+ */
+ public void setPotion(ItemStack potion) {
+ public void setPotion(@Nullable ItemStack potion) {
+ this.potion = potion != null ? potion.clone() : null;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -77,7 +83,7 @@ index 00000000..79021899
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
new file mode 100644
index 00000000..6ef6367b
index 000000000..6ef6367b6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
@@ -0,0 +1,33 @@
@ -115,5 +121,5 @@ index 00000000..6ef6367b
+ }
+}
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From f7201b04e24d4bbf74d326bf78b5edce24be9e0d Mon Sep 17 00:00:00 2001
From 456f51c1047c446b824766799d6883ab066ee8bb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:39:09 -0400
Subject: [PATCH] WitchThrowPotionEvent
@ -6,10 +6,10 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
index 6ef6367b..77487e28 100644
index 6ef6367b6..688a596aa 100644
--- a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
@@ -1,13 +1,51 @@
@@ -1,29 +1,77 @@
package com.destroystokyo.paper.event.entity;
+import org.bukkit.entity.LivingEntity;
@ -19,6 +19,8 @@ index 6ef6367b..77487e28 100644
import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
-public class WitchThrowPotionEvent extends Event implements Cancellable {
- public WitchThrowPotionEvent() {
@ -26,15 +28,16 @@ index 6ef6367b..77487e28 100644
+ * Fired when a witch throws a potion at a player
+ */
+public class WitchThrowPotionEvent extends EntityEvent implements Cancellable {
+ private final LivingEntity target;
+ private ItemStack potion;
+ @NotNull private final LivingEntity target;
+ @Nullable private ItemStack potion;
+
+ public WitchThrowPotionEvent(Witch witch, LivingEntity target, ItemStack potion) {
+ public WitchThrowPotionEvent(@NotNull Witch witch, @NotNull LivingEntity target, @Nullable ItemStack potion) {
+ super(witch);
+ this.target = target;
+ this.potion = potion;
}
+ @NotNull
+ @Override
+ public Witch getEntity() {
+ return (Witch) super.getEntity();
@ -43,6 +46,7 @@ index 6ef6367b..77487e28 100644
+ /**
+ * @return The target of the potion
+ */
+ @NotNull
+ public LivingEntity getTarget() {
+ return target;
+ }
@ -50,6 +54,7 @@ index 6ef6367b..77487e28 100644
+ /**
+ * @return The potion the witch will throw at a player
+ */
+ @Nullable
+ public ItemStack getPotion() {
+ return potion;
+ }
@ -58,13 +63,21 @@ index 6ef6367b..77487e28 100644
+ * Sets the potion to be thrown at a player
+ * @param potion The potion
+ */
+ public void setPotion(ItemStack potion) {
+ public void setPotion(@Nullable ItemStack potion) {
+ this.potion = potion != null ? potion.clone() : null;
+ }
private static final HandlerList handlers = new HandlerList();
@@ -21,9 +59,12 @@ public class WitchThrowPotionEvent extends Event implements Cancellable {
+ @NotNull
public HandlerList getHandlers() {
return handlers;
}
+ @NotNull
public static HandlerList getHandlerList() {
return handlers;
}
private boolean cancelled = false;
@ -79,5 +92,5 @@ index 6ef6367b..77487e28 100644
@Override
--
2.20.1
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 316049bab75da64f7cd691eca897200c63ce88b8 Mon Sep 17 00:00:00 2001
From f518eb3d1040b4b8131c289ceecfe47d04561b21 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 24 May 2018 21:01:13 -0400
Subject: [PATCH] Location.toBlockLocation/toCenterLocation()
@ -6,10 +6,10 @@ Subject: [PATCH] Location.toBlockLocation/toCenterLocation()
Convert location objects to their block coordinates, or the center of the block
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 1ddebf3c..916238c4 100644
index a2dfad2f4..3387fb477 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -492,6 +492,29 @@ public class Location implements Cloneable, ConfigurationSerializable {
@@ -507,6 +507,31 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
public boolean isChunkLoaded() { return world.isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
@ -18,6 +18,7 @@ index 1ddebf3c..916238c4 100644
+ /**
+ * @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
+ */
+ @NotNull
+ public Location toBlockLocation() {
+ Location blockLoc = clone();
+ blockLoc.setX(getBlockX());
@ -28,6 +29,7 @@ index 1ddebf3c..916238c4 100644
+ /**
+ * @return A new location where X/Y/Z are the center of the block
+ */
+ @NotNull
+ public Location toCenterLocation() {
+ Location centerLoc = clone();
+ centerLoc.setX(getBlockX() + 0.5);
@ -40,5 +42,5 @@ index 1ddebf3c..916238c4 100644
public boolean equals(Object obj) {
if (obj == null) {
--
2.20.1
2.21.0

Datei anzeigen

@ -1,41 +1,47 @@
From 631b3e9d4a7a908df94994d6d25987747e313a54 Mon Sep 17 00:00:00 2001
From 8d34f2367c37cd9a2f1e78b4698332157ae7b670 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Jun 2018 04:10:13 -0400
Subject: [PATCH] PotionEffect clone methods
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
index 86616f1b..efb55d29 100644
index d57450c95..4125a024e 100644
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
@@ -100,6 +100,27 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -103,6 +103,33 @@ public class PotionEffect implements ConfigurationSerializable {
this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)));
}
+ // Paper start
+ public PotionEffect withType(PotionEffectType type) {
+ @NotNull
+ public PotionEffect withType(@NotNull PotionEffectType type) {
+ return new PotionEffect(type, duration, amplifier, ambient, particles, icon);
+ }
+ @NotNull
+ public PotionEffect withDuration(int duration) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ @NotNull
+ public PotionEffect withAmplifier(int amplifier) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ @NotNull
+ public PotionEffect withAmbient(boolean ambient) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ @NotNull
+ public PotionEffect withParticles(boolean particles) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ @NotNull
+ public PotionEffect withIcon(boolean icon) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ // Paper end
+
private static PotionEffectType getEffectType(Map<?, ?> map) {
@NotNull
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) {
int type = getInt(map, TYPE);
PotionEffectType effect = PotionEffectType.getById(type);
--
2.20.1
2.21.0

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen