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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>

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

@ -3,7 +3,4 @@
boostPower: 4.0 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
# damageOthers defines whether other people (excluding the shooter) get damaged (default: true)
damageOthers: true

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

@ -16,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 damageOthers;
@Override @Override
public void onEnable() { public void onEnable() {
@ -24,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);
damageOthers = config.getBoolean("damageOthers", true);
Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(this, this);
} }
@ -36,13 +34,11 @@ public final class RocketJumping extends JavaPlugin implements Listener {
public void onProjectileHit(ProjectileHitEvent event) { public void onProjectileHit(ProjectileHitEvent event) {
Projectile projectile = event.getEntity(); Projectile projectile = event.getEntity();
if (projectile instanceof Firework) { if (projectile instanceof Firework firework) {
Firework firework = (Firework) projectile;
Entity shooter = (Entity) firework.getShooter(); Entity shooter = (Entity) firework.getShooter();
for (Entity entity : firework.getNearbyEntities(5, 5, 5)) { for (Entity entity : firework.getNearbyEntities(5, 5, 5)) {
if (entity instanceof Player) { if (entity instanceof Player player) {
Player player = (Player) entity;
Vector boostDirection = player.getLocation().toVector().subtract(firework.getLocation().toVector()).normalize(); Vector boostDirection = player.getLocation().toVector().subtract(firework.getLocation().toVector()).normalize();
player.setVelocity(player.getVelocity().add(boostDirection.multiply(boostPower))); 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))); 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);
}
}
}
} }
} }
} }

@ -3,7 +3,4 @@
boostPower: 4.0 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
# damageOthers defines whether other people (excluding the shooter) get damaged (default: true)
damageOthers: true

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