Interface ViewResources
DocumentView- 
Nested Class Summary
Nested Classes - 
Method Summary
Modifier and TypeMethodDescriptionGets the resource module.Gets the name of the resource modulegetView()Gets the document view these resource belong to.loadBuffer(String uri) Load a string buffer from thegetModule().Result<net.kyori.adventure.text.Component, DelphiException> loadComponent(@NotNull String uri, @Nullable ViewResources.ComponentFormat format) Attempts to load a chat component.loadDocument(String uri) Attempts to load a document from the specified resource path.Result<org.bukkit.inventory.ItemStack, DelphiException> loadItemStack(String uri) Loads an item stack from a JSON file.loadStylesheet(String uri) Attempts to load a stylesheet from the specified resource path.Result<net.kyori.adventure.text.Component, DelphiException> parseComponent(@NotNull String data, @Nullable ViewResources.ComponentFormat format) Parses the specified data string into a component.Result<org.bukkit.inventory.ItemStack, DelphiException> parseItemStack(String json) Loads an item stack from the specified JSON string.Parse a URI into a resource path. 
- 
Method Details
- 
getModule
 - 
getModuleName
 - 
getView
 - 
resolve
Parse a URI into a resource path.Using the
./as a path prefix means the path will be relative to the currently open menu file instead of the module's root.Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.- Parameters:
 uri- URI string- Returns:
 - A successful result if the URI was parsed, an erroneous result otherwise.
 
 - 
loadBuffer
Load a string buffer from thegetModule().Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.ERR_API_MODULEIf the module is not an IoModule.ERR_NO_FILEModule threw a NoSuchFileExceptionERR_ACCESS_DENIEDModule threw a AccessDeniedExceptionERR_IO_ERRORModule threw an IOException- Parameters:
 uri- File path- Returns:
 - Successful result, if the buffer was loaded, or an erroneous one
 
 - 
loadItemStack
Loads an item stack from a JSON file.Any errors thrown during the method's execution will be caught and returned in the result.
If the underlying module is not an
IoModulethen an erroneous result is returned, otherwiseIoModule.loadString(ResourcePath)is called, and it attempts to parse JSON from the returned buffer.The item is loaded from minecraft's JSON format. Example:
{ "id": "minecraft:netherite_sword", "count": 1, "components": { "minecraft:enchantments": { "levels": { "minecraft:sharpness": 5 } } } }Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.ERR_API_MODULEIf the module is not an IoModule.ERR_NO_FILEModule threw a NoSuchFileExceptionERR_ACCESS_DENIEDModule threw a AccessDeniedExceptionERR_IO_ERRORModule threw an IOExceptionERR_SYNTAXFailed to parse JSON from file contents ERR_SCHEMA_ERRORIf the item fails to load from the loaded JSON - Parameters:
 uri- file path- Returns:
 - Loaded item, or an erroneous result, if the item cannot be loaded for any reason
 
 - 
parseItemStack
Loads an item stack from the specified JSON string.Any errors thrown during the method's execution will be caught and returned in the result.
The item is loaded from minecraft's JSON format. Example:
{ "id": "minecraft:netherite_sword", "count": 1, "components": { "minecraft:enchantments": { "levels": { "minecraft:sharpness": 5 } } } }Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.ERR_SYNTAXFailed to parse JSON from file contents ERR_SCHEMA_ERRORIf the item fails to load from the loaded JSON - Parameters:
 json- Item JSON data- Returns:
 - Loaded item, or an erroneous result, if the item cannot be loaded for any reason
 
 - 
loadDocument
Attempts to load a document from the specified resource path.Any errors thrown during the method's execution will be caught and returned in the result.
If
getModule()is aIoModulethen this method attempts to use theIoModule.loadString(ResourcePath)to load the document's XML content. If the underlying module is aApiModule, thenApiModule.loadDocument(ResourcePath, DocumentContext)is called.Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.ERR_MODULE_ERRORIf getModule()is anApiModuleand it returned an erroneous result.ERR_NO_FILEModule threw a NoSuchFileExceptionERR_ACCESS_DENIEDModule threw a AccessDeniedExceptionERR_IO_ERRORModule threw an IOExceptionERR_SAX_PARSER_INITFailed to instantiate SAX parser to parse the XML document. ERR_DOC_PARSEUnrecoverable failure trying to parse the XML data ERR_MISSING_PLUGINSOne or more of the document's required plugins are missing.The returned exception's message will contain a comma separated list of plugins that it failed to find. ERR_UNKNOWNAn unknown error caused the document parser to return a nulldocument- Parameters:
 uri- file path- Returns:
 - Loaded document, or an erroneous result if the document cannot be loaded for any reason.
 
 - 
loadStylesheet
Attempts to load a stylesheet from the specified resource path.Any errors thrown during the method's execution will be caught and an erroneous result returned.
If
getModule()is aIoModulethen this method attempts to use theIoModule.loadString(ResourcePath)to load the stylesheet. If the underlying module is aApiModule, then an erroneous result is returned.Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.ERR_API_MODULEThe underlying module is an ApiModule, stylesheet loading not supported.ERR_NO_FILEModule threw a NoSuchFileExceptionERR_ACCESS_DENIEDModule threw a AccessDeniedExceptionERR_IO_ERRORModule threw an IOExceptionERR_SYNTAXUnrecoverable failure trying to parse the stylesheet data. - Parameters:
 uri- file path- Returns:
 - Loaded stylesheet, or an empty result if the stylesheet could not be loaded for any reason
 - See Also:
 
 - 
loadComponent
Result<net.kyori.adventure.text.Component, DelphiException> loadComponent(@NotNull @NotNull String uri, @Nullable @Nullable ViewResources.ComponentFormat format) Attempts to load a chat component.Any errors thrown during the methods execution will be caught and an erroneous result returned.
If
getModule()is aIoModulethen this method attempts to use theIoModule.loadString(ResourcePath)to load the chat component. If the underlying module is aApiModule, then an erroneous result is returned.Result errors Error code Description ERR_INVALID_PATHThe uricould not be parsed into a resource path.ERR_API_MODULEThe underlying module is an ApiModule, stylesheet loading not supported.ERR_NO_FILEModule threw a NoSuchFileExceptionERR_ACCESS_DENIEDModule threw a AccessDeniedExceptionERR_IO_ERRORModule threw an IOExceptionERR_SYNTAXUnrecoverable failure trying to parse the component data. ERR_SCHEMA_ERROROnly thrown when reading JSON, means the JSON is incorrect. - Parameters:
 uri- Path to the component data.format- Format to load from, ifnull, usesViewResources.ComponentFormat.JSON- Returns:
 - Loaded component, or an empty resul, if the component couldn't be loaded for any reason.
 
 - 
parseComponent
Result<net.kyori.adventure.text.Component, DelphiException> parseComponent(@NotNull @NotNull String data, @Nullable @Nullable ViewResources.ComponentFormat format) Parses the specified data string into a component.Any errors thrown during the methods execution will be caught and an erroneous result returned.
Result errors Error code Description ERR_SYNTAXUnrecoverable failure trying to parse the component data. ERR_SCHEMA_ERROROnly thrown when reading JSON, means the JSON is incorrect. - Parameters:
 data-format-- Returns:
 
 
 -