mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Swap some nullable annotations (#10960)
This commit is contained in:
parent
fed26cf9a8
commit
acbaa46a96
@ -48,7 +48,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return The potion the witch is drinking
|
||||
+ */
|
||||
+ @Nullable ItemStack getDrinkingPotion();
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ ItemStack getDrinkingPotion();
|
||||
+
|
||||
+ /**
|
||||
+ * 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.
|
||||
+ * @return The player's copied reputation with this villager.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @NotNull
|
||||
+ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId);
|
||||
+
|
||||
+ /**
|
||||
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return this.shouldConsumeItem();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull @Deprecated
|
||||
+ @Nullable @Deprecated
|
||||
+ public ItemStack getArrowItem() {
|
||||
+ return this.getConsumable();
|
||||
+ }
|
||||
|
@ -795,6 +795,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@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 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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LightningStrike.java
|
||||
@ -885,6 +898,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @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 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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -939,6 +965,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
-@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 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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java
|
||||
|
@ -1020,21 +1020,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @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
|
||||
}
|
||||
|
@ -589,29 +589,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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() {
|
||||
@@ -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() {
|
||||
+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
|
||||
|
Loading…
Reference in New Issue
Block a user