From e4d184f39d433feb9c1a0f7077e47b4f2affeec4 Mon Sep 17 00:00:00 2001 From: Jakub Zacek Date: Sat, 14 Oct 2023 22:43:32 +0200 Subject: [PATCH] Replace bukkit Consumers with java consumers (#9836) --- ...a-consumer-parameter-to-ProjectileSource-launchP.patch | 4 ++-- ...a-consumer-parameter-to-ProjectileSource-launchP.patch | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/api/0377-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/0377-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index bec7a5d015..f1884d2c5e 100644 --- a/patches/api/0377-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/api/0377-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,7 +5,7 @@ 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..6cb28e65b82198b19f159f8e8334208f7f62d394 100644 +index eabd8b926ec1c934cd7e77b7cc6adfae16771021..5a2dcb1dbd0a875ff9cf5fd01445196a947f2fdc 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 { @@ -30,6 +30,6 @@ index eabd8b926ec1c934cd7e77b7cc6adfae16771021..6cb28e65b82198b19f159f8e8334208f + * @return the launched projectile + */ + @NotNull -+ public T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity, @Nullable org.bukkit.util.Consumer function); ++ public T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity, @Nullable java.util.function.Consumer function); + // Paper end } diff --git a/patches/server/0852-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/0852-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index f2fc80e18c..81fbb79345 100644 --- a/patches/server/0852-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/0852-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 26054a3b4e2609cb68751d6e37bce22df94c46b8..f0d8000915db9ae497dddb09e9bde87a516a1b4b 100644 +index 26054a3b4e2609cb68751d6e37bce22df94c46b8..8c8431f40e9415b32e43acea4cd91a20d82d8d08 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -509,8 +509,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -20,7 +20,7 @@ index 26054a3b4e2609cb68751d6e37bce22df94c46b8..f0d8000915db9ae497dddb09e9bde87a + + @Override + @SuppressWarnings("unchecked") -+ public T launchProjectile(Class projectile, Vector velocity, org.bukkit.util.Consumer function) { ++ public T launchProjectile(Class projectile, Vector velocity, java.util.function.Consumer function) { + // Paper end - launchProjectile consumer Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation"); @@ -38,7 +38,7 @@ index 26054a3b4e2609cb68751d6e37bce22df94c46b8..f0d8000915db9ae497dddb09e9bde87a world.addFreshEntity(launch); return (T) launch.getBukkitEntity(); diff --git a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java -index 7f9a716ea65f98d1c8487438949f1d5bc8becc4a..24156e1cd819584c1856cf6d30b4d510691136b6 100644 +index 7f9a716ea65f98d1c8487438949f1d5bc8becc4a..f880b0def6ee12d1e88a732ade348ac062f8ab69 100644 --- a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java +++ b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java @@ -56,6 +56,13 @@ public class CraftBlockProjectileSource implements BlockProjectileSource { @@ -50,7 +50,7 @@ index 7f9a716ea65f98d1c8487438949f1d5bc8becc4a..24156e1cd819584c1856cf6d30b4d510 + } + + @Override -+ public T launchProjectile(Class projectile, Vector velocity, org.bukkit.util.Consumer function) { ++ public T launchProjectile(Class projectile, Vector velocity, java.util.function.Consumer function) { + // Paper end - launchProjectile consumer Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser"); // Copied from BlockDispenser.dispense()