Bukkit transaction API for predicting when a server packet arrives at a client. Mainly intended for use in Minecraft anticheats.

Overview

Pledge

A high performance and lightweight Bukkit packet tracking API for predicting when a server packet arrives at a client using transactions. Mainly intended for use in Minecraft anticheats, or if you really want to track whether a player has received packets or not. Supporting 1.8 - 1.17.1

How does it work

Given below is a very simplified explanation how Pledge works and what it should be used for.

As most of you who are here already know, Minecraft Java Edition uses the TCP protocol to send data between the client and the server. This protocol guarantees us packet order, even if data is dropped or duplicated. We can use this to our advantage by sending a transaction packet and the start and end of a tick. If we receive a response for these two packets from the client, we would logically know that every packet between these packets has also been received.

Pledge simply sends a transaction packet when the tick starts and one when the tick ends to every player. Doing this, every packet that is sent in this tick can be tracked the same way as explained above.

How to use

Build a Pledge object using the Pledge#build method and use the builder pattern methods to configure it. After you're done, use the Pledge#start method to inject and start the transaction task. Most of your questions should be answered by reading the documentation in the API package.

public void onEnable() {
    Pledge pledge = Pledge.build();
    pledge.start(this);
}

A transaction packet listener is included, in case you're not already listening to transaction packets yourself. Please make sure that you set the 'events' setting to true, because it is not used by default. Simply implement the TransactionListener interface and create your own implementation. After that, you can register it using the Pledge#addListener method. Below is an example of using Pledge with a transaction listener, where MyTransactionListener is your implementation.

public void onEnable() {
    Pledge pledge = Pledge.build().events(true);
    pledge.start(this);
    
    pledge.addListener(new MyTransactionListener());
}

Another important detail is that the player channel is injected when joining the world, so only play packets are tracked. Because we need the player connection object to be set, we miss the server spawn packet and a few other packets sent when the player joins the server. This shouldn't matter for most use cases, but please be aware of this.

If you want to use this in your project, you can add it as a Maven dependency:

<repositories>
  <repository>
    <id>pledge-repo</id>
    <url>https://raw.github.com/ThomasOM/Pledge/repository/</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>dev.thomazz</groupId>
    <artifactId>pledge</artifactId>
    <version>1.0-SNAPSHOT</version>
  </dependency>
</dependencies>

You're free to copy, share and use this code however you want. Credits are appreciated.

You might also like...

A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge.

A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge.

A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge. Originally designed as a MCP Client (called Tephra), it is now being ported t

Jan 1, 2023

A free mixin-based injection hacked-client for Minecraft using Minecraft Forge.

Custom LiquidBounce 1.8.9 build that aims to improve original visuals and bypasses, along with built-in ViaVersion to help you change from 1.8 to 1.17.1 without creating any other version branch.

Jan 2, 2023

Small mod for Minecraft Forge 1.16.5 that sends messages of in-game events to a channel in your Discord server. This mod also enables cross-chatting between Minecraft and Discord.

DiscordSync Small mod for Minecraft Forge 1.16.5 that sends messages of in-game events to a channel in your Discord server. This mod also enables cros

Dec 20, 2022

Bukkit plugin to create smooth camera paths for cinematic purposes.

Spigot Plugin Template You can use this template to develop your own high quality Spigot plugins using Gradle with ease. Features Quickstart setup Rel

Nov 13, 2021

A flexible minigame framework for bukkit.

Oyster Subproject of Oni, a framework which focused on minigames. QQ Group What It is a flexible framework that attempts to reduce costs for developin

Dec 25, 2022

🚀Small java eventing library created to developer familiar with Bukkit,Nukkit and PowerNukkit...

FestivalKit 🇺🇸 Small event library for developers familiar with Bukkit,PowerNukkit and Nukkit 🇧🇷 Pequena libraria de eventos para desenvolvedores

Jan 2, 2022

DnD Plugin submission using Atlas. Plugin inspired on the TrollGUI bukkit plugin

💡 PunishGUI DnD Plugin submission using Atlas. Plugin inspired on the TrollGUI bukkit plugin 📜 Dependencies 📃 Paper 1.18 🌎 Atlas 💻 Commands /hell

Jan 19, 2022

💜 LiteSkullAPI Fast and extensive skull library for Bukkit/Spigot/Paper plugins

💜 LiteSkullAPI Fast and extensive skull library for Bukkit/Spigot/Paper plugins. Helpful links: Support Discord GitHub issues Eternal Repository (Mav

Dec 2, 2022

Backdoor injector for Bukkit/Spigot plugins.

MinePatcher Backdoor injector for Bukkit/Spigot plugins. MinePatcher was developed to test the security systems of Minecraft servers. Usage: 1. Window

Sep 18, 2022
Comments
  • java.lang.ArrayIndexOutOfBoundsException: -1 when joining

    java.lang.ArrayIndexOutOfBoundsException: -1 when joining

    Every time I join the server with Pledge enabled, I get an ArrayIndexOutOfBoundsException.

    Server and client version: 1.8.9 Pledge version: 1.3 Only other plugins I have are Citizens and StrikePractice

    Stacktrace:

    [10:34:24 WARN]: A task raised an exception.
    java.lang.ArrayIndexOutOfBoundsException: -1
            at io.netty.util.collection.IntObjectHashMap.put(IntObjectHashMap.java:109) ~[server.jar:git-Spigot-db6de12-18fbb24]
            at dev.thomazz.pledge.transaction.TransactionHandler.addIndex(TransactionHandler.java:158) ~[?:?]
            at dev.thomazz.pledge.transaction.TransactionHandler.lambda$tickStart$0(TransactionHandler.java:62) ~[?:?]
            at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [server.jar:git-Spigot-db6de12-18fbb24]
            at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [server.jar:git-Spigot-db6de12-18fbb24]
            at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [server.jar:git-Spigot-db6de12-18fbb24]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]
    [10:34:24 ERROR]: Could not read incoming packet!
    [10:34:24 WARN]: java.lang.ArrayIndexOutOfBoundsException
    opened by TypicalFin 0
  • Add support for reloads with online players

    Add support for reloads with online players

    Whilst testing I found that Pledge would not begin sending transaction packets until relogging into the server after performing a reload on a plugin using Pledge.

    This injects into all current online players when Pledge is started and removes itself from all players when the Pledge#destroy method is called (otherwise you will get a duplicate handler name error when starting again).

    Also additionally added the Spigot repository (and bumped version from .4 to .5), because that was missing.

    Tested on 1.17.1 Paper using Plugman to reload.

    opened by SamB440 0
Owner
Thomazz
Thomazz
🏃 A lightweight, multiarena, complex Parkour Spigot/Bukkit plugin for Minecraft Server

?? A lightweight, multiarena, multilanguage, completely configurable and complex Parkour Spigot/Bukkit plugin for Minecraft Server

Victor Rodrigues 6 Oct 17, 2022
Essentials - Minecraft server command mod - Adds over 100 commands for use in-game to help manage a server

Essentials Development Readme The official repository is at: https://github.com/essentials/Essentials We use NetBeans 7.3 for development. Recommended

Essentials 811 Jan 7, 2023
A essentials bukkit plugin for your server

?? A essentials, lightweight, multilanguage, customizable, modular and complex plugin for Minecraft Server

Victor Rodrigues 8 Jan 30, 2022
LoliServer 是 Minecraft 较新版本 1.16.5 中的 Forge + Bukkit 服务端核心, 支持Forge Mod和Bukkit 插件, 兼容性与性能优秀, 于Mohist1.16.5基础加以维护更新

LoliServer 1.16.5 LoliServer-1.16.5,基于Forge并融合Paper/Spigot/Bukkit的高性能高兼容性的服务端核心 上游项目 Mohist Bukkit Paper CraftBukkit Spigot MinecraftForge Atom Thermo

LoliServer 0 Apr 29, 2022
Bukkit/Bungee plugin to send Minecraft data to JMX

Bukkit/Bungee plugin to send Minecraft data to JMX

Fabrizio La Rosa 4 Jan 30, 2022
Fast Bukkit Custom Book Constructor for Minecraft 1.8 to 1.16.5

BookMaker ?? BookMaker is a fast Spigot API to create Custom Book for Minecraft 1.8 to 1.16.5. Features Create a book with your title, author and desc

Giovanni Ranieri 3 Oct 2, 2021
Plugin para minecraft 1.16+ (Spiggot/Bukkit)

TIERRA O NADA! Plugin para Minecraft Quieres pasar Minecraft de otra forma? Prueba con este plugin para Spiggot/Bukkit Minecraft Versión: 1.16+ Plugin

JkDev 3 Nov 12, 2022
Exeter client. A client created by Friendly, for Minecraft version 1.8

Exeter client. A client created by Friendly, for Minecraft version 1.8. It has been released or leaked on that version.

null 25 Dec 31, 2022
The Lezard Client is a new, open-source, minecraft client for the newer versions of the game.

The Lezard Client is a new, open-source, minecraft client for the newer versions of the game. It is oriented not for PvP, but for the Vanilla and the Survival experience. It is not a hack client for Minecraft and do not ask for it. 1 I hate hacked client and 2 it is not fun for other people. Also, I misspelled the word lizard in English and decided to leave it like that.

Michel-Ange 4 Jul 5, 2022
A Minecraft server proxy with unparalleled server support, scalability, and flexibility

Velocity A Minecraft server proxy with unparalleled server support, scalability, and flexibility. Velocity is licensed under the GPLv3 license. Goals

PaperMC 1.2k Jan 8, 2023