Modifier and Type | Method and Description |
---|---|
static LayoutManager |
getInstance()
Gets LayoutManager instance.
|
Layout |
getLayout(String name)
Gets layout by name.
|
List<Layout> |
getLayouts()
Gets all available layouts.
|
SyncConnection |
getSyncConnection() |
Layout |
layoutFromJson(String json)
Parses a JSON string to a layout and registers necessary resources.
|
void |
registerLayoutExtension(LayoutExtension layoutExtension,
org.bukkit.plugin.Plugin plugin)
Registers the layout extension as a bukkit event listener and calls the
LayoutLoadEvent for all
layouts that have already been loaded. |
void |
reload(Consumer<String> failedLayoutCallback)
Reloads layouts from the layouts/ folder.
|
void |
setSyncConnection(SyncConnection syncConnection) |
void |
setup(Consumer<String> failedLayoutCallback)
Sets up the LayoutManager by loading all layouts from the layouts/ folder.
|
void |
shutdownSync()
Shutdown any running syncing processes
|
void |
syncFromJson(String json)
Perform live sync from the given json.
|
public static LayoutManager getInstance()
public void setup(Consumer<String> failedLayoutCallback)
failedLayoutCallback
- will be called with the file name of json files that could not be parsed as a layoutpublic Layout getLayout(String name)
name
- the namepublic Layout layoutFromJson(String json) throws IOException
json
- the jsonIOException
- the indicate malformed JSONIllegalArgumentException
- to indicate wrong JSON structurepublic void syncFromJson(String json) throws IOException
json
- the jsonIOException
- parsing errorspublic void reload(Consumer<String> failedLayoutCallback)
failedLayoutCallback
- will be called with the file name of json files that could not be parsed as a layoutpublic void registerLayoutExtension(LayoutExtension layoutExtension, org.bukkit.plugin.Plugin plugin)
LayoutLoadEvent
for all
layouts that have already been loaded.layoutExtension
- the layout extensionplugin
- the your pluginpublic void shutdownSync()
public SyncConnection getSyncConnection()
public void setSyncConnection(SyncConnection syncConnection)
Copyright © 2021. All rights reserved.