calmdev0499
📎 1 file 4,247 chars
📄
pasted-code-1792760355763.txt
txt 105 lines
▶
Minecraft Custom Domain Plugin — Full Project Requirements

Build a working Minecraft Paper plugin called Dreamland Domains.

1. Main Command

The main command is:

/custom  

Example:

/custom dreamlands .net

The plugin should process this command and create the finished custom domain:

.dreamlands.net

2. Domain Formatting Rules

* The dot at the beginning of the custom name is mandatory and must be added automatically.
* The player supplies their custom name and domain ending as separate command arguments.
* The domain ending must include a dot, such as .net.
* Remove all spaces from the custom name before creating the finished domain.
* Normalize the name and validate the domain ending.
* Reject missing arguments, invalid characters, malformed endings, and invalid domain names with helpful chat messages.
* Do not silently accept malformed input.
* Display the final domain in Minecraft chat after a successful save.

Example:

Input:
/custom Dragon Lands .net

Output:
.DragonLands.net

3. One Domain Per Server

* Each server may have only one saved custom domain.
* Store the domain in the plugin’s configuration file, such as plugins/DreamlandDomains/config.yml.
* When an authorized player creates a new domain, replace the previous saved domain.
* Save changes persistently so the domain remains after a server restart.
* Do not create duplicate domain entries.

Example configuration:

custom-domain: ".DragonLands.net"

4. Chat Confirmation

After successfully saving a domain, display a clear message containing the complete address.

Example:

Custom domain saved: .DragonLands.net

Provide an easy-to-copy message and explain that the owner can take a screenshot to share it with friends.

If a new domain replaces an old one, notify the player that the previous domain has been replaced.

5. Permissions and Validation

* Add a permission such as dreamlanddomains.custom.
* Include a default permission setting in plugin.yml.
* Validate input before saving it.
* Only save valid domains.
* Return helpful messages for missing arguments, invalid input, and permission errors.
* Never overwrite the saved domain when validation fails.

6. Make the Domain Actually Work

Saving a domain in a configuration file does not make it accessible over the internet.

Design the plugin so it can integrate with a real DNS provider or a separate domain-management backend. The backend must map the custom address to the correct Minecraft server address and port.

* Never pretend a domain is active merely because it was saved.
* Report whether the domain is only saved locally or has been successfully configured through DNS.
* Do not hardcode API credentials into the plugin.
* Do not claim that arbitrary domain endings, such as .play or .smp, work publicly unless they are supported by the real domain system.
* Explain that .net domains and their DNS records must be registered and controlled by the service owner.
* If the required DNS integration is unavailable, implement the local plugin functionality first and document the missing integration.

7. Technical Requirements

* Target the Paper server API compatible with the server version specified by the developer.
* Use Java and provide a complete, compilable project.
* Include plugin.yml, the main Java class, configuration defaults, command registration, permissions, and a build file such as Maven pom.xml.
* Include complete source code and clear build and installation instructions.
* Do not provide incomplete snippets or omit required files.
* Handle errors safely and avoid deleting valid saved data after a failed operation.

8. Deliverables

Provide:

1. The complete project folder structure.
2. Every required source and configuration file.
3. Instructions for compiling the plugin into a .jar.
4. Instructions for installing it on a Paper server.
5. Example commands and expected output.
6. Testing instructions for creating a domain, replacing it, restarting the server, and verifying persistence.
7. Clear instructions for connecting the plugin to a real DNS provider.

Build the local domain-saving functionality first, then explain what additional infrastructure is required to make custom domains genuinely connect players to the server.
Kodari AI
KodariOct 23 at 1:00 pm 1
DreamlandDomains
DreamlandDomains is a Paper Minecraft plugin that lets authorized players create and manage a single custom domain address per server. Players use the /custom command with a name and ending (e.g., /custom Dragon Lands .net) to generate a formatted domain like .DragonLands.net. The plugin validates input, checks permissions, removes spaces, and persists the domain to config.yml. It displays clear chat confirmations, warns when replacing existing domains, and reports whether the domain is locally saved or actively configured through a DNS backend. Includes full command registration, permission defaults, and safe error handling.

I’ll create the Paper plugin, configuration, command/permission setup, and a README covering local-only behavior, installation, testing, and DNS requirements.

Created Dreamland Domains targeting Paper 1.21.4 / Java 21. /custom <name> <ending> validates input, saves one domain to config.yml, and reports replacements; the plugin explicitly marks the address LOCAL_ONLY because DNS integration isn’t included.

The README covers Kodari compilation, installation, persistence testing, and the DNS requirements. To automate DNS changes, the next step is a backend deployed as a Discord bot project on Kodari; keep provider credentials on that backend, not in the plugin.

calmdev0499
📎 1 file 2,735 chars
📄
pasted-code-1792767559819.txt
txt 84 lines
▶
Build a Minecraft Custom Domain Plugin

Create a complete, working Minecraft Paper plugin called Dreamland Domains.

1. Main command

The command must be:

/custom  

Example:

/custom dreamlands .net

The finished domain must be:

dreamlands.net

Important: Never put a dot at the beginning of the finished domain. The dot in .net separates the custom name from the domain ending.

2. Domain creation

When a player runs /custom dreamlands .net:

1. Read the custom name and domain ending.
2. Remove all spaces from the custom name.
3. Validate both parts.
4. Combine them into dreamlands.net.
5. Check whether the domain can be claimed.
6. Save the new domain to the plugin’s configuration file.
7. Display the finished domain in Minecraft chat.

Example success message:

Your custom domain is: dreamlands.net

3. One domain per server

Each server can have only one saved custom domain.

Store it in plugins/DreamlandDomains/config.yml:

custom-domain: "dreamlands.net"

If the owner creates another domain, replace the previous domain instead of keeping multiple domains. If the new input is invalid, keep the existing domain unchanged.

4. Input validation

* Require both the custom name and the domain ending.
* Require a valid ending, such as .net.
* Reject invalid characters and malformed domain names.
* Prevent duplicate or conflicting claims where the backend supports checking availability.
* Display clear error messages when a command fails.
* Add a permission named dreamlanddomains.custom.

5. Make the address connect to Minecraft

The plugin must integrate with a real domain and DNS system.

* Configure the domain to point to the correct Minecraft server IP and port.
* Use an appropriate DNS provider API or a separate backend service.
* Never claim that a domain is active just because it has been saved in a file.
* Keep API keys and credentials secure.
* Clearly report whether the domain is saved locally, configured in DNS, and ready to use.
* Do not claim that arbitrary endings can be created for free.
* Explain that a domain such as dreamlands.net must be registered and controlled by the service owner.

6. Complete project

Provide every file needed to compile and install the plugin:

* Java source code
* plugin.yml
* config.yml
* Maven pom.xml
* Command registration
* Permission configuration
* DNS integration design
* Build and installation instructions
* Testing instructions

Target the Paper version I specify. Provide the complete project, not incomplete code snippets.

First make the command, validation, configuration saving, and replacement behavior work. Then implement and test the real DNS integration so players can use the custom address to join the Minecraft server.
Kodari AI
KodariOct 23 at 3:00 pm 1

Plan:

  1. Update domain normalization and validation to produce name.ending without a leading dot.

  2. Preserve one-domain replacement and clearly report local-only status unless DNS is actually configured.

  3. Align the command, config, permissions, and README with the revised requirements.

Updated the plugin to save domains without a leading dot (for example, dreamlands.net) and revised the README examples and persistence checks accordingly.

The plugin still saves locally only: it cannot check domain availability or configure DNS without a DNS provider/backend. It continues to report LOCAL_ONLY rather than suggesting the address is live.

calmdev0499
📎 1 file 4,419 chars
📄
pasted-code-1792768327324.txt
txt 124 lines
▶
Build Dreamland Domains — Minecraft Paper Plugin

Build a complete, working Minecraft Paper plugin called Dreamland Domains.

Main goal

Allow a Minecraft server owner to create one custom domain that acts as an additional way to connect to their existing server.

The plugin must never change the server’s actual IP address. The original server address must continue working exactly as before.

For example, the server’s original address might be:

dreamlandsmp.skymc.io

The owner creates this custom address:

dreamlands.net

Both addresses should connect players to the same Minecraft server once DNS is configured correctly.

1. Command

Implement this command:

/custom  

Example:

/custom dreamlands .net

Expected custom domain:

dreamlands.net

Requirements:

* Accept a custom name and a domain ending as separate arguments.
* Remove spaces from the custom name before building the domain.
* Keep the dot between the name and ending.
* Reject missing arguments and invalid domain syntax.
* Validate that the ending is supported by the actual domain system.
* Display the completed domain in Minecraft chat.

2. Save one custom domain

Store the custom domain in:

plugins/DreamlandDomains/config.yml

Example:

custom-domain: "dreamlands.net"

Requirements:

* Only one custom domain per server.
* Creating another domain replaces the previous custom domain.
* Never change or delete the server’s original IP.
* Invalid input must not overwrite a working saved domain.
* The saved custom domain must survive server restarts.

3. Make the address actually connect

The custom domain must be an additional connection address, not a replacement for the original IP.

Implement or integrate the required DNS system so that the custom domain resolves to the existing server.

Requirements:

* Support a DNS provider API or a separate backend service.
* Correctly account for the server’s IP address and port.
* Use an appropriate DNS record, such as an A record plus an SRV record when needed.
* Do not assume every hosting provider supports custom domains.
* Never claim that the domain is active until the DNS configuration has been verified.
* Keep provider credentials secure and outside publicly distributed source code.
* Explain which domain ownership, DNS service, and hosting permissions are required.

The plugin configuration file alone cannot make an internet domain work. Implement the DNS integration instead of pretending that saving the domain is enough.

4. Minecraft Multiplayer compatibility

The final custom address should be usable in the Minecraft Java Edition Multiplayer menu through both Direct Connection and Add Server.

The original server address must remain usable.

DNS works independently of Minecraft versions, but actual connection compatibility still depends on the server software, client version, and any version-compatibility plugins.

5. Chat messages

After saving a custom domain, show a message such as:

Custom domain saved: dreamlands.net

If the DNS system is configured and verified, show a separate confirmation that the address is ready to use.

If DNS setup fails, explain that the address has been saved but is not yet ready for public connections.

Allow the owner to copy the address or take a screenshot of the message.

6. Permissions and safety

* Add the permission dreamlanddomains.custom.
* Include permission declarations in plugin.yml.
* Validate names and endings.
* Prevent malformed or unsupported domains.
* Do not allow unauthorized players to change the saved domain.
* Do not destroy the previous domain when a replacement fails validation or DNS setup.

7. Complete project deliverables

Provide:

* Every Java source file.
* plugin.yml.
* Default config.yml.
* Maven pom.xml.
* All required command and permission code.
* DNS integration code or a clearly specified backend API.
* Complete compilation and installation instructions.
* Testing instructions for domain creation, replacement, server restart, and joining with the custom address.

Target the Paper version I specify and provide a complete, compilable project rather than incomplete snippets.

Priority: First implement the working command and persistent domain storage. Then implement the real DNS connection needed to make the custom address work. Clearly identify anything that requires external domain registration, DNS configuration, or hosting-provider support.
Kodari AI
KodariOct 23 at 3:23 pm 2
  1. Check the existing command, persistence, and project setup.

  2. Add configurable DNS setup and verification without exposing credentials or falsely marking failures as active.

  3. Update the setup and testing instructions.

Implemented Cloudflare DNS provisioning for Dreamland Domains. With an active Cloudflare zone, scoped API token, and configured public IPv4 address and port, /custom creates or checks the A and Minecraft SRV records and verifies them before saving the status as DNS_VERIFIED.

If DNS setup fails on the first domain, it is saved as LOCAL_ONLY. If a replacement fails, the previously saved domain stays unchanged. Added the Maven descriptor and updated the README with setup and testing instructions.

Live DNS wasn’t tested because no Cloudflare token, registered zone, or server address was provided. The service owner must supply those and control the registered domain for public connections to work.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
pom.xml
README.md
settings.gradle
Code
9 722
src/main/java/com/dreamlanddomains/DreamlandDomainsPlugin.java
package com.dreamlanddomains;

import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public final class DreamlandDomainsPlugin extends JavaPlugin implements CommandExecutor {
    private static final String PERMISSION = "dreamlanddomains.custom";
    private static final Pattern ASCII_LETTER_OR_DIGIT = Pattern.compile("[A-Za-z0-9]");
    private boolean dnsOperationInProgress;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        Objects.requireNonNull(getCommand("custom"), "custom command is missing from plugin.yml")
                .setExecutor(this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!sender.hasPermission(PERMISSION)) {
            sender.sendMessage(color("&cYou don't have permission to save a custom domain."));
            return true;
        }

        if (args.length < 2) {
            sender.sendMessage(color("&cUsage: /custom <name> <ending> (example: /custom Dragon Lands .net)"));
            return true;
        }

        String suppliedName = String.join("", Arrays.copyOf(args, args.length - 1));
        String name = suppliedName.replaceAll("\\s+", "").toLowerCase(Locale.ROOT);
        String ending = args[args.length - 1].toLowerCase(Locale.ROOT);

        if (!isValidLabel(name)) {
            sender.sendMessage(color("&cInvalid name. Use 1-63 English letters, numbers, or internal hyphens; the name cannot start or end with a hyphen."));
            return true;
        }

        if (!isValidEnding(ending)) {
            sender.sendMessage(color("&cInvalid ending. Include a dot and valid domain labels, such as .net or .co.uk."));
            return true;
        }

        String domain = name + ending;
        if (domain.length() > 253) {
            sender.sendMessage(color("&cThat domain is too long. A domain must be 253 characters or fewer."));
            return true;
        }

        if (dnsOperationInProgress) {
            sender.sendMessage(color("&eA domain/DNS update is already in progress. Please try again shortly."));
            return true;
        }

        String previousDomain = getConfig().getString("custom-domain", "");
        String apiToken = System.getenv("DREAMLANDDOMAINS_CLOUDFLARE_API_TOKEN");
        String serverIp = getConfig().getString("dns.server-ip", "").trim();
        int serverPort = getConfig().getInt("dns.server-port", 25565);
        String dnsSetupError = getDnsSetupError(apiToken, serverIp, serverPort);
        if (dnsSetupError != null) {
            handleLocalOnlySave(sender, domain, previousDomain, dnsSetupError);
            return true;
        }

        dnsOperationInProgress = true;
        sender.sendMessage(color("&eChecking Cloudflare DNS and configuring &f" + domain + "&e..."));
        Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
            CloudflareDnsManager.ProvisionResult result = null;
            Exception failure = null;
            try {
                CloudflareDnsManager manager = new CloudflareDnsManager(apiToken, serverIp, serverPort, getLogger());
                result = manager.configure(domain, previousDomain);
            } catch (Exception exception) {
                failure = exception;
                getLogger().warning("Cloudflare DNS setup failed for " + domain + ": " + exception.getMessage());
            }

            CloudflareDnsManager.ProvisionResult completedResult = result;
            Exception completedFailure = failure;
            Bukkit.getScheduler().runTask(this, () -> {
                dnsOperationInProgress = false;
                if (!isEnabled()) {
                    return;
                }

                if (completedFailure == null) {
                    saveDomain(domain, "DNS_VERIFIED");
                    if (previousDomain != null && !previousDomain.isBlank() && !previousDomain.equalsIgnoreCase(domain)) {
                        sender.sendMessage(color("&eThe previous saved domain &f" + previousDomain + " &ehas been replaced."));
                    }
                    sender.sendMessage(color("&aCustom domain saved: &f" + domain));
                    sender.sendMessage(color("&aCloudflare DNS records were verified. The address is ready for connections after DNS propagation."));
                    sender.sendMessage(color("&eTake a screenshot of this message to share the address with friends."));
                    if (!completedResult.cleanupWarning().isBlank()) {
                        sender.sendMessage(color("&eNote: " + completedResult.cleanupWarning()));
                    }
                } else if (previousDomain == null || previousDomain.isBlank()) {
                    saveDomain(domain, "LOCAL_ONLY");
                    sender.sendMessage(color("&eCustom domain saved locally: &f" + domain));
                    sender.sendMessage(color("&cDNS setup failed, so this address is not ready for public connections: &f" + completedFailure.getMessage()));
                    sender.sendMessage(color("&eTake a screenshot to share the saved address, but it will not connect until DNS is configured."));
                } else {
                    sender.sendMessage(color("&cDNS setup failed. The saved domain &f" + previousDomain + " &cwas left unchanged."));
                    sender.sendMessage(color("&7Reason: " + completedFailure.getMessage()));
                }
            });
        });
        return true;
    }

    private String getDnsSetupError(String apiToken, String serverIp, int serverPort) {
        if (apiToken == null || apiToken.isBlank()) {
            return "Cloudflare API token is missing from DREAMLANDDOMAINS_CLOUDFLARE_API_TOKEN.";
        }
        if (!CloudflareDnsManager.isValidIpv4(serverIp)) {
            return "Set dns.server-ip to the server's public IPv4 address in config.yml.";
        }
        if (serverPort < 1 || serverPort > 65535) {
            return "dns.server-port must be between 1 and 65535.";
        }
        return null;
    }

    private void handleLocalOnlySave(CommandSender sender, String domain, String previousDomain, String reason) {
        if (previousDomain == null || previousDomain.isBlank()) {
            saveDomain(domain, "LOCAL_ONLY");
            sender.sendMessage(color("&eCustom domain saved locally: &f" + domain));
            sender.sendMessage(color("&cIt is not ready for public connections. " + reason));
            sender.sendMessage(color("&eTake a screenshot to share the saved address."));
        } else if (previousDomain.equalsIgnoreCase(domain)) {
            sender.sendMessage(color("&eThe saved domain is still &f" + previousDomain + "&e, but it is not DNS-verified."));
            sender.sendMessage(color("&cDNS setup is unavailable: " + reason));
        } else {
            sender.sendMessage(color("&cDNS setup is unavailable, so &f" + previousDomain + " &cwas left unchanged."));
            sender.sendMessage(color("&7Reason: " + reason));
        }
    }

    private void saveDomain(String domain, String status) {
        getConfig().set("custom-domain", domain);
        getConfig().set("domain-status", status);
        saveConfig();
    }

    private boolean isValidEnding(String ending) {
        if (ending.length() < 2 || !ending.startsWith(".")) {
            return false;
        }

        String[] labels = ending.substring(1).split("\\.", -1);
        for (String label : labels) {
            if (!isValidLabel(label)) {
                return false;
            }
        }
        return true;
    }

    private boolean isValidLabel(String label) {
        if (label.isEmpty() || label.length() > 63
                || !ASCII_LETTER_OR_DIGIT.matcher(label.substring(0, 1)).matches()
                || !ASCII_LETTER_OR_DIGIT.matcher(label.substring(label.length() - 1)).matches()) {
            return false;
        }

        for (int i = 0; i < label.length(); i++) {
            char character = label.charAt(i);
            if (!(character >= 'A' && character <= 'Z')
                    && !(character >= 'a' && character <= 'z')
                    && !(character >= '0' && character <= '9')
                    && character != '-') {
                return false;
            }
        }
        return true;
    }

    private String color(String message) {
        return ChatColor.translateAlternateColorCodes('&', message);
    }
}