Mirage icon

Mirage -----

Configurable resettable worlds, per player world rendering, with rollback and backups



Maven
<repository>
<id>bonka</id>
<url> https://nexus.bonka.gg/repository/maven-public/</url>
</repository>
bonka https://nexus.bonka.gg/repository/maven-public/ " tabindex="0" role="button" style="box-sizing: border-box; position: relative; font-size: 14px; font-weight: var(--base-text-weight-medium, 500); line-height: 20px; text-wrap: nowrap; vertical-align: middle; cursor: pointer; user-select: none; border: 0px; border-radius: 6px; appearance: none; color: var(--fgColor-accent, var(--color-accent-fg)); background-color: transparent; box-shadow: none; transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1), background-color, box-shadow, border-color; width: var(--control-small-size, 28px); height: var(--control-small-size, 28px); display: flex !important; padding: 0px !important; justify-content: center !important; align-items: center !important; margin: var(--base-size-8, 8px) !important;">
<dependency>
<groupId>gg.bonka</groupId>
<artifactId>Mirage</artifactId>
<version>1.0.0</version>
</dependency>
gg.bonka Mirage 1.0.0 " tabindex="0" role="button" style="box-sizing: border-box; position: relative; font-size: 14px; font-weight: var(--base-text-weight-medium, 500); line-height: 20px; text-wrap: nowrap; vertical-align: middle; cursor: pointer; user-select: none; border: 0px; border-radius: 6px; appearance: none; color: var(--fgColor-accent, var(--color-accent-fg)); background-color: transparent; box-shadow: none; transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1), background-color, box-shadow, border-color; width: var(--control-small-size, 28px); height: var(--control-small-size, 28px); display: flex !important; padding: 0px !important; justify-content: center !important; align-items: center !important; margin: var(--base-size-8, 8px) !important;">
API
Mirage uses 2 singletons from where you can easily save, load, backup and rollback mirage worlds! These singletons are WorldsDirectoryManager and WorldsTracker.

Also, don't forget to add mirage as a dependency in you plugin.yml:
depend: [Mirage] or softdepend: [Mirage]

WorldsDirectoryManager
The worlds directory manager is what makes Mirage tick. Use WorldsDirectoryManager.getMirageWorld(String worldName) to convert any world into a mirage world! You can then use WorldsDirectoryManager.getInstance() to save, load, remove, or backup the world. Although it's important to note that the WorldsDirectoryManager is not responsible for runtime worlds! So make sure you unload your worlds before doing anything with them.

example:

void deleteWorld(String worldName) {
World world = Bukkit.getWorld(worldName);

for(Player player : world.getPlayers()) {
player.kick(Component.text("World is being deleted!"));
}

Bukkit.unloadWorld(world, false);

WorldsDirectoryManager.getInstance().removeWorldAsync(WorldsDirectoryManager.getMirageWorld(worldName), (success, message) -> {
if (success) {
player.sendMessage(Chat.format(String.format("World: %s has been removed successfully!", worldName), ChatColor.SUCCESS));
} else {
player.sendMessage(Chat.format(message, ChatColor.ERROR));
}
});
}
{ if (success) { player.sendMessage(Chat.format(String.format("World: %s has been removed successfully!", worldName), ChatColor.SUCCESS)); } else { player.sendMessage(Chat.format(message, ChatColor.ERROR)); } }); }" tabindex="0" role="button" style="box-sizing: border-box; position: relative; font-size: 14px; font-weight: var(--base-text-weight-medium, 500); line-height: 20px; text-wrap: nowrap; vertical-align: middle; cursor: pointer; user-select: none; border: 0px; border-radius: 6px; appearance: none; color: var(--fgColor-accent, var(--color-accent-fg)); background-color: transparent; box-shadow: none; transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1), background-color, box-shadow, border-color; width: var(--control-small-size, 28px); height: var(--control-small-size, 28px); display: flex !important; padding: 0px !important; justify-content: center !important; align-items: center !important; margin: var(--base-size-8, 8px) !important;">
I generally recommend using the Async WorldsDirectoryManager methods, keep in mind that the callback is also on that async though!

WorldsTracker
Only relevant for worlds that have use-rollback enabled! Stores the initial state of chunks in memory and actively keeps track of changed blocks of the worlds it is tracking.

Use WorldsTracker.getInstance().getTrackedWorld(String worldName) to get a tracked world. You can either update the tracked world, meaning you save the current state of the world to memory (Not to disk, you can only do that through the WorldsDirectoryManager). Or you can reset the world to its previous state (again, memory only, the world won't get reloaded from disk, this is impossible without kicking players from the world).

These function are: trackedWorld.updateSave() and trackedWorld.reset().
Resource Information
Author:
----------
Total Downloads: 88
First Release: Aug 23, 2024
Last Update: Oct 29, 2024
Category: ---------------
All-Time Rating:
2 ratings
Find more info at github.com...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings