kallu jasus
📎 1 file 5,299 chars
📄
pasted-code-1790302654139.txt
txt 276 lines
▶
Create a Minecraft Paper plugin for Minecraft 1.26.2 called **WorldHome**.

The plugin must be fully compatible with **Multiverse-Core** and must allow me to control exactly which worlds the plugin works in through `config.yml`.

### 1. World Configuration

Create a `config.yml` like this:

```yml
enabled-worlds:
  - survival
  - survival_nether
  - survival_the_end

dimension-worlds:
  survival:
    nether: survival_nether
    end: survival_the_end

  survival_nether:
    overworld: survival
    end: survival_the_end

  survival_the_end:
    overworld: survival
    nether: survival_nether
```

Only worlds listed under `enabled-worlds` should use this plugin.

If a world is NOT listed in `enabled-worlds`, the plugin must completely ignore that world.

The plugin must NOT interfere with other Multiverse worlds such as:
- lobby
- lifesteal
- oneblock
- test worlds

unless I manually add them to `config.yml`.

### 2. Home System

Add these commands:

```text
/sethome
/sethome 
/home
/home 
/delhome 
/homes
```

The player should be able to create multiple homes.

Example:

```text
/sethome base
/sethome mine
/sethome shop
```

Then:

```text
/home base
/home mine
/home shop
```

### 3. World-Specific Homes

Homes must be stored separately according to the world.

For example:

```text
Player
 ├── survival
 │    ├── base
 │    └── mine
 │
 ├── survival_nether
 │    └── fortress
 │
 └── survival_the_end
      └── endbase
```

A home created in `survival` must NOT automatically become available in another world.

When a player runs `/home`, only homes belonging to the player's current world should be shown.

Example:

Player is currently in `survival_nether`.

`/homes`

should only show:

```text
fortress
```

### 4. Multiverse Compatibility

Do NOT create worlds yourself.

Multiverse-Core will create/manage the worlds.

This plugin should detect existing Multiverse worlds and work with them.

If a configured world does not exist, show a clear warning in console instead of crashing the server.

Example:

```text
[WorldHome] Warning: Configured world 'survival_nether' does not exist.
```

### 5. Dimension Linking

The configured worlds should be linked together.

If:

```yml
survival:
  nether: survival_nether
  end: survival_the_end
```

then the plugin should know that:

```text
survival
      ↕
survival_nether
      ↕
survival_the_end
```

When a player enters a configured Nether/End portal, teleport them to the corresponding world defined in `config.yml`.

Do NOT assume default world names.

For example, I may use:

```text
mainworld
mainworld_nether
mainworld_the_end
```

The names must come entirely from `config.yml`.

### 6. Separate World Data

Each configured world must maintain its own homes.

Do not mix homes between worlds.

The plugin should safely save all data to disk so that homes are not lost after a server restart.

Use a clean data format such as:

```text
plugins/WorldHome/homes.yml
```

### 7. Permissions

Add permissions:

```text
worldhome.sethome
worldhome.home
worldhome.delhome
worldhome.homes
worldhome.admin
```

Default player permissions should allow normal home commands.

Admin permission should be required for admin/debug commands.

### 8. Admin Commands

Add:

```text
/worldhome reload
/worldhome info
```

`/worldhome reload` should reload `config.yml` without requiring a server restart.

`/worldhome info` should show which configured worlds are currently detected.

### 9. Safety

Before teleporting to a home:

- Check that the world still exists.
- Check that the saved location is valid.
- Prevent teleporting to an unloaded/non-existing world.
- Display a clear error message if the world was deleted.
- Do not crash the server.

### 10. Important Requirement

The plugin must be **world-scoped**.

If `config.yml` contains:

```yml
enabled-worlds:
  - survival
  - survival_nether
  - survival_the_end
```

then the plugin works ONLY in those worlds.

For example:

```text
survival        → plugin works
survival_nether → plugin works
survival_the_end → plugin works

lobby           → plugin does nothing
lifesteal       → plugin does nothing
oneblock        → plugin does nothing
```

### 11. Technical Requirements

Build the plugin for:

- Minecraft/Paper 1.26.2
- Java version appropriate for Paper 1.26.2
- Multiverse-Core compatibility
- Maven project
- `plugin.yml`
- `config.yml`
- Persistent `homes.yml`
- Clean, optimized Java code
- No unnecessary dependencies

The final project must compile successfully with:

```bash
mvn clean package
```

The final output should be:

```text
WorldHome-1.0.0.jar
```

Also provide complete installation instructions and explain exactly:

1. Where to put the JAR.
2. How to configure `config.yml`.
3. How to create worlds using Multiverse.
4. How to link the worlds.
5. How to use `/sethome`.
6. How to use `/home`.
7. How to reload the plugin.
8. How permissions work.

Do not leave any TODOs or placeholder code. Generate the complete working plugin source code.
Kodari AI
KodariSep 25 at 2:19 am 1
WorldHome
World-scoped home management plugin for Paper 1.26.2 with Multiverse-Core compatibility. Players can set, list, and teleport to multiple named homes per world, with homes stored separately for each configured world. Features configurable enabled-worlds list, dimension linking for Nether/End portals, persistent YAML storage, reload and info admin commands, and full permission support. Automatically detects Multiverse worlds and safely handles missing or deleted worlds without crashing.
  1. Create the Maven/Paper 1.26.2 project, plugin metadata, and default world-link configuration.

  2. Implement world-scoped homes, persistent storage, admin commands, and configured portal routing.

  3. Add installation, Multiverse setup, configuration, and permissions instructions.

Created the WorldHome 1.0.0 Maven project with world-specific persistent homes, enabled-world checks, configurable portal links, reload/info commands, permissions, and Multiverse setup instructions in README.md.

Build with Java 25 using mvn clean package; the configured output is target/WorldHome-1.0.0.jar.

kallu jasus

fix the problem after restart server muliver wolrd is deletd

Kodari AI
KodariSep 25 at 2:51 am 1

WorldHome contains no code that creates, unloads, or deletes worlds. I updated its warning to say “is not loaded” instead of claiming the world does not exist, and added Multiverse recovery steps to the README.

After restart, check /mv list. If the world folder still exists but Multiverse doesn’t list it, import it again, for example /mv import survival_nether nether. If the folder itself is missing, restore it from a backup or recreate it with Multiverse; WorldHome won’t generate a replacement world.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
8 757
src/main/java/com/worldhome/WorldHomePlugin.java
package com.worldhome;

import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

public final class WorldHomePlugin extends JavaPlugin {
    private Set<String> enabledWorlds = Set.of();
    private Set<String> configuredWorlds = Set.of();
    private Map<String, Map<String, String>> dimensionWorlds = Map.of();
    private HomeStorage homeStorage;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        reloadWorldConfiguration();
        homeStorage = new HomeStorage(this);

        WorldHomeCommand commandHandler = new WorldHomeCommand(this);
        registerCommand("sethome", commandHandler);
        registerCommand("home", commandHandler);
        registerCommand("delhome", commandHandler);
        registerCommand("homes", commandHandler);
        registerCommand("worldhome", commandHandler);
        getServer().getPluginManager().registerEvents(new PortalListener(this), this);
    }

    public void reloadWorldConfiguration() {
        reloadConfig();

        Set<String> worlds = new LinkedHashSet<>();
        for (String worldName : getConfig().getStringList("enabled-worlds")) {
            if (worldName != null && !worldName.isBlank()) {
                worlds.add(worldName.trim());
            }
        }

        Set<String> configured = new LinkedHashSet<>(worlds);
        Map<String, Map<String, String>> links = new LinkedHashMap<>();
        var dimensions = getConfig().getConfigurationSection("dimension-worlds");
        if (dimensions != null) {
            for (String sourceWorld : dimensions.getKeys(false)) {
                var sourceLinks = dimensions.getConfigurationSection(sourceWorld);
                if (sourceLinks == null) {
                    continue;
                }
                Map<String, String> linksForWorld = new LinkedHashMap<>();
                for (String dimension : Set.of("overworld", "nether", "end")) {
                    String targetWorld = sourceLinks.getString(dimension);
                    if (targetWorld != null && !targetWorld.isBlank()) {
                        targetWorld = targetWorld.trim();
                        linksForWorld.put(dimension, targetWorld);
                        configured.add(targetWorld);
                    }
                }
                links.put(sourceWorld, linksForWorld);
                configured.add(sourceWorld);
            }
        }

        enabledWorlds = Collections.unmodifiableSet(worlds);
        configuredWorlds = Collections.unmodifiableSet(configured);
        dimensionWorlds = Collections.unmodifiableMap(links);

        for (String worldName : configuredWorlds) {
            if (Bukkit.getWorld(worldName) == null) {
                getLogger().warning("Configured world '" + worldName + "' is not loaded. WorldHome does not create or delete worlds; check Multiverse-Core's world registration and the world folder.");
            }
        }
    }

    private void registerCommand(String name, WorldHomeCommand commandHandler) {
        PluginCommand command = getCommand(name);
        if (command != null) {
            command.setExecutor(commandHandler);
            command.setTabCompleter(commandHandler);
        }
    }

    public boolean isEnabledWorld(String worldName) {
        return enabledWorlds.contains(worldName);
    }

    public String getLinkedWorld(String sourceWorld, String dimension) {
        Map<String, String> links = dimensionWorlds.get(sourceWorld);
        return links == null ? null : links.get(dimension.toLowerCase(Locale.ROOT));
    }

    public Set<String> getEnabledWorlds() {
        return enabledWorlds;
    }

    public Set<String> getConfiguredWorlds() {
        return configuredWorlds;
    }

    public HomeStorage getHomeStorage() {
        return homeStorage;
    }
}