mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Add mcMMO reload command "/mcmmoreload"
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
package com.gmail.nossr50.commands.server;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReloadCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if (!Permissions.reload(sender))
|
||||
return false;
|
||||
}
|
||||
|
||||
Bukkit.broadcastMessage(LocaleLoader.getString("Commands.Reload.Start"));
|
||||
mcMMO.getConfigManager().reloadConfigs();
|
||||
Bukkit.broadcastMessage(LocaleLoader.getString("Commands.Reload.Finished"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -425,7 +425,6 @@ public class mcMMO extends JavaPlugin {
|
||||
//Unload configs last
|
||||
configManager.unloadAllConfigsAndRegisters();
|
||||
|
||||
|
||||
debug("Was disabled."); // How informative!
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,10 @@ public final class Permissions {
|
||||
return permissible.hasPermission("mcmmo.commands.mmoedit");
|
||||
}
|
||||
|
||||
public static boolean reload(Permissible permissible) {
|
||||
return permissible.hasPermission("mcmmo.commands.reload");
|
||||
}
|
||||
|
||||
public static boolean mmoeditOthers(Permissible permissible) {
|
||||
return permissible.hasPermission("mcmmo.commands.mmoedit.others");
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.gmail.nossr50.commands.experience.SkillresetCommand;
|
||||
import com.gmail.nossr50.commands.party.PartyCommand;
|
||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||
import com.gmail.nossr50.commands.player.*;
|
||||
import com.gmail.nossr50.commands.server.ReloadCommand;
|
||||
import com.gmail.nossr50.commands.skills.*;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@ -174,6 +175,15 @@ public final class CommandRegistrationManager {
|
||||
command.setExecutor(new MmoeditCommand());
|
||||
}
|
||||
|
||||
private static void registerMcmmoReloadCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcmmoreload");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmoreload"));
|
||||
command.setPermission("mcmmo.commands.reload");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmoreload"));
|
||||
command.setExecutor(new ReloadCommand());
|
||||
}
|
||||
|
||||
private static void registerSkillresetCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("skillreset");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
|
||||
@ -445,5 +455,8 @@ public final class CommandRegistrationManager {
|
||||
|
||||
// Skill Commands
|
||||
registerSkillCommands();
|
||||
|
||||
//Config Commands
|
||||
registerMcmmoReloadCommand();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user