Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlimeWorld read-only status always true when importing vanilla world #152

Open
bennie3211 opened this issue Feb 3, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@bennie3211
Copy link

bennie3211 commented Feb 3, 2025

Describe the issue
Creating a new SlimeWorld from a vanilla world using asp.readVanillaWorld() directly states that the SlimeWorld read-only flag is true when the slimeLoader is provided and not null. According to the documentation on infernalsuite.com it will set the read-only to true when the slimeLoader is null, but after testing it appears that the SlimeWorls read-only tag is always true even when the slimeLoader is not null.

Spigot version
This server is running AdvancedSlimePaper version 1.21.3-16529-main@fb817aa (2024-12-20T16:52:56Z) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
You are running the latest version

Plugin version
N/A

How to reproduce

/**
 * Sets up a {@link SlimeWorld} asynchronously from the 'vanilla' directory. Or gives a reference to the already
 * loaded {@link SlimeWorld} if it is already loaded.
 *
 * @param importWorldName The name of the world to import to memory
 *
 * @return A {@link CompletableFuture} returning the setup {@link SlimeWorld}, or null when an exception occurs
 */
public @NotNull CompletableFuture<@Nullable SlimeWorld> importNewSlimeWorldAsync(@NotNull String importWorldName) {
    if (this.slimeApi.getLoadedWorld(importWorldName) != null) {
        return CompletableFuture.completedFuture(this.slimeApi.getLoadedWorld(importWorldName));
    }

    return CompletableFuture.supplyAsync(() -> {
        try {
            File worldDirectory = new File(this.vanillaDirectory, importWorldName);
            SlimeWorld slimeWorld;

            if (!worldDirectory.exists() || !worldDirectory.isDirectory()) {
                throw new IllegalStateException("The world directory does not exist.");
            }

            /*
            * Debugging if the loader is null, which can make it that the read-only status is true.
            * After testing this debug message it returns false, indicating that the slimeLoader is not null.
            */
            Logging.logDebug("Slime loader null? " + (this.slimeLoader == null), this);

            slimeWorld = this.slimeApi.readVanillaWorld(worldDirectory, importWorldName, this.slimeLoader);

            /*
             * Debugging if the world is read only after importing with the slimeLoader (that is not null).
             * The read-only status is given to be true at this point.
             */
            Logging.logDebug("Slime world is read-only: " + slimeWorld.isReadOnly(), this);

            return slimeWorld;
        } catch (Exception e) {
            throw new CompletionException(e);
        }
    });
}

Crash reports (if available)
It's not crashing but the logging from the version above is given as follows

[12:14:29 INFO]: GonnaKillYou2 issued server command: /rr create dungeon DO2
[12:14:29 INFO]: [RelicRush] me.gonnakillyou2.relicrush.worlds.WorldManager: Slime loader null? false
[12:14:29 INFO]: [STDOUT] [com.infernalsuite.aswm.serialization.anvil.AnvilWorldReader] Loading region file: r.-1.3.mca...
[12:14:29 INFO]: [STDOUT] [com.infernalsuite.aswm.serialization.anvil.AnvilWorldReader] Loading region file: r.-1.4.mca...
[12:14:30 INFO]: [STDOUT] [com.infernalsuite.aswm.serialization.anvil.AnvilWorldReader] Loading region file: r.-2.3.mca...
[12:14:30 INFO]: [STDOUT] [com.infernalsuite.aswm.serialization.anvil.AnvilWorldReader] Loading region file: r.-2.4.mca...
[12:14:31 INFO]: [RelicRush] me.gonnakillyou2.relicrush.worlds.WorldManager: Slime world is read-only: true
[12:14:31 INFO]: [RelicRush] me.gonnakillyou2.relicrush.dungeons.DungeonManager: Setting slime world for dungeon
[12:14:32 INFO]: [RelicRush] me.gonnakillyou2.relicrush.dungeons.DungeonManager: Starting an editing world
[12:14:32 INFO]: [AdvancedSlimePaper] Loading world DO2...
[12:14:32 INFO]: [AdvancedSlimePaper] World DO2 loaded in 53ms.
@bennie3211 bennie3211 added the bug Something isn't working label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant