mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Swap some nullable annotations (#10960)
This commit is contained in:
parent
fed26cf9a8
commit
acbaa46a96
6 changed files with 90 additions and 41 deletions
|
@ -48,7 +48,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ *
|
+ *
|
||||||
+ * @return The potion the witch is drinking
|
+ * @return The potion the witch is drinking
|
||||||
+ */
|
+ */
|
||||||
+ @Nullable ItemStack getDrinkingPotion();
|
+ @org.jetbrains.annotations.NotNull
|
||||||
|
+ ItemStack getDrinkingPotion();
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Set the potion the Witch should drink
|
+ * Set the potion the Witch should drink
|
||||||
|
|
|
@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param uniqueId The {@link UUID} of the player to get the reputation of.
|
+ * @param uniqueId The {@link UUID} of the player to get the reputation of.
|
||||||
+ * @return The player's copied reputation with this villager.
|
+ * @return The player's copied reputation with this villager.
|
||||||
+ */
|
+ */
|
||||||
+ @Nullable
|
+ @NotNull
|
||||||
+ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId);
|
+ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId);
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
|
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return this.shouldConsumeItem();
|
+ return this.shouldConsumeItem();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @NotNull @Deprecated
|
+ @Nullable @Deprecated
|
||||||
+ public ItemStack getArrowItem() {
|
+ public ItemStack getArrowItem() {
|
||||||
+ return this.getConsumable();
|
+ return this.getConsumable();
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -795,6 +795,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@Contract("null -> null")
|
@Contract("null -> null")
|
||||||
@Nullable
|
@Nullable
|
||||||
public static EntityType fromName(@Nullable String name) {
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/ItemDisplay.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/ItemDisplay.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
|
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||||
|
@ -885,6 +898,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Deprecated // Paper
|
+ @Deprecated // Paper
|
||||||
public MaterialData getDisplayBlock();
|
public MaterialData getDisplayBlock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/OminousItemSpawner.java b/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/OminousItemSpawner.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
@ -939,6 +965,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
-@Deprecated
|
-@Deprecated
|
||||||
+@Deprecated(forRemoval = true) // Paper
|
+@Deprecated(forRemoval = true) // Paper
|
||||||
public interface SplashPotion extends ThrownPotion { }
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
||||||
|
|
|
@ -1020,21 +1020,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.Location getAnchorLocation() {
|
+ public org.bukkit.Location getAnchorLocation() {
|
||||||
+ net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
|
+ net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
|
||||||
+ if (pos == null) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
|
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setAnchorLocation(org.bukkit.Location location) {
|
+ public void setAnchorLocation(org.bukkit.Location location) {
|
||||||
+ net.minecraft.core.BlockPos pos = null;
|
+ com.google.common.base.Preconditions.checkArgument(location != null, "location cannot be null");
|
||||||
+ if (location != null) {
|
+ this.getHandle().anchorPoint = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
||||||
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ this.getHandle().anchorPoint = pos;
|
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
|
@ -589,29 +589,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
super(server, entity);
|
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() {
|
- public ProjectileSource getShooter() {
|
||||||
- return this.getHandle().projectileSource;
|
- return this.getHandle().projectileSource;
|
||||||
- }
|
+ public void setTarget(org.bukkit.entity.Entity target) {
|
||||||
-
|
+ Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
|
||||||
- @Override
|
+
|
||||||
|
+ this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
- public void setShooter(ProjectileSource shooter) {
|
- public void setShooter(ProjectileSource shooter) {
|
||||||
- if (shooter instanceof Entity) {
|
- if (shooter instanceof Entity) {
|
||||||
- this.getHandle().setOwner(((CraftEntity) shooter).getHandle());
|
- this.getHandle().setOwner(((CraftEntity) shooter).getHandle());
|
||||||
- } else {
|
- } else {
|
||||||
- this.getHandle().setOwner(null);
|
- this.getHandle().setOwner(null);
|
||||||
- }
|
|
||||||
- this.getHandle().projectileSource = shooter;
|
|
||||||
- }
|
|
||||||
+ // Paper - moved to AbstractProjectile
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.bukkit.entity.Entity getTarget() {
|
|
||||||
@@ -0,0 +0,0 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul
|
|
||||||
this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle());
|
|
||||||
}
|
|
||||||
|
|
||||||
+ @Override
|
|
||||||
+ public org.bukkit.util.Vector getTargetDelta() {
|
+ public org.bukkit.util.Vector getTargetDelta() {
|
||||||
+ net.minecraft.world.entity.projectile.ShulkerBullet bullet = this.getHandle();
|
+ net.minecraft.world.entity.projectile.ShulkerBullet bullet = this.getHandle();
|
||||||
+ return new org.bukkit.util.Vector(bullet.targetDeltaX, bullet.targetDeltaY, bullet.targetDeltaZ);
|
+ return new org.bukkit.util.Vector(bullet.targetDeltaX, bullet.targetDeltaY, bullet.targetDeltaZ);
|
||||||
|
@ -627,27 +626,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.block.BlockFace getCurrentMovementDirection() {
|
+ public org.bukkit.block.BlockFace getCurrentMovementDirection() {
|
||||||
+ return org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(this.getHandle().currentMoveDirection);
|
+ net.minecraft.core.Direction dir = this.getHandle().currentMoveDirection;
|
||||||
+ }
|
+ if (dir == null) {
|
||||||
+
|
+ return null; // random dir
|
||||||
+ @Override
|
}
|
||||||
|
- 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) {
|
+ public void setCurrentMovementDirection(org.bukkit.block.BlockFace movementDirection) {
|
||||||
+ this.getHandle().currentMoveDirection = org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(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() {
|
+ public int getFlightSteps() {
|
||||||
+ return this.getHandle().flightSteps;
|
+ return this.getHandle().flightSteps;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle());
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setFlightSteps(int steps) {
|
+ public void setFlightSteps(int steps) {
|
||||||
+ this.getHandle().flightSteps = steps;
|
+ this.getHandle().flightSteps = steps;
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
@Override
|
@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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||||
|
|
Loading…
Reference in a new issue