mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-09 01:37:37 +01:00
feat: Add reload command
This commit is contained in:
parent
16096acc34
commit
19ad1db5fb
@ -25,8 +25,8 @@ import com.onarandombox.MultiverseCore.api.LocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.api.MVConfig;
|
||||
import com.onarandombox.MultiverseCore.api.MVCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.commands.CheckCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.CloneCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ConfirmCommand;
|
||||
@ -35,6 +35,7 @@ import com.onarandombox.MultiverseCore.commands.DebugCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.DeleteCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.LoadCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.RegenCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ReloadCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
|
||||
@ -208,6 +209,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
this.commandManager.registerCommand(new DeleteCommand(this));
|
||||
this.commandManager.registerCommand(new LoadCommand(this));
|
||||
this.commandManager.registerCommand(new RegenCommand(this));
|
||||
this.commandManager.registerCommand(new ReloadCommand(this));
|
||||
this.commandManager.registerCommand(new TeleportCommand(this));
|
||||
this.commandManager.registerCommand(new UnloadCommand(this));
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class ReloadCommand extends MultiverseCommand {
|
||||
public ReloadCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("reload")
|
||||
@CommandPermission("multiverse.core.reload")
|
||||
@Description("Reloads config files for all multiverse modules.")
|
||||
public void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
|
||||
issuer.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
|
||||
this.plugin.loadConfigs();
|
||||
this.plugin.getAnchorManager().loadAnchors();
|
||||
this.plugin.getMVWorldManager().loadWorlds(true);
|
||||
|
||||
List<String> configsLoaded = new ArrayList<>();
|
||||
configsLoaded.add("Multiverse-Core - config.yml");
|
||||
configsLoaded.add("Multiverse-Core - worlds.yml");
|
||||
configsLoaded.add("Multiverse-Core - anchors.yml");
|
||||
|
||||
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
|
||||
this.plugin.getServer().getPluginManager().callEvent(configReload);
|
||||
|
||||
configReload.getAllConfigsLoaded().forEach(issuer::sendMessage);
|
||||
issuer.sendMessage(String.format("%sReload Complete!", ChatColor.GREEN));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user