sinnalwayssimle
📎 1 file 14,405 chars
📄
pasted-code-1789650778421.txt
txt 726 lines
▶
You are an elite Minecraft network-security engineer, Java developer, proxy developer, and anti-DDoS/anti-bot architect.

Build a production-grade Minecraft network protection system called:

TEVADASHIELD

The system is designed to protect a Minecraft network using:

* Velocity Proxy
* Paper/Purpur backend servers
* Java Edition
* Bedrock Edition through GeyserMC/Floodgate
* Multiple backend servers
* Modern Minecraft versions

This is NOT an anti-cheat.

The primary purpose is:

ANTI-BOT + CONNECTION FLOOD PROTECTION + PROXY SECURITY + PAPER BACKEND PROTECTION + NETWORK RESILIENCE

Do not create a fake/basic plugin with only IP rate limiting. Design it as a serious layered protection system.

==================================================

1. ARCHITECTURE
    ==================================================

Use a two-layer architecture:

VELOCITY LAYER
↓
TEVADASHIELD PROXY
↓
PAPER BACKENDS
↓
PLAYERS

The proxy layer should handle connection-level protection before suspicious traffic reaches backend servers.

The Paper component should provide backend-side protection and coordination with the proxy.

Create separate modules where appropriate:

TevadaShield-Core
TevadaShield-Velocity
TevadaShield-Paper
TevadaShield-Geyser
TevadaShield-Storage

Do not force this exact structure if a better architecture is technically justified.

==================================================
2. ANTI-BOT SYSTEM

Create a sophisticated bot-detection pipeline.

Do NOT ban players simply because they connect quickly.

Analyze multiple signals:

* connection frequency
* connections per IP
* unique usernames
* connection bursts
* reconnect frequency
* handshake behavior
* login timing
* protocol behavior
* session duration
* authentication progression
* repeated connection patterns
* suspicious IP behavior
* concurrent connections
* server-wide connection rate
* proxy-wide connection rate
* backend connection rate

Create a risk score.

Example:

LOW RISK
→ allow normally

MEDIUM RISK
→ rate limit / temporary verification

HIGH RISK
→ temporary connection challenge / throttle

EXTREME RISK
→ temporary block

Do not permanently blacklist players automatically.

==================================================
3. CONNECTION FLOOD PROTECTION

Protect against connection floods that attempt to overwhelm:

* Velocity
* Paper
* login processing
* connection pools
* authentication systems
* backend servers

Implement configurable:

* global connection rate
* per-IP rate
* per-subnet rate where appropriate
* concurrent connection limits
* login attempt limits
* reconnect limits
* backend connection limits
* burst limits
* cooldowns

Use sliding windows or token-bucket/leaky-bucket style rate limiting where appropriate.

Make the system efficient enough to handle large numbers of connection attempts without creating excessive memory usage.

==================================================
4. BOT WAVE DETECTION

Detect coordinated bot waves.

Look for patterns such as:

* hundreds of new connections within a short period
* many accounts behaving identically
* synchronized joins
* repeated username patterns
* repeated connection timing
* large numbers of short-lived sessions
* abnormal IP distribution
* sudden traffic spikes compared with baseline

Do not rely on one signal.

Use multiple signals before escalating protection.

==================================================
5. AUTOMATIC DEFENSE MODE

Create protection modes:

NORMAL
ELEVATED
ATTACK
EMERGENCY

NORMAL:
Minimal overhead.

ELEVATED:
Stricter connection rate limits.

ATTACK:
Aggressive bot filtering and connection throttling.

EMERGENCY:
Maximum protection while preserving legitimate player access where possible.

Automatically enter/exit modes based on configurable metrics.

Also allow administrators to manually change the mode.

Commands:

/ts status
/ts mode normal
/ts mode elevated
/ts mode attack
/ts mode emergency

==================================================
6. SMART RATE LIMITING

Do NOT use simplistic permanent IP bans.

Use temporary adaptive controls.

Example:

IP sends normal traffic
→ no restriction

IP exceeds threshold
→ temporary slowdown

IP continues exceeding threshold
→ temporary block

Traffic returns to normal
→ gradually restore access

Support configurable:

* window
* maximum attempts
* cooldown
* block duration
* burst allowance

==================================================
7. PROXY PROTECTION

Protect Velocity itself.

Monitor:

* connection rate
* login queue
* handshake processing
* authentication queue
* CPU usage
* memory usage
* active connections
* backend connections
* traffic patterns

Prevent suspicious connection bursts from consuming unlimited proxy resources.

Avoid expensive processing before rate limiting.

Perform cheap checks first.

==================================================
8. PAPER BACKEND PROTECTION

Paper servers should never blindly trust that traffic reaching them is legitimate.

Implement backend protection for:

* abnormal connection bursts
* backend join spikes
* plugin message abuse
* suspicious player sessions
* excessive command activity
* excessive interaction where appropriate

Coordinate with the Velocity layer.

The Paper plugin should know when the network is under attack.

==================================================
9. GEYSER + FLOODGATE

Support Bedrock players.

Do NOT accidentally block legitimate Bedrock traffic.

Recognize Java vs Bedrock where possible.

Create configurable Bedrock-specific limits.

Avoid fingerprinting that incorrectly identifies normal Geyser behavior as bots.

==================================================
10. IP / NETWORK INTELLIGENCE

Create an optional IP reputation layer.

Support configurable trusted/protected IPs.

Allow:

* whitelist
* temporary blacklist
* subnet controls
* proxy/network exceptions

Do NOT require an external IP database.

If external reputation services are supported, make them optional and asynchronous.

Never block the main thread waiting for an external API.

==================================================
11. WHITELIST / STAFF PROTECTION

Support:

* trusted IPs
* trusted players
* permissions
* bypass rules
* temporary exemptions

Never let a normal player give themselves an exemption.

Use permission checks.

==================================================
12. SECURITY DASHBOARD GUI

Create a premium Minecraft admin GUI.

Main dashboard should show:

TEVADASHIELD

Status:
NORMAL / ELEVATED / ATTACK / EMERGENCY

Current connections
Connections/sec
Blocked attempts
Suspicious connections
Active players
Proxy load
Backend load
Current risk level

Create menus for:

* Live Attacks
* Suspicious Connections
* IP Management
* Player Sessions
* Rate Limits
* Network Statistics
* Configuration
* Protection Mode

Use clean Minecraft GUI design with icons, colors, player heads where useful, pagination, sounds, and configurable messages.

==================================================
13. ATTACK DASHBOARD

Create an attack-monitoring GUI.

Show:

Attack detected:
YES/NO

Attack intensity:
LOW/MEDIUM/HIGH/EXTREME

Connection rate:
X/sec

Blocked:
X

Allowed:
X

Suspicious:
X

Top sources:
…

Backend impact:
…

Protection mode:
…

Recent events:
…

Make the information understandable to server staff.

==================================================
14. ALERTS

Create staff alerts.

Example:

[TevadaShield]
⚠ CONNECTION FLOOD DETECTED

Rate: 1,842 connections/sec
Blocked: 1,510
Suspicious: 271
Mode: ATTACK

Send alerts only to authorized staff.

Allow:

/ts alerts on
/ts alerts off

==================================================
15. LOGGING

Create structured security logs.

Record useful information such as:

* timestamp
* event type
* connection result
* risk score
* protection mode
* relevant counters
* reason for mitigation

Do not log unnecessary sensitive information.

Provide configurable retention.

==================================================
16. DATABASE

Use SQLite by default.

Database operations must not block the main server thread.

Design the storage layer so MySQL can be added later.

Persist useful security statistics and temporary reputation data where appropriate.

==================================================
17. PERFORMANCE

This is extremely important.

The protection system itself must not become the cause of server lag.

Avoid:

* blocking network calls
* synchronous database queries
* huge unbounded maps
* memory leaks
* expensive calculations for every connection
* unnecessary packet inspection
* excessive GUI updates

Use:

* bounded caches
* expiration
* efficient counters
* asynchronous processing where safe
* cleanup tasks
* lightweight fast-path checks

Design for attack conditions, not only normal conditions.

==================================================
18. FAIL-SAFE DESIGN

If the protection system crashes or becomes unavailable:

* do not crash Velocity
* do not crash Paper
* fail safely
* clean up resources
* log the failure
* preserve normal server operation where possible

Do not create a single point of failure that takes down the entire Minecraft network.

==================================================
19. COMMANDS

Create:

/ts
/ts status
/ts gui
/ts mode 
/ts alerts
/ts whitelist
/ts blacklist
/ts inspect 
/ts inspectip 
/ts reload
/ts stats
/ts attack
/ts version

Add tab completion.

Permissions:

tevadashield.admin
tevadashield.alerts
tevadashield.gui
tevadashield.inspect
tevadashield.whitelist
tevadashield.blacklist
tevadashield.reload

==================================================
20. CONFIGURATION

Create a professional config.yml.

Include configurable:

* connection limits
* IP limits
* burst limits
* cooldowns
* temporary blocks
* risk scoring
* attack thresholds
* protection modes
* Bedrock limits
* whitelist
* blacklist
* GUI
* alerts
* logging
* database
* automatic defense
* performance settings

Never hard-code important thresholds.

==================================================
21. ANTI-BYPASS

Think about common attempts to evade simple anti-bot systems.

Consider:

* changing IP addresses
* distributed bot traffic
* reconnect loops
* randomized usernames
* synchronized waves
* slow attacks
* burst attacks
* many low-rate sources
* repeated sessions

Do NOT respond by simply permanently banning large IP ranges.

Use adaptive behavior and multiple signals.

==================================================
22. IMPORTANT NETWORK SECURITY LIMITATION

Do not falsely claim that a Minecraft plugin can stop a volumetric network-layer DDoS attack by itself.

Clearly separate:

APPLICATION-LAYER PROTECTION
from
NETWORK/TRANSPORT-LAYER DDoS MITIGATION.

If traffic is already saturating the server’s:

* bandwidth
* upstream connection
* host network
* firewall
* datacenter capacity

a Velocity/Paper plugin cannot magically filter traffic that never reaches the server.

Design TevadaShield to mitigate Minecraft/application-layer attacks and provide integration points for external network-level protection.

==================================================
23. EXTERNAL PROTECTION INTEGRATION

Design optional integration points for:

* external firewall
* DDoS-protected hosting
* TCP/UDP filtering
* proxy providers
* reverse proxies
* external monitoring

Do not invent APIs.

If an integration is unavailable, create a clean interface so it can be implemented later.

==================================================
24. OBSERVABILITY

Provide useful metrics:

* connections/sec
* blocked/sec
* suspicious/sec
* active sessions
* average login time
* rejected connections
* attack duration
* current protection mode
* backend connection rate

Make metrics available to the admin GUI and optionally an API.

==================================================
25. TESTING

Create safe local stress-testing tools/tests that simulate:

* normal players
* reconnecting players
* connection bursts
* bot-like sessions
* distributed low-rate connections
* attack-mode transitions

Do NOT create tools intended to attack real external servers.

Test:

* false positives
* memory usage
* CPU usage
* concurrent connections
* Java players
* Bedrock players
* Geyser
* Floodgate
* Velocity
* Paper

==================================================
26. BUILD SYSTEM

Use Gradle.

Provide a complete project with:

* source code
* Gradle configuration
* Velocity plugin metadata
* Paper plugin metadata
* config.yml
* messages.yml
* database schema/migrations if required
* README
* installation guide
* configuration guide
* troubleshooting guide

Verify all APIs and dependencies against the target Minecraft/proxy versions.

Do not invent classes, events, or methods.

==================================================
27. FINAL QUALITY AUDIT

Before considering the project complete, perform a full audit:

COMPILATION

* missing imports
* missing dependencies
* incorrect APIs
* incorrect plugin metadata

SECURITY

* permission bypasses
* command abuse
* GUI abuse
* malformed input
* resource exhaustion

PERFORMANCE

* memory leaks
* unbounded collections
* blocking operations
* expensive connection handling

COMPATIBILITY

* Velocity
* Paper/Purpur
* Geyser
* Floodgate
* Java
* Bedrock

RELIABILITY

* proxy restart
* backend restart
* player reconnect
* configuration reload
* database failure
* temporary network failure

FALSE POSITIVES

* legitimate players
* VPN users
* shared networks
* mobile networks
* Bedrock players
* unstable connections

==================================================
FINAL GOAL

Build TevadaShield as a professional Minecraft network-security system focused on:

⚡ Anti-Bot
🛡️ Connection Flood Protection
🔒 Proxy Protection
🌐 Paper Backend Protection
📊 Attack Monitoring
🎛️ Adaptive Defense
🧠 Risk-Based Detection
🖥️ Premium Admin GUI
📱 Java + Bedrock Compatibility
💾 Persistent Security Statistics
🚀 High Performance

The system must be realistic.

Never claim that a plugin can provide unlimited DDoS protection against attacks that exceed the network’s upstream capacity.

Prioritize legitimate-player availability, low false positives, performance, and safe automatic mitigation.

Before coding, verify the current APIs and dependencies, produce the architecture, then implement the complete project and verify that it compiles.
Kodari AI
KodariSep 17 at 1:17 pm 3
TevadaShield
Layered Minecraft network protection system for Velocity and Paper backends. Implements adaptive anti-bot detection with risk scoring, connection flood protection via token-bucket rate limiting, bot wave detection, and automatic defense modes. Features smart rate limiting with temporary adaptive controls, Geyser/Bedrock support, IP intelligence, staff whitelist, and a premium admin GUI dashboard with attack monitoring. Includes structured logging, SQLite persistence, performance-optimized bounded caches, fail-safe design, and external protection integration points. Commands with tab completion and permission checks for admin control.
  1. Build a Gradle multi-module project for shared risk analysis, async SQLite storage, Velocity enforcement, Paper backend protection, and Geyser identity handling.

  2. Implement bounded, expiring token-bucket controls with adaptive NORMAL/ELEVATED/ATTACK/EMERGENCY modes, risk scoring, trusted identities, metrics, and fail-safe behavior.

  3. Add Velocity events/commands/alerts, Paper events/commands/admin dashboard GUI, metadata, configuration, messages, schema, documentation, and safe unit simulations.

Created the initial TevadaShield multi-module project:

  • core: adaptive defense engine, risk scoring, token buckets, modes, metrics, bounded caches, temporary mitigation.

  • storage: asynchronous SQLite security-event persistence.

  • velocity: pre-login protection, sessions, alerts, commands, automatic defense modes, metadata.

  • paper: backend login safeguards, command controls, admin dashboard GUI.

  • geyser: conservative Bedrock identity classifier.

  • Configuration, messages, schema, Gradle setup, permissions, README, installation, configuration, and troubleshooting documentation.

  • Safe local unit tests for trusted access and burst mitigation.

  • Explicit documentation that application plugins cannot mitigate bandwidth-saturating network-layer DDoS attacks.

I did not run inspection or compilation commands because the project-initialization constraints explicitly prohibited them.

Kodari can make mistakes. Review important code before using.
Files
core
database
geyser
paper
src
storage
velocity
build.gradle
CONFIGURATION.md
INSTALLATION.md
manifest.kod
README.md
settings.gradle
TROUBLESHOOTING.md
Code
43 1,421
paper/src/main/java/com/tevada/tevadashield/paper/TevadaShieldPaper.java
package com.tevada.tevadashield.paper;

import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class TevadaShieldPaper extends JavaPlugin {
    private BackendGuard guard;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        guard = new BackendGuard(getConfig().getInt("backend.per-ip-per-second", 6),
                getConfig().getInt("backend.burst", 12));
        getServer().getPluginManager().registerEvents(new PaperShieldListener(guard), this);
        PluginCommand command = getCommand("ts");
        if (command != null) {
            PaperShieldCommand executor = new PaperShieldCommand(guard);
            command.setExecutor(executor);
            command.setTabCompleter(executor);
        }
        getLogger().info("TevadaShield Paper backend protection is enabled.");
    }
}