From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Trigary Date: Tue, 14 Apr 2020 12:05:22 +0200 Subject: [PATCH] Player elytra boost API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 3f63f83b21d84a4fa1cfda217afb22c4cf7fd2ad..129f1941d65d11e614f5efefd7f4e4cc2fd55a76 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2085,6 +2085,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } throw new RuntimeException("Unknown settings type"); } + + @Override + public org.bukkit.entity.Firework boostElytra(ItemStack firework) { + Validate.isTrue(isGliding(), "Player must be gliding"); + Validate.isTrue(firework != null, "firework == null"); + Validate.isTrue(firework.getType() == Material.FIREWORK_ROCKET, "Firework must be Material.FIREWORK_ROCKET"); + + net.minecraft.server.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework); + net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); + net.minecraft.server.EntityFireworks entity = new net.minecraft.server.EntityFireworks(world, item, getHandle()); + return world.addEntity(entity) + ? (org.bukkit.entity.Firework) entity.getBukkitEntity() + : null; + } // Paper end // Spigot start