mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Replace bukkit Consumers with java consumers (#9836)
This commit is contained in:
parent
3e9d2ac5f2
commit
e4d184f39d
2 changed files with 6 additions and 6 deletions
|
@ -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 extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, @Nullable org.bukkit.util.Consumer<T> function);
|
||||
+ public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, @Nullable java.util.function.Consumer<T> function);
|
||||
+ // Paper end
|
||||
}
|
||||
|
|
|
@ -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 extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, org.bukkit.util.Consumer<T> function) {
|
||||
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<T> 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 extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, org.bukkit.util.Consumer<T> function) {
|
||||
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<T> function) {
|
||||
+ // Paper end - launchProjectile consumer
|
||||
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
||||
// Copied from BlockDispenser.dispense()
|
||||
|
|
Loading…
Reference in a new issue