J

can you imptove the detection by alot without needing me to record all data again just improve the detection drastically and make the vl system better 1st flag = 1 etc etc

make it use %player% etc placeholders in config instead of {player}

also move classes in different packages so it doesnt look messy also some issues [16:37:40 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'Apollo-1.0.0 (2).jar' in folder 'plugins/.paper-remapped' org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/github/retrooper/packetevents/event/PacketListenerCommon at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:129) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:35) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy.loadProviders(ModernPluginLoadingStrategy.java:116) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:38) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:39) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:564) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:277) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?] Caused by: java.lang.NoClassDefFoundError: com/github/retrooper/packetevents/event/PacketListenerCommon at java.base/java.lang.Class.forName0(Native Method) ~[?:?] at java.base/java.lang.Class.forName(Class.java:547) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:78) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:125) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] ... 9 more Caused by: java.lang.ClassNotFoundException: com.github.retrooper.packetevents.event.PacketListenerCommon at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490) ~[?:?] at java.base/java.lang.Class.forName0(Native Method) ~[?:?] at java.base/java.lang.Class.forName(Class.java:547) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:78) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:125) ~[paper-1.21.4.jar:1.21.4-232-12d8fe0] ... 9 more

also can you shift this project from gradle to maven? without any errors

Kodari AI
KodariSep 3 at 6:23 pm 9

Plan:

  1. Inspect and strengthen the detection/VL pipeline without requiring new recorded data.

  2. Standardize config placeholders to %player% and update all message call sites/config defaults.

  3. Reorganize classes into focused packages while preserving references.

  4. Fix the PacketEvents runtime dependency/loading issue.

  5. Migrate the build from Gradle to Maven and align dependencies/resources.

  1. Detection/VL: I’m replacing the one-hit score-only behavior with fresh packet evidence, temporal smoothing, finite-value safety, and an integer VL where the first confirmed flag is exactly 1 and each subsequent flag increments it.

  2. Existing 12-column datasets remain unchanged; the stronger signals are derived at runtime, so no re-recording is required.

  1. Detection/VL is updated: runtime-only temporal smoothing and packet-quality checks now reinforce repeated suspicious behavior, malformed model values are neutralized, and VL is an integer escalation (1, 2, 3…) with configurable decay/cap.

  2. Mitigation now also escalates at a configured VL instead of relying only on a single raw score.

  1. Placeholder formatting now uses %name% consistently, including actionbar, alerts, mitigation, recording, model, and toggle messages.

  2. I’m moving on to package cleanup next; the move must be done as a reference-aware relocation so the plugin entrypoint and all imports remain valid.

  1. Package cleanup is landed: commands, listeners, data, detection, model, session, and tracking now have separate packages; the root plugin entrypoint remains unchanged for plugin.yml.

  2. MessageFormatter was made public because the session package now consumes it.

  3. Next I’m fixing the PacketEvents class-loading failure before converting the build, since Maven must preserve the correct runtime dependency behavior.

  1. The runtime failure is a packaging/load-order issue: Apollo directly resolves PacketEvents classes, but the jar is not bundling them and plugin.yml did not require PacketEvents first.

  2. I’m treating PacketEvents as a server-provided plugin, adding an explicit dependency/load order, and making Maven use the equivalent provided scope so Apollo does not ship a conflicting duplicate.

  1. The structural and build work is in place; I’m making one final detection-side improvement before closing that task: compiled models will actually use the existing dataset to build feature stumps instead of claiming an ensemble while training only a linear score.

  2. This changes only model compilation and keeps the existing 12-feature CSV format and saved-model compatibility.

Implemented:

  1. Stronger detection without new recordings

    • Added temporal score smoothing.

    • Added fresh packet-evidence validation.

    • Improved click-rate, jitter, target-switching, and reach checks.

    • Added finite-value protection for corrupt model/data values.

    • Existing 12-column datasets remain compatible.

    • Model compilation now generates actual feature stumps instead of only training a linear model.

  2. Improved VL system

    • First confirmed flag is VL 1.

    • Repeated flags increment VL: 2, 3, 4, etc.

    • Added configurable VL cap and decay.

    • Mitigation can activate after a configurable VL threshold.

    • Alerts now display integer VL values.

  3. Placeholder format

    • Replaced {player}-style placeholders with %player%.

    • Updated all built-in messages and actionbar placeholders.

  4. Package cleanup

    • Organized classes into:

      • command

      • data

      • detection

      • listener

      • model

      • session

      • tracking

  5. PacketEvents loading fix

    • Added packetevents as a required plugin dependency in plugin.yml.

    • Maven treats PacketEvents as server-provided instead of incorrectly expecting it inside Apollo.

    • Make sure the PacketEvents plugin jar is installed in the server’s plugins folder.

  6. Gradle to Maven

    • Removed build.gradle and settings.gradle.

    • Added a Java 21 pom.xml.

    • Configured Paper API and PacketEvents dependencies.

    • Maven output will be target/Apollo-1.0.0.jar.

New detection settings include:

YAML
detection:
  max-vl: 20
  vl-decay-seconds: 15
  mitigation-vl: 2

The existing recorded data can be reused; after installing the updated plugin, run:

Plain Text
/apollo model compile
J

it isnt even flagging now restore the old detection logic completely only make it better dont change the logic completely also make the best config for it for fastest detection with least FP

Kodari AI
KodariSep 3 at 6:32 pm 2
  1. Restore the original score/threshold flagging flow while keeping only safe accuracy improvements.

  2. Tune the default detection config for fast confirmation with conservative false-positive protection.

The regression is in the new score composition: packet weight is added to the denominator even when packet evidence is zero, and smoothing changes the old immediate threshold result. I’m removing those score-path changes, keeping finite-value protection and VL decay, and making the fallback heuristic capable of detecting when no model is loaded.

The score path is restored, but existing server configs are not overwritten by Bukkit. I’m aligning the Java fallback defaults too, so the improved thresholds work even if the installed config.yml is still the old one.

Fixed the regression.

  • Restored direct detection scoring:

    • model score × model weight

    • heuristic score × heuristic weight

    • No temporal smoothing.

    • No packet score being added to the denominator.

    • Packet telemetry can no longer suppress a valid high score.

  • If no trained model is loaded, heuristic detection now works by itself instead of being capped around 0.5.

  • VL is now a true integer:

    • First flag: VL 1

    • Next flag: VL 2

    • Then 3, 4, etc.

  • Kept finite-value protection and VL decay.

  • Tuned defaults:

    • Alert threshold: 0.80

    • Flag threshold: 0.88

    • Mitigation threshold: 0.94

    • Alert cooldown: 2 seconds

    • Model/heuristic weights remain 65% / 35% for low false positives.

For an existing server, update plugins/Apollo/config.yml manually because Bukkit does not overwrite existing configs:

YAML
detection:
  alert-threshold: 0.80
  flag-threshold: 0.88
  mitigation-threshold: 0.94
  mitigation-damage-multiplier: 0.35
  alert-cooldown-seconds: 2
  max-vl: 20
  vl-decay-seconds: 15
  mitigation-vl: 2
  precision-angle-degrees: 1.25
  model-weight: 0.65
  heuristic-weight: 0.35
  teleport-grace-millis: 1000
  alerts-enabled: true
  mitigations-enabled: true

No new recording or dataset is required.

Kodari can make mistakes. Review important code before using.
Files
src
IMPORTANT.txt
manifest.kod
pom.xml
Code
19 1,669
src/main/java/com/kodari/apollo/ApolloPlugin.java
package com.kodari.apollo;

import com.kodari.apollo.command.ApolloCommand;
import com.kodari.apollo.data.DatasetStore;
import com.kodari.apollo.detection.DetectionEngine;
import com.kodari.apollo.listener.ApolloListener;
import com.kodari.apollo.model.ModelTrainer;
import com.kodari.apollo.session.SessionManager;
import com.kodari.apollo.tracking.PacketMonitor;
import com.kodari.apollo.tracking.RotationTracker;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.util.TimeStampMode;
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;

public final class ApolloPlugin extends JavaPlugin {
    private DatasetStore datasetStore;
    private RotationTracker rotationTracker;
    private SessionManager sessionManager;
    private DetectionEngine detectionEngine;
    private PacketMonitor packetMonitor;
    private volatile boolean alertsEnabled;
    private volatile boolean mitigationsEnabled;

    @Override
    public void onLoad() {
        PacketEvents.setAPI(SpigotPacketEventsBuilder.build(this));
        PacketEvents.getAPI().load();
    }

    @Override
    public void onEnable() {
        saveDefaultConfig();
        alertsEnabled = getConfig().getBoolean("detection.alerts-enabled", true);
        mitigationsEnabled = getConfig().getBoolean("detection.mitigations-enabled", true);

        PacketEvents.getAPI().getSettings().timeStampMode(TimeStampMode.MILLIS).checkForUpdates(false);
        PacketEvents.getAPI().init();

        datasetStore = new DatasetStore(this);
        datasetStore.loadModel();
        rotationTracker = new RotationTracker();
        detectionEngine = new DetectionEngine(this, datasetStore, rotationTracker);
        sessionManager = new SessionManager(this, datasetStore, rotationTracker);

        Bukkit.getPluginManager().registerEvents(new ApolloListener(this, rotationTracker, sessionManager, detectionEngine), this);
        packetMonitor = new PacketMonitor(rotationTracker);
        PacketEvents.getAPI().getEventManager().registerListener(packetMonitor);
        ApolloCommand command = new ApolloCommand(this, sessionManager, new ModelTrainer(this, datasetStore));
        PluginCommand pluginCommand = getCommand("apollo");
        if (pluginCommand != null) {
            pluginCommand.setExecutor(command);
            pluginCommand.setTabCompleter(command);
        }
        Bukkit.getScheduler().runTaskTimer(this, sessionManager::updateActionbars, 0L, 10L);
    }

    @Override
    public void onDisable() {
        if (sessionManager != null) {
            sessionManager.stopAll();
        }
        if (PacketEvents.getAPI() != null) {
            if (packetMonitor != null) {
                PacketEvents.getAPI().getEventManager().unregisterListener(packetMonitor);
            }
            PacketEvents.getAPI().terminate();
        }
    }

    public boolean alertsEnabled() {
        return alertsEnabled;
    }

    public void setAlertsEnabled(boolean enabled) {
        alertsEnabled = enabled;
    }

    public boolean mitigationsEnabled() {
        return mitigationsEnabled;
    }

    public boolean modelTrained() {
        return datasetStore != null && datasetStore.model().trained();
    }

    public String modelType() {
        return datasetStore == null ? "none" : datasetStore.model().type();
    }

    public int datasetCount(String label) {
        return datasetStore == null ? 0 : datasetStore.count(label);
    }

    public void setMitigationsEnabled(boolean enabled) {
        mitigationsEnabled = enabled;
    }

    public void sendMessage(org.bukkit.command.CommandSender sender, String key, java.util.Map<String, String> values) {
        String message = getConfig().getString("messages." + key, key);
        sender.sendMessage(MessageFormatter.format(message, values));
    }

    public void broadcastAlert(String player, double score, double model, int vl, String source) {
        if (!alertsEnabled) {
            return;
        }
        String template = getConfig().getString("messages.alert", "%player% %score%");
        String message = MessageFormatter.format(template, java.util.Map.of(
                "prefix", getConfig().getString("messages.prefix", ""),
                "player", player,
                "score", String.format(java.util.Locale.ROOT, "%.3f", score),
                "model", String.format(java.util.Locale.ROOT, "%.3f", model),
                "vl", Integer.toString(vl),
                "source", source));
        Bukkit.getOnlinePlayers().stream()
                .filter(playerObject -> playerObject.hasPermission("apollo.alerts"))
                .forEach(playerObject -> playerObject.sendMessage(message));
        getLogger().warning(MessageFormatter.strip(message));
    }

    public void sendMitigationMessage(String player, double score) {
        if (!mitigationsEnabled) {
            return;
        }
        String template = getConfig().getString("messages.mitigation", "Mitigation applied to %player%");
        String message = MessageFormatter.format(template, java.util.Map.of(
                "prefix", getConfig().getString("messages.prefix", ""),
                "player", player,
                "score", String.format(java.util.Locale.ROOT, "%.3f", score)));
        Bukkit.getOnlinePlayers().stream()
                .filter(playerObject -> playerObject.hasPermission("apollo.alerts"))
                .forEach(playerObject -> playerObject.sendMessage(message));
    }

    public void reloadApollo() {
        reloadConfig();
        alertsEnabled = getConfig().getBoolean("detection.alerts-enabled", alertsEnabled);
        mitigationsEnabled = getConfig().getBoolean("detection.mitigations-enabled", mitigationsEnabled);
        if (datasetStore != null) {
            datasetStore.loadModel();
        }
    }
}