i18n: Reload command

This commit is contained in:
Lildirt 2023-03-01 11:25:26 -05:00
parent 3e468dba4d
commit ca0f6febb5
3 changed files with 13 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import org.bukkit.ChatColor;
import org.jetbrains.annotations.NotNull;
@ -21,9 +22,9 @@ public class ReloadCommand extends MultiverseCoreCommand {
@Subcommand("reload")
@CommandPermission("multiverse.core.reload")
@Description("Reloads config files for all multiverse modules.")
@Description("{@@mv-core.reload.description}")
public void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
issuer.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
issuer.sendInfo(MVCorei18n.RELOAD_RELOADING);
this.plugin.loadConfigs();
this.plugin.getAnchorManager().loadAnchors();
this.plugin.getMVWorldManager().loadWorlds(true);
@ -36,7 +37,8 @@ public class ReloadCommand extends MultiverseCoreCommand {
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
this.plugin.getServer().getPluginManager().callEvent(configReload);
// @TODO: replace this sendMessage and format the configsLoaded above, maybe?
configReload.getAllConfigsLoaded().forEach(issuer::sendMessage);
issuer.sendMessage(String.format("%sReload Complete!", ChatColor.GREEN));
issuer.sendInfo(MVCorei18n.RELOAD_SUCCESS);
}
}

View File

@ -50,6 +50,10 @@ public enum MVCorei18n implements MessageKeyProvider {
REGEN_FAILED,
REGEN_SUCCESS,
REGEN_PROMPT,
// reload command
RELOAD_RELOADING,
RELOAD_SUCCESS,
DEBUG_INFO_OFF,
DEBUG_INFO_ON;

View File

@ -61,6 +61,10 @@ mv-core.regen.regenerating=Regenerating world '{world}'...
mv-core.regen.failed=There was an issue regenerating '{world}'! Please check console for errors.
mv-core.regen.success=World {world} was regenerated!
mv-core.regen.prompt=Are you sure you want to regenerate world '{world}'?
mv-core.reload.description=Reloads config files for all Multiverse modules.
mv-core.reload.reloading=Reloading all Multiverse Plugin configs...
mv-core.reload.success=Reload complete!
mv-core.debug.info.description=Show the current debug level.
mv-core.debug.info.off=&fMultiverse Debug mode is &cOFF&f.
mv-core.debug.info.on=&fMultiverse Debug mode is at &alevel {level}&f.