added a reload command

This commit is contained in:
Richard Mikloš 2024-08-13 00:20:12 +02:00
parent bc5ffcc2fc
commit 1184c0370c
2 changed files with 29 additions and 1 deletions

@ -1,6 +1,8 @@
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.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;
@ -30,6 +32,13 @@ public final class RocketJumping extends JavaPlugin implements Listener {
public void onDisable() { public void onDisable() {
} }
private void loadConfigValues() {
FileConfiguration config = getConfig();
boostPower = config.getDouble("boostPower", 4.0);
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();
@ -52,4 +61,17 @@ public final class RocketJumping extends JavaPlugin implements Listener {
} }
} }
} }
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("rocketlauncher")) {
if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
reloadConfig();
loadConfigValues();
sender.sendMessage("§aRocketLauncher config reloaded!");
return true;
}
}
return false;
}
} }

@ -1,4 +1,10 @@
name: RocketJumping name: RocketJumping
version: '1.3-1.21' version: '1.4-1.21'
main: org.twipnetwork.rocketJumping.RocketJumping main: org.twipnetwork.rocketJumping.RocketJumping
api-version: '1.21' 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.