config reload command

This commit is contained in:
2023-06-24 22:22:47 +02:00
parent 0e9984bbb7
commit 4b386923e6
5 changed files with 97 additions and 6 deletions
@@ -1,5 +1,6 @@
package me.youhavetrouble.notjustnameplates;
import me.youhavetrouble.notjustnameplates.commands.MainCommand;
import me.youhavetrouble.notjustnameplates.nameplates.TeamManagementListener;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.java.JavaPlugin;
@@ -11,14 +12,22 @@ public final class NotJustNameplates extends JavaPlugin {
private static NJNConfig config;
private static long time = Long.MIN_VALUE;
private TeamManagementListener teamManagementListener = null;
@Override
public void onEnable() {
instance = this;
config = new NJNConfig(this);
DefaultPermissions.registerPermission("notjustnameplates.seeown", "Allows a player to see their own nameplate", PermissionDefault.FALSE);
DefaultPermissions.registerPermission("notjustnameplates.command", "Allows a player to use the /njn command", PermissionDefault.TRUE);
this.teamManagementListener = new TeamManagementListener(this);
getServer().getPluginManager().registerEvents(this.teamManagementListener, this);
new MainCommand(this);
getServer().getPluginManager().registerEvents(new TeamManagementListener(this), this);
getServer().getScheduler().runTaskTimerAsynchronously(this, () -> {
time++;
if (config == null) return;
@@ -31,6 +40,12 @@ public final class NotJustNameplates extends JavaPlugin {
}, 1, 1);
}
public void reloadPluginConfig() {
config = new NJNConfig(this);
teamManagementListener.reloadTeams();
}
public static NotJustNameplates getInstance() {
return instance;
}