mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancydialogs, docs: Add command to reload dialogs
This commit is contained in:
@@ -30,6 +30,13 @@ Loads all dialog data from the storage.
|
||||
- **Syntax**: `/fancydialogs storage load`
|
||||
- **Permissions**: `fancydialogs.commands.fancydialogs.storage.load`
|
||||
|
||||
### Reload all dialogs
|
||||
|
||||
Clears the dialog registry and loads all dialog data from the storage.
|
||||
|
||||
- **Syntax**: `/fancydialogs storage reload`
|
||||
- **Permissions**: `fancydialogs.commands.fancydialogs.storage.reload`
|
||||
|
||||
## Registry
|
||||
|
||||
## List all dialogs
|
||||
|
||||
@@ -27,8 +27,7 @@ public final class FancyDialogsCMD {
|
||||
@Description("Shows the version of FancyDialogs")
|
||||
@CommandPermission("fancydialogs.commands.tutorial")
|
||||
public void version(
|
||||
final BukkitCommandActor actor,
|
||||
final String tutorial
|
||||
final BukkitCommandActor actor
|
||||
) {
|
||||
String version = plugin.getPluginMeta().getVersion();
|
||||
|
||||
@@ -72,6 +71,25 @@ public final class FancyDialogsCMD {
|
||||
.send(actor.sender());
|
||||
}
|
||||
|
||||
@Command("fancydialogs storage reload")
|
||||
@Description("Clears the dialog registry and loads all dialog data from the storage")
|
||||
@CommandPermission("fancydialogs.commands.storage.load")
|
||||
public void storageReload(
|
||||
final BukkitCommandActor actor
|
||||
) {
|
||||
plugin.getDialogRegistry().clear();
|
||||
|
||||
Collection<DialogData> dialogs = plugin.getDialogStorage().loadAll();
|
||||
for (DialogData dialogData : dialogs) {
|
||||
DialogImpl dialog = new DialogImpl(dialogData.id(), dialogData);
|
||||
plugin.getDialogRegistry().register(dialog);
|
||||
}
|
||||
|
||||
translator.translate("commands.fancydialogs.storage.reload.success")
|
||||
.replace("count", String.valueOf(dialogs.size()))
|
||||
.send(actor.sender());
|
||||
}
|
||||
|
||||
@Command("fancydialogs registry list")
|
||||
@Description("Lists all registered dialogs")
|
||||
@CommandPermission("fancydialogs.commands.registry.list")
|
||||
|
||||
@@ -8,6 +8,8 @@ messages:
|
||||
success: "<dark_gray>› <gray>Successfully saved {warningColor}{count}<gray> dialogs to the storage."
|
||||
load:
|
||||
success: "<dark_gray>› <gray>Successfully loaded {warningColor}{count}<gray> dialogs from the storage."
|
||||
reload:
|
||||
success: "<dark_gray>› <gray>Successfully reloaded {warningColor}{count}<gray> dialogs from the storage."
|
||||
registry:
|
||||
list:
|
||||
empty: "<dark_gray>› <gray>There are no dialogs registered."
|
||||
|
||||
Reference in New Issue
Block a user