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
This commit is contained in:
Shane Freeder 2019-03-20 00:28:15 +00:00
parent 2b722719b3
commit a7ba5db3de
260 changed files with 2328 additions and 2021 deletions

View File

@ -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
@@ -0,0 +0,0 @@ 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
+

View File

@ -10,7 +10,7 @@ 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
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

View File

@ -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
@@ -0,0 +0,0 @@ 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;
import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ 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

View File

@ -5,30 +5,32 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
index 33cd0ea0..35407d5e 100644
index 893300a77..22ff63e52 100644
--- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java
@@ -0,0 +0,0 @@ public interface Chunk {
*/
@NotNull
Entity[] getEntities();
+ // Paper start
/**
* Get a list of all tile entities in the chunk.
*
* @return The tile entities.
*/
- BlockState[] getTileEntities();
+ /**
+ * Get a list of all tile entities in the chunk.
+ *
+ * @return The tile entities.
+ */
+ @NotNull
+ default BlockState[] getTileEntities() {
+ return getTileEntities(true);
+ }
+
+ /**
+ * Get a list of all tile entities in the chunk.
+ *
/**
* Get a list of all tile entities in the chunk.
*
+ * @param useSnapshot Take snapshots or direct references
+ * @return The tile entities.
+ */
* @return The tile entities.
*/
@NotNull
- BlockState[] getTileEntities();
+ BlockState[] getTileEntities(boolean useSnapshot);
+ // Paper end

View File

@ -5,12 +5,12 @@ 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
@@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory {
public void setHeldItemSlot(int slot);
@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,7 +29,7 @@ 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
}
--

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {

View File

@ -16,7 +16,7 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 658eac26..335d3803 100644
index 919d1b66a..30195c045 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@ -30,7 +30,7 @@ index 658eac26..335d3803 100644
/**
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
*/
@Nullable
public Location getBedSpawnLocation();
+ // Paper start

View File

@ -8,7 +8,7 @@ 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
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@ -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,7 +74,7 @@ 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
@@ -0,0 +0,0 @@
@ -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;
import org.bukkit.Instrument;
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(MapView map);
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);

View File

@ -5,11 +5,11 @@ 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
@@ -0,0 +0,0 @@ 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,29 +34,9 @@ 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
@@ -0,0 +0,0 @@ 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);
}
@@ -0,0 +0,0 @@ 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);
}
--

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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,11 +85,13 @@ index 00000000..6579ae99
+ return primary;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add EntityKnockbackByEntityEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
new file mode 100644
index 00000000..f6ef1162
index 000000000..9efecabab
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
@@ -0,0 +0,0 @@
@ -18,6 +18,7 @@ index 00000000..f6ef1162
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
@ -27,22 +28,24 @@ index 00000000..f6ef1162
+public class EntityKnockbackByEntityEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ private final Entity hitBy;
+ @NotNull private final Entity hitBy;
+ private final float knockbackStrength;
+ private final Vector acceleration;
+ @NotNull private final Vector acceleration;
+ private boolean cancelled = false;
+
+ public EntityKnockbackByEntityEvent(LivingEntity entity, Entity hitBy, float knockbackStrength, Vector acceleration) {
+ public EntityKnockbackByEntityEvent(@NotNull LivingEntity entity, @NotNull Entity hitBy, float knockbackStrength, @NotNull Vector acceleration) {
+ super(entity);
+ this.hitBy = hitBy;
+ this.knockbackStrength = knockbackStrength;
+ this.acceleration = acceleration;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -60,6 +63,7 @@ index 00000000..f6ef1162
+ /**
+ * @return the entity which was knocked back
+ */
+ @NotNull
+ @Override
+ public LivingEntity getEntity() {
+ return (LivingEntity) super.getEntity();
@ -75,6 +79,7 @@ index 00000000..f6ef1162
+ /**
+ * @return the Entity which hit
+ */
+ @NotNull
+ public Entity getHitBy() {
+ return hitBy;
+ }
@ -82,6 +87,7 @@ index 00000000..f6ef1162
+ /**
+ * @return the acceleration that will be applied
+ */
+ @NotNull
+ public Vector getAcceleration() {
+ return acceleration;
+ }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add EntityTeleportEndGatewayEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
new file mode 100644
index 00000000..80899ecb
index 000000000..bfc69a43c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
@@ -0,0 +0,0 @@
@ -16,15 +16,16 @@ index 00000000..80899ecb
+import org.bukkit.block.EndGateway;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.entity.EntityTeleportEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired any time an entity attempts to teleport in an end gateway
+ */
+public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent {
+
+ private final EndGateway gateway;
+ @NotNull private final EndGateway gateway;
+
+ public EntityTeleportEndGatewayEvent(Entity what, Location from, Location to, EndGateway gateway) {
+ public EntityTeleportEndGatewayEvent(@NotNull Entity what, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
+ super(what, from, to);
+ this.gateway = gateway;
+ }
@ -34,6 +35,7 @@ index 00000000..80899ecb
+ *
+ * @return EndGateway used
+ */
+ @NotNull
+ public EndGateway getGateway() {
+ return gateway;
+ }

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ import org.bukkit.event.HandlerList;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
/**
* Stores data for pigs being zapped
*/
@ -97,7 +99,7 @@ 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;
@ -109,9 +111,9 @@ index c1d4b30a..de8cad81 100644
+ // Paper start
+ /*
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
@@ -0,0 +0,0 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add ItemStack Recipe API helper methods
Allows using ExactChoice Recipes with easier methodss
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 80af6cf5..3eae5a55 100644
index 64a43f426..76b2dd7cb 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -0,0 +0,0 @@ public class ShapedRecipe implements Recipe, Keyed {
@ -14,7 +14,8 @@ index 80af6cf5..3eae5a55 100644
}
+ // Paper start
+ public ShapedRecipe setIngredient(char key, ItemStack item) {
+ @NotNull
+ public ShapedRecipe setIngredient(char key, @NotNull ItemStack item) {
+ return setIngredient(key, new RecipeChoice.ExactChoice(item));
+ }
+ // Paper end
@ -23,7 +24,7 @@ index 80af6cf5..3eae5a55 100644
* Get a copy of the ingredients map.
*
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 7347e746..4de38b33 100644
index 46a398e88..818bf2936 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -0,0 +0,0 @@ public class ShapelessRecipe implements Recipe, Keyed {
@ -31,20 +32,27 @@ index 7347e746..4de38b33 100644
}
+ // Paper start
+ public ShapelessRecipe addIngredient(ItemStack item) {
+ @NotNull
+ public ShapelessRecipe addIngredient(@NotNull ItemStack item) {
+ return addIngredient(1, item);
+ }
+ public ShapelessRecipe addIngredient(int count, ItemStack item) {
+
+ @NotNull
+ public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) {
+ Validate.isTrue(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
+ while (count-- > 0) {
+ ingredients.add(new RecipeChoice.ExactChoice(item));
+ }
+ return this;
+ }
+ public ShapelessRecipe removeIngredient(ItemStack item) {
+
+ @NotNull
+ public ShapelessRecipe removeIngredient(@NotNull ItemStack item) {
+ return removeIngredient(1, item);
+ }
+ public ShapelessRecipe removeIngredient(int count, ItemStack item) {
+
+ @NotNull
+ public ShapelessRecipe removeIngredient(int count, @NotNull ItemStack item) {
+ Iterator<RecipeChoice> iterator = ingredients.iterator();
+ while (count > 0 && iterator.hasNext()) {
+ ItemStack stack = iterator.next().getItemStack();
@ -57,7 +65,7 @@ index 7347e746..4de38b33 100644
+ }
+ // Paper end
+
public ShapelessRecipe addIngredient(RecipeChoice ingredient) {
Validate.isTrue(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients");
/**
* Removes an ingredient from the list.
*
--

View File

@ -9,7 +9,7 @@ Allows creating recipes that must match isSimilar to full item stack.
diff --git a/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java
new file mode 100644
index 00000000..43e6576b
index 000000000..43e6576b1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java
@@ -0,0 +0,0 @@

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
new file mode 100644
index 00000000..5df8eed2
index 000000000..f52644fab
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
@@ -0,0 +0,0 @@
@ -14,6 +14,7 @@ index 00000000..5df8eed2
+
+import org.bukkit.entity.Entity;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents information about a targeted entity
@ -22,7 +23,7 @@ index 00000000..5df8eed2
+ private final Entity entity;
+ private final Vector hitVec;
+
+ public TargetEntityInfo(Entity entity, Vector hitVec) {
+ public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) {
+ this.entity = entity;
+ this.hitVec = hitVec;
+ }
@ -32,6 +33,7 @@ index 00000000..5df8eed2
+ *
+ * @return Targeted entity
+ */
+ @NotNull
+ public Entity getEntity() {
+ return entity;
+ }
@ -41,18 +43,19 @@ index 00000000..5df8eed2
+ *
+ * @return Targeted position
+ */
+ @NotNull
+ public Vector getHitVector() {
+ return hitVec;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index bd47e720..34a8fe3f 100644
index 4dec50caf..956d68867 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
@Nullable
public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+
+ /**
+ * Gets information about the entity being targeted

View File

@ -8,7 +8,7 @@ are related to each other by a trait.
diff --git a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
new file mode 100644
index 00000000..b036c374
index 000000000..c91ea2a06
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
@@ -0,0 +0,0 @@
@ -33,6 +33,8 @@ index 00000000..b036c374
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class MaterialSetTag implements Tag<Material> {
+
@ -43,7 +45,7 @@ index 00000000..b036c374
+ * @deprecated Use NamespacedKey version of constructor
+ */
+ @Deprecated
+ public MaterialSetTag(Predicate<Material> filter) {
+ public MaterialSetTag(@NotNull Predicate<Material> filter) {
+ this(null, Stream.of(Material.values()).filter(filter).collect(Collectors.toList()));
+ }
+
@ -51,7 +53,7 @@ index 00000000..b036c374
+ * @deprecated Use NamespacedKey version of constructor
+ */
+ @Deprecated
+ public MaterialSetTag(Collection<Material> materials) {
+ public MaterialSetTag(@NotNull Collection<Material> materials) {
+ this(null, materials);
+ }
+
@ -59,123 +61,140 @@ index 00000000..b036c374
+ * @deprecated Use NamespacedKey version of constructor
+ */
+ @Deprecated
+ public MaterialSetTag(Material... materials) {
+ public MaterialSetTag(@NotNull Material... materials) {
+ this(null, materials);
+ }
+
+ public MaterialSetTag(NamespacedKey key, Predicate<Material> filter) {
+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Predicate<Material> filter) {
+ this(key, Stream.of(Material.values()).filter(filter).collect(Collectors.toList()));
+ }
+
+ public MaterialSetTag(NamespacedKey key, Material... materials) {
+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Material... materials) {
+ this(key, Lists.newArrayList(materials));
+ }
+
+ public MaterialSetTag(NamespacedKey key, Collection<Material> materials) {
+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection<Material> materials) {
+ this.key = key != null ? key : NamespacedKey.randomKey();
+ this.materials = Sets.newEnumSet(materials, Material.class);
+ }
+
+ @NotNull
+ @Override
+ public NamespacedKey getKey() {
+ return key;
+ }
+
+ public MaterialSetTag add(Tag<Material>... tags) {
+ @NotNull
+ public MaterialSetTag add(@NotNull Tag<Material>... tags) {
+ for (Tag<Material> tag : tags) {
+ add(tag.getValues());
+ }
+ return this;
+ }
+
+ public MaterialSetTag add(MaterialSetTag... tags) {
+ @NotNull
+ public MaterialSetTag add(@NotNull MaterialSetTag... tags) {
+ for (Tag<Material> tag : tags) {
+ add(tag.getValues());
+ }
+ return this;
+ }
+
+ public MaterialSetTag add(Material... material) {
+ @NotNull
+ public MaterialSetTag add(@NotNull Material... material) {
+ this.materials.addAll(Lists.newArrayList(material));
+ return this;
+ }
+
+ public MaterialSetTag add(Collection<Material> materials) {
+ @NotNull
+ public MaterialSetTag add(@NotNull Collection<Material> materials) {
+ this.materials.addAll(materials);
+ return this;
+ }
+
+ public MaterialSetTag contains(String with) {
+ return add(mat -> mat.name().contains(with)); }
+ @NotNull
+ public MaterialSetTag contains(@NotNull String with) {
+ return add(mat -> mat.name().contains(with));
+ }
+
+ public MaterialSetTag endsWith(String with) {
+ @NotNull
+ public MaterialSetTag endsWith(@NotNull String with) {
+ return add(mat -> mat.name().endsWith(with));
+ }
+
+
+ public MaterialSetTag startsWith(String with) {
+ @NotNull
+ public MaterialSetTag startsWith(@NotNull String with) {
+ return add(mat -> mat.name().startsWith(with));
+ }
+
+ public MaterialSetTag add(Predicate<Material> filter) {
+ @NotNull
+ public MaterialSetTag add(@NotNull Predicate<Material> filter) {
+ add(Stream.of(Material.values()).filter(((Predicate<Material>) Material::isLegacy).negate()).filter(filter).collect(Collectors.toList()));
+ return this;
+ }
+
+ public MaterialSetTag not(MaterialSetTag tags) {
+ @NotNull
+ public MaterialSetTag not(@NotNull MaterialSetTag tags) {
+ not(tags.getValues());
+ return this;
+ }
+
+ public MaterialSetTag not(Material... material) {
+ @NotNull
+ public MaterialSetTag not(@NotNull Material... material) {
+ this.materials.removeAll(Lists.newArrayList(material));
+ return this;
+ }
+
+ public MaterialSetTag not(Collection<Material> materials) {
+ @NotNull
+ public MaterialSetTag not(@NotNull Collection<Material> materials) {
+ this.materials.removeAll(materials);
+ return this;
+ }
+
+ public MaterialSetTag not(Predicate<Material> filter) {
+ @NotNull
+ public MaterialSetTag not(@NotNull Predicate<Material> filter) {
+ not(Stream.of(Material.values()).filter(((Predicate<Material>) Material::isLegacy).negate()).filter(filter).collect(Collectors.toList()));
+ return this;
+ }
+
+ public MaterialSetTag notEndsWith(String with) {
+ @NotNull
+ public MaterialSetTag notEndsWith(@NotNull String with) {
+ return not(mat -> mat.name().endsWith(with));
+ }
+
+
+ public MaterialSetTag notStartsWith(String with) {
+ @NotNull
+ public MaterialSetTag notStartsWith(@NotNull String with) {
+ return not(mat -> mat.name().startsWith(with));
+ }
+
+ @NotNull
+ public Set<Material> getValues() {
+ return this.materials;
+ }
+
+ public boolean isTagged(BlockData block) {
+ public boolean isTagged(@NotNull BlockData block) {
+ return isTagged(block.getMaterial());
+ }
+
+ public boolean isTagged(BlockState block) {
+ public boolean isTagged(@NotNull BlockState block) {
+ return isTagged(block.getType());
+ }
+
+ public boolean isTagged(Block block) {
+ public boolean isTagged(@NotNull Block block) {
+ return isTagged(block.getType());
+ }
+
+ public boolean isTagged(ItemStack item) {
+ public boolean isTagged(@NotNull ItemStack item) {
+ return isTagged(item.getType());
+ }
+
+ public boolean isTagged(Material material) {
+ public boolean isTagged(@NotNull Material material) {
+ return this.materials.contains(material);
+ }
+
+ public MaterialSetTag ensureSize(String label, int size) {
+ @NotNull
+ public MaterialSetTag ensureSize(@NotNull String label, int size) {
+ long actual = this.materials.stream().filter(((Predicate<Material>) Material::isLegacy).negate()).count();
+ if (size != actual) {
+ throw new IllegalStateException(label + " - Expected " + size + " materials, got " + actual);
@ -185,7 +204,7 @@ index 00000000..b036c374
+}
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
new file mode 100644
index 00000000..660191c2
index 000000000..660191c24
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -0,0 +0,0 @@
@ -573,7 +592,7 @@ index 00000000..660191c2
+}
diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java
new file mode 100644
index 00000000..328c5147
index 000000000..328c51471
--- /dev/null
+++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java
@@ -0,0 +0,0 @@
@ -603,7 +622,7 @@ index 00000000..328c5147
+ }
+}
diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java
index 2d840320..613675c3 100644
index 2d8403206..613675c3b 100644
--- a/src/test/java/org/bukkit/TestServer.java
+++ b/src/test/java/org/bukkit/TestServer.java
@@ -0,0 +0,0 @@ public class TestServer implements InvocationHandler {

View File

@ -6,7 +6,7 @@ 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
@@ -0,0 +0,0 @@ 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();

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add More Creeper API
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
new file mode 100644
index 00000000..3d10bb03
index 000000000..ff10251b6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
@@ -0,0 +0,0 @@
@ -16,6 +16,7 @@ index 00000000..3d10bb03
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a Creeper is ignite flag is changed (armed/disarmed to explode).
@ -25,11 +26,12 @@ index 00000000..3d10bb03
+ private boolean canceled;
+ private boolean ignited;
+
+ public CreeperIgniteEvent(Creeper creeper, boolean ignited) {
+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
+ super(creeper);
+ this.ignited = ignited;
+ }
+
+ @NotNull
+ @Override
+ public Creeper getEntity() {
+ return (Creeper) entity;
@ -51,17 +53,19 @@ index 00000000..3d10bb03
+ canceled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
index f957d836..b9877fb8 100644
index f957d8368..b9877fb88 100644
--- a/src/main/java/org/bukkit/entity/Creeper.java
+++ b/src/main/java/org/bukkit/entity/Creeper.java
@@ -0,0 +0,0 @@ public interface Creeper extends Monster {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add PhantomPreSpawnEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
new file mode 100644
index 00000000..303a1ec9
index 000000000..9022f697a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
@@ -0,0 +0,0 @@
@ -16,16 +16,17 @@ index 00000000..303a1ec9
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.annotation.Nullable;
+
+/**
+ * Called when a phantom is spawned for an exhausted player
+ */
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
+ private final Entity entity;
+ @NotNull private final Entity entity;
+
+ public PhantomPreSpawnEvent(Location location, Entity entity, CreatureSpawnEvent.SpawnReason reason) {
+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) {
+ super(location, EntityType.PHANTOM, reason);
+ this.entity = entity;
+ }
@ -41,9 +42,18 @@ index 00000000..303a1ec9
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
index 1a1044ed..65b703a2 100644
index 1a1044edc..ed4d417c2 100644
--- a/src/main/java/org/bukkit/entity/Phantom.java
+++ b/src/main/java/org/bukkit/entity/Phantom.java
@@ -0,0 +0,0 @@
package org.bukkit.entity;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
/**
* Represents a phantom.
*/
@@ -0,0 +0,0 @@ public interface Phantom extends Flying {
* @param sz The new size of the phantom.
*/
@ -55,6 +65,7 @@ index 1a1044ed..65b703a2 100644
+ *
+ * @return UUID
+ */
+ @Nullable
+ public java.util.UUID getSpawningEntity();
+ // Paper end
}

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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,7 +142,7 @@ 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;
+ }
+ }

View File

@ -35,7 +35,7 @@ is undefined.
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
new file mode 100644
index 00000000..80896bbf
index 000000000..12c1c6fe9
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
@@ -0,0 +0,0 @@
@ -46,6 +46,7 @@ index 00000000..80896bbf
+
+import java.net.InetAddress;
+import java.util.UUID;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * <p>
@ -87,11 +88,11 @@ index 00000000..80896bbf
+
+ private static final HandlerList HANDLERS = new HandlerList();
+
+ private final UUID playerUniqueId;
+ private final String playerName;
+ private final InetAddress ipAddress;
+ @NotNull private final UUID playerUniqueId;
+ @NotNull private final String playerName;
+ @NotNull private final InetAddress ipAddress;
+
+ public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) {
+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) {
+ super(async);
+ this.playerUniqueId = playerUniqueId;
+ this.playerName = playerName;
@ -101,6 +102,7 @@ index 00000000..80896bbf
+ /**
+ * Returns the {@code UUID} of the player disconnecting.
+ */
+ @NotNull
+ public UUID getPlayerUniqueId() {
+ return this.playerUniqueId;
+ }
@ -108,6 +110,7 @@ index 00000000..80896bbf
+ /**
+ * Returns the name of the player disconnecting.
+ */
+ @NotNull
+ public String getPlayerName() {
+ return this.playerName;
+ }
@ -115,15 +118,18 @@ index 00000000..80896bbf
+ /**
+ * Returns the player's IP address.
+ */
+ @NotNull
+ public InetAddress getIpAddress() {
+ return this.ipAddress;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLERS;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLERS;
+ }

View File

@ -7,7 +7,7 @@ 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 +0,0 @@
@ -17,12 +17,13 @@ index 00000000..d1d6f33c
+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,15 +43,17 @@ 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;
+ }

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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,11 +105,13 @@ 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;
+ }

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -16,15 +16,16 @@ index 00000000..70eeaf5c
+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,15 +40,18 @@ 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;
+ }

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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;

View File

@ -5,11 +5,11 @@ 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
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(MapView map);
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,7 +30,7 @@ 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
@ -56,7 +56,7 @@ 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.");
}
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ -68,7 +68,7 @@ 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.");
}
--

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
new file mode 100644
index 00000000..2ae8826b
index 000000000..73dabb82c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
@@ -0,0 +0,0 @@
@ -17,6 +17,8 @@ index 00000000..2ae8826b
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when TNT block is about to turn into {@link org.bukkit.entity.TNTPrimed}
@ -29,10 +31,10 @@ index 00000000..2ae8826b
+public class TNTPrimeEvent extends BlockEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private PrimeReason reason;
+ private Entity primerEntity;
+ @NotNull private PrimeReason reason;
+ @Nullable private Entity primerEntity;
+
+ public TNTPrimeEvent(Block theBlock, PrimeReason reason, Entity primerEntity) {
+ public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) {
+ super(theBlock);
+ this.reason = reason;
+ this.primerEntity = primerEntity;
@ -43,6 +45,7 @@ index 00000000..2ae8826b
+ *
+ * @return Prime reason
+ */
+ @NotNull
+ public PrimeReason getReason() {
+ return this.reason;
+ }
@ -56,6 +59,7 @@ index 00000000..2ae8826b
+ *
+ * @return The {@link Entity} who primed the TNT
+ */
+ @Nullable
+ public Entity getPrimerEntity() {
+ return this.primerEntity;
+ }
@ -80,11 +84,13 @@ index 00000000..2ae8826b
+ this.cancelled = cancel;
+ }
+
+ @Nullable
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Nullable
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -16,18 +16,19 @@ index 00000000..19d634c3
+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,15 +76,17 @@ 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;
+ }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add WhitelistToggleEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
new file mode 100644
index 00000000..e7b785e7
index 000000000..fdd5eedb2
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
@@ -0,0 +0,0 @@
@ -14,6 +14,7 @@ index 00000000..e7b785e7
+
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * This event is fired when whitelist is toggled
@ -38,11 +39,13 @@ index 00000000..e7b785e7
+ return enabled;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Add World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index c73b7065..e424ed4e 100644
index dcc47cde5..5ccd8500d 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Collection<Entity> getNearbyEntities(Location location, double x, double y, double z);
@NotNull
public Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z);
+ // Paper start - getEntity by UUID API
+ /**
@ -19,7 +19,8 @@ index c73b7065..e424ed4e 100644
+ * @param uuid the UUID of the entity
+ * @return the entity with the given UUID, or null if it isn't found
+ */
+ public Entity getEntity(UUID uuid);
+ @Nullable
+ public Entity getEntity(@NotNull UUID uuid);
+ // Paper end
+
/**

View File

@ -6,16 +6,9 @@ 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
@@ -0,0 +0,0 @@
package org.bukkit.event;
+import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
/**
@@ -0,0 +0,0 @@ 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 {

View File

@ -6,12 +6,14 @@ Subject: [PATCH] Add an API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/com/destroystokyo/paper/Namespaced.java b/src/main/java/com/destroystokyo/paper/Namespaced.java
new file mode 100644
index 00000000..2baf58b7
index 000000000..cd1a34b82
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/Namespaced.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a namespaced resource, see {@link org.bukkit.NamespacedKey} for single elements
+ * or {@link com.destroystokyo.paper.NamespacedTag} for a collection of elements
@ -34,6 +36,7 @@ index 00000000..2baf58b7
+ *
+ * @return resource namespace
+ */
+ @NotNull
+ String getNamespace();
+
+ /**
@ -44,11 +47,12 @@ index 00000000..2baf58b7
+ *
+ * @return resource key
+ */
+ @NotNull
+ String getKey();
+}
diff --git a/src/main/java/com/destroystokyo/paper/NamespacedTag.java b/src/main/java/com/destroystokyo/paper/NamespacedTag.java
new file mode 100644
index 00000000..89949827
index 000000000..28f3fda95
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/NamespacedTag.java
@@ -0,0 +0,0 @@
@ -59,6 +63,7 @@ index 00000000..89949827
+import java.util.UUID;
+import java.util.regex.Pattern;
+import org.bukkit.plugin.Plugin;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a String based key pertaining to a tagged entry. Consists of two components - a namespace
@ -98,7 +103,7 @@ index 00000000..89949827
+ * @deprecated should never be used by plugins, for internal use only!!
+ */
+ @Deprecated
+ public NamespacedTag(String namespace, String key) {
+ public NamespacedTag(@NotNull String namespace, @NotNull String key) {
+ Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
+ Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key);
+
@ -121,7 +126,7 @@ index 00000000..89949827
+ * @param plugin the plugin to use for the namespace
+ * @param key the key to create
+ */
+ public NamespacedTag(Plugin plugin, String key) {
+ public NamespacedTag(@NotNull Plugin plugin, @NotNull String key) {
+ Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
+ Preconditions.checkArgument(key != null, "Key cannot be null");
+
@ -136,10 +141,12 @@ index 00000000..89949827
+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters (%s)", string);
+ }
+
+ @NotNull
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @NotNull
+ public String getKey() {
+ return key;
+ }
@ -186,15 +193,16 @@ index 00000000..89949827
+ * @param key the key to use
+ * @return new key in the Minecraft namespace
+ */
+ public static NamespacedTag minecraft(String key) {
+ @NotNull
+ public static NamespacedTag minecraft(@NotNull String key) {
+ return new NamespacedTag(MINECRAFT, key);
+ }
+}
diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java
index fe8d3468..074769c1 100644
index f5e3929aa..8648e8fb6 100644
--- a/src/main/java/org/bukkit/NamespacedKey.java
+++ b/src/main/java/org/bukkit/NamespacedKey.java
@@ -0,0 +0,0 @@ import org.bukkit.plugin.Plugin;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
* underscores, hyphens, and forward slashes.
*
*/
@ -204,20 +212,21 @@ index fe8d3468..074769c1 100644
/**
* The namespace representing all inbuilt keys.
@@ -0,0 +0,0 @@ public final class NamespacedKey {
Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters (%s)", string);
}
@NotNull
+ @Override // Paper
public String getNamespace() {
return namespace;
}
@NotNull
+ @Override // Paper
public String getKey() {
return key;
}
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 4d0351c4..03e3cfd4 100644
index f2a6755a5..3ed7ea06a 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
@ -228,6 +237,7 @@ index 4d0351c4..03e3cfd4 100644
+ *
* @return a list of lore that is set
*/
@Nullable
List<String> getLore();
/**
@ -237,7 +247,7 @@ index 4d0351c4..03e3cfd4 100644
*
* @param lore the lore that will be set
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
int getEnchantLevel(Enchantment ench);
int getEnchantLevel(@NotNull Enchantment ench);
/**
- * Returns a copy the enchantments in this ItemMeta. <br>
@ -246,7 +256,7 @@ index 4d0351c4..03e3cfd4 100644
*
* @return An immutable copy of the enchantments
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
@NotNull
Spigot spigot();
// Spigot end
+ // Paper start - Add an API for CanPlaceOn and CanDestroy NBT values
@ -291,6 +301,7 @@ index 4d0351c4..03e3cfd4 100644
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ Set<com.destroystokyo.paper.Namespaced> getDestroyableKeys();
+
+ /**
@ -298,13 +309,14 @@ index 4d0351c4..03e3cfd4 100644
+ *
+ * @param canDestroy Collection of {@link com.destroystokyo.paper.Namespaced}
+ */
+ void setDestroyableKeys(Collection<com.destroystokyo.paper.Namespaced> canDestroy);
+ void setDestroyableKeys(@NotNull Collection<com.destroystokyo.paper.Namespaced> canDestroy);
+
+ /**
+ * Gets the collection of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ Set<com.destroystokyo.paper.Namespaced> getPlaceableKeys();
+
+ /**
@ -312,7 +324,8 @@ index 4d0351c4..03e3cfd4 100644
+ *
+ * @param canPlaceOn Collection of {@link com.destroystokyo.paper.Namespaced}
+ */
+ void setPlaceableKeys(Collection<com.destroystokyo.paper.Namespaced> canPlaceOn);
+ @NotNull
+ void setPlaceableKeys(@NotNull Collection<com.destroystokyo.paper.Namespaced> canPlaceOn);
+
+ /**
+ * Checks for the existence of any keys that the item can be placed on

View File

@ -7,7 +7,7 @@ Not here to name and shame, only so server admins can be aware of which
plugins have and haven't been updated.
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index a4aabfe7..f462b631 100644
index a4aabfe7f..f462b631b 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -0,0 +0,0 @@ public interface UnsafeValues {
@ -22,7 +22,7 @@ index a4aabfe7..f462b631 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
index b1d384e8..72c0c0bc 100644
index d4e74d292..6cfd9f3c6 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -0,0 +0,0 @@ public class PluginsCommand extends BukkitCommand {
@ -42,7 +42,7 @@ index b1d384e8..72c0c0bc 100644
StringBuilder pluginList = new StringBuilder();
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index c7782e7d..39f92d88 100644
index 095448fe7..e91cb2c78 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {

View File

@ -6,7 +6,7 @@ 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
@@ -0,0 +0,0 @@ public final class Bukkit {
@ -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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ public class ReloadCommand extends BukkitCommand {
public ReloadCommand(String name) {
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
@ -77,22 +77,20 @@ index 0ab7e295..f331a442 100644
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
Bukkit.reload();
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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

View File

@ -6,7 +6,7 @@ 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
@@ -0,0 +0,0 @@ public final class Bukkit {
@ -25,9 +25,9 @@ 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
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
@ -46,7 +46,7 @@ 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
@@ -0,0 +0,0 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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 +0,0 @@
@ -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
@@ -0,0 +0,0 @@ import java.util.Iterator;
@ -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
@@ -0,0 +0,0 @@ import java.util.logging.Level;

View File

@ -8,7 +8,7 @@ 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 +0,0 @@
@ -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 +0,0 @@
@ -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
@@ -0,0 +0,0 @@ import org.bukkit.event.server.ServerListPingEvent;
*/
public interface CachedServerIcon {
public String getData(); // Spigot
+
@@ -0,0 +0,0 @@ public interface CachedServerIcon {
@Nullable
public String getData(); // Paper
+ // Paper start
+ default boolean isEmpty() {
+ return getData() == null;

View File

@ -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
@@ -0,0 +0,0 @@ public interface ItemFactory {
* @return A potentially Data Converted ItemStack
*/
ItemStack ensureServerConversions(ItemStack item);
@NotNull
ItemStack ensureServerConversions(@NotNull ItemStack item);
+
+ /**
+ * Gets the Display name as seen in the Client.
@ -24,11 +24,12 @@ 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
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
@ -43,6 +44,7 @@ index 5e8de115..c3cb1247 100644
+ *
+ * @return Display name of Item
+ */
+ @Nullable
+ public String getI18NDisplayName() {
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
+ }

View File

@ -1,256 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 18 Jun 2018 00:41:46 -0500
Subject: [PATCH] Add "getNearbyXXX" methods to Location
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 916238c4..162a76e8 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -0,0 +0,0 @@ import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.util.NumberConversions;
import org.bukkit.util.Vector;
+// Paper start
+import java.util.Collection;
+import java.util.Collections;
+import java.util.function.Predicate;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+// Paper end
+
/**
* Represents a 3-dimensional position in a world.
* <br>
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
centerLoc.setZ(getBlockZ() + 0.5);
return centerLoc;
}
+
+ /**
+ * Returns a list of entities within a bounding box centered around a Location.
+ *
+ * Some implementations may impose artificial restrictions on the size of the search bounding box.
+ *
+ * @param x 1/2 the size of the box along x axis
+ * @param y 1/2 the size of the box along y axis
+ * @param z 1/2 the size of the box along z axis
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public Collection<Entity> getNearbyEntities(double x, double y, double z) {
+ if (world == null) {
+ throw new IllegalArgumentException("Location has no world");
+ }
+ return world.getNearbyEntities(this, x, y, z);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X Radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius Radius
+ * @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 Collection<LivingEntity> getNearbyLivingEntities(double radius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius, predicate);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @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 Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius, predicate);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z radius
+ * @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 Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius, predicate);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X/Y/Z Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+
+ public Collection<Player> getNearbyPlayers(double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X/Y/Z Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double radius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius, predicate);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius, predicate);
+ }
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius, predicate);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param radius X/Y/Z radius to search within
+ * @param <T> the entity type
+ * @return the collection of entities of type clazz near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double radius) {
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, null);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
+ * @param clazz Type to filter by
+ * @param xzRadius X/Z radius to search within
+ * @param yRadius Y radius to search within
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param radius X/Y/Z radius to search within
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double radius, Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, predicate);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
+ * @param clazz Type to filter by
+ * @param xzRadius X/Z radius to search within
+ * @param yRadius Y radius to search within
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double xzRadius, double yRadius, Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends Entity> clazz, double xRadius, double yRadius, double zRadius, Predicate<T> predicate) {
+ if (world == null) {
+ throw new IllegalArgumentException("Location has no world");
+ }
+ return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate);
+ }
// Paper end
@Override
public boolean equals(Object obj) {
--

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public final class Bukkit {
@ -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
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
*/
Entity getEntity(UUID uuid);
@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
+

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add hand to bucket events
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
index 8fb121a9..7b9596f3 100644
index cdf2e2016..5e93f1bbb 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
@ -14,23 +14,23 @@ index 8fb121a9..7b9596f3 100644
import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
/**
@@ -0,0 +0,0 @@ public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
super(who, blockClicked, blockFace, bucket, itemInHand);
}
+ // Paper start - add EquipmentSlot
+ public PlayerBucketEmptyEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand, final EquipmentSlot hand) {
+ public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
+ }
+ // Paper end
+
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
index 56584687..3dbe428b 100644
index d0ccba060..280ca87bb 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
@ -39,20 +39,20 @@ index 56584687..3dbe428b 100644
import org.bukkit.event.Cancellable;
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
/**
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
private final Block blockClicked;
private final BlockFace blockFace;
private final Material bucket;
+ private final EquipmentSlot hand; // Paper - add EquipmentSlot
public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
+ // Paper start - add EquipmentSlot
+ this(who, blockClicked, blockFace, bucket, itemInHand, null);
+ }
+
+ public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand, final EquipmentSlot hand) {
+ public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @Nullable final EquipmentSlot hand) {
+ // Paper end
super(who);
this.blockClicked = blockClicked;
@ -73,6 +73,7 @@ index 56584687..3dbe428b 100644
+ *
+ * @return the hand used
+ */
+ @NotNull
+ public EquipmentSlot getHand() {
+ return hand;
+ }
@ -82,7 +83,7 @@ index 56584687..3dbe428b 100644
return cancelled;
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
index 94e042a3..884b9240 100644
index cc1b03eb2..15be7128b 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
@ -91,19 +92,20 @@ index 94e042a3..884b9240 100644
import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
/**
@@ -0,0 +0,0 @@ public class PlayerBucketFillEvent extends PlayerBucketEvent {
super(who, blockClicked, blockFace, bucket, itemInHand);
}
+
+ // Paper start - add EquipmentSlot
+ public PlayerBucketFillEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand, final EquipmentSlot hand) {
+ public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
+ }
+ // Paper end
+
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
--

View File

@ -7,7 +7,7 @@ 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 +0,0 @@
@ -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,16 +216,18 @@ 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;
+ }

View File

@ -5,13 +5,13 @@ 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
@@ -0,0 +0,0 @@ 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,7 +19,7 @@ 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
}
--

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add more Witch API
diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java
index 4b27f689..64ec8409 100644
index 4b27f6890..1828b2ced 100644
--- a/src/main/java/org/bukkit/entity/Witch.java
+++ b/src/main/java/org/bukkit/entity/Witch.java
@@ -0,0 +0,0 @@ package org.bukkit.entity;
@ -14,7 +14,7 @@ index 4b27f689..64ec8409 100644
+// Paper start
+import org.bukkit.inventory.ItemStack;
+import javax.annotation.Nullable;
+import org.jetbrains.annotations.Nullable;
+// Paper end
+
/**
@ -42,6 +42,7 @@ index 4b27f689..64ec8409 100644
+ *
+ * @return The potion the witch is drinking
+ */
+ @Nullable
+ ItemStack getDrinkingPotion();
+
+ /**

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add more Zombie API
diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java
index 48034198..615dd990 100644
index ee2e70c67..74d6529a1 100644
--- a/src/main/java/org/bukkit/entity/Zombie.java
+++ b/src/main/java/org/bukkit/entity/Zombie.java
@@ -0,0 +0,0 @@ public interface Zombie extends Monster {

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity
diff --git a/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java
new file mode 100644
index 00000000..fe43d955
index 000000000..18a96dbb0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java
@@ -0,0 +0,0 @@
@ -14,6 +14,7 @@ index 00000000..fe43d955
+
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents information about a targeted block
@ -22,7 +23,7 @@ index 00000000..fe43d955
+ private final Block block;
+ private final BlockFace blockFace;
+
+ public TargetBlockInfo(Block block, BlockFace blockFace) {
+ public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) {
+ this.block = block;
+ this.blockFace = blockFace;
+ }
@ -32,6 +33,7 @@ index 00000000..fe43d955
+ *
+ * @return Targeted block
+ */
+ @NotNull
+ public Block getBlock() {
+ return block;
+ }
@ -41,6 +43,7 @@ index 00000000..fe43d955
+ *
+ * @return Targeted blockface
+ */
+ @NotNull
+ public BlockFace getBlockFace() {
+ return blockFace;
+ }
@ -50,6 +53,7 @@ index 00000000..fe43d955
+ *
+ * @return Block relative to targeted block
+ */
+ @NotNull
+ public Block getRelativeBlock() {
+ return block.getRelative(blockFace);
+ }
@ -61,12 +65,12 @@ index 00000000..fe43d955
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index e3bc04e1..bd47e720 100644
index 863d727d0..4dec50caf 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
public Block getTargetBlock(Set<Material> transparent, int maxDistance);
@NotNull
public Block getTargetBlock(@Nullable Set<Material> transparent, int maxDistance);
+ // Paper start
+ /**
@ -90,7 +94,7 @@ index e3bc04e1..bd47e720 100644
+ * or null if no block is within maxDistance
+ */
+ @Nullable
+ public Block getTargetBlock(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+ public Block getTargetBlock(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+
+ /**
+ * Gets the blockface of that block that the living entity has targeted, ignoring fluids
@ -113,7 +117,7 @@ index e3bc04e1..bd47e720 100644
+ * or null if no block is targeted
+ */
+ @Nullable
+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+
+ /**
+ * Gets information about the block the living entity has targeted, ignoring fluids
@ -136,7 +140,7 @@ index e3bc04e1..bd47e720 100644
+ * or null if no block is targeted
+ */
+ @Nullable
+ public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+ public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+ // Paper end
+
/**

View File

@ -7,19 +7,18 @@ 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
@@ -0,0 +0,0 @@
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;
import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ public class FormattedCommandAlias extends Command {
ArrayList<String> commands = new ArrayList<String>();
for (String formatString : formatStrings) {
@ -33,8 +32,8 @@ index 9c80f464..631be1cb 100644
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

View File

@ -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
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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.
@@ -0,0 +0,0 @@ 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,15 +40,16 @@ 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
@@ -0,0 +0,0 @@
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;
+
/**
@ -57,7 +57,7 @@ index 15c1dfd9..a458000f 100644
*/
@@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta {
@Deprecated
boolean setOwner(String owner);
boolean setOwner(@Nullable String owner);
+ // Paper start
+ /**

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add source block to BlockPhysicsEvent
diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
index a34359ed..cda896fa 100644
index 75d4e70f5..a28731dc2 100644
--- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
@@ -0,0 +0,0 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
@ -19,7 +19,7 @@ index a34359ed..cda896fa 100644
+ }
+ // Paper end
+
public BlockPhysicsEvent(final Block block, final BlockData changed) {
public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) {
this(block, changed, block);
}
--

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@
@ -14,8 +14,9 @@ index f37491d7..30882559 100644
+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;

View File

@ -8,7 +8,7 @@ Subject: [PATCH] Add spectator target events
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
new file mode 100644
index 00000000..d3b7cc27
index 000000000..b8ec7ef2d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
@@ -0,0 +0,0 @@
@ -19,6 +19,7 @@ index 00000000..d3b7cc27
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Triggered when a player starts spectating an entity in spectator mode.
@ -27,10 +28,10 @@ index 00000000..d3b7cc27
+
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private final Entity currentSpectatorTarget;
+ private final Entity newSpectatorTarget;
+ @NotNull private final Entity currentSpectatorTarget;
+ @NotNull private final Entity newSpectatorTarget;
+
+ public PlayerStartSpectatingEntityEvent(Player player, Entity currentSpectatorTarget, Entity newSpectatorTarget) {
+ public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) {
+ super(player);
+ this.currentSpectatorTarget = currentSpectatorTarget;
+ this.newSpectatorTarget = newSpectatorTarget;
@ -41,6 +42,7 @@ index 00000000..d3b7cc27
+ *
+ * @return The entity the player is currently spectating (before they start spectating the new target).
+ */
+ @NotNull
+ public Entity getCurrentSpectatorTarget() {
+ return currentSpectatorTarget;
+ }
@ -50,6 +52,7 @@ index 00000000..d3b7cc27
+ *
+ * @return The entity the player is now going to be spectating.
+ */
+ @NotNull
+ public Entity getNewSpectatorTarget() {
+ return newSpectatorTarget;
+ }
@ -64,11 +67,13 @@ index 00000000..d3b7cc27
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -76,7 +81,7 @@ index 00000000..d3b7cc27
+
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
new file mode 100644
index 00000000..ce23caaf
index 000000000..693d119ab
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
@@ -0,0 +0,0 @@
@ -87,6 +92,7 @@ index 00000000..ce23caaf
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Triggered when a player stops spectating an entity in spectator mode.
@ -95,9 +101,9 @@ index 00000000..ce23caaf
+
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private final Entity spectatorTarget;
+ @NotNull private final Entity spectatorTarget;
+
+ public PlayerStopSpectatingEntityEvent(Player player, Entity spectatorTarget) {
+ public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) {
+ super(player);
+ this.spectatorTarget = spectatorTarget;
+ }
@ -107,6 +113,7 @@ index 00000000..ce23caaf
+ *
+ * @return The entity the player is currently spectating (before they will stop).
+ */
+ @NotNull
+ public Entity getSpectatorTarget() {
+ return spectatorTarget;
+ }
@ -121,11 +128,13 @@ index 00000000..ce23caaf
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add sun related API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 60b7f2e3..5df75830 100644
index 6b91635fe..3d8ff98a8 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
@ -26,12 +26,12 @@ index 60b7f2e3..5df75830 100644
* Returns whether the world has an ongoing storm.
*
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
index 48eddcd3..1b108a4a 100644
index afdc103fe..784db447d 100644
--- a/src/main/java/org/bukkit/entity/Mob.java
+++ b/src/main/java/org/bukkit/entity/Mob.java
@@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable {
* @return Pathfinding Manager for this entity
*/
@NotNull
com.destroystokyo.paper.entity.Pathfinder getPathfinder();
+
+ /**

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -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,7 +155,7 @@ 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
@@ -0,0 +0,0 @@ import org.json.simple.parser.ParseException;
@ -193,7 +194,7 @@ 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());
--

View File

@ -14,7 +14,7 @@ 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 +0,0 @@
@ -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,7 +60,7 @@ 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
@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase {
@ -85,7 +87,7 @@ 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
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot

View File

@ -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
@@ -0,0 +0,0 @@ package org.bukkit;
@ -19,8 +19,8 @@ index d499e41b..bc6a51d7 100644
import java.util.HashMap;
import java.util.List;
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Collection<Entity> getEntitiesByClasses(Class<?>... classes);
@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;
+ }

View File

@ -18,17 +18,9 @@ Y range: [0, 1023]
X, Z range: [-67 108 864, 67 108 863]
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 8dcb15fb..7e1ee875 100644
index d38f15142..d3cff9de8 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -0,0 +0,0 @@ import org.bukkit.util.Vector;
// Paper start
import java.util.Collection;
-import java.util.Collections;
import java.util.function.Predicate;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
blockLoc.setZ(getBlockZ());
return blockLoc;
@ -49,12 +41,12 @@ index 8dcb15fb..7e1ee875 100644
* @return A new location where X/Y/Z are the center of the block
*/
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 61f2cd9a..30204b98 100644
index 1b0744ed9..158917492 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Block getBlockAt(Location location);
@NotNull
public Block getBlockAt(@NotNull Location location);
+ // Paper start
+ /**
@ -65,6 +57,7 @@ index 61f2cd9a..30204b98 100644
+ * @see Location#toBlockKey()
+ * @see Block#getBlockKey()
+ */
+ @NotNull
+ public default Block getBlockAtKey(long key) {
+ int x = (int) ((key << 37) >> 37);
+ int y = (int) (key >>> 54);
@ -79,6 +72,7 @@ index 61f2cd9a..30204b98 100644
+ * @see Location#toBlockKey()
+ * @see Block#getBlockKey()
+ */
+ @NotNull
+ public default Location getLocationAtKey(long key) {
+ int x = (int) ((key << 37) >> 37);
+ int y = (int) (key >>> 54);
@ -91,7 +85,7 @@ index 61f2cd9a..30204b98 100644
* Gets the y coordinate of the lowest block at this position such that the
* block and all blocks above it are transparent for lighting purposes.
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 064acf32..d1a9512a 100644
index 708288e99..42f31db29 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -0,0 +0,0 @@ public interface Block extends Metadatable {

View File

@ -6,7 +6,7 @@ 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
@@ -0,0 +0,0 @@ public final class Bukkit {
@ -24,9 +24,9 @@ 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
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
@ -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
@@ -0,0 +0,0 @@ public interface CommandMap {
* @throws IllegalArgumentException if either sender or cmdLine are null
*/
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,11 +51,12 @@ 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
@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap {
@ -64,17 +65,18 @@ index 65ad78c4..41e95692 100644
}
+
+ // 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
@@ -0,0 +0,0 @@ public class ReloadCommand extends BukkitCommand {
public ReloadCommand(String name) {
public ReloadCommand(@NotNull String name) {
super(name);
this.description = "Reloads the server configuration and plugins";
- this.usageMessage = "/reload [permissions]"; // Paper

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index 099da6ce..859f166f 100644
index 387d04e5b..492df420b 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {

View File

@ -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
@@ -0,0 +0,0 @@
<scope>compile</scope>
<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
@@ -0,0 +0,0 @@ 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());
+ }

View File

@ -5,29 +5,37 @@ Subject: [PATCH] Allow setting the vex's summoner
diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java
index 7b9b21e5..23a15f8f 100644
index 6b61c4ab7..c34a3ea7b 100644
--- a/src/main/java/org/bukkit/entity/Vex.java
+++ b/src/main/java/org/bukkit/entity/Vex.java
@@ -0,0 +0,0 @@
package org.bukkit.entity;
+import org.jetbrains.annotations.Nullable;
+
/**
* Represents a Vex.
*/
@@ -0,0 +0,0 @@ public interface Vex extends Monster {
* @param charging new state
*/
void setCharging(boolean charging);
+
+ // Paper start
/**
- * @return What Entity (most likely an Evoker, but not guaranteed) summoned this Vex
+ /**
+ * Get the Mob that summoned this vex
+ *
+ * @return Mob that summoned this vex
+ */
+ @Nullable
+ Mob getSummoner();
+
+ /**
+ * Set the summoner of this vex
+ *
+ * @param summoner New summoner
*/
- Mob getSummoner(); // Paper
+ void setSummoner(Mob summoner);
+ */
+ void setSummoner(@Nullable Mob summoner);
+ // Paper end
}
--

View File

@ -0,0 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 17 Mar 2019 23:04:30 +0000
Subject: [PATCH] Annotation Test changes
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index dfd6e137c..596f28076 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -0,0 +0,0 @@ public class AnnotationTest {
"org/bukkit/util/io/Wrapper",
"org/bukkit/plugin/java/PluginClassLoader",
// Generic functional interface
- "org/bukkit/util/Consumer"
+ "org/bukkit/util/Consumer",
+ // Paper start
+ // Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull
+ "co/aikar/timings/TimingHistory$2",
+ "co/aikar/timings/TimingHistory$2$1",
+ "co/aikar/timings/TimingHistory$2$1$1",
+ "co/aikar/timings/TimingHistory$2$1$2",
+ "co/aikar/timings/TimingHistory$3",
+ "co/aikar/timings/TimingHistory$4",
+ "co/aikar/timings/TimingHistoryEntry$1"
+ // Paper end
};
@Test
--

View File

@ -6,7 +6,7 @@ Subject: [PATCH] AnvilDamageEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
new file mode 100644
index 00000000..fd3c5c02
index 000000000..a83c286c1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
@@ -0,0 +0,0 @@
@ -19,6 +19,8 @@ index 00000000..fd3c5c02
+import org.bukkit.event.inventory.InventoryEvent;
+import org.bukkit.inventory.AnvilInventory;
+import org.bukkit.inventory.InventoryView;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when an anvil is damaged from being used
@ -28,11 +30,12 @@ index 00000000..fd3c5c02
+ private boolean cancel;
+ private DamageState damageState;
+
+ public AnvilDamagedEvent(InventoryView inventory, BlockData blockData) {
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @NotNull BlockData blockData) {
+ super(inventory);
+ this.damageState = DamageState.getState(blockData);
+ }
+
+ @NotNull
+ @Override
+ public AnvilInventory getInventory() {
+ return (AnvilInventory) super.getInventory();
@ -43,6 +46,7 @@ index 00000000..fd3c5c02
+ *
+ * @return Damage state
+ */
+ @NotNull
+ public DamageState getDamageState() {
+ return damageState;
+ }
@ -52,7 +56,7 @@ index 00000000..fd3c5c02
+ *
+ * @param damageState Damage state
+ */
+ public void setDamageState(DamageState damageState) {
+ public void setDamageState(@NotNull DamageState damageState) {
+ this.damageState = damageState;
+ }
+
@ -86,10 +90,12 @@ index 00000000..fd3c5c02
+ this.cancel = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -105,7 +111,7 @@ index 00000000..fd3c5c02
+
+ private Material material;
+
+ DamageState(Material material) {
+ DamageState(@NotNull Material material) {
+ this.material = material;
+ }
+
@ -114,6 +120,7 @@ index 00000000..fd3c5c02
+ *
+ * @return Material
+ */
+ @NotNull
+ public Material getMaterial() {
+ return material;
+ }
@ -125,7 +132,8 @@ index 00000000..fd3c5c02
+ * @return DamageState
+ * @throws IllegalArgumentException If non anvil block data is given
+ */
+ public static DamageState getState(BlockData blockData) {
+ @NotNull
+ public static DamageState getState(@Nullable BlockData blockData) {
+ return blockData == null ? BROKEN : getState(blockData.getMaterial());
+ }
+
@ -136,7 +144,8 @@ index 00000000..fd3c5c02
+ * @return DamageState
+ * @throws IllegalArgumentException If non anvil material is given
+ */
+ public static DamageState getState(Material material) {
+ @NotNull
+ public static DamageState getState(@Nullable Material material) {
+ if (material == null) {
+ return BROKEN;
+ }

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public interface Arrow extends Projectile {

View File

@ -8,7 +8,7 @@ Adds API's to load or generate chunks asynchronously.
Also adds utility methods to Entity to teleport asynchronously.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 807bd7fc..51cf7fd3 100644
index c5da4d387..1b0744ed9 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
@ -33,11 +33,11 @@ index 807bd7fc..51cf7fd3 100644
+ */
+ @Deprecated
+ public static interface ChunkLoadCallback extends java.util.function.Consumer<Chunk> {
+ public void onLoad(Chunk chunk);
+ public void onLoad(@NotNull Chunk chunk);
+
+ // backwards compat to old api
+ @Override
+ default void accept(Chunk chunk) {
+ default void accept(@NotNull Chunk chunk) {
+ onLoad(chunk);
+ }
+ }
@ -62,7 +62,7 @@ index 807bd7fc..51cf7fd3 100644
+ * will be executed synchronously
+ */
+ @Deprecated
+ public default void getChunkAtAsync(int x, int z, ChunkLoadCallback cb) {
+ public default void getChunkAtAsync(int x, int z, @NotNull ChunkLoadCallback cb) {
+ getChunkAtAsync(x, z, true).thenAccept(cb::onLoad);
+ }
+
@ -85,7 +85,7 @@ index 807bd7fc..51cf7fd3 100644
+ * will be executed synchronously
+ */
+ @Deprecated
+ public default void getChunkAtAsync(Location loc, ChunkLoadCallback cb) {
+ public default void getChunkAtAsync(@NotNull Location loc, @NotNull ChunkLoadCallback cb) {
+ getChunkAtAsync(loc, true).thenAccept(cb::onLoad);
+ }
+
@ -108,7 +108,7 @@ index 807bd7fc..51cf7fd3 100644
+ * will be executed synchronously
+ */
+ @Deprecated
+ public default void getChunkAtAsync(Block block, ChunkLoadCallback cb) {
+ public default void getChunkAtAsync(@NotNull Block block, @NotNull ChunkLoadCallback cb) {
+ getChunkAtAsync(block, true).thenAccept(cb::onLoad);
+ }
+
@ -130,7 +130,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public default void getChunkAtAsync(int x, int z, java.util.function.Consumer<Chunk> cb) {
+ public default void getChunkAtAsync(int x, int z, @NotNull java.util.function.Consumer<Chunk> cb) {
+ getChunkAtAsync(x, z, true).thenAccept(cb);
+ }
+
@ -153,7 +153,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public default void getChunkAtAsync(int x, int z, boolean gen, java.util.function.Consumer<Chunk> cb) {
+ public default void getChunkAtAsync(int x, int z, boolean gen, @NotNull java.util.function.Consumer<Chunk> cb) {
+ getChunkAtAsync(x, z, gen).thenAccept(cb);
+ }
+
@ -174,7 +174,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public default void getChunkAtAsync(Location loc, java.util.function.Consumer<Chunk> cb) {
+ public default void getChunkAtAsync(@NotNull Location loc, @NotNull java.util.function.Consumer<Chunk> cb) {
+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true, cb);
+ }
+
@ -196,7 +196,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public default void getChunkAtAsync(Location loc, boolean gen, java.util.function.Consumer<Chunk> cb) {
+ public default void getChunkAtAsync(@NotNull Location loc, boolean gen, @NotNull java.util.function.Consumer<Chunk> cb) {
+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, cb);
+ }
+
@ -217,7 +217,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public default void getChunkAtAsync(Block block, java.util.function.Consumer<Chunk> cb) {
+ public default void getChunkAtAsync(@NotNull Block block, @NotNull java.util.function.Consumer<Chunk> cb) {
+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, cb);
+ }
+
@ -239,7 +239,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param cb Callback to receive the chunk when it is loaded.
+ * will be executed synchronously
+ */
+ public default void getChunkAtAsync(Block block, boolean gen, java.util.function.Consumer<Chunk> cb) {
+ public default void getChunkAtAsync(@NotNull Block block, boolean gen, @NotNull java.util.function.Consumer<Chunk> cb) {
+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, cb);
+ }
+
@ -258,7 +258,8 @@ index 807bd7fc..51cf7fd3 100644
+ * @param loc Location to load the corresponding chunk from
+ * @return Future that will resolve when the chunk is loaded
+ */
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(Location loc) {
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Location loc) {
+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true);
+ }
+
@ -278,7 +279,8 @@ index 807bd7fc..51cf7fd3 100644
+ * @param gen Should the chunk generate
+ * @return Future that will resolve when the chunk is loaded
+ */
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(Location loc, boolean gen) {
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Location loc, boolean gen) {
+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen);
+ }
+
@ -297,7 +299,8 @@ index 807bd7fc..51cf7fd3 100644
+ * @param block Block to load the corresponding chunk from
+ * @return Future that will resolve when the chunk is loaded
+ */
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(Block block) {
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Block block) {
+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true);
+ }
+
@ -317,7 +320,8 @@ index 807bd7fc..51cf7fd3 100644
+ * @param gen Should the chunk generate
+ * @return Future that will resolve when the chunk is loaded
+ */
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(Block block, boolean gen) {
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Block block, boolean gen) {
+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen);
+ }
+
@ -338,6 +342,7 @@ index 807bd7fc..51cf7fd3 100644
+ * @param z Z Coord
+ * @return Future that will resolve when the chunk is loaded
+ */
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z) {
+ return getChunkAtAsync(x, z, true);
+ }
@ -360,17 +365,18 @@ index 807bd7fc..51cf7fd3 100644
+ * @param gen Should we generate a chunk if it doesn't exists or not
+ * @return Future that will resolve when the chunk is loaded
+ */
+ @NotNull
+ public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen);
// Paper end
/**
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 2dd7a03c..59787c47 100644
index a7f81d17d..73b75ffda 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
*/
public boolean teleport(Entity destination, TeleportCause cause);
public boolean teleport(@NotNull Entity destination, @NotNull TeleportCause cause);
+ // Paper start
+ /**
@ -378,7 +384,8 @@ index 2dd7a03c..59787c47 100644
+ * @param loc Location to teleport to
+ * @return A future that will be completed with the result of the teleport
+ */
+ public default java.util.concurrent.CompletableFuture<Boolean> teleportAsync(Location loc) {
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Boolean> teleportAsync(@NotNull Location loc) {
+ return teleportAsync(loc, TeleportCause.PLUGIN);
+ }
+ /**
@ -387,7 +394,8 @@ index 2dd7a03c..59787c47 100644
+ * @param cause Reason for teleport
+ * @return A future that will be completed with the result of the teleport
+ */
+ public default java.util.concurrent.CompletableFuture<Boolean> teleportAsync(Location loc, TeleportCause cause) {
+ @NotNull
+ public default java.util.concurrent.CompletableFuture<Boolean> teleportAsync(@NotNull Location loc, @NotNull TeleportCause cause) {
+ java.util.concurrent.CompletableFuture<Boolean> future = new java.util.concurrent.CompletableFuture<>();
+ loc.getWorld().getChunkAtAsync(loc).thenAccept((chunk) -> future.complete(teleport(loc, cause)));
+ return future;

View File

@ -13,7 +13,7 @@ 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 +0,0 @@
@ -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
@@ -0,0 +0,0 @@
@ -196,14 +205,22 @@ index a6229839..f0bc3563 100644
import java.util.List;
import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender;
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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
@ -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

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Automatically disable plugins that fail to load
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
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
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {

View File

@ -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 +0,0 @@
+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 +0,0 @@
@ -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,19 +235,9 @@ 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
@@ -0,0 +0,0 @@ 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
*/
@@ -0,0 +0,0 @@ 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,26 +272,17 @@ 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
@@ -0,0 +0,0 @@ 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.
*/
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
* @return true if player names should be suggested
*/
@ -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,6 +313,7 @@ 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
}

View File

@ -12,7 +12,7 @@ This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
new file mode 100644
index 00000000..a6247718
index 000000000..3aee12f1c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
@@ -0,0 +0,0 @@
@ -23,6 +23,7 @@ index 00000000..a6247718
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired anytime the server intends to 'destroy' a block through some triggering reason.
@ -39,13 +40,13 @@ index 00000000..a6247718
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private final BlockData newState;
+ @NotNull private final BlockData newState;
+ private final boolean willDrop;
+ private boolean playEffect;
+
+ private boolean cancelled = false;
+
+ public BlockDestroyEvent(Block block, BlockData newState, boolean willDrop) {
+ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, boolean willDrop) {
+ super(block);
+ this.newState = newState;
+ this.willDrop = willDrop;
@ -54,6 +55,7 @@ index 00000000..a6247718
+ /**
+ * @return The new state of this block (Air, or a Fluid type)
+ */
+ @NotNull
+ public BlockData getNewState() {
+ return newState;
+ }
@ -96,10 +98,12 @@ index 00000000..a6247718
+ cancelled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }

View File

@ -5,20 +5,20 @@ Subject: [PATCH] Change the reserved channel check to be sensible
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
index f21cae72..865028d3 100644
index 8227b375e..cc750eb3e 100644
--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
@@ -0,0 +0,0 @@ public class StandardMessenger implements Messenger {
public boolean isReservedChannel(String channel) {
public boolean isReservedChannel(@NotNull String channel) {
channel = validateAndCorrectChannel(channel);
- return channel.contains("minecraft") && !channel.equals("minecraft:brand");
+ return channel.equals("minecraft:register") || channel.equals("minecraft:unregister"); // Paper
}
public void registerOutgoingPluginChannel(Plugin plugin, String channel) {
public void registerOutgoingPluginChannel(@NotNull Plugin plugin, @NotNull String channel) {
diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
index c15fa003..31ff2f61 100644
index c15fa0039..31ff2f61d 100644
--- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
+++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
@@ -0,0 +0,0 @@ public class StandardMessengerTest {

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ import org.json.simple.JSONObject;
@ -18,11 +18,11 @@ index 5a994953..f38f6864 100644
+// Paper end
+
public class VersionCommand extends BukkitCommand {
public VersionCommand(String name) {
public VersionCommand(@NotNull String name) {
super(name);
@@ -0,0 +0,0 @@ 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
@ -74,9 +74,9 @@ index 5a994953..f38f6864 100644
}
}
- 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);

View File

@ -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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ public interface PluginManager {
*/
public void disablePlugin(Plugin plugin);
public void disablePlugin(@NotNull Plugin plugin);
+ // Paper start - close Classloader on disable
+ /**
@ -47,14 +46,14 @@ 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
@@ -0,0 +0,0 @@ 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 {
@ -100,7 +98,7 @@ 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
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
@ -113,15 +111,14 @@ index 77207f14..c7782e7d 100644
// Paper end
}
@@ -0,0 +0,0 @@ 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");

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ -15,7 +15,7 @@ index 5109a0c3..96d97bf3 100644
+ * @deprecated use {@link #setResourcePack(String, String)}
*/
+ @Deprecated // Paper
public void setResourcePack(String url);
public void setResourcePack(@NotNull String url);
/**
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ -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
@@ -0,0 +0,0 @@ import org.bukkit.event.HandlerList;
@@ -0,0 +0,0 @@ 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;

View File

@ -5,18 +5,9 @@ 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
@@ -0,0 +0,0 @@ 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).
@@ -0,0 +0,0 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isCancelled = false;

View File

@ -10,24 +10,24 @@ 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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
index 28d0954a..7ad9400a 100644
index 8726bb9a2..21b929f94 100644
--- a/src/main/java/co/aikar/timings/TimingHistory.java
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -0,0 +0,0 @@ public class TimingHistory {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] EnderDragon Events
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
new file mode 100644
index 00000000..ef2a8dab
index 000000000..118c7b677
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFireballHitEvent.java
@@ -0,0 +0,0 @@
@ -20,15 +20,17 @@ index 00000000..ef2a8dab
+import org.bukkit.event.entity.EntityEvent;
+
+import java.util.Collection;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
+ */
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
+ private final Collection<LivingEntity> targets;
+ private final AreaEffectCloud areaEffectCloud;
+ @Nullable private final Collection<LivingEntity> targets;
+ @NotNull private final AreaEffectCloud areaEffectCloud;
+
+ public EnderDragonFireballHitEvent(DragonFireball fireball, Collection<LivingEntity> targets, AreaEffectCloud areaEffectCloud) {
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @Nullable Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
+ super(fireball);
+ this.targets = targets;
+ this.areaEffectCloud = areaEffectCloud;
@ -37,6 +39,7 @@ index 00000000..ef2a8dab
+ /**
+ * The fireball involved in this event
+ */
+ @NotNull
+ @Override
+ public DragonFireball getEntity() {
+ return (DragonFireball) super.getEntity();
@ -49,6 +52,7 @@ index 00000000..ef2a8dab
+ *
+ * @return the targets
+ */
+ @Nullable
+ public Collection<LivingEntity> getTargets() {
+ return targets;
+ }
@ -56,16 +60,19 @@ index 00000000..ef2a8dab
+ /**
+ * @return The area effect cloud spawned in this collision
+ */
+ @NotNull
+ public AreaEffectCloud getAreaEffectCloud() {
+ return areaEffectCloud;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -84,7 +91,7 @@ index 00000000..ef2a8dab
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
new file mode 100644
index 00000000..d8c3ab33
index 000000000..1915177f4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
@@ -0,0 +0,0 @@
@ -95,14 +102,15 @@ index 00000000..d8c3ab33
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
+ */
+public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
+ private final AreaEffectCloud areaEffectCloud;
+ @NotNull private final AreaEffectCloud areaEffectCloud;
+
+ public EnderDragonFlameEvent(EnderDragon enderDragon, AreaEffectCloud areaEffectCloud) {
+ public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
+ super(enderDragon);
+ this.areaEffectCloud = areaEffectCloud;
+ }
@ -110,6 +118,7 @@ index 00000000..d8c3ab33
+ /**
+ * The enderdragon involved in this event
+ */
+ @NotNull
+ @Override
+ public EnderDragon getEntity() {
+ return (EnderDragon) super.getEntity();
@ -118,16 +127,19 @@ index 00000000..d8c3ab33
+ /**
+ * @return The area effect cloud spawned in this collision
+ */
+ @NotNull
+ public AreaEffectCloud getAreaEffectCloud() {
+ return areaEffectCloud;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
@ -146,7 +158,7 @@ index 00000000..d8c3ab33
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
new file mode 100644
index 00000000..aa70dda1
index 000000000..8414bd805
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonShootFireballEvent.java
@@ -0,0 +0,0 @@
@ -157,14 +169,15 @@ index 00000000..aa70dda1
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when an EnderDragon shoots a fireball
+ */
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
+ private final DragonFireball fireball;
+ @NotNull private final DragonFireball fireball;
+
+ public EnderDragonShootFireballEvent(EnderDragon entity, DragonFireball fireball) {
+ public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
+ super(entity);
+ this.fireball = fireball;
+ }
@ -172,6 +185,7 @@ index 00000000..aa70dda1
+ /**
+ * The enderdragon shooting the fireball
+ */
+ @NotNull
+ @Override
+ public EnderDragon getEntity() {
+ return (EnderDragon) super.getEntity();
@ -180,16 +194,19 @@ index 00000000..aa70dda1
+ /**
+ * @return The fireball being shot
+ */
+ @NotNull
+ public DragonFireball getFireball() {
+ return fireball;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }

View File

@ -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
@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Enderman extends Monster {

View File

@ -9,7 +9,7 @@ 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 +0,0 @@
@ -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;
+ }

View File

@ -9,7 +9,7 @@ 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 +0,0 @@
@ -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;
+ }

View File

@ -6,7 +6,7 @@ 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 +0,0 @@
@ -16,6 +16,7 @@ index 00000000..18b158cd
+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,23 +26,25 @@ 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 +0,0 @@
@ -51,22 +54,25 @@ index 00000000..800be6aa
+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;
+ }

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
@ -21,11 +21,12 @@ 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
@@ -0,0 +0,0 @@ public interface FallingBlock extends Entity {
@ -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
@@ -0,0 +0,0 @@ public interface TNTPrimed extends Explosive {
* @return the source of this primed TNT
*/
@Nullable
public Entity getSource();
+
+ /**

View File

@ -5,12 +5,12 @@ 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
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
* @return Location where entity originates or null if not yet added
*/
@Nullable
Location getOrigin();
+
+ /**

View File

@ -6,15 +6,16 @@ Subject: [PATCH] Entity#getChunk API
Get the chunk the entity is currently registered to
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 13de2d74..2dd7a03c 100644
index 373204d37..a7f81d17d 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -0,0 +0,0 @@
package org.bukkit.entity;
+import org.bukkit.Chunk;
import org.bukkit.Location;
+import org.bukkit.Location;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Nameable;
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
* @return True if entity spawned from a mob spawner
@ -26,6 +27,7 @@ index 13de2d74..2dd7a03c 100644
+ *
+ * @return The current, or most recent chunk if the entity is invalid (which may load the chunk)
+ */
+ @NotNull
+ Chunk getChunk();
// Paper end
}

View File

@ -7,7 +7,7 @@ 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 +0,0 @@
@ -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;
+ }

View File

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
@ -14,12 +14,12 @@ index 976b80b7..a5ac3edf 100644
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;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
Adds ability to get what arrow was shot, and control if it should be consumed.
diff --git a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
index f8c91a13..c9eb75aa 100644
index 57f6203d4..efde16174 100644
--- a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
@@ -0,0 +0,0 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
@ -16,22 +16,24 @@ index f8c91a13..c9eb75aa 100644
+ // Paper start
+ private boolean consumeArrow = true;
+ private final ItemStack arrowItem;
+ public boolean getConsumeArrow() {
+ return consumeArrow;
+ }
+ public void setConsumeArrow(boolean consumeArrow) {
+ this.consumeArrow = consumeArrow;
+ }
+ public boolean getConsumeArrow() {
+ return consumeArrow;
+ }
+ @NotNull
+ public ItemStack getArrowItem() {
+ return arrowItem;
+ }
+
+ @Deprecated
public EntityShootBowEvent(final LivingEntity shooter, final ItemStack bow, final Projectile projectile, final float force) {
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Projectile projectile, final float force) {
+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
+ }
+ public EntityShootBowEvent(final LivingEntity shooter, final ItemStack bow, ItemStack arrowItem, final Projectile projectile, final float force) {
+
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull ItemStack arrowItem, @NotNull final Projectile projectile, final float force) {
super(shooter);
+ this.arrowItem = arrowItem;
+ // Paper end

View File

@ -6,7 +6,7 @@ Subject: [PATCH] EntityTransformedEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
new file mode 100644
index 00000000..12194f1f
index 000000000..12194f1fc
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
@@ -0,0 +0,0 @@

View File

@ -8,7 +8,7 @@ Add the following:
- Enable/Disable slot interactions
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index 859f166f..eda4873d 100644
index 492df420b..e7f71e65e 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -0,0 +0,0 @@
@ -17,7 +17,7 @@ index 859f166f..eda4873d 100644
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
* currently holding
*
@ -27,6 +27,7 @@ index 859f166f..eda4873d 100644
+ * @see ArmorStand#getItem(EquipmentSlot)
+ // Paper end
*/
@NotNull
+ @Deprecated // Paper
ItemStack getItemInHand();
@ -41,7 +42,7 @@ index 859f166f..eda4873d 100644
+ // Paper end
*/
+ @Deprecated // Paper
void setItemInHand(ItemStack item);
void setItemInHand(@Nullable ItemStack item);
/**
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
@ -56,7 +57,8 @@ index 859f166f..eda4873d 100644
+ * @param slot the equipment slot to get
+ * @return the ItemStack in the equipment slot
+ */
+ ItemStack getItem(final org.bukkit.inventory.EquipmentSlot slot);
+ @NotNull
+ ItemStack getItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot);
+
+ /**
+ * Sets the item the armor stand has
@ -65,13 +67,14 @@ index 859f166f..eda4873d 100644
+ * @param slot the equipment slot to set
+ * @param item the item to hold
+ */
+ void setItem(final org.bukkit.inventory.EquipmentSlot slot, final ItemStack item);
+ void setItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot, @Nullable final ItemStack item);
+
+ /**
+ * Get the list of disabled slots
+ *
+ * @return list of disabled slots
+ */
+ @NotNull
+ java.util.Set<org.bukkit.inventory.EquipmentSlot> getDisabledSlots();
+
+ /**
@ -82,7 +85,7 @@ index 859f166f..eda4873d 100644
+ *
+ * @param slots var-arg array of slots to lock
+ */
+ void setDisabledSlots(org.bukkit.inventory.EquipmentSlot... slots);
+ void setDisabledSlots(@NotNull org.bukkit.inventory.EquipmentSlot... slots);
+
+ /**
+ * Disable specific slots, adding them
@ -93,7 +96,7 @@ index 859f166f..eda4873d 100644
+ *
+ * @param slots var-arg array of slots to lock
+ */
+ void addDisabledSlots(final org.bukkit.inventory.EquipmentSlot... slots);
+ void addDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
+
+ /**
+ * Remove the given slots from the disabled
@ -103,7 +106,7 @@ index 859f166f..eda4873d 100644
+ *
+ * @param slots var-arg array of slots to unlock
+ */
+ void removeDisabledSlots(final org.bukkit.inventory.EquipmentSlot... slots);
+ void removeDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
+
+ /**
+ * Check if a specific slot is disabled
@ -111,7 +114,7 @@ index 859f166f..eda4873d 100644
+ * @param slot The slot to check
+ * @return {@code true} if the slot is disabled, else {@code false}.
+ */
+ boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot);
+ boolean isSlotDisabled(@NotNull org.bukkit.inventory.EquipmentSlot slot);
// Paper end
}
--

View File

@ -6,12 +6,20 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 162a76e8..056a4d6b 100644
index 3387fb477..56be7e5fa 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -0,0 +0,0 @@ import java.util.Map;
import org.bukkit.block.Block;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
+import org.bukkit.entity.Entity; // Paper
import org.bukkit.util.NumberConversions;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate);
centerLoc.setZ(getBlockZ() + 0.5);
return centerLoc;
}
+
+ /**
@ -62,7 +70,7 @@ index 162a76e8..056a4d6b 100644
+ * @param power The power of explosion, where 4F is TNT
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(Entity source, float power) {
+ public boolean createExplosion(@Nullable Entity source, float power) {
+ return world.createExplosion(source, this, power, true, true);
+ }
+
@ -77,7 +85,7 @@ index 162a76e8..056a4d6b 100644
+ * @param setFire Whether or not to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(Entity source, float power, boolean setFire) {
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
+ return world.createExplosion(source, this, power, setFire, true);
+ }
+
@ -91,19 +99,19 @@ index 162a76e8..056a4d6b 100644
+ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(Entity source, float power, boolean setFire, boolean breakBlocks) {
+ public boolean createExplosion(@NotNull Entity source, float power, boolean setFire, boolean breakBlocks) {
+ return world.createExplosion(source, source.getLocation(), power, setFire, breakBlocks);
+ }
// Paper end
@Override
public boolean equals(Object obj) {
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 6b7eeeac..c73b7065 100644
index bec405feb..dcc47cde5 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public boolean createExplosion(Location loc, float power, boolean setFire);
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire);
+ // Paper start
+ /**
@ -117,7 +125,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks);
+ public boolean createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks);
+
+ /**
+ * Creates explosion at given location with given power and optionally
@ -131,7 +139,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param setFire Whether or not to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
+ */
+ public default boolean createExplosion(Entity source, Location loc, float power, boolean setFire) {
+ public default boolean createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire) {
+ return createExplosion(source, loc, power, setFire, true);
+ }
+ /**
@ -143,7 +151,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param power The power of explosion, where 4F is TNT
+ * @return false if explosion was canceled, otherwise true
+ */
+ public default boolean createExplosion(Entity source, Location loc, float power) {
+ public default boolean createExplosion(@Nullable Entity source, @NotNull Location loc, float power) {
+ return createExplosion(source, loc, power, true, true);
+ }
+ /**
@ -156,7 +164,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
+ public default boolean createExplosion(Entity source, float power, boolean setFire, boolean breakBlocks) {
+ public default boolean createExplosion(@NotNull Entity source, float power, boolean setFire, boolean breakBlocks) {
+ return createExplosion(source, source.getLocation(), power, setFire, breakBlocks);
+ }
+ /**
@ -170,7 +178,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param setFire Whether or not to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
+ */
+ public default boolean createExplosion(Entity source, float power, boolean setFire) {
+ public default boolean createExplosion(@NotNull Entity source, float power, boolean setFire) {
+ return createExplosion(source, source.getLocation(), power, setFire, true);
+ }
+
@ -182,7 +190,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param power The power of explosion, where 4F is TNT
+ * @return false if explosion was canceled, otherwise true
+ */
+ public default boolean createExplosion(Entity source, float power) {
+ public default boolean createExplosion(@NotNull Entity source, float power) {
+ return createExplosion(source, source.getLocation(), power, true, true);
+ }
+
@ -196,7 +204,7 @@ index 6b7eeeac..c73b7065 100644
+ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
+ public default boolean createExplosion(Location loc, float power, boolean setFire, boolean breakBlocks) {
+ public default boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks) {
+ return createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks);
+ }
+ // Paper end

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Expand Location Manipulation API
Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z);
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 056a4d6b..8dcb15fb 100644
index 56be7e5fa..d38f15142 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
@ -23,6 +23,7 @@ index 056a4d6b..8dcb15fb 100644
+ * @param z Z coordinate
+ * @return self (not cloned)
+ */
+ @NotNull
+ public Location set(double x, double y, double z) {
+ this.x = x;
+ this.y = y;
@ -40,7 +41,8 @@ index 056a4d6b..8dcb15fb 100644
+ * @param z Z coordinate to add to base
+ * @return self (not cloned)
+ */
+ public Location add(Location base, double x, double y, double z) {
+ @NotNull
+ public Location add(@NotNull Location base, double x, double y, double z) {
+ return this.set(base.x + x, base.y + y, base.z + z);
+ }
+
@ -54,7 +56,8 @@ index 056a4d6b..8dcb15fb 100644
+ * @param z Z coordinate to subtract from base
+ * @return self (not cloned)
+ */
+ public Location subtract(Location base, double x, double y, double z) {
+ @NotNull
+ public Location subtract(@NotNull Location base, double x, double y, double z) {
+ return this.set(base.x - x, base.y - y, base.z - z);
+ }
+

View File

@ -10,7 +10,7 @@ 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 +0,0 @@
@ -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,12 +487,13 @@ 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
@@ -0,0 +0,0 @@ public enum Particle {
@ -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
@@ -0,0 +0,0 @@ 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,7 +571,7 @@ 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
+

View File

@ -9,7 +9,7 @@ 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 +0,0 @@
@ -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;
+ }

View File

@ -8,13 +8,14 @@ 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
@@ -0,0 +0,0 @@
package org.bukkit.entity;
+import javax.annotation.Nullable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable; // Paper
+
/**
* Represents an Experience Orb.
@ -111,6 +112,7 @@ 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
}

View File

@ -5,13 +5,13 @@ 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
@@ -0,0 +0,0 @@ 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,7 +22,7 @@ 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

View File

@ -1,38 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Tue, 4 Sep 2018 15:01:54 -0500
Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index ddf226a4..db6bcae5 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param profile The new profile to use
*/
void setPlayerProfile(PlayerProfile profile);
+
+ /**
+ * Returns the amount of ticks the current cooldown lasts
+ *
+ * @return Amount of ticks cooldown will last
+ */
+ float getCooldownPeriod();
+
+ /**
+ * Returns the percentage of attack power available based on the cooldown (zero to one).
+ *
+ * @param adjustTicks Amount of ticks to add to cooldown counter for this calculation
+ * @return Percentage of attack power available
+ */
+ float getCooledAttackStrength(float adjustTicks);
+
+ /**
+ * Reset the cooldown counter to 0, effectively starting the cooldown period.
+ */
+ void resetCooldown();
// Paper end
// Spigot start
--

View File

@ -11,7 +11,7 @@ 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 +0,0 @@
@ -19,7 +19,8 @@ index 00000000..9072e384
+
+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
@@ -0,0 +0,0 @@ import org.bukkit.scoreboard.Scoreboard;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a player, connected or not
*/

View File

@ -5,29 +5,31 @@ 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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
@ -40,6 +42,7 @@ index 1632af18..c4dc1de2 100644
+ *
+ * @return the active command map
+ */
+ @NotNull
+ org.bukkit.command.CommandMap getCommandMap();
+
/**

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