Fix Spigot annotation mistakes

while some of these may of been true, they are extreme cases and cause
a ton of noise to plugin developers.

Use ApiStatus.Internal instead of Deprecated for actual internal API
that continues to have use (internally).

These do not help plugin developers if they bring moise noise than value.
This commit is contained in:
Aikar
2019-03-24 18:39:01 -04:00
parent ded424db46
commit 2825ece820
145 changed files with 372 additions and 235 deletions

View File

@@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Called when a brewing stand starts to brew.
*/
@org.jetbrains.annotations.ApiStatus.Experimental // Paper
public class BrewingStartEvent extends InventoryBlockStartEvent {
private static final HandlerList handlers = new HandlerList();

View File

@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Called when a Campfire starts to cook.
*/
@org.jetbrains.annotations.ApiStatus.Experimental // Paper
public class CampfireStartEvent extends InventoryBlockStartEvent {
private static final HandlerList handlers = new HandlerList();

View File

@@ -17,6 +17,7 @@ public class CrafterCraftEvent extends BlockEvent implements Cancellable {
private ItemStack result;
private boolean cancelled;
@org.jetbrains.annotations.ApiStatus.Internal // Paper - fix upstream annotation mistakes
public CrafterCraftEvent(@NotNull Block theBlock, @NotNull CraftingRecipe recipe, @NotNull ItemStack result) {
super(theBlock);
this.result = result;

View File

@@ -23,7 +23,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
private boolean cancelled;
private final Player enchanter;
public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull EnchantmentView view, @NotNull final Block table, @NotNull final ItemStack item, @NotNull final EnchantmentOffer[] offers, final int bonus) {
public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull EnchantmentView view, @NotNull final Block table, @NotNull final ItemStack item, @org.jetbrains.annotations.Nullable final EnchantmentOffer @NotNull [] offers, final int bonus) { // Paper - offers can contain null values
super(view);
this.enchanter = enchanter;
this.table = table;
@@ -86,8 +86,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
*
* @return list of available enchantment offers
*/
@NotNull
public EnchantmentOffer[] getOffers() {
public @org.jetbrains.annotations.Nullable EnchantmentOffer @NotNull [] getOffers() { // Paper offers can contain null values
return offers;
}

View File

@@ -218,7 +218,10 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
MILK,
/**
* When a player gets bad omen after killing a patrol captain.
*
* @deprecated no longer used, player now gets an ominous bottle instead
*/
@Deprecated(since = "1.21") // Paper
PATROL_CAPTAIN,
/**
* When a potion effect is modified through the plugin methods.

View File

@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
* LivingEntity's.
*/
public class EntityTargetLivingEntityEvent extends EntityTargetEvent {
public EntityTargetLivingEntityEvent(@NotNull final Entity entity, @Nullable final LivingEntity target, @Nullable final TargetReason reason) {
public EntityTargetLivingEntityEvent(@NotNull final Entity entity, @Nullable final LivingEntity target, @NotNull final TargetReason reason) { // Paper
super(entity, target, reason);
}

View File

@@ -24,6 +24,14 @@ public class EntityToggleSwimEvent extends EntityEvent implements Cancellable {
return cancel;
}
/**
* @deprecated This does nothing, the server and the client doesn't work
* correctly when the server try to bypass this. A current workaround
* exists. If you want to cancel the switch from the ground state to the
* swimming state you need to disable the sprinting flag for the player after
* the cancel action.
*/
@Deprecated // Paper
@Override
public void setCancelled(boolean cancel) {
this.cancel = cancel;

View File

@@ -19,22 +19,27 @@ public class ProjectileHitEvent extends EntityEvent implements Cancellable {
private final BlockFace hitFace;
private boolean cancel = false;
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile) {
this(projectile, null, null);
this(projectile, null, null, null); // Paper
}
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity) {
this(projectile, hitEntity, null);
this(projectile, hitEntity, null, null); // Paper
}
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Block hitBlock) {
this(projectile, null, hitBlock);
this(projectile, null, hitBlock, null); // Paper
}
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock) {
this(projectile, hitEntity, hitBlock, null);
}
@org.jetbrains.annotations.ApiStatus.Internal // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace) {
super(projectile);
this.hitEntity = hitEntity;

View File

@@ -12,12 +12,19 @@ import org.jetbrains.annotations.NotNull;
public class SpawnerSpawnEvent extends EntitySpawnEvent {
private final CreatureSpawner spawner;
public SpawnerSpawnEvent(@NotNull final Entity spawnee, @NotNull final CreatureSpawner spawner) {
public SpawnerSpawnEvent(@NotNull final Entity spawnee, @org.jetbrains.annotations.Nullable final CreatureSpawner spawner) { // Paper
super(spawnee);
this.spawner = spawner;
}
@NotNull
/**
* Gets the spawner tile state, or null
* when the entity is spawned from a minecart
* spawner.
*
* @return the spawner tile state
*/
@org.jetbrains.annotations.Nullable // Paper
public CreatureSpawner getSpawner() {
return spawner;
}

View File

@@ -11,22 +11,21 @@ import org.jetbrains.annotations.Nullable;
public class HangingBreakByEntityEvent extends HangingBreakEvent {
private final Entity remover;
public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @Nullable final Entity remover) {
public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @NotNull final Entity remover) { // Paper
this(hanging, remover, HangingBreakEvent.RemoveCause.ENTITY);
}
public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @Nullable final Entity remover, @NotNull final HangingBreakEvent.RemoveCause cause) {
public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @NotNull final Entity remover, @NotNull final HangingBreakEvent.RemoveCause cause) { // Paper
super(hanging, cause);
this.remover = remover;
}
/**
* Gets the entity that removed the hanging entity.
* May be null, for example when broken by an explosion.
*
* @return the entity that removed the hanging entity
*/
@Nullable
@NotNull // Paper
public Entity getRemover() {
return remover;
}

View File

@@ -34,7 +34,7 @@ public class HopperInventorySearchEvent extends BlockEvent {
DESTINATION;
}
public HopperInventorySearchEvent(@NotNull Inventory inventory, @NotNull ContainerType containerType, @NotNull Block hopper, @NotNull Block searchBlock) {
public HopperInventorySearchEvent(@Nullable Inventory inventory, @NotNull ContainerType containerType, @NotNull Block hopper, @NotNull Block searchBlock) { // Paper
super(hopper);
this.inventory = inventory;
this.containerType = containerType;

View File

@@ -88,7 +88,7 @@ public class InventoryClickEvent extends InventoryInteractEvent {
*
* @return the cursor ItemStack
*/
@Nullable
@NotNull // Paper - fix nullability
public ItemStack getCursor() {
return getView().getCursor();
}

View File

@@ -155,7 +155,7 @@ public enum InventoryType {
*
* @deprecated use {@link #SMITHING}
*/
@Deprecated(since = "1.20.1")
@Deprecated(since = "1.20.1", forRemoval = true) // Paper
SMITHING_NEW(4, "Upgrade Gear", MenuType.SMITHING),
;

View File

@@ -43,7 +43,10 @@ public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable {
* {@link Player#setBedSpawnLocation(Location)}.
*
* @return true if the spawn location will be changed
* @deprecated the respawn point is now set when the player enter the bed and
* this option doesn't work since MC 1.15.
*/
@Deprecated(forRemoval = true) // Paper - Unused
public boolean shouldSetSpawnLocation() {
return setBedSpawn;
}
@@ -59,7 +62,10 @@ public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable {
* {@link Player#setBedSpawnLocation(Location)}.
*
* @param setBedSpawn true to change the new spawn location
* @deprecated the respawn point is now set when the player enter the bed and
* this option doesn't work since MC 1.15.
*/
@Deprecated(forRemoval = true) // Paper - Unused
public void setSpawnLocation(boolean setBedSpawn) {
this.setBedSpawn = setBedSpawn;
}

View File

@@ -78,7 +78,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
*
* @return Location the player moved to
*/
@Nullable
@NotNull // Paper
public Location getTo() {
return to;
}

View File

@@ -19,7 +19,7 @@ public class RaidSpawnWaveEvent extends RaidEvent {
private final List<Raider> raiders;
private final Raider leader;
public RaidSpawnWaveEvent(@NotNull Raid raid, @NotNull World world, @Nullable Raider leader, @NotNull List<Raider> raiders) {
public RaidSpawnWaveEvent(@NotNull Raid raid, @NotNull World world, @NotNull Raider leader, @NotNull List<Raider> raiders) { // Paper
super(raid, world);
this.raiders = raiders;
this.leader = leader;
@@ -30,7 +30,7 @@ public class RaidSpawnWaveEvent extends RaidEvent {
*
* @return {@link Raider}
*/
@Nullable
@NotNull // Paper
public Raider getPatrolLeader() {
return leader;
}

View File

@@ -36,18 +36,22 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement
this.cancelled = cancel;
}
@Deprecated(forRemoval = true) // Paper - Unused
public boolean isPickupCancelled() {
return cancelledPickup;
}
@Deprecated(forRemoval = true) // Paper - Unused
public void setPickupCancelled(boolean cancel) {
cancelledPickup = cancel;
}
@Deprecated(forRemoval = true) // Paper - Unused
public boolean isCollisionCancelled() {
return cancelledCollision;
}
@Deprecated(forRemoval = true) // Paper - Unused
public void setCollisionCancelled(boolean cancel) {
cancelledCollision = cancel;
}