draconivr2.0

can you create me a plugin that lets me test how many players can join my server a player test

Kodari AI
KodariApr 26 at 10:33 am 8,035 (v2)

I’ll create a server capacity testing plugin that spawns simulated entities to test how many players your server can handle.

PlayerCapacityTest
A server stress testing plugin that spawns simulated players to test server capacity and performance limits. Administrators can spawn and manage fake players, monitor real-time TPS and memory usage, and determine maximum player capacity before performance degradation. Includes commands to add/remove test players in bulk, view current test status, and automatic cleanup features.

Created PlayerCapacityTest - a server stress testing plugin!

Features:

  • Spawn fake players as lightweight entities (armor stands or invisible area effect clouds)

  • Real-time TPS and memory monitoring with warnings

  • Commands to add/remove/clear test players in bulk

  • Status display showing metrics, fake player count, and performance

  • Configurable limits and settings

  • Auto cleanup when plugin disables

  • Tab completion support

Commands:

  • /ct add [amount] - Spawn fake players at your location

  • /ct remove [amount] - Remove fake players

  • /ct clear - Remove all fake players

  • /ct status - View performance metrics and player counts

  • /ct start [amount] - Start test session (optionally spawn players)

  • /ct stop - Stop test and clear all fake players

The plugin uses armor stands or area effect clouds (configurable) to simulate players, allowing you to test your server’s capacity without needing actual player connections. Monitor TPS and memory to find your server’s limits!

draconivr2.0

make it spawn like real minecraft npcs

Kodari AI
KodariApr 26 at 10:37 am 27,206 (v2)

I’ll update the plugin to spawn real player NPCs using the Citizens API.

Perfect! I’ve updated the plugin to spawn real Minecraft player NPCs using the Citizens API.

Changes made:

  1. Added Citizens dependency - The plugin now requires Citizens to be installed on your server

  2. Replaced entity spawning - Instead of armor stands or area effect clouds, the plugin now spawns actual player NPCs that look like real players

  3. Added NPC features:

    • Random player skins from a configurable list (Notch, Dinnerbone, jeb_, Herobrine, etc.)

    • Optional look-at-players feature with configurable range

    • Protected NPCs (invulnerable to damage)

    • Random name generation

  4. Updated config - Removed armor stand settings, added NPC-specific options like random-skins, skin-names, look-at-players, and look-range

The NPCs created are full Citizens NPCs that appear as real players in the tab list and world. They can have custom skins, names, and behaviors. The plugin will automatically check for Citizens on startup and disable itself if Citizens isn’t found.

Requirements:

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 632
src/main/java/com/playercapacitytest/PlayerCapacityTest.java
package com.playercapacitytest;

import com.playercapacitytest.commands.TestCommand;
import com.playercapacitytest.managers.PerformanceMonitor;
import com.playercapacitytest.managers.TestManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class PlayerCapacityTest extends JavaPlugin {

    private TestManager testManager;
    private PerformanceMonitor performanceMonitor;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        if (getServer().getPluginManager().getPlugin("Citizens") == null) {
            getLogger().severe("Citizens not found! This plugin requires Citizens to function.");
            getLogger().severe("Download it from: https://www.spigotmc.org/resources/citizens.13811/");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        this.testManager = new TestManager(this);
        this.testManager.initialize();
        this.performanceMonitor = new PerformanceMonitor(this);

        getCommand("capacitytest").setExecutor(new TestCommand(this));

        if (getConfig().getBoolean("monitoring.enabled", true)) {
            performanceMonitor.startMonitoring();
        }

        getLogger().info("PlayerCapacityTest has been enabled!");
        getLogger().info("Use /capacitytest to manage fake players");
    }

    @Override
    public void onDisable() {
        if (getConfig().getBoolean("cleanup.on-disable", true)) {
            testManager.clearAllFakePlayers();
        }

        if (performanceMonitor != null) {
            performanceMonitor.stopMonitoring();
        }

        getLogger().info("PlayerCapacityTest has been disabled!");
    }

    public String formatMessage(String key) {
        String prefix = getConfig().getString("messages.prefix", "&8[&bCapTest&8]&r");
        String message = getConfig().getString("messages." + key, key);
        return colorize(prefix + " " + message);
    }

    public String colorize(String message) {
        return message.replace("&", "§");
    }
}