K

create a velocity plugin that teleports every player into limbo server, and shows bossbar with text setted up in config. make the plugin reload every 10 second but also make command "reapstart reload" to manually reload plugin. when command "reapstart start" is used, send all players to server main and when the command is triggered make the plugin don't work anymore

Kodari AI
KodariJan 28 at 5:08 pm 5,166 (v2)

I’ll create a Velocity plugin that manages player teleportation to limbo with bossbar notifications and restart control.

ReapStart
A Velocity proxy plugin that manages server restarts by teleporting players to a limbo server with a customizable bossbar notification. Features include automatic config reload every 10 seconds, manual reload command, and a start command to send all players back to the main server while disabling the plugin functionality.

Plugin created successfully! Features:

  • Auto-teleport: Every 10 seconds, teleports all players to limbo server

  • BossBar: Shows customizable message to all players

  • Auto-reload: Config reloads every 10 seconds automatically

  • Commands:

    • /reapstart reload - Manual config reload

    • /reapstart start - Sends all players to main server and disables plugin

  • Config (config.toml): Customize limbo/main server names and bossbar text

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 383
src/main/java/com/reapstart/ReapStart.java
package com.reapstart;

import com.google.inject.Inject;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer;
import org.slf4j.Logger;

import java.nio.file.Path;
import java.util.concurrent.TimeUnit;

@Plugin(
    id = "reapstart",
    name = "ReapStart",
    version = "1.0.0",
    description = "Manages server restarts with limbo teleportation and bossbar notifications",
    authors = {"ReapStart"}
)
public class ReapStart {

    private final ProxyServer server;
    private final Logger logger;
    private final Path dataDirectory;
    private ConfigManager configManager;
    private PlayerManager playerManager;
    private BossBarManager bossBarManager;
    private boolean active = true;

    @Inject
    public ReapStart(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) {
        this.server = server;
        this.logger = logger;
        this.dataDirectory = dataDirectory;
    }

    @Subscribe
    public void onProxyInitialization(ProxyInitializeEvent event) {
        this.configManager = new ConfigManager(this);
        this.configManager.loadConfig();

        this.bossBarManager = new BossBarManager(this);
        this.playerManager = new PlayerManager(this);

        server.getCommandManager().register("reapstart", new ReapStartCommand(this));

        server.getScheduler()
            .buildTask(this, () -> {
                if (active) {
                    configManager.loadConfig();
                    bossBarManager.updateBossBar();
                    playerManager.teleportPlayersToLimbo();
                }
            })
            .repeat(10L, TimeUnit.SECONDS)
            .schedule();

        logger.info("ReapStart has been initialized!");
    }

    public ProxyServer getServer() {
        return server;
    }

    public Logger getLogger() {
        return logger;
    }

    public Path getDataDirectory() {
        return dataDirectory;
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public BossBarManager getBossBarManager() {
        return bossBarManager;
    }

    public PlayerManager getPlayerManager() {
        return playerManager;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public void reload() {
        configManager.loadConfig();
        bossBarManager.updateBossBar();
        logger.info("ReapStart has been reloaded!");
    }
}