#935: Change Consumer and Predicates to super

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
Bukkit/Spigot 2023-11-14 19:50:23 +13:00
parent 2dc53c2502
commit 72d2572304
6 changed files with 20 additions and 20 deletions

View file

@ -1937,7 +1937,7 @@ public final class Bukkit {
* @return new data instance
*/
@NotNull
public static BlockData createBlockData(@NotNull Material material, @Nullable Consumer<BlockData> consumer) {
public static BlockData createBlockData(@NotNull Material material, @Nullable Consumer<? super BlockData> consumer) {
return server.createBlockData(material, consumer);
}

View file

@ -4504,7 +4504,7 @@ public enum Material implements Keyed, Translatable {
* @return new data instance
*/
@NotNull
public BlockData createBlockData(@Nullable Consumer<BlockData> consumer) {
public BlockData createBlockData(@Nullable Consumer<? super BlockData> consumer) {
return Bukkit.createBlockData(this, consumer);
}

View file

@ -182,7 +182,7 @@ public interface RegionAccessor {
* @param stateConsumer The consumer which should get called for every block which gets changed
* @return true if the tree was created successfully, otherwise false
*/
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Consumer<BlockState> stateConsumer);
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Consumer<? super BlockState> stateConsumer);
/**
* Creates a tree at the given {@link Location}
@ -202,7 +202,7 @@ public interface RegionAccessor {
* @param statePredicate The predicate which should get used to test if a block should be set or not.
* @return true if the tree was created successfully, otherwise false
*/
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Predicate<BlockState> statePredicate);
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Predicate<? super BlockState> statePredicate);
/**
* Creates a entity at the given {@link Location}
@ -309,7 +309,7 @@ public interface RegionAccessor {
* {@link Entity} requested cannot be spawned
*/
@NotNull
<T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @Nullable Consumer<T> function) throws IllegalArgumentException;
<T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @Nullable Consumer<? super T> function) throws IllegalArgumentException;
/**
* Creates a new entity at the given {@link Location} with the supplied
@ -347,7 +347,7 @@ public interface RegionAccessor {
* @throws IllegalArgumentException if either the world or clazz parameter are null.
*/
@NotNull
public <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, boolean randomizeData, @Nullable Consumer<T> function) throws IllegalArgumentException;
public <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, boolean randomizeData, @Nullable Consumer<? super T> function) throws IllegalArgumentException;
/**
* Gets the highest non-empty (impassable) coordinate at the given

View file

@ -1649,7 +1649,7 @@ public interface Server extends PluginMessageRecipient {
* @return new data instance
*/
@NotNull
public BlockData createBlockData(@NotNull Material material, @Nullable Consumer<BlockData> consumer);
public BlockData createBlockData(@NotNull Material material, @Nullable Consumer<? super BlockData> consumer);
/**
* Creates a new {@link BlockData} instance with material and properties

View file

@ -454,7 +454,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return ItemDrop entity created as a result of this method
*/
@NotNull
public Item dropItem(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function);
public Item dropItem(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<? super Item> function);
/**
* Drops an item at the specified {@link Location} with a random offset
@ -476,7 +476,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return ItemDrop entity created as a result of this method
*/
@NotNull
public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function);
public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<? super Item> function);
/**
* Creates an {@link Arrow} entity at the given {@link Location}
@ -642,7 +642,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* non-null collection.
*/
@NotNull
public Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate<Entity> filter);
public Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate<? super Entity> filter);
/**
* Returns a list of entities within the given bounding box.
@ -672,7 +672,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* be a non-null collection
*/
@NotNull
public Collection<Entity> getNearbyEntities(@NotNull BoundingBox boundingBox, @Nullable Predicate<Entity> filter);
public Collection<Entity> getNearbyEntities(@NotNull BoundingBox boundingBox, @Nullable Predicate<? super Entity> filter);
/**
* Performs a ray trace that checks for entity collisions.
@ -727,7 +727,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @see #rayTraceEntities(Location, Vector, double, double, Predicate)
*/
@Nullable
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, @Nullable Predicate<Entity> filter);
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, @Nullable Predicate<? super Entity> filter);
/**
* Performs a ray trace that checks for entity collisions.
@ -747,7 +747,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* is no hit
*/
@Nullable
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate<Entity> filter);
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate<? super Entity> filter);
/**
* Performs a ray trace that checks for block collisions using the blocks'
@ -843,7 +843,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* entity, or <code>null</code> if there is no hit
*/
@Nullable
public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate<Entity> filter);
public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate<? super Entity> filter);
/**
* Gets the default spawn {@link Location} of this world

View file

@ -227,7 +227,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
public void runTask(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task) throws IllegalArgumentException;
public void runTask(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task) throws IllegalArgumentException;
/**
* @param plugin the reference to the plugin scheduling task
@ -267,7 +267,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task) throws IllegalArgumentException;
public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task) throws IllegalArgumentException;
/**
* @param plugin the reference to the plugin scheduling task
@ -305,7 +305,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay) throws IllegalArgumentException;
public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException;
/**
* @param plugin the reference to the plugin scheduling task
@ -350,7 +350,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay) throws IllegalArgumentException;
public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException;
/**
* @param plugin the reference to the plugin scheduling task
@ -391,7 +391,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException;
/**
* @param plugin the reference to the plugin scheduling task
@ -441,7 +441,7 @@ public interface BukkitScheduler {
* @throws IllegalArgumentException if plugin is null
* @throws IllegalArgumentException if task is null
*/
public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException;
/**
* @param plugin the reference to the plugin scheduling task