PacketsBookFix
The plugin fixes DOS packages of the book. It was private plugin, but I laid it out for evil to those who started selling it, now you can use it whatever you want.
Dependencies: ProtocolLib.
Permissions:
PacketFix.reload - Reload config. (Can be changed in the Config)
Commands:
/packetbookfix reload - Reloads config.
Config:
BanMessage: '&cBook edited too quickly!' //Message at the kick.
BanPlayer: false // Ban or not.
KickPlayer: true // Kick the player or not.
PacketInMillis: 1000 //Packet in millisecond
ReloadPermissions: PacketFix.reload //Permissions to reload the config.
ReloadedMessage: '&aPlugin successfully reloaded.' //Message when the config is reloaded.
Source
The plugin fixes DOS packages of the book. It was private plugin, but I laid it out for evil to those who started selling it, now you can use it whatever you want.
Dependencies: ProtocolLib.
Permissions:
PacketFix.reload - Reload config. (Can be changed in the Config)
Commands:
/packetbookfix reload - Reloads config.
Config:
BanMessage: '&cBook edited too quickly!' //Message at the kick.
BanPlayer: false // Ban or not.
KickPlayer: true // Kick the player or not.
PacketInMillis: 1000 //Packet in millisecond
ReloadPermissions: PacketFix.reload //Permissions to reload the config.
ReloadedMessage: '&aPlugin successfully reloaded.' //Message when the config is reloaded.
Source
Code (Java):
package com.demkom58.packet ;
import org.bukkit.command.Command ;
import org.bukkit.command.CommandSender ;
import com.comphenix.protocol.events.PacketListener ;
import com.comphenix.protocol.events.PacketContainer ;
import com.comphenix.protocol.events.PacketEvent ;
import org.bukkit.plugin.Plugin ;
import com.comphenix.protocol.events.PacketAdapter ;
import com.comphenix.protocol.PacketType ;
import com.comphenix.protocol.events.ListenerPriority ;
import com.comphenix.protocol.ProtocolLibrary ;
import org.bukkit.entity.Player ;
import java.util.WeakHashMap ;
import org.bukkit.plugin.java.JavaPlugin ;
public class fix extends JavaPlugin
{
private int PacketInMillis ;
private boolean kick ;
private boolean ban ;
private String reason ;
private String ReloadPermissions ;
private String ReloadedMessage ;
private WeakHashMap <Player, Long > hmap ;
public fix ( ) {
hmap = new WeakHashMap <Player, Long > ( ) ;
}
public void onEnable ( ) {
getConfig ( ). options ( ). copyDefaults ( true ) ;
saveConfig ( ) ;
PacketInMillis = getConfig ( ). getInt ( "PacketInMillis" ) ;
kick = getConfig ( ). getBoolean ( "KickPlayer" ) ;
ban = getConfig ( ). getBoolean ( "BanPlayer" ) ;
reason = getConfig ( ). getString ( "BanMessage" ). replaceAll ( "&", "§" ) ;
ReloadPermissions = getConfig ( ). getString ( "ReloadPermissions" ) ;
ReloadedMessage = getConfig ( ). getString ( "ReloadedMessage" ). replaceAll ( "&", "§" ) ;
ProtocolLibrary. getProtocolManager ( ). addPacketListener ( (PacketListener ) new PacketAdapter ( this, ListenerPriority. HIGHEST, new PacketType [ ] { PacketType. Play. Client. CUSTOM_PAYLOAD } ) {
public void onPacketReceiving ( final PacketEvent event ) {
final PacketContainer packet = event. getPacket ( ) ;
final String channelName = ( String )packet. getStrings ( ). read ( 0 ) ;
final Player p = event. getPlayer ( ) ;
if (channelName. contains ( "MC|BEdit" ) || channelName. contains ( "MC|BSign" ) ) {
safePacket (p, plugin, event ) ;
}
}
} ) ;
}
private void safePacket ( final Player p, final Plugin pl, final PacketEvent event ) {
if (hmap. containsKey (event. getPlayer ( ) ) && hmap. get (event. getPlayer ( ) ) < System. currentTimeMillis ( ) ) {
hmap. put (p, System. currentTimeMillis ( ) +PacketInMillis ) ;
} else {
hmap. put (p, System. currentTimeMillis ( ) +PacketInMillis ) ;
}
if (hmap. containsKey (event. getPlayer ( ) ) ) {
if (hmap. get (p ) > System. currentTimeMillis ( ) ) {
event. setCancelled ( true ) ;
if (ban ) {
getServer ( ). banIP (p. getAddress ( ). getHostString ( ) ) ;
getServer ( ). getBannedPlayers ( ). add (p ) ;
}
if (kick ) {
getServer ( ). getScheduler ( ). runTask ( (Plugin ) this, ( ) -> p. kickPlayer ( this. reason ) ) ;
}
}
if (p. isOnline ( ) ) {
hmap. put (p, System. currentTimeMillis ( ) ) ;
} else {
hmap. remove (p ) ;
}
}
}
public void onDisable ( ) {
getServer ( ). getLogger ( ). info ( "Plugin has been disabled" ) ;
}
public boolean onCommand ( final CommandSender sender, final Command cmd, final String label, final String [ ] args ) {
if (cmd. getName ( ). equalsIgnoreCase ( "PacketBookFix" ) ) {
if (args. length == 1 ) {
if (sender. hasPermission (ReloadPermissions ) && args [ 0 ]. equalsIgnoreCase ( "reload" ) ) {
reloadConfig ( ) ;
PacketInMillis = getConfig ( ). getInt ( "PacketInMillis" ) ;
kick = getConfig ( ). getBoolean ( "KickPlayer" ) ;
ban = getConfig ( ). getBoolean ( "BanPlayer" ) ;
reason = getConfig ( ). getString ( "BanMessage" ). replaceAll ( "&", "§" ) ;
ReloadPermissions = getConfig ( ). getString ( "ReloadPermissions" ) ;
sender. sendMessage (ReloadedMessage = getConfig ( ). getString ( "ReloadedMessage" ). replaceAll ( "&", "§" ) ) ;
return true ;
}
return false ;
}
else {
sender. sendMessage ( "&cPacketBookFix created by demkom58.". replaceAll ( "&", "§" ) ) ;
}
}
return false ;
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.7, 1.8, 1.9
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
PacketsBookFix is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 5,522 times (via Spigot). Download it and open it directly in the game.