📄
pasted-code-1791713326826.txt
txt
68 lines
▶
Create a complete Minecraft anti-cheat plugin named **WAFFLE AntiFreecam + AntiXray** for my **WAFFLE SMP** server.
### Required environment
- Minecraft: Paper 1.21.11
- Java 21
- Maven
- Modern Paper APIs
- Deliver a complete Maven source project and a compiled, ready-to-install `WAFFLEAntiCheat.jar`.
### 1. Anti-Freecam — prevent camera scouting
The goal is to prevent players from using Freecam to scout bases, inspect hidden rooms, locate chests, and look through terrain without exposing themselves in-game.
- Protect hidden bases, underground rooms, storage areas, and other concealed builds.
- Use server-side protection to prevent players from gaining information through unauthorized block and container interactions.
- Validate block breaking, placement, interaction, and container access against legitimate server-side reach and visibility rules.
- Block interactions through solid walls and impossible distances.
- Where supported, use server-side packet handling or an appropriate integration to detect and reject invalid interactions.
- Never punish players simply for moving their camera or using legitimate client settings.
- Do not claim that a normal Paper plugin can completely disable every Freecam implementation: the client camera can move independently of the server-authoritative player position. Focus on preventing the exploit's actual advantages.
### 2. Anti-Xray — hide ores and valuable blocks
Implement strong anti-Xray protection for survival gameplay.
- Use Paper's native engine-mode anti-xray configuration wherever possible.
- Provide setup instructions for `paper-world-defaults.yml` and per-world overrides.
- Configure hidden ores so clients cannot see their true locations through X-ray texture packs or modified clients.
- Protect valuable blocks, including diamond ore, ancient debris, emerald ore, gold ore, and other configurable targets.
- Use appropriate hidden-block substitutions and realistic block palettes.
- Support overworld and Nether worlds.
- Make the engine mode, hidden blocks, replacement blocks, and world settings configurable.
- Avoid revealing actual ore locations in block updates sent to clients.
- Keep normal mining, lighting, redstone, and block interactions working correctly.
- Explain any limitations of hiding chests or player-built blocks: native ore anti-xray does not automatically conceal every block in a base.
### 3. Optional custom protections
If technically feasible, add:
- Configurable protection for hidden containers and selected blocks.
- Detection of suspicious mining patterns, with violation tracking rather than instant bans.
- Staff alerts with player name, world, coordinates, and detection reason.
- Configurable exemptions for authorized staff.
### 4. Commands
Create:
- `/waffleac` — show plugin status and help.
- `/waffleac reload` — reload supported plugin settings.
- `/waffleac alerts` — toggle staff alerts.
- `/waffleac info ` — show recorded violations.
- `/waffleac reset ` — reset violation data.
Use separate permissions for administration, alerts, inspection, resetting violations, and bypass access.
### 5. WAFFLE branding
- Plugin name: **WAFFLE AntiCheat**
- Prefix: `WAFFLE AC`
- Gold, cream, and toasted-brown visual theme.
- All messages and settings editable in configuration files.
### 6. Performance and safety
- Do not scan every block around every player every tick.
- Avoid expensive packet processing and unnecessary tasks.
- Handle latency, server lag, teleports, and legitimate gameplay without excessive false positives.
- Never automatically ban someone solely because an X-ray detection heuristic triggers once.
- Keep the plugin compatible with other Paper plugins.
### 7. Deliverables
Provide the complete source code, Maven `pom.xml`, `plugin.yml`, default configuration files, installation instructions, and a compiled `WAFFLEAntiCheat.jar`.
The project must build successfully using Java 21 and `mvn clean package`. Do not provide pseudocode or incomplete classes. Clearly separate protections implemented by the custom plugin from protections that must be configured in Paper itself.
Create the Maven/Paper 1.21.11 plugin scaffold and WAFFLE-branded configuration.
Add server-side reach/visibility checks, container access checks, and review-only mining alerts/violation tracking.
Include Paper Anti-Xray defaults and installation notes that distinguish Paper settings from plugin protections.
Created the WAFFLE AntiCheat Maven project for Paper 1.21.11 / Java 21. It includes server-side reach and line-of-sight checks, configurable container checks, review-only mining alerts with saved violation totals, the requested commands and permissions, and a Paper Anti-Xray reference configuration.
Paper Anti-Xray must be merged into the server’s Paper world settings; the plugin does not apply those settings itself. The README covers installation and the limits of both protections, including that a normal plugin cannot disable every Freecam camera mode.
To get WAFFLEAntiCheat.jar, click Compile in the desktop top bar, or on phone tap ⋮ → Compile Project. Click Compile in the window, then Download when it succeeds. Place the jar in the server’s plugins folder.
package com.waffle.anticheat;
import org.bukkit.plugin.java.JavaPlugin;
public final class WaffleAntiCheat extends JavaPlugin {
private ViolationManager violationManager;
@Override
public void onEnable() {
saveDefaultConfig();
violationManager = new ViolationManager(this);
getServer().getPluginManager().registerEvents(new ProtectionListener(this), this);
WaffleCommand command = new WaffleCommand(this);
getCommand("waffleac").setExecutor(command);
getCommand("waffleac").setTabCompleter(command);
getLogger().info("WAFFLE AntiCheat enabled. Paper Anti-Xray must be configured in Paper world settings.");
}
@Override
public void onDisable() {
if (violationManager != null) {
violationManager.save();
}
}
public ViolationManager getViolationManager() {
return violationManager;
}
}