opmasterleo

Build be true anti totem ghost using packetevents, it should be ultrafast and run on asny on paper and folia supported. make it real advanced and acutally works. with nice config too

Kodari AI
KodariJul 18 at 6:45 pm 5
TotemSyncGuard
A PacketEvents-powered Paper and Folia plugin that prevents ghost-totem inventory desynchronization after a resurrection. It tracks authoritative totem consumption, detects suspicious client inventory acknowledgements, and immediately reconciles the player’s offhand and inventory through region-safe scheduling. Configurable thresholds, alerts, exemptions, bypass permissions, and detailed debug logging provide responsive protection without blocking legitimate totem use.

[Generation stopped]

opmasterleo

nono i ment when player dies, sometimes server ghosts totem even tho it was in hand. make plugin to prevent that

Kodari AI
KodariJul 18 at 6:46 pm 10
TotemSyncGuard
TotemSyncGuard prevents client-side ghost totem desynchronization after a successful resurrection. It uses PacketEvents to detect inventory interaction packets during a short post-resurrection protection window, then performs immediate and delayed authoritative inventory synchronization on the player’s region thread. The plugin supports Paper and Folia, includes configurable timings, packet cooldowns, debug output, bypass permissions, and an administrator reload command.

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
10 394
src/main/java/com/kodari/totemsyncguard/TotemSyncGuard.java
package com.kodari.totemsyncguard;

import com.github.retrooper.packetevents.PacketEvents;
import com.kodari.totemsyncguard.command.TotemSyncGuardCommand;
import com.kodari.totemsyncguard.config.ConfigManager;
import com.kodari.totemsyncguard.listener.PacketInventoryListener;
import com.kodari.totemsyncguard.service.ResurrectionGuard;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class TotemSyncGuard extends JavaPlugin {

    private ConfigManager configManager;
    private ResurrectionGuard resurrectionGuard;
    private PacketInventoryListener packetInventoryListener;

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

        saveDefaultConfig();

        this.configManager = new ConfigManager(this);
        this.resurrectionGuard = new ResurrectionGuard(this, configManager);
        this.packetInventoryListener = new PacketInventoryListener(resurrectionGuard);

        getServer().getPluginManager().registerEvents(resurrectionGuard, this);
        PacketEvents.getAPI().getEventManager().registerListener(packetInventoryListener);

        TotemSyncGuardCommand command = new TotemSyncGuardCommand(this);
        getCommand("totemsyncguard").setExecutor(command);
        getCommand("totemsyncguard").setTabCompleter(command);
    }

    @Override
    public void onDisable() {
        if (packetInventoryListener != null) {
            PacketEvents.getAPI().getEventManager().unregisterListener(packetInventoryListener);
        }
    }

    public void reloadGuardConfiguration() {
        reloadConfig();
        configManager.load();
    }
}