noob489

csinlaj a survivle szerveremhez egy rtp ami at vissz /mvtp smp vilagba

Kodari AI
KodariJul 1 at 3:06 pm 1
RTPPlugin
A survival server random teleport plugin with /rtp for teleporting to random safe locations within configurable radius, and /mvtp for teleporting players between worlds (including SMP world). Features configurable cooldowns, warmup timers, safe-location detection, and world existence validation. Lightweight and permission-friendly.

I’ll create a survival RTP plugin with /rtp and /mvtp <world> commands.

Let me check what was created so far and continue building the remaining files

[Generation stopped]

noob489

/rtp4 legyen a parancs es az rtp lefutatja /mvtp smpt

Kodari AI
KodariJul 1 at 3:09 pm 2

Megvan az összes fájl. A kérés: /rtp4 legyen a parancs, és /rtp4 futtassa le a /mvtp smp-t. Átírom a parancsnevet, létrehozom a Command executorokat.

Most már létrehozom a két command executort.

noob489

na kesz?

Kodari AI
KodariJul 1 at 3:09 pm 1

Igen, kész. Egy apró bugot javítok a movement checkben (NPE lehetőség

Kész, rendben. Íme a végeredmény:

Fájlok:

Fájl
Szerep
RTPPlugin.java
Main class — regisztrálja a parancsokat
RTP4Command.java
/rtp4
— először lefuttatja
/mvtp smp
, majd warmup után random teleport a center worldbe
MVTPCommand.java
/mvtp <world>
— átrak a megadott világ spawnjára
LocationFinder.java
Random biztonságos hely keresése a konfigurált rádiuszon belül
config.yml
Center, rádiusz, cooldown, warmup, üzenetek
plugin.yml
Parancsok:
rtp4
,
mvtp

Működés:

  1. /rtp4 → játékos parancsot ad → automatikusan lefut a /mvtp smp → kis várakozás (warmup) → random teleportálás a center világban (config: rtp.center.world)

  2. /mvtp smp → közvetlenül átrak a megadott világba

Config: config.yml-ben állíthatod a center világot (world → smp), rádiuszt, cooldown-t, warmup-ot, és az összes üzenetet.

A movement-cancel NPE javítva. Használatra kész.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 339
src/main/java/com/example/rtp/RTPPlugin.java
package com.example.rtp;

import com.example.rtp.commands.MVTPCommand;
import com.example.rtp.commands.RTP4Command;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

public class RTPPlugin extends JavaPlugin {

    private static RTPPlugin instance;

    private String centerWorld;
    private int centerX;
    private int centerZ;
    private int minRadius;
    private int maxRadius;
    private int cooldownSeconds;
    private int warmupSeconds;
    private int maxAttempts;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();
        loadConfig();

        getCommand("rtp4").setExecutor(new RTP4Command(this));
        getCommand("mvtp").setExecutor(new MVTPCommand(this));

        getLogger().info("RTPPlugin enabled.");
    }

    @Override
    public void onDisable() {
        getLogger().info("RTPPlugin disabled.");
    }

    public void loadConfig() {
        reloadConfig();
        FileConfiguration cfg = getConfig();

        centerWorld = cfg.getString("rtp.center.world", "world");
        centerX = cfg.getInt("rtp.center.x", 0);
        centerZ = cfg.getInt("rtp.center.z", 0);
        minRadius = cfg.getInt("rtp.min-radius", 500);
        maxRadius = cfg.getInt("rtp.max-radius", 2000);
        cooldownSeconds = cfg.getInt("rtp.cooldown-seconds", 60);
        warmupSeconds = cfg.getInt("rtp.warmup-seconds", 5);
        maxAttempts = cfg.getInt("rtp.max-attempts", 50);
    }

    public String message(String key) {
        return getConfig().getString("messages." + key, "&cMessage not found: " + key);
    }

    public static RTPPlugin getInstance() {
        return instance;
    }

    public String getCenterWorld() { return centerWorld; }
    public int getCenterX() { return centerX; }
    public int getCenterZ() { return centerZ; }
    public int getMinRadius() { return minRadius; }
    public int getMaxRadius() { return maxRadius; }
    public int getCooldownSeconds() { return cooldownSeconds; }
    public int getWarmupSeconds() { return warmupSeconds; }
    public int getMaxAttempts() { return maxAttempts; }
}