### SlimeWorld Configuration Example Source: https://github.com/renaudrl/btc-core/blob/main/README.md Example configuration for the SlimeWorld system, located in config/BTCCore/slimeworld-config.yml. ```yaml slimeworld: enabled: true backend: "mysql" default-rules: copperFade: 50 keepInventory: true ``` -------------------------------- ### Run Test Server Source: https://github.com/renaudrl/btc-core/blob/main/README.md Build the plugin and start a test server instance with Mojmap mappings. ```bash # Build plugin and start server with Mojmap mappings ./gradlew :btccore-server:runServer ``` -------------------------------- ### Implement SlimeLoader Storage Backends Source: https://context7.com/renaudrl/btc-core/llms.txt Examples of initializing and interacting with File, MySQL, and Redis storage loaders, as well as performing world migrations. ```java import dev.btc.core.api.loaders.SlimeLoader; import dev.btc.core.loaders.file.FileLoader; import dev.btc.core.loaders.mysql.MysqlLoader; import dev.btc.core.loaders.redis.RedisLoader; public class LoaderSetup { // File-based loader with cold storage archiving public SlimeLoader createFileLoader() throws Exception { File worldDir = new File("slime_worlds"); FileLoader loader = new FileLoader(worldDir); // List available worlds for (String worldName : loader.listWorlds()) { System.out.println("Available world: " + worldName); } // Check if world exists (checks both active and archived) if (loader.worldExists("my_world")) { byte[] worldData = loader.readWorld("my_world"); System.out.println("World size: " + worldData.length + " bytes"); } // Archive world to cold storage (Zstd compression) loader.archiveWorld("inactive_world"); return loader; } // MySQL loader for networked servers public SlimeLoader createMySQLLoader() throws Exception { MysqlLoader loader = new MysqlLoader( "jdbc:mysql://{host}:{port}/{database}?useSSL={usessl}", "localhost", // host 3306, // port "minecraft_worlds", // database false, // useSSL "username", // username "password" // password ); // List all worlds stored in MySQL for (String world : loader.listWorlds()) { System.out.println("MySQL world: " + world); } return loader; } // Redis loader for high-performance caching public SlimeLoader createRedisLoader() { RedisLoader loader = new RedisLoader("redis://localhost:6379"); try { // Save world data to Redis byte[] worldData = /* serialized world */; loader.saveWorld("dungeon_instance_001", worldData); // Delete world when done loader.deleteWorld("dungeon_instance_001"); } catch (Exception e) { e.printStackTrace(); } return loader; } // Migrate world between storage backends public void migrateWorldToMySQL(String worldName, FileLoader source, MysqlLoader destination) { BTCCoreAPI api = BTCCoreAPI.instance(); try { api.migrateWorld(worldName, source, destination); System.out.println("Migrated " + worldName + " to MySQL"); } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### Initialize Global State Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Initializes global state variables, including Zf, Jf, Xf, and a counter dn. This function should be called once at the start. ```javascript function ss(){qn||(qn=!0,_n=Ff(Zf),vn=Ff(Jf),gn=Ff(Xf),dn=0)} ``` -------------------------------- ### Handle InventoryPreMoveItemEvent in Java Source: https://context7.com/renaudrl/btc-core/llms.txt Implement a listener for InventoryPreMoveItemEvent to intercept and potentially cancel item transfers between containers. This example shows how to block transfers from protected containers and into full containers. ```java import dev.btc.core.event.inventory.InventoryPreMoveItemEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.inventory.Inventory; import org.bukkit.block.Container; public class ItemTransferListener implements Listener { @EventHandler public void onPreMoveItem(InventoryPreMoveItemEvent event) { Inventory source = event.getSource(); Inventory destination = event.getDestination(); Inventory initiator = event.getInitiator(); // Block transfers from protected containers if (source.getHolder() instanceof Container container) { if (isProtectedContainer(container.getBlock().getLocation())) { event.setCancelled(true); return; } } // Block transfers into full containers (optimization) if (destination.firstEmpty() == -1) { event.setCancelled(true); return; } // Log for debugging hopper chains System.out.printf("Item transfer: %s -> %s (initiated by %s)%n", source.getType(), destination.getType(), initiator.getType()); } private boolean isProtectedContainer(Location loc) { return false; } } ``` -------------------------------- ### Get Name from Input Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the name property from the input object. ```javascript function ts(n){return ss(),n.name} ``` -------------------------------- ### Get Path from Input Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the path property from the input object. ```javascript function Zf(n){return ss(),n.path} ``` -------------------------------- ### Initialize and Configure Component Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Initializes and configures a component, potentially creating instances of cs or hs based on input. ```javascript function Ss(n,t,r){return function(n,t,r){var i,e=Va(),u=Za();return e.ma([u.ka(Tf(t,(i=r,function(n){return function(n,t,r,i){var e,u;return t instanceof cs?Js(Q.vd(t.pf_1)):t instanceof hs?Va().ba(cf((u ``` -------------------------------- ### Get Base Pixel Method Source: https://github.com/renaudrl/btc-core/blob/main/btccore-server/build_output_2.txt The getBasePixel method in CraftMapCanvas is deprecated. ```java public byte getBasePixel(int x, int y) { ``` -------------------------------- ### Utility Commands Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/overview-tree.html This section details utility commands for the BTC Core plugin, such as listing worlds, setting spawn points, and managing configurations. ```APIDOC ## GET /api/worlds ### Description Retrieves a list of all managed worlds. ### Method GET ### Endpoint /api/worlds ### Response #### Success Response (200) - **worlds** (array) - A list of world names. - **worldName** (string) - The name of a managed world. #### Response Example { "worlds": ["world1", "world2", "spawn"] } ``` ```APIDOC ## POST /api/spawn/set ### Description Sets the spawn point for the current world. ### Method POST ### Endpoint /api/spawn/set ### Request Body - **location** (object) - Required - The coordinates for the spawn point. - **x** (number) - The X coordinate. - **y** (number) - The Y coordinate. - **z** (number) - The Z coordinate. - **worldName** (string) - Optional - The name of the world to set the spawn point for. Defaults to the currently loaded world. ### Request Example { "location": { "x": 100.5, "y": 64.0, "z": -200.0 }, "worldName": "myWorld" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the spawn point was set. #### Response Example { "message": "Spawn point set for world 'myWorld'." } ``` ```APIDOC ## POST /api/config/reload ### Description Reloads the plugin's configuration files. ### Method POST ### Endpoint /api/config/reload ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the configuration was reloaded. #### Response Example { "message": "Plugin configuration reloaded successfully." } ``` ```APIDOC ## GET /api/version ### Description Retrieves the current version of the BTC Core plugin. ### Method GET ### Endpoint /api/version ### Response #### Success Response (200) - **version** (string) - The plugin version. #### Response Example { "version": "1.0.0" } ``` ```APIDOC ## GET /api/worlds/list ### Description Retrieves a list of all managed worlds. ### Method GET ### Endpoint /api/worlds/list ### Response #### Success Response (200) - **worlds** (array) - A list of world names. - **worldName** (string) - The name of a managed world. #### Response Example { "worlds": ["world1", "world2", "spawn"] } ``` -------------------------------- ### GET /sentinel/notify Source: https://github.com/renaudrl/btc-core/blob/main/README.md Toggles the real-time alerting system for the executor natively. ```APIDOC ## GET /sentinel/notify ### Description Toggles the real-time alerting system for the executor natively. ### Method GET ### Endpoint /sentinel notify ``` -------------------------------- ### Get Task Path from Input Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the taskPath property from the input object. ```javascript function Xf(n){return ss(),n.taskPath} ``` -------------------------------- ### Generate Production Artifacts Source: https://github.com/renaudrl/btc-core/blob/main/README.md Build the Server Paperclip and Plugin ShadowJar for deployment. ```bash # Build both Server Paperclip and Plugin ShadowJar ./gradlew buildAll ``` -------------------------------- ### Get Plugin ID from Input Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the pluginId property from the input object. ```javascript function Jf(n){return ss(),n.pluginId} ``` -------------------------------- ### SWMImporter - main Source: https://github.com/renaudrl/btc-core/blob/main/importer/build/docs/javadoc/index-all.html The main entry point for the SWMImporter, used to initiate the import process. ```APIDOC ## POST /api/importer/main ### Description Main entry point for the importer. This method initiates the world import process. ### Method POST ### Endpoint /api/importer/main ### Parameters #### Request Body - **args** (String[]) - Required - Command-line arguments passed to the importer. ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the importer has run. ``` -------------------------------- ### Configure BTC-CORE API Dependencies Source: https://github.com/renaudrl/btc-core/blob/main/README.md Add the BTC-CORE repository and API dependency to your project. Requires Java 25. ```kotlin repositories { // Remplacez par l'URL de votre site (ex: https://borntocraftstudio.net/repo/) maven("https://borntocraftstudio.net/repo/") } dependencies { compileOnly("dev.btc.core:btccore-api:26.1.2-R0.1-SNAPSHOT") } java { toolchain.languageVersion.set(JavaLanguageVersion.of(25)) } ``` ```xml btc-studio https://borntocraftstudio.net/repo/ dev.btc.core btccore-api 26.1.2-R0.1-SNAPSHOT provided ``` -------------------------------- ### Get Default Value Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns a default value, likely related to a configuration or state. ```javascript function es(){return Lf(),wn} ``` -------------------------------- ### Build Logic and Property Handling Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Utilities for processing build logic types and property usage definitions. ```javascript function va(n){var t=n.parts;if(null==t){var r=n.summary;return null==r?null:new uo(xa(r))}for(var i=n.summary,e=null==i?null:xa(i),u=ei(),o=0,a=t.length;o build_output.txt ... ``` ```java blockstate = org.bukkit.craftbukkit.block.CapturedBlockState.getBlockState(this, pos, flags); ``` -------------------------------- ### Get Fifth Default Value Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns a fifth default value, possibly for a final default state. ```javascript function fs(){return Lf(),kn} ``` -------------------------------- ### Manage SlimeWorld Data and Properties Source: https://context7.com/renaudrl/btc-core/llms.txt Demonstrates inspecting world metadata, accessing chunks, storing custom NBT data, cloning worlds for instances, and modifying world properties. ```java import dev.btc.core.api.world.SlimeWorld; import dev.btc.core.api.world.SlimeChunk; import dev.btc.core.api.world.properties.SlimePropertyMap; import net.kyori.adventure.nbt.BinaryTag; import net.kyori.adventure.nbt.StringBinaryTag; public class WorldDataManager { public void inspectWorld(SlimeWorld world) { // Basic world info System.out.println("World: " + world.getName()); System.out.println("Read-only: " + world.isReadOnly()); System.out.println("Data version: " + world.getDataVersion()); System.out.println("Total chunks: " + world.getChunkStorage().size()); // Access specific chunk SlimeChunk chunk = world.getChunk(0, 0); if (chunk != null) { System.out.println("Chunk (0,0) exists"); } // Iterate all chunks for (SlimeChunk c : world.getChunkStorage()) { System.out.println("Chunk at: " + c.getX() + ", " + c.getZ()); } } public void storeCustomData(SlimeWorld world) { // Store custom data that persists with the world ConcurrentMap extraData = world.getExtraData(); // Store island owner extraData.put("owner", StringBinaryTag.stringBinaryTag("player_uuid_here")); // Store custom metadata extraData.put("created_at", StringBinaryTag.stringBinaryTag( String.valueOf(System.currentTimeMillis()) )); // Retrieve later BinaryTag ownerTag = extraData.get("owner"); if (ownerTag instanceof StringBinaryTag str) { System.out.println("Island owner: " + str.value()); } } public void cloneForInstance(SlimeWorld template, String instanceName) { try { // Clone with same loader (will be saved to same storage) SlimeWorld instance = template.clone(instanceName, template.getLoader()); // Or clone as read-only (temporary, won't be saved) SlimeWorld tempInstance = template.clone("temp_" + instanceName); System.out.println("Created instance: " + instance.getName()); } catch (Exception e) { e.printStackTrace(); } } public void configureWorldProperties(SlimeWorld world) { SlimePropertyMap props = world.getPropertyMap(); // Read current values int spawnX = props.getValue(SlimeProperties.SPAWN_X); String difficulty = props.getValue(SlimeProperties.DIFFICULTY); boolean pvp = props.getValue(SlimeProperties.PVP); // Modify properties props.setValue(SlimeProperties.SPAWN_X, 100); props.setValue(SlimeProperties.SPAWN_Y, 64); props.setValue(SlimeProperties.SPAWN_Z, 100); props.setValue(SlimeProperties.DIFFICULTY, "hard"); props.setValue(SlimeProperties.ALLOW_MONSTERS, true); props.setValue(SlimeProperties.ALLOW_ANIMALS, false); props.setValue(SlimeProperties.PVP, true); props.setValue(SlimeProperties.DRAGON_BATTLE, false); // Advanced properties props.setValue(SlimeProperties.SEA_LEVEL, 63); props.setValue(SlimeProperties.SAVE_POI, true); props.setValue(SlimeProperties.SAVE_BLOCK_TICKS, true); } } ``` -------------------------------- ### World GameRule Methods Deprecation Source: https://github.com/renaudrl/btc-core/blob/main/btccore-server/build_output_2.txt Methods for getting and setting GameRule values in the World class are deprecated. ```java public boolean setGameRuleValue(String rule, String value) { ``` ```java public String getGameRuleValue(String rule) { ``` -------------------------------- ### Get Fourth Default Value Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns a fourth default value, likely for another specific use case. ```javascript function as(){return Lf(),pn} ``` -------------------------------- ### Create World Command Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/index-all.html API for creating a new Slime world. ```APIDOC ## POST /api/worlds/create ### Description Creates a new empty Slime world. ### Method POST ### Endpoint /api/worlds/create ### Parameters #### Request Body - **source** (Source) - Required - The source of the command execution. - **worldName** (String) - Required - The name of the world to create. - **slimeLoader** (NamedSlimeLoader) - Required - The Slime loader to use. - **namespaceKey** (NamespacedKey) - Required - The namespace key for the world. - **worldType** (String) - Required - The type of the world to create. ``` -------------------------------- ### Regex and String Utility Initialization Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Initializes global regex patterns and utility instances for string processing. ```javascript function Ae(){C=this,this.q6_1=new RegExp("[\\\\^$*+?.()|[\\]{}]","g"),this.r6_1=new RegExp("[\\\\$]","g"),this.s6_1=new RegExp("\\$","g")}function Fe(){return null==C&&new Ae,C} ``` -------------------------------- ### Get Another Default Value Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns another default value, possibly representing a different state or configuration. ```javascript function us(){return Lf(),bn} ``` -------------------------------- ### GET /sentinel/check Source: https://github.com/renaudrl/btc-core/blob/main/README.md Fetches the last 10 violation metadata records for a specific player from the MySQL async pool. ```APIDOC ## GET /sentinel/check ### Description Fetches the last 10 violation metadata records straight from MySQL async pool. ### Method GET ### Endpoint /sentinel check ### Parameters #### Path Parameters - **player** (string) - Required - The name of the player to check. ``` -------------------------------- ### Yt(Xi).i6 Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Appends a string to the buffer. Handles null input by appending 'null'. ```javascript Yt(Xi).i6=function(n){var t=this.m6_1,r=null==n?null:$t(n);this.m6_1=t+(null==r?"null":r)} ``` -------------------------------- ### SlimePluginBootstrap bootstrap Method Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/index-all.html The bootstrap method for the SlimePluginBootstrap class. ```APIDOC ## bootstrap(BootstrapContext) ### Description Initializes the plugin using the provided BootstrapContext. ### Method N/A ### Endpoint N/A ### Parameters - **bootstrapContext** (BootstrapContext) - Required - The context for bootstrapping the plugin. ### Request Example None ### Response None ``` -------------------------------- ### Yt(Ee).toString Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the final string representation of the internal buffer. Used to get the accumulated string. ```javascript Yt(Ee).toString=function(){return this.v5_1} ``` -------------------------------- ### View Factory Methods for Element Creation Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Provides various methods on the ViewFactory to create elements with different configurations. These methods abstract the process of element instantiation. ```javascript return on.ce(this.aa_1,b,n) ``` ```javascript return on.ce(this.aa_1,b,b,n) ``` ```javascript return on.ce(this.aa_1,b,b,Lr(n)) ``` ```javascript return on.ce(this.aa_1,n,b,Lr(n)) ``` ```javascript return on.ce(this.aa_1,n,b,n) ``` ```javascript return on.ce(this.aa_1,n,t) ``` ```javascript return on.ce(this.aa_1,n,t) ``` -------------------------------- ### Yt(Ee).a Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the length of the internal string or array. Used to get the size of the data structure. ```javascript Yt(Ee).a=function(){return this.v5_1.length} ``` -------------------------------- ### World Management Commands Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/overview-tree.html This section details the commands related to managing worlds within the BTC Core plugin. ```APIDOC ## DELETE /api/worlds/{worldName} ### Description Deletes a specified world from the plugin. ### Method DELETE ### Endpoint /api/worlds/{worldName} ### Parameters #### Path Parameters - **worldName** (string) - Required - The name of the world to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world was deleted. #### Response Example { "message": "World 'exampleWorld' deleted successfully." } ``` ```APIDOC ## POST /api/worlds/import ### Description Imports a world into the plugin. ### Method POST ### Endpoint /api/worlds/import ### Request Body - **worldName** (string) - Required - The name for the imported world. - **filePath** (string) - Required - The path to the world file to import. ### Request Example { "worldName": "importedWorld", "filePath": "/path/to/world/save" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world was imported. #### Response Example { "message": "World 'importedWorld' imported successfully." } ``` ```APIDOC ## POST /api/worlds/load ### Description Loads a specified world. ### Method POST ### Endpoint /api/worlds/load ### Request Body - **worldName** (string) - Required - The name of the world to load. ### Request Example { "worldName": "myWorld" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world was loaded. #### Response Example { "message": "World 'myWorld' loaded successfully." } ``` ```APIDOC ## POST /api/worlds/save ### Description Saves the current world. ### Method POST ### Endpoint /api/worlds/save ### Request Body - **worldName** (string) - Optional - The name of the world to save. If not provided, the currently loaded world is saved. ### Request Example { "worldName": "myWorld" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world was saved. #### Response Example { "message": "World 'myWorld' saved successfully." } ``` ```APIDOC ## POST /api/worlds/unload ### Description Unloads a specified world. ### Method POST ### Endpoint /api/worlds/unload ### Request Body - **worldName** (string) - Required - The name of the world to unload. ### Request Example { "worldName": "myWorld" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world was unloaded. #### Response Example { "message": "World 'myWorld' unloaded successfully." } ``` ```APIDOC ## POST /api/worlds/template/load ### Description Loads a world from a template. ### Method POST ### Endpoint /api/worlds/template/load ### Request Body - **templateName** (string) - Required - The name of the template to load. - **newWorldName** (string) - Required - The name for the new world created from the template. ### Request Example { "templateName": "defaultTemplate", "newWorldName": "newWorldFromTemplate" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world was created from the template. #### Response Example { "message": "World 'newWorldFromTemplate' created from template 'defaultTemplate' successfully." } ``` ```APIDOC ## POST /api/worlds/migrate ### Description Migrates a world to a new format or version. ### Method POST ### Endpoint /api/worlds/migrate ### Request Body - **worldName** (string) - Required - The name of the world to migrate. ### Request Example { "worldName": "oldWorld" } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the world migration status. #### Response Example { "message": "World 'oldWorld' migration process initiated." } ``` -------------------------------- ### Yt(Ze).p Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns a reverse iterator for the collection, starting from a specified index. Used for iterating backwards. ```javascript Yt(Ze).p=function(n){return new Ye(this,n)} ``` -------------------------------- ### Yt(De).a7 Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Checks if a string starts with a specific pattern defined by a regular expression. Resets the regex lastIndex. ```javascript Yt(De).a7=function(n){this.x6_1.lastIndex=0;var t=this.x6_1.exec($t(n));return!(null==t)&&0===t.index&&this.x6_1.lastIndex===Et(n)} ``` -------------------------------- ### SWPlugin Methods Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/index-all.html Core methods for the SWPlugin. ```APIDOC ## GET /api/plugin/instance ### Description Gets the singleton instance of the SWPlugin. ### Method GET ### Endpoint /api/plugin/instance ### Response #### Success Response (200) - **pluginInstance** (SWPlugin) - The instance of the SWPlugin. #### Response Example { "pluginInstance": "" } ## GET /api/plugin/loader-manager ### Description Retrieves the LoaderManager instance associated with the plugin. ### Method GET ### Endpoint /api/plugin/loader-manager ### Response #### Success Response (200) - **loaderManager** (LoaderManager) - The LoaderManager instance. #### Response Example { "loaderManager": "" } ``` -------------------------------- ### Yt(Ee).c Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Extracts a substring from the internal string or array based on start and end indices. Similar to String.prototype.substring. ```javascript Yt(Ee).c=function(n,t){return Re(this.v5_1,n,t)} ``` -------------------------------- ### Yt(Zi).i6 Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Writes a string to the output buffer. Handles null input by writing 'null'. ```javascript Yt(Zi).i6=function(n){var t=null==n?null:$t(n),r=null==t?"null":t;this.k6_1.write(r)} ``` -------------------------------- ### Compile Java for btc-core-server Source: https://github.com/renaudrl/btc-core/blob/main/btccore-server/build_output_2.txt Compiles Java code for the btc-core-server module. This task is marked as UP-TO-DATE, indicating it has already been completed. ```bash cmd :btc-core-server:compileJava > build_output_2.txt ... ``` -------------------------------- ### Element Builder to Get PrettyText Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns a PrettyText representation of the elements built so far. This is useful for rendering or serializing the constructed element tree. ```javascript return new Aa(Qn(this.hd_1)) ``` -------------------------------- ### Initialize PluginManager Source: https://github.com/renaudrl/btc-core/blob/main/btccore-server/build_output_2.txt Instantiation of the SimplePluginManager within the project. ```java this.pluginManager = new SimplePluginManager(this, commandMap); ``` -------------------------------- ### Create Lobby World Properties Source: https://context7.com/renaudrl/btc-core/llms.txt Configures properties for a peaceful lobby world. Sets spawn location, disables monsters and animals, and sets PvP to false. Requires SlimePropertyMap and SlimeProperties imports. ```java import dev.btc.core.api.world.properties.SlimePropertyMap; import dev.btc.core.api.world.properties.SlimeProperties; public class PropertyMapExamples { public SlimePropertyMap createLobbyProperties() { SlimePropertyMap props = new SlimePropertyMap(); // Spawn configuration props.setValue(SlimeProperties.SPAWN_X, 0); props.setValue(SlimeProperties.SPAWN_Y, 100); props.setValue(SlimeProperties.SPAWN_Z, 0); props.setValue(SlimeProperties.SPAWN_YAW, 0.0f); // Peaceful lobby - no mobs props.setValue(SlimeProperties.DIFFICULTY, "peaceful"); props.setValue(SlimeProperties.ALLOW_MONSTERS, false); props.setValue(SlimeProperties.ALLOW_ANIMALS, false); props.setValue(SlimeProperties.PVP, false); // Normal environment props.setValue(SlimeProperties.ENVIRONMENT, "normal"); props.setValue(SlimeProperties.WORLD_TYPE, "flat"); return props; } public SlimePropertyMap createDungeonProperties() { SlimePropertyMap props = new SlimePropertyMap(); // Hard difficulty dungeon props.setValue(SlimeProperties.DIFFICULTY, "hard"); props.setValue(SlimeProperties.ALLOW_MONSTERS, true); props.setValue(SlimeProperties.ALLOW_ANIMALS, false); props.setValue(SlimeProperties.PVP, false); // No friendly fire // End dimension for boss arena props.setValue(SlimeProperties.ENVIRONMENT, "the_end"); props.setValue(SlimeProperties.DRAGON_BATTLE, false); // Custom boss instead // Enable tick data for redstone puzzles props.setValue(SlimeProperties.SAVE_BLOCK_TICKS, true); props.setValue(SlimeProperties.SAVE_FLUID_TICKS, true); // Enable POI for custom villager mechanics props.setValue(SlimeProperties.SAVE_POI, true); return props; } public SlimePropertyMap createSkyblockIslandProperties() { SlimePropertyMap props = new SlimePropertyMap(); // Island spawn props.setValue(SlimeProperties.SPAWN_X, 0); props.setValue(SlimeProperties.SPAWN_Y, 100); props.setValue(SlimeProperties.SPAWN_Z, 0); // Normal survival settings props.setValue(SlimeProperties.DIFFICULTY, "normal"); props.setValue(SlimeProperties.ALLOW_MONSTERS, true); props.setValue(SlimeProperties.ALLOW_ANIMALS, true); props.setValue(SlimeProperties.PVP, false); // Void biome props.setValue(SlimeProperties.DEFAULT_BIOME, "minecraft:the_void"); props.setValue(SlimeProperties.SEA_LEVEL, -63); // No water spawning // Aggressive pruning for islands (remove empty chunks) props.setValue(SlimeProperties.CHUNK_PRUNING, "aggressive"); // Limit save bounds to island area props.setValue(SlimeProperties.SHOULD_LIMIT_SAVE, true); props.setValue(SlimeProperties.SAVE_MIN_X, -5); props.setValue(SlimeProperties.SAVE_MIN_Z, -5); props.setValue(SlimeProperties.SAVE_MAX_X, 5); props.setValue(SlimeProperties.SAVE_MAX_Z, 5); return props; } public void mergeProperties() { SlimePropertyMap base = createLobbyProperties(); SlimePropertyMap override = new SlimePropertyMap(); override.setValue(SlimeProperties.PVP, true); override.setValue(SlimeProperties.DIFFICULTY, "normal"); // Merge override into base base.merge(override); // Clone properties SlimePropertyMap cloned = base.clone(); } } ``` -------------------------------- ### Handle SlimeWorld Load Events Source: https://context7.com/renaudrl/btc-core/llms.txt Listens for the LoadSlimeWorldEvent to perform post-load initialization such as setting world borders and game rules. ```java import dev.btc.core.api.events.LoadSlimeWorldEvent; import dev.btc.core.api.world.SlimeWorldInstance; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class SlimeWorldListener implements Listener { @EventHandler public void onSlimeWorldLoad(LoadSlimeWorldEvent event) { SlimeWorldInstance world = event.getSlimeWorld(); String worldName = world.getName(); System.out.println("SlimeWorld loaded: " + worldName); // Initialize world-specific features if (worldName.startsWith("dungeon_")) { initializeDungeonWorld(world); } else if (worldName.startsWith("island_")) { initializeIslandWorld(world); } // Set world border world.getWorldBorder().setCenter(0, 0); world.getWorldBorder().setSize(1000); // Apply game rules world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false); world.setGameRule(GameRule.DO_MOB_SPAWNING, false); world.setGameRule(GameRule.KEEP_INVENTORY, true); } private void initializeDungeonWorld(SlimeWorldInstance world) { // Spawn dungeon mobs, set up triggers, etc. } private void initializeIslandWorld(SlimeWorldInstance world) { // Set spawn protection, initialize island data, etc. } } ``` -------------------------------- ### Array/String Slice Function Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Extracts a portion of an array or string based on start and end indices. Handles potential index out-of-bounds scenarios. ```javascript function Au(n){var t=0,r=Et(n)-1|0,i=!1;n:for(;t<=r;){var e=Ne(zt(n,i?r:t));if(i){if(!e)break n;r=r-1|0}else e?t=t+1|0:i=!0}return Mt(n,t,r+1|0)} ``` -------------------------------- ### Range Iterator Class Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Provides an iterator for a range, managing current position and bounds. Useful for iterating over sequences with specific start and end points. ```javascript function Gu(n){if(n.e9_1<0)n.c9_1=0,n.f9_1=null;else{var t;if(n.h9_1.k9_1>0?(n.g9_1=n.g9_1+1|0,t=n.g9_1>=n.h9_1.k9_1):t=!1,t||n.e9_1>Et(n.h9_1.i9_1))n.f9_1=Ir(n.d9_1,Ru(n.h9_1.i9_1)),n.e9_1=-1;else{var r=n.h9_1.l9_1(n.h9_1.i9_1,n.e9_1);if(null==r)n.f9_1=Ir(n.d9_1,Ru(n.h9_1.i9_1)),n.e9_1=-1;else{var i=r.o9(),e=r.p9();n.f9_1=function(n,t){return t<=-2147483648?xu().t_1:Ir(n,t-1|0)}(n.d9_1,i),n.d9_1=i+e|0,n.e9_1=n.d9_1+(0===e?1:0)|0}}n.c9_1=1}} ``` ```javascript function Uu(n){this.h9_1=n,this.c9_1=-1,this.d9_1=function(n,t,r){if(0>r)throw ue("Cannot coerce value to an empty range: maximum "+r+" is less than minimum 0.");return n<0?0:n>r?r:n}(n.j9_1,0,Et(n.i9_1)),this.e9_1=this.d9_1,this.f9_1=null,this.g9_1=0} ``` -------------------------------- ### Configure SlimeWorld Game Rules Source: https://github.com/renaudrl/btc-core/blob/main/README.md Define global and world-specific game rules using YAML. Supports pattern matching with wildcards and regex prefixes. ```yaml default: # Applied to ALL SlimeWorlds copperFade: 100 randomTickSpeed: 3 worlds: # Specific world overrides "my_lobby": doDaylightCycle: false doMobSpawning: false # Pattern matching: Use * for wildcards or regex: prefix "plot_*": keepInventory: true doFireTick: false "regex:^dungeon_.*_boss$": difficulty: hard ``` -------------------------------- ### String Search Function Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Searches for a substring within a larger string, returning the starting index. Handles various search parameters and string types. ```javascript function Mu(n,t,r,i){return r=r===b?0:r,(i=i!==b&&i)||"string"!=typeof n?Nu(n,t,r,Et(n),i):n.indexOf(t,r)} ``` ```javascript function Nu(n,t,r,i,e,u){var o=(u=u!==b&&u)?it(rt(r,Ru(n)),tt(i,0)):Ir(tt(r,0),rt(i,Et(n)));if("string"==typeof n&&"string"==typeof t){var a=o.l8_1,f=o.m8_1,s=o.n8_1;if(s>0&&a<=f||s<0&&f<=a)do{var c=a;if(a=a+s|0,Qe(t,0,n,c,t.length,e))return c}while(c!==f)}else{var h=o.l8_1,l=o.m8_1,_=o.n8_1;if(_>0&&h<=l||_<0&&l<=h)do{var v=h;if(h=h+\|0,Hu(t,0,n,v,Et(t),e))return v}while(v!==l)}return-1} ``` -------------------------------- ### Spawn Async Text Display Entity Source: https://context7.com/renaudrl/btc-core/llms.txt Spawns a fake text display entity asynchronously. Requires a viewer, location, and text content. The entity is purely network-side. ```java import dev.btc.core.api.BTCCoreVisualAPI; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.Material; import org.bukkit.util.Transformation; import org.joml.Vector3f; import org.joml.Quaternionf; import java.util.UUID; import java.util.concurrent.CompletableFuture; public class AsyncVisualManager { private final BTCCoreVisualAPI visualApi = BTCCoreVisualAPI.getInstance(); // Spawn a fake display entity (runs async, 0 MSPT) public void spawnHologram(Player viewer, Location location, String text) { CompletableFuture.runAsync(() -> { int entityId = generateEntityId(); UUID uuid = UUID.randomUUID(); // Create transformation (scale, rotation, translation) Transformation transform = new Transformation( new Vector3f(0, 0, 0), // translation new Quaternionf(), // left rotation new Vector3f(1.0f, 1.0f, 1.0f), // scale new Quaternionf() // right rotation ); // Spawn text display entity (purely network-side) visualApi.spawnAsyncDisplayEntity( viewer, entityId, uuid, location, "text", // displayType: "text", "item", or "block" transform ); // Store entityId for later cleanup trackEntity(viewer, entityId); }); } // Send virtual inventory without blocking main thread public void openVirtualMenu(Player player, String menuTitle) { CompletableFuture.runAsync(() -> { // Create inventory contents ItemStack[] contents = new ItemStack[54]; // 6 rows // Fill with menu items contents[0] = new ItemStack(Material.DIAMOND_SWORD); contents[4] = new ItemStack(Material.COMPASS); contents[8] = new ItemStack(Material.BARRIER); // Close button // Fill borders ItemStack border = new ItemStack(Material.BLACK_STAINED_GLASS_PANE); for (int i = 0; i < 9; i++) { contents[45 + i] = border; // Bottom row } // Get current container ID from player's network state int containerId = getNextContainerId(player); int stateId = 0; // Use 0 to force UI update // Send inventory packets async (bypasses NMS container checks) visualApi.sendAsyncVirtualInventory( player, containerId, stateId, contents ); }); } // Cleanup fake entities public void removeHolograms(Player viewer, int... entityIds) { CompletableFuture.runAsync(() -> { visualApi.destroyAsyncDisplayEntity(viewer, entityIds); }); } // Example: Animated item display public void spawnFloatingItem(Player viewer, Location location, ItemStack item) { CompletableFuture.runAsync(() -> { int entityId = generateEntityId(); Transformation transform = new Transformation( new Vector3f(0, 0.5f, 0), // Float above ground new Quaternionf(), new Vector3f(0.5f, 0.5f, 0.5f), // Half size new Quaternionf() // right rotation ); visualApi.spawnAsyncDisplayEntity( viewer, entityId, UUID.randomUUID(), location, "item", transform ); }); } private int generateEntityId() { return (int) (Math.random() * Integer.MAX_VALUE); } private int getNextContainerId(Player player) { // Implementation depends on NMS access return 100; } private void trackEntity(Player viewer, int entityId) { // Store for cleanup } } ``` -------------------------------- ### Get Display Name from Problem ID Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Retrieves the display name for a problem ID from an array of problems. Throws an error if the problem ID array is empty. ```javascript function Qf(n){return ss(),function(n){if(0===n.length)throw we("Array is empty.");return n\[Rn(n)\]}(n.problemId).displayName} ``` -------------------------------- ### CloneWorldCmd Class Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/index-all.html Command to clone an existing Slime world. ```APIDOC ## CloneWorldCmd ### Description Command to clone an existing Slime world. ### Method N/A ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### Info Class Implementation Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Represents an informational item with a label and documentation link. Includes methods for string representation, hash code generation, and equality checks. ```javascript Yt(mo).toString=function(){return"Info(label="+$t(this.lb_1)+", docLink="+pt(this.mb_1)+")"} ``` ```javascript Yt(mo).hashCode=function(){var n=Gt(this.lb_1);return Ln(n,31)+(null==this.mb_1?0:Gt(this.mb_1))|0} ``` ```javascript Yt(mo).equals=function(n){if(this===n)return!0;if(!(n instanceof mo))return!1;var t=n instanceof mo?n:tr();return!!Vt(this.lb_1,t.lb_1)&&!!Vt(this.mb_1,t.mb_1)} ``` -------------------------------- ### CloneWorldCmd Constructor Source: https://github.com/renaudrl/btc-core/blob/main/plugin/build/docs/javadoc/index-all.html Constructs the clone world command. ```APIDOC ## CloneWorldCmd(CommandManager) ### Description Constructs the clone world command. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters - **commandManager** (CommandManager) - Required - The command manager instance. ### Request Example None ### Response None ``` -------------------------------- ### Yt($e).w1 Method Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Returns the underlying comparison function. Allows direct access to the comparison logic. ```javascript Yt($e).w1=function(){return this.e7_1} ``` -------------------------------- ### Constructor for ps Class Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Constructor for the ps class, taking multiple arguments for various properties. ```javascript function ps(n,t,r,i,e,u,o,a,f,s){this.bg_1=n,this.cg_1=t,this.dg_1=r,this.eg_1=i,this.fg_1=e,this.gg_1=u,this.hg_1=o,this.ig_1=a,this.jg_1=f,this.kg_1=s} ``` -------------------------------- ### LearnMore Object Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Represents a 'Learn More' link with associated text and a documentation URL. Used for providing additional information or help. ```javascript return"LearnMore(text="+$t(this.wc_1)+", documentationLink="+this.xc_1+")" ``` ```javascript var n=Qt(this.wc_1);return Ln(n,31)+Qt(this.xc_1)|0 ``` ```javascript if(this===n)return!0;if(!(n instanceof za))return!1;var t=n instanceof za?n:tr();return this.wc_1===t.wc_1&&this.xc_1===t.xc_1 ``` -------------------------------- ### View Factory Methods Source: https://github.com/renaudrl/btc-core/blob/main/build/reports/problems/problems-report.html Provides methods for creating and manipulating views using a factory pattern. These methods abstract the creation of view elements. ```javascript return on.ce(this.aa_1,b,n,Lr(t)) ``` ```javascript return on.ce(this.aa_1,n,b,t) ``` ```javascript return on.ce(this.aa_1,n,b,Lr(t)) ``` ```javascript return on.ce(this.aa_1,b,b,n) ``` ```javascript return on.ce(this.aa_1,b,b,Lr(n)) ``` ```javascript return on.ce(this.aa_1,n,t) ``` ```javascript return on.ce(this.aa_1,b,n) ```