Swap some nullable annotations (#10960)
This commit is contained in:
parent
1d3fc0ee68
commit
b99d071a36
10 changed files with 102 additions and 53 deletions
|
@ -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 1a8366f6757431baaba4f3d48abea3cf0ec1f1ad..1cde639c5dc7e746209488b1a58c2a81080ab3d7 100644
|
||||
index 1a8366f6757431baaba4f3d48abea3cf0ec1f1ad..e4efcd757ca51a4edd396f55c812dbe89ffb68c7 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityShootBowEvent.java
|
||||
@@ -22,7 +22,32 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
|
@ -24,7 +24,7 @@ index 1a8366f6757431baaba4f3d48abea3cf0ec1f1ad..1cde639c5dc7e746209488b1a58c2a81
|
|||
+ return this.shouldConsumeItem();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull @Deprecated
|
||||
+ @Nullable @Deprecated
|
||||
+ public ItemStack getArrowItem() {
|
||||
+ return this.getConsumable();
|
||||
+ }
|
||||
|
|
|
@ -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 6618f2129e108c0a6cd15f6d0e86426021b6ff0d..4badeafe2f20cb123ef95897c90d5e61251cc40f 100644
|
||||
index 6618f2129e108c0a6cd15f6d0e86426021b6ff0d..e833250798e1811bd922c2335a113bf3468ec8a5 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Witch.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Witch.java
|
||||
@@ -2,6 +2,11 @@ package org.bukkit.entity;
|
||||
|
@ -20,7 +20,7 @@ index 6618f2129e108c0a6cd15f6d0e86426021b6ff0d..4badeafe2f20cb123ef95897c90d5e61
|
|||
/**
|
||||
* Represents a Witch
|
||||
*/
|
||||
@@ -13,4 +18,37 @@ public interface Witch extends Raider, RangedEntity { // Paper
|
||||
@@ -13,4 +18,38 @@ public interface Witch extends Raider, RangedEntity { // Paper
|
||||
* @return whether the witch is drinking a potion
|
||||
*/
|
||||
boolean isDrinkingPotion();
|
||||
|
@ -48,7 +48,8 @@ index 6618f2129e108c0a6cd15f6d0e86426021b6ff0d..4badeafe2f20cb123ef95897c90d5e61
|
|||
+ *
|
||||
+ * @return The potion the witch is drinking
|
||||
+ */
|
||||
+ @Nullable ItemStack getDrinkingPotion();
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ ItemStack getDrinkingPotion();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the potion the Witch should drink
|
||||
|
|
|
@ -795,6 +795,19 @@ index 4047f026ab796eca7ad2d6718e1436f251c08e93..d248069adfc67eb840951f7ab4a1fa5d
|
|||
@Contract("null -> null")
|
||||
@Nullable
|
||||
public static EntityType fromName(@Nullable String name) {
|
||||
diff --git a/src/main/java/org/bukkit/entity/ItemDisplay.java b/src/main/java/org/bukkit/entity/ItemDisplay.java
|
||||
index bd718c1cf6f20cd716d2fac11556437b4a5aab2e..586ac8abbd1a0f2724fdfadc01370cb6f1c1067a 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ItemDisplay.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ItemDisplay.java
|
||||
@@ -14,7 +14,7 @@ public interface ItemDisplay extends Display {
|
||||
*
|
||||
* @return the displayed item stack
|
||||
*/
|
||||
- @Nullable
|
||||
+ @NotNull // Paper
|
||||
ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||
index b27447d7a2833f84cf05946c851f5b6740a578e3..5afeb2f6c82e8f752229462c2d7846f6ae7a4b44 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||
|
@ -885,6 +898,19 @@ index 95c79c5fa0c4e30201f887da6467ce5f81c8a255..7f9c4d4b430a3f0276461346ff2621ba
|
|||
+ @Deprecated // Paper
|
||||
public MaterialData getDisplayBlock();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/OminousItemSpawner.java b/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||
index 60522888bc320ba0a55655532e19185fac816bd1..4aa07d4edb2c81d0ae7999b30ad53ff8bb884ec7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||
+++ b/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||
@@ -15,7 +15,7 @@ public interface OminousItemSpawner extends Entity {
|
||||
*
|
||||
* @return the item
|
||||
*/
|
||||
- @Nullable
|
||||
+ @org.jetbrains.annotations.NotNull // Paper
|
||||
ItemStack getItem();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index dc9829ab0f4efcf9534f1b2d4a2e48ea49e8d372..e65f4f0df2e6832cf089572822c96ecc7a83dab3 100644
|
||||
|
@ -939,6 +965,29 @@ index 9cb08fe7201a9f91e88c7b1ee22c17889a7bf1c3..c0fcfccdf476106b48e626a099658c04
|
|||
-@Deprecated
|
||||
+@Deprecated(forRemoval = true) // Paper
|
||||
public interface SplashPotion extends ThrownPotion { }
|
||||
diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
index 7cc1d9a966454af70b7c25735fe474fe3eb97eb4..e38f38ebfc6e85f29b09c4bb3e2ea79639078ad0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
@@ -13,15 +13,15 @@ public interface ZombieVillager extends Zombie {
|
||||
* Sets the villager profession of this zombie.
|
||||
*/
|
||||
@Override
|
||||
- void setVillagerProfession(@Nullable Villager.Profession profession);
|
||||
+ void setVillagerProfession(@NotNull Villager.Profession profession); // Paper
|
||||
|
||||
/**
|
||||
* Returns the villager profession of this zombie.
|
||||
*
|
||||
- * @return the profession or null
|
||||
+ * @return the profession
|
||||
*/
|
||||
@Override
|
||||
- @Nullable
|
||||
+ @NotNull // Paper
|
||||
Villager.Profession getVillagerProfession();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
||||
index 8f601e85df580ef8106eaff8b9eafb5691a4874b..d615c006c9153fb65024241604b744fbfc383efc 100644
|
||||
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
||||
|
|
|
@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..5600fcdc9795a9f49091db48d73bbd49
|
|||
+ TRADING,
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
|
||||
index 4128b848ec739308694d54d9e859c28185f42a63..d841d94d46462e0ceb7c6b04cc8fc36792bd9201 100644
|
||||
index 4128b848ec739308694d54d9e859c28185f42a63..49db82ceff5e2c5f6414045648d68bd384c857c8 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -1,6 +1,8 @@
|
||||
|
@ -135,7 +135,7 @@ index 4128b848ec739308694d54d9e859c28185f42a63..d841d94d46462e0ceb7c6b04cc8fc367
|
|||
+ * @param uniqueId The {@link UUID} of the player to get the reputation of.
|
||||
+ * @return The player's copied reputation with this villager.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @NotNull
|
||||
+ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId);
|
||||
+
|
||||
+ /**
|
||||
|
|
|
@ -420,7 +420,7 @@ index d248069adfc67eb840951f7ab4a1fa5d30214dec..976f701ed9b9873945a5628173c580e2
|
|||
* Gets if this EntityType is enabled by feature in a world.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
|
||||
index d841d94d46462e0ceb7c6b04cc8fc36792bd9201..8c8176121cafed0ed09239b6a7b392dc846438e2 100644
|
||||
index 49db82ceff5e2c5f6414045648d68bd384c857c8..b3957b3ff64f35fdeb2daa2ed1fb34fd65e24693 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -160,7 +160,7 @@ public interface Villager extends AbstractVillager {
|
||||
|
|
|
@ -1416,7 +1416,7 @@ index 87a814f63c3f35be35bfa210c9248ad211c0dd8f..14543c2238b45c526dd9aebea2aa5c22
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
index 7cc1d9a966454af70b7c25735fe474fe3eb97eb4..ac6fd8ca95771c185c145f4589ddd5b2a6e8c2da 100644
|
||||
index e38f38ebfc6e85f29b09c4bb3e2ea79639078ad0..e647c6b933be8234c6ef8726724a7e1198f24f31 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
@@ -90,4 +90,22 @@ public interface ZombieVillager extends Zombie {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] More vanilla friendly methods to update trades
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
|
||||
index 8c8176121cafed0ed09239b6a7b392dc846438e2..3bc24457d143449e6a338d79becf7c39b9f81054 100644
|
||||
index b3957b3ff64f35fdeb2daa2ed1fb34fd65e24693..48c8af31b2bdc849b5269784ff3829ba31fb3f47 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -60,8 +60,11 @@ public interface Villager extends AbstractVillager {
|
||||
|
|
|
@ -137,7 +137,7 @@ index 06ca3dc4b0b69cbaefa96464dce484cea93e0717..748e58eb93c7882e15d9cbdd56d11bb1
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/OminousItemSpawner.java b/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||
index 60522888bc320ba0a55655532e19185fac816bd1..764e058c37eeedaff617c2672b8c446d2a1d6848 100644
|
||||
index 4aa07d4edb2c81d0ae7999b30ad53ff8bb884ec7..dbd4da4c63b6b1b21c3e638ac4d2c9fdd6716a8e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||
+++ b/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||
@@ -7,7 +7,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
|
|
@ -1009,10 +1009,10 @@ index 5467e4a74b70ff57b49d9e6bc686c493178f8511..01d104d91de9e1319d27e39d3f474318
|
|||
public boolean isRolling() {
|
||||
return this.getHandle().isRolling();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
||||
index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..8338effd39b1709dbe578e247710a8e58d83e3aa 100644
|
||||
index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..83e77c6d287d8e239d2f55f3e9f19ef74946be7c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
||||
@@ -44,5 +44,25 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
|
||||
@@ -44,5 +44,17 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
|
||||
public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
||||
getHandle().setShouldBurnInDay(shouldBurnInDay);
|
||||
}
|
||||
|
@ -1020,21 +1020,13 @@ index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..8338effd39b1709dbe578e247710a8e5
|
|||
+ @Override
|
||||
+ public org.bukkit.Location getAnchorLocation() {
|
||||
+ net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
|
||||
+ if (pos == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setAnchorLocation(org.bukkit.Location location) {
|
||||
+ net.minecraft.core.BlockPos pos = null;
|
||||
+ if (location != null) {
|
||||
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
||||
+ }
|
||||
+
|
||||
+ this.getHandle().anchorPoint = pos;
|
||||
+ com.google.common.base.Preconditions.checkArgument(location != null, "location cannot be null");
|
||||
+ this.getHandle().anchorPoint = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
|
|
|
@ -582,36 +582,35 @@ index 696fdfa723aa896a67946f862d7c6890f7f7ab17..4f1fa7dec78970bdfc184d3c1f1632dc
|
|||
@Override
|
||||
public net.minecraft.world.entity.projectile.Projectile getHandle() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java
|
||||
index d685d09cae5f862c0004f148298c800736d2139e..636c4481e3afdf20197e502cf221f5d34d18f101 100644
|
||||
index d685d09cae5f862c0004f148298c800736d2139e..b3797a43eeee11cb7ae0774d61bd5f195d0aa3ad 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java
|
||||
@@ -12,20 +12,7 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul
|
||||
@@ -12,31 +12,56 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
- @Override
|
||||
+ // Paper - moved to AbstractProjectile
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.Entity getTarget() {
|
||||
+ return this.getHandle().getTarget() != null ? this.getHandle().getTarget().getBukkitEntity() : null;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
- public ProjectileSource getShooter() {
|
||||
- return this.getHandle().projectileSource;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
+ public void setTarget(org.bukkit.entity.Entity target) {
|
||||
+ Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
|
||||
+
|
||||
+ this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void setShooter(ProjectileSource shooter) {
|
||||
- if (shooter instanceof Entity) {
|
||||
- this.getHandle().setOwner(((CraftEntity) shooter).getHandle());
|
||||
- } else {
|
||||
- this.getHandle().setOwner(null);
|
||||
- }
|
||||
- this.getHandle().projectileSource = shooter;
|
||||
- }
|
||||
+ // Paper - moved to AbstractProjectile
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getTarget() {
|
||||
@@ -39,6 +26,40 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul
|
||||
this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle());
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public org.bukkit.util.Vector getTargetDelta() {
|
||||
+ net.minecraft.world.entity.projectile.ShulkerBullet bullet = this.getHandle();
|
||||
+ return new org.bukkit.util.Vector(bullet.targetDeltaX, bullet.targetDeltaY, bullet.targetDeltaZ);
|
||||
|
@ -627,27 +626,35 @@ index d685d09cae5f862c0004f148298c800736d2139e..636c4481e3afdf20197e502cf221f5d3
|
|||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.block.BlockFace getCurrentMovementDirection() {
|
||||
+ return org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(this.getHandle().currentMoveDirection);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ net.minecraft.core.Direction dir = this.getHandle().currentMoveDirection;
|
||||
+ if (dir == null) {
|
||||
+ return null; // random dir
|
||||
}
|
||||
- this.getHandle().projectileSource = shooter;
|
||||
+ return org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public org.bukkit.entity.Entity getTarget() {
|
||||
- return this.getHandle().getTarget() != null ? this.getHandle().getTarget().getBukkitEntity() : null;
|
||||
+ public void setCurrentMovementDirection(org.bukkit.block.BlockFace movementDirection) {
|
||||
+ this.getHandle().currentMoveDirection = org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(movementDirection);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void setTarget(org.bukkit.entity.Entity target) {
|
||||
- Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
|
||||
+ public int getFlightSteps() {
|
||||
+ return this.getHandle().flightSteps;
|
||||
+ }
|
||||
+
|
||||
|
||||
- this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle());
|
||||
+ @Override
|
||||
+ public void setFlightSteps(int steps) {
|
||||
+ this.getHandle().flightSteps = steps;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftShulkerBullet";
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||
index d67a80161b3e7c1fe02a6ed9d341c00dc7c2847a..f6fa6f1ac50b757dd3bc9a8dee9f6085446182c8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||
|
|
Loading…
Reference in a new issue