removed crossbow check, no work :(

This commit is contained in:
Richard Mikloš 2024-07-27 14:28:54 +02:00
parent 37e90d077d
commit 396ed3aec7
2 changed files with 0 additions and 29 deletions

@ -9,8 +9,6 @@ import org.bukkit.entity.Firework;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.CrossbowMeta;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -18,7 +16,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
private double boostPower; private double boostPower;
private boolean damageShooter; private boolean damageShooter;
private boolean onlyCrossbow;
@Override @Override
public void onEnable() { public void onEnable() {
@ -26,7 +23,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
FileConfiguration config = getConfig(); FileConfiguration config = getConfig();
boostPower = config.getDouble("boostPower", 4.0); boostPower = config.getDouble("boostPower", 4.0);
damageShooter = config.getBoolean("damageShooter", false); damageShooter = config.getBoolean("damageShooter", false);
onlyCrossbow = config.getBoolean("onlyCrossbow", true);
Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(this, this);
} }
@ -41,28 +37,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
if (projectile instanceof Firework firework) { if (projectile instanceof Firework firework) {
Entity shooter = (Entity) firework.getShooter(); Entity shooter = (Entity) firework.getShooter();
if (onlyCrossbow && shooter instanceof Player player) {
ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
ItemStack itemInOffHand = player.getInventory().getItemInOffHand();
boolean shotFromCrossbow = false;
if (itemInMainHand.getItemMeta() instanceof CrossbowMeta meta) {
if (meta.getChargedProjectiles().contains(firework)) {
shotFromCrossbow = true;
}
}
if (itemInOffHand.getItemMeta() instanceof CrossbowMeta meta) {
if (meta.getChargedProjectiles().contains(firework)) {
shotFromCrossbow = true;
}
}
if (!shotFromCrossbow) {
return;
}
}
for (Entity entity : firework.getNearbyEntities(5, 5, 5)) { for (Entity entity : firework.getNearbyEntities(5, 5, 5)) {
if (entity instanceof Player player) { if (entity instanceof Player player) {
Vector boostDirection = player.getLocation().toVector().subtract(firework.getLocation().toVector()).normalize(); Vector boostDirection = player.getLocation().toVector().subtract(firework.getLocation().toVector()).normalize();

@ -4,6 +4,3 @@ boostPower: 4.0
# damageShooter defines whether the shooter gets damages by their own fireworks (default: false) # damageShooter defines whether the shooter gets damages by their own fireworks (default: false)
damageShooter: false damageShooter: false
# onlyCrossbow defines whether the only fireworks shot from a crossbow should launch entities or if all fireworks (default: true)
onlyCrossbow: true