added a reload command

This commit is contained in:
Richard Mikloš 2024-08-13 13:00:02 +02:00
parent 4eb1af4636
commit dbf7de4d52
15 changed files with 10 additions and 19 deletions

Binary file not shown.

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

@ -1,10 +0,0 @@
name: RocketJumping
version: '1.4-1.21'
main: org.twipnetwork.rocketJumping.RocketJumping
api-version: '1.21'
commands:
rocketlauncher:
description: Reloads the RocketJumping configuration.
usage: /<command> reload
permission: rocketlauncher.reload
permission-message: You do not have permission to execute this command.

@ -1,8 +1,7 @@
package org.twipnetwork.rocketJumping; package org.twipnetwork.rocketJumping;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.*;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -14,6 +13,8 @@ import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.Objects;
public final class RocketJumping extends JavaPlugin implements Listener { public final class RocketJumping extends JavaPlugin implements Listener {
private double boostPower; private double boostPower;
@ -35,7 +36,6 @@ public final class RocketJumping extends JavaPlugin implements Listener {
boostPower = config.getDouble("boostPower", 4.0); boostPower = config.getDouble("boostPower", 4.0);
damageShooter = config.getBoolean("damageShooter", false); damageShooter = config.getBoolean("damageShooter", false);
} }
@EventHandler @EventHandler
public void onProjectileHit(ProjectileHitEvent event) { public void onProjectileHit(ProjectileHitEvent event) {
Projectile projectile = event.getEntity(); Projectile projectile = event.getEntity();
@ -56,15 +56,16 @@ public final class RocketJumping extends JavaPlugin implements Listener {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("rocketlauncher")) { if (command.getName().equalsIgnoreCase("rocketjumping")) {
if (args.length > 0 && args[0].equalsIgnoreCase("reload")) { if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
reloadConfig(); reloadConfig();
loadConfigValues(); loadConfigValues();
sender.sendMessage("§aRocketLauncher config reloaded!"); sender.sendMessage("§aRocketJumping config reloaded!");
return true; return true;
} }
} }
return false; return false;
} }
} }

@ -1,10 +1,10 @@
name: RocketJumping name: RocketJumping
version: '1.5-1.21' version: '1.6-1.21'
main: org.twipnetwork.rocketJumping.RocketJumping main: org.twipnetwork.rocketJumping.RocketJumping
api-version: 1.21 api-version: 1.21
commands: commands:
rocketlauncher: rocketjumping:
description: Reloads the RocketJumping configuration. description: Reloads the RocketJumping configuration.
usage: /<command> reload usage: /<command> reload
permission: rocketlauncher.reload permission: rocketjumpingo.reload
permission-message: You do not have permission to execute this command. permission-message: You do not have permission to execute this command.