sainm5656

Create a Minecraft cross-server spawn plugin using Java (Paper/Spigot) with MySQL support.

Features: /setspawn command (admin only) to set spawn per server (server1, server2, etc.) /spawn command that teleports player to their server’s spawn location even if they are on another server (cross-server support) MySQL database to store spawn locations per server Teleport delay (configurable) Teleport cooldown (configurable per player) Cancel teleport if player moves All messages shown in ActionBar (not chat) Sound effects on teleport start and completion Fully configurable config.yml: messages sounds delay time cooldown time permission nodes Support multiple servers (cross-server network like BungeeCord or Velocity) Requirements:

Clean and optimized code Easy-to-edit config system Proper MySQL connection handling Safe teleport system (no bugs or duplication issues)

Kodari AI
KodariJun 17 at 8:23 am 22

I’ll create a cross-server spawn plugin with MySQL support and advanced teleportation features.

CrossServerSpawn
A cross-server spawn system with MySQL database integration. Features per-server spawn locations, configurable teleport delays and cooldowns, movement detection to cancel teleports, ActionBar messaging, and sound effects. Supports BungeeCord/Velocity networks with cross-server teleportation, allowing players to return to their server's spawn from anywhere in the network. Includes admin commands and full configuration options.

All files created! This cross-server spawn plugin includes:

Core Features:

  • /setspawn - Sets spawn location per server (stored in MySQL)

  • /spawn - Teleports to spawn with configurable delay/cooldown

  • Cross-server support via BungeeCord/Velocity plugin messaging

  • Movement detection cancels teleport if player moves

  • ActionBar messages (no chat spam)

  • XSeries sound effects (start, complete, cancel)

Technical Implementation:

  • HikariCP connection pooling for MySQL performance

  • Async database operations to prevent server lag

  • Lazy initialization for proper class loading

  • Permission-based cooldown/delay bypass

  • Clean architecture with separated managers

Configuration:

  • Fully customizable messages with color codes

  • Adjustable delay/cooldown times

  • Configurable sounds (volume/pitch)

  • Movement threshold setting

  • Per-server naming (server1, server2, etc.)

Setup Instructions:

  1. Configure config.yml with your MySQL credentials

  2. Set unique server-name for each server in your network

  3. Grant crossserverspawn.setspawn to admins

  4. Use /setspawn on each server to set spawn points

  5. Players use /spawn from anywhere in the network

The plugin automatically creates the MySQL table and handles cross-server communication through BungeeCord’s plugin messaging channel.

sainm5656

fix Fix and extend a Minecraft cross-server spawn plugin (Paper/Spigot + MySQL + BungeeCord/Velocity).

Core System:

There is a global fallback spawn system.

Behavior Requirement:

There is a default global spawn (hub spawn) stored in MySQL.

Example: spawn is set on server3 That becomes the global spawn for all servers Commands:

Add and fix these commands:

/spawn /hub /lobby Expected Behavior:

All commands must work identically:

/spawn → teleport to global spawn /hub → teleport to global spawn /lobby → teleport to global spawn Cross-Server Logic:

Spawn is stored in MySQL as: global_spawn (not per-server anymore) If spawn is set on server3: /spawn from ANY server (server1, server2, server3, server4, server100) teleports to server3 spawn location Example:

If spawn is set on server3:

server1 → /spawn → teleport to server3 spawn server2 → /hub → teleport to server3 spawn server3 → /lobby → teleport to server3 spawn server4 → /spawn → teleport to server3 spawn Requirements:

MySQL stores only one global spawn location Remove per-server spawn logic (or ignore it) Ensure correct proxy teleport handling (BungeeCord/Velocity) Fix incorrect routing where system always defaults to server3 Ensure server switching works correctly before teleporting player Add proper fallback if spawn is not set (error message in ActionBar) Keep delay, cooldown, movement cancel system All messages, sounds, delay, cooldown must be configurable in config.yml Important Fix:

Stop using server-specific spawn keys Always fetch and use global spawn location from database Goal:

Make /spawn, /hub, and /lobby all point to a single global spawn location stored in MySQL, fully working across all servers in the network.

Kodari AI
KodariJun 17 at 8:38 am 56

I’ll fix the plugin to use a global spawn system with /spawn, /hub, and /lobby commands all pointing to one location.

I’ll convert the plugin to use a global spawn system with /spawn, /hub, and /lobby commands.

sainm5656

fix Fix this Minecraft plugin MySQL error:

Unknown column 'id' in 'field list' SQLSyntaxErrorException Problem:

When I use /setspawn, the plugin tries to use an id column, but my MySQL table does not have it.

Fix needed:

Fix SQL query or remove id usage Make sure table structure matches the code Either:

Add correct id column in MySQL table, OR Remove id from all queries and use proper keys (like world or global_spawn) Ensure /setspawn saves spawn without errors Make sure /spawn still works after fix Goal:

No SQL errors and spawn system works perfectly across all servers.

sainm5656

Fix this Minecraft cross-server spawn plugin bug:

Problem:

When I set spawn on server3, then go to server5 and use /spawn, it teleports me to my last location on server3, not the saved spawn location from MySQL.

Expected Fix: /spawn must always teleport player to the MySQL saved spawn location Do NOT use player last location or current server location Must correctly switch server first (BungeeCord/Velocity) Then teleport to saved spawn coordinates (world, x, y, z) Goal:

Make sure /spawn always sends players to the correct global spawn set on server3 from any server without using last location.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
18 1,091
src/main/java/com/crossserverspawn/CrossServerSpawn.java
package com.crossserverspawn;

import com.crossserverspawn.commands.SetSpawnCommand;
import com.crossserverspawn.commands.SpawnCommand;
import com.crossserverspawn.commands.HubCommand;
import com.crossserverspawn.commands.LobbyCommand;
import com.crossserverspawn.database.DatabaseManager;
import com.crossserverspawn.listeners.PlayerMoveListener;
import com.crossserverspawn.managers.ConfigManager;
import com.crossserverspawn.managers.TeleportManager;
import com.crossserverspawn.network.CrossServerHandler;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CrossServerSpawn extends JavaPlugin {
    
    private ConfigManager configManager;
    private DatabaseManager databaseManager;
    private TeleportManager teleportManager;
    private CrossServerHandler crossServerHandler;
    
    @Override
    public void onEnable() {
        this.saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        
        this.databaseManager = new DatabaseManager(this);
        if (!this.databaseManager.connect()) {
            this.getLogger().severe("Failed to connect to database! Disabling plugin...");
            this.getServer().getPluginManager().disablePlugin(this);
            return;
        }
        
        this.teleportManager = new TeleportManager(this);
        this.crossServerHandler = new CrossServerHandler(this);
        
        this.registerCommands();
        this.registerListeners();
        this.registerPluginChannel();
        
        this.getLogger().info("CrossServerSpawn has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (this.teleportManager != null) {
            this.teleportManager.cancelAllTeleports();
        }
        
        if (this.databaseManager != null) {
            this.databaseManager.disconnect();
        }
        
        this.getLogger().info("CrossServerSpawn has been disabled!");
    }
    
    private void registerCommands() {
        this.getCommand("setspawn").setExecutor(new SetSpawnCommand(this));
        this.getCommand("spawn").setExecutor(new SpawnCommand(this));
        this.getCommand("hub").setExecutor(new HubCommand(this));
        this.getCommand("lobby").setExecutor(new LobbyCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new PlayerMoveListener(this), this);
    }
    
    private void registerPluginChannel() {
        this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
        this.getServer().getMessenger().registerIncomingPluginChannel(this, "crossserverspawn:main", this.crossServerHandler);
        this.getServer().getMessenger().registerOutgoingPluginChannel(this, "crossserverspawn:main");
    }
}