This commit is contained in:
Richard Mikloš 2024-07-26 23:22:10 +02:00
parent 582fbafa53
commit 745c7df193
18 changed files with 8 additions and 25 deletions

Binary file not shown.

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>

@ -3,7 +3,7 @@ plugins {
}
group = 'org.twipnetwork'
version = '1.0-SNAPSHOT'
version = '1.2-1.21'
repositories {
mavenCentral()

@ -4,6 +4,3 @@ boostPower: 4.0
# damageShooter defines whether the shooter gets damages by their own fireworks (default: false)
damageShooter: false
# damageOthers defines whether other people (excluding the shooter) get damaged (default: true)
damageOthers: true

@ -1,4 +1,4 @@
name: RocketJumping
version: '1.0-SNAPSHOT'
version: '1.2-1.21'
main: org.twipnetwork.rocketJumping.RocketJumping
api-version: '1.21'

@ -16,7 +16,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
private double boostPower;
private boolean damageShooter;
private boolean damageOthers;
@Override
public void onEnable() {
@ -24,7 +23,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();
boostPower = config.getDouble("boostPower", 4.0);
damageShooter = config.getBoolean("damageShooter", false);
damageOthers = config.getBoolean("damageOthers", true);
Bukkit.getPluginManager().registerEvents(this, this);
}
@ -36,13 +34,11 @@ public final class RocketJumping extends JavaPlugin implements Listener {
public void onProjectileHit(ProjectileHitEvent event) {
Projectile projectile = event.getEntity();
if (projectile instanceof Firework) {
Firework firework = (Firework) projectile;
if (projectile instanceof Firework firework) {
Entity shooter = (Entity) firework.getShooter();
for (Entity entity : firework.getNearbyEntities(5, 5, 5)) {
if (entity instanceof Player) {
Player player = (Player) entity;
if (entity instanceof Player player) {
Vector boostDirection = player.getLocation().toVector().subtract(firework.getLocation().toVector()).normalize();
player.setVelocity(player.getVelocity().add(boostDirection.multiply(boostPower)));
@ -54,14 +50,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
entity.setVelocity(entity.getVelocity().add(boostDirection.multiply(boostPower)));
}
}
if (!damageOthers) {
for (Entity entity : firework.getNearbyEntities(5, 5, 5)) {
if (!(entity instanceof Player && entity.equals(shooter))) {
((Player) entity).setNoDamageTicks(1);
}
}
}
}
}
}

@ -4,6 +4,3 @@ boostPower: 4.0
# damageShooter defines whether the shooter gets damages by their own fireworks (default: false)
damageShooter: false
# damageOthers defines whether other people (excluding the shooter) get damaged (default: true)
damageOthers: true

@ -1,4 +1,4 @@
name: RocketJumping
version: '1.0-SNAPSHOT'
version: '1.2-1.21'
main: org.twipnetwork.rocketJumping.RocketJumping
api-version: '1.21'