Use ? super in Consumer/Predicate API (#9939)

This commit is contained in:
Jake Potrebic 2023-11-25 15:03:02 -08:00 committed by GitHub
commit b37bbcfd98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 240 additions and 277 deletions

View file

@ -5,15 +5,15 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile
diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
index eabd8b926ec1c934cd7e77b7cc6adfae16771021..5a2dcb1dbd0a875ff9cf5fd01445196a947f2fdc 100644
index eabd8b926ec1c934cd7e77b7cc6adfae16771021..96ebd30d339060758e726e9e1e7428d1d0813c17 100644
--- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java
+++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
@@ -31,4 +31,24 @@ public interface ProjectileSource {
@@ -31,4 +31,23 @@ public interface ProjectileSource {
*/
@NotNull
public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity);
+
+ // Paper start
+ // Paper start - add consumer to launchProjectile
+ /**
+ * Launches a {@link Projectile} from the ProjectileSource with an
+ * initial velocity, with the supplied function run before the
@ -29,7 +29,6 @@ index eabd8b926ec1c934cd7e77b7cc6adfae16771021..5a2dcb1dbd0a875ff9cf5fd01445196a
+ * @param function the function to be run before the entity is spawned
+ * @return the launched projectile
+ */
+ @NotNull
+ public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, @Nullable java.util.function.Consumer<T> function);
+ // Paper end
+ <T extends Projectile> @NotNull T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, java.util.function.@Nullable Consumer<? super T> function);
+ // Paper end - add consumer to launchProjectile
}