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

@@ -13,7 +13,7 @@ You can use EntityPathfindEvent to cancel new pathfinds from overriding your cur
diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
new file mode 100644
index 00000000..d6953b39
index 000000000..8b90a9053
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
@@ -0,0 +0,0 @@
@@ -23,9 +23,9 @@ index 00000000..d6953b39
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Mob;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.List;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Handles pathfinding operations for an Entity
@@ -36,6 +36,7 @@ index 00000000..d6953b39
+ *
+ * @return The entity that is controlled by this pathfinder
+ */
+ @NotNull
+ Mob getEntity();
+
+ /**
@@ -52,7 +53,8 @@ index 00000000..d6953b39
+ /**
+ * @return The location the entity is trying to navigate to, or null if there is no destination
+ */
+ @Nullable PathResult getCurrentPath();
+ @Nullable
+ PathResult getCurrentPath();
+
+ /**
+ * Calculates a destination for the Entity to navigate to, but does not set it
@@ -60,7 +62,7 @@ index 00000000..d6953b39
+ * @param loc Location to navigate to
+ * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
+ */
+ @Nullable PathResult findPath(Location loc);
+ @Nullable PathResult findPath(@NotNull Location loc);
+
+ /**
+ * Calculates a destination for the Entity to navigate to to reach the target entity,
@@ -75,7 +77,7 @@ index 00000000..d6953b39
+ * @param target the Entity to navigate to
+ * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
+ */
+ @Nullable PathResult findPath(LivingEntity target);
+ @Nullable PathResult findPath(@NotNull LivingEntity target);
+
+ /**
+ * Calculates a destination for the Entity to navigate to, and sets it with default speed
@@ -83,7 +85,7 @@ index 00000000..d6953b39
+ * @param loc Location to navigate to
+ * @return If the pathfinding was successfully started
+ */
+ default boolean moveTo(@Nonnull Location loc) {
+ default boolean moveTo(@NotNull Location loc) {
+ return moveTo(loc, 1);
+ }
+
@@ -94,7 +96,7 @@ index 00000000..d6953b39
+ * @param speed Speed multiplier to navigate at, where 1 is 'normal'
+ * @return If the pathfinding was successfully started
+ */
+ default boolean moveTo(@Nonnull Location loc, double speed) {
+ default boolean moveTo(@NotNull Location loc, double speed) {
+ PathResult path = findPath(loc);
+ return path != null && moveTo(path, speed);
+ }
@@ -111,7 +113,7 @@ index 00000000..d6953b39
+ * @param target the Entity to navigate to
+ * @return If the pathfinding was successfully started
+ */
+ default boolean moveTo(@Nonnull LivingEntity target) {
+ default boolean moveTo(@NotNull LivingEntity target) {
+ return moveTo(target, 1);
+ }
+
@@ -128,7 +130,7 @@ index 00000000..d6953b39
+ * @param speed Speed multiplier to navigate at, where 1 is 'normal'
+ * @return If the pathfinding was successfully started
+ */
+ default boolean moveTo(@Nonnull LivingEntity target, double speed) {
+ default boolean moveTo(@NotNull LivingEntity target, double speed) {
+ PathResult path = findPath(target);
+ return path != null && moveTo(path, speed);
+ }
@@ -140,7 +142,7 @@ index 00000000..d6953b39
+ * @param path The Path to start following
+ * @return If the pathfinding was successfully started
+ */
+ default boolean moveTo(@Nonnull PathResult path) {
+ default boolean moveTo(@NotNull PathResult path) {
+ return moveTo(path, 1);
+ }
+
@@ -152,7 +154,7 @@ index 00000000..d6953b39
+ * @param speed Speed multiplier to navigate at, where 1 is 'normal'
+ * @return If the pathfinding was successfully started
+ */
+ boolean moveTo(@Nonnull PathResult path, double speed);
+ boolean moveTo(@NotNull PathResult path, double speed);
+
+ /**
+ * Represents the result of a pathfinding calculation
@@ -165,6 +167,7 @@ index 00000000..d6953b39
+ * Will return points the entity has already moved past, see {@link #getNextPointIndex()}
+ * @return List of points
+ */
+ @NotNull
+ List<Location> getPoints();
+
+ /**
@@ -185,10 +188,18 @@ index 00000000..d6953b39
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
index d029d34e..48eddcd3 100644
index 838440ff8..afdc103fe 100644
--- a/src/main/java/org/bukkit/entity/Mob.java
+++ b/src/main/java/org/bukkit/entity/Mob.java
@@ -0,0 +0,0 @@ import org.bukkit.loot.Lootable;
@@ -0,0 +0,0 @@
package org.bukkit.entity;
import org.bukkit.loot.Lootable;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Mob extends LivingEntity, Lootable {
@@ -197,6 +208,7 @@ index d029d34e..48eddcd3 100644
+ * Enables access to control the pathing of an Entity
+ * @return Pathfinding Manager for this entity
+ */
+ @NotNull
+ com.destroystokyo.paper.entity.Pathfinder getPathfinder();
+ // Paper end
+