mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancydialogs: Make dialog registry accessible through api
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.fancyinnovations.fancydialogs.api;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface DialogRegistry {
|
||||
|
||||
/**
|
||||
* Registers a new dialog in the registry.
|
||||
*
|
||||
* @param dialog the dialog to register
|
||||
*/
|
||||
void register(@NotNull Dialog dialog);
|
||||
|
||||
/**
|
||||
* Unregisters a dialog from the registry.
|
||||
*
|
||||
* @param id the ID of the dialog to unregister
|
||||
*/
|
||||
void unregister(@NotNull String id);
|
||||
|
||||
/**
|
||||
* Retrieves a dialog by its ID.
|
||||
*
|
||||
* @param id the ID of the dialog to retrieve
|
||||
* @return the dialog, or null if not found
|
||||
*/
|
||||
Dialog get(String id);
|
||||
|
||||
/**
|
||||
* Retrieves all registered dialogs.
|
||||
*
|
||||
* @return a collection of all registered dialogs
|
||||
*/
|
||||
Collection<Dialog> getAll();
|
||||
|
||||
/**
|
||||
* Clears all registered dialogs.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
}
|
||||
@@ -13,4 +13,6 @@ public interface FancyDialogs {
|
||||
|
||||
Dialog createDialog(DialogData data);
|
||||
|
||||
DialogRegistry getDialogRegistry();
|
||||
|
||||
}
|
||||
|
||||
@@ -203,6 +203,7 @@ public class FancyDialogsPlugin extends JavaPlugin implements FancyDialogs {
|
||||
return fdConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialogRegistry getDialogRegistry() {
|
||||
return dialogRegistry;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class DialogRegistry {
|
||||
public class DialogRegistry implements com.fancyinnovations.fancydialogs.api.DialogRegistry {
|
||||
|
||||
private final Map<String, Dialog> dialogs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user