Noah Pitogo

can you compile this

Kodari AI
KodariOct 24 at 3:27 pm 1

On desktop, click Compile in the top bar. On your phone, tap ⋮ → Compile Project. Then click Compile in the window; when it succeeds, click Download to get the jar.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
18 2,600
src/main/java/com/loyola/anticheat/LoyolaAntiCheat.java
package com.loyola.anticheat;

import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.loyola.anticheat.commands.*;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class LoyolaAntiCheat extends JavaPlugin {

    public static final String BRAND =
            "<gradient:#00B4D8:#48CAE4:#90E0EF>&lʟ ᴏ ʏ ᴏ ʟ ᴀ - ᴀ ɴ ᴛ ɪ ᴄ ʜ ᴇ ᴀ ᴛ</gradient>";
    public static final String SHORT =
            "<gradient:#00B4D8:#48CAE4:#90E0EF>&lʟᴏʏᴏʟᴀ-ᴀɴᴛɪᴄʜᴇᴀᴛ</gradient>";
    public static final String PREFIX = SHORT + " &7| ";

    private AntiCheatManager manager;
    private AlertManager alerts;

    @Override
    public void onEnable() {
        if (getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
            getLogger().severe("ProtocolLib is required. Disabling.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        saveDefaultConfig();

        this.manager = new AntiCheatManager(this);
        this.alerts = new AlertManager(this);

        ProtocolManager protocol = ProtocolLibrary.getProtocolManager();

        MovementListener movement = new MovementListener(this);
        CombatListener combat = new CombatListener(this);
        HandshakeListener handshake = new HandshakeListener(this);
        SusLogGUI logGui = new SusLogGUI(this);
        SusGUI susGui = new SusGUI(this, logGui);
        logGui.setSusGui(susGui);

        Bukkit.getPluginManager().registerEvents(movement, this);
        Bukkit.getPluginManager().registerEvents(combat, this);
        Bukkit.getPluginManager().registerEvents(handshake, this);
        Bukkit.getPluginManager().registerEvents(susGui, this);
        Bukkit.getPluginManager().registerEvents(logGui, this);

        combat.registerPackets(protocol);
        handshake.registerPackets(protocol);

        getCommand("sus").setExecutor(new SusCommand(this, susGui));
        SusLogCommand susLog = new SusLogCommand(this, logGui);
        getCommand("suslog").setExecutor(susLog);
        getCommand("suslog").setTabCompleter(susLog);
        getCommand("acalerts").setExecutor(new AlertsCommand(this));
        ScreenShareCommand ss = new ScreenShareCommand(this);
        getCommand("ss").setExecutor(ss);
        getCommand("ss").setTabCompleter(ss);
        SpecCommand spec = new SpecCommand(this);
        getCommand("spec").setExecutor(spec);
        getCommand("spec").setTabCompleter(spec);

        // Players already online (e.g. after /reload) get their state rebuilt.
        for (org.bukkit.entity.Player p : Bukkit.getOnlinePlayers()) {
            manager.loadStored(p.getUniqueId(), p.getName());
            alerts.handleJoin(p);
        }

        manager.start();
        Bukkit.getConsoleSender().sendMessage(Text.parse(PREFIX + "&aEnabled &7v" + getPluginMeta().getVersion()));
    }

    @Override
    public void onDisable() {
        if (manager != null) {
            manager.shutdown();
        }
        try {
            ProtocolLibrary.getProtocolManager().removePacketListeners(this);
        } catch (Throwable ignored) {
            // ProtocolLib may already be unloaded during shutdown.
        }
    }

    public AntiCheatManager getManager() {
        return manager;
    }

    public AlertManager getAlerts() {
        return alerts;
    }
}