diff --git a/README.md b/README.md
index 72afbf754..8d3dbb2f0 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,6 @@ DisableWithers: false
DisableExplosions: false
FixChatcoIgnoreBug: true
FixWorldStatsCommandBug: true
-PreventGodMode: true
# Attempt to prevent chunk bans/fps lag.
PreventChunkBan: true
MaxEnchantmentTablePerChunk: 16
@@ -62,7 +61,7 @@ MaxEnderchestPerChunk: 64
MaxContainerPerChunk: 1000
MaxSignPerChunk: 100
# Antispam time in seconds
-AntiSpamTime: 3
+AntiSpamTime: 1
AntiSpamWordTime: 60
AntiSpamLinkTime: 300
PreventUnicodeDot: true
@@ -130,6 +129,12 @@ PatchPacketElytraFly: false
# Recommended to not go lower as there could be false positives.
MaxElytraOpensPer10Seconds: 25 # Will only allow players to go about 85km/h on kami blue, and won't even work on rusherhack.
+# Patch future/rusher packet fly
+PatchPacketFly: true
+# Max teleport packets per 10 seconds, this is how the packet fly works, 25 is usually fine, if you go lower players may get stuck.
+MaxTeleportPacketsPer10Seconds: 25
+LogPacketFlyEvents: true
+
# Patch futureclient boat fly exploit
# Note: this also prevents boats on land. Boats in water are fine
BoatflyPatch: true
@@ -190,6 +195,4 @@ FallingBlocks: 19
## Missing features
-* Modified god mode patch - Was removed because the original code was so shit that when reloaded with plugman all the players will get kicked, aswell as breaking support for anything other than 1.12.2. Please use my standalone plugin for this (1.12.2 only): https://github.com/moom0o/AntiGodMode
-## Probably won't fix
-* Packet fly - It's so slow it would be useless to patch. Might as well allow your players to go the same or less speed than walking :^)
+* Modified god mode patch - Was removed because the original code was so shit that when reloaded with plugman all the players will get kicked, aswell as breaking support for anything other than 1.12.2. Please use my standalone plugin for this (1.12.2 only): https://github.com/moom0o/AntiGodMode
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index c44cf8c2e..737bea347 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.moomoo
anarchyexploitfixes
- 16.0
+ 17.0
jar
AnarchyExploitFixes
diff --git a/src/main/java/me/moomoo/anarchyexploitfixes/Main.java b/src/main/java/me/moomoo/anarchyexploitfixes/Main.java
index 41fb455e1..4230959fc 100644
--- a/src/main/java/me/moomoo/anarchyexploitfixes/Main.java
+++ b/src/main/java/me/moomoo/anarchyexploitfixes/Main.java
@@ -9,10 +9,7 @@
import me.moomoo.anarchyexploitfixes.misc.*;
import me.moomoo.anarchyexploitfixes.patches.*;
import me.moomoo.anarchyexploitfixes.prevention.*;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Chunk;
-import org.bukkit.Material;
+import org.bukkit.*;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Player;
@@ -30,6 +27,7 @@ public class Main extends JavaPlugin implements Listener {
static HashSet crafting = new HashSet<>();
public final HashMap newChunks = new HashMap<>();
public final HashMap oldChunks = new HashMap<>();
+ public HashMap levels = new HashMap<>();
public FileConfiguration config = getConfig();
private Logger log;
@@ -78,6 +76,34 @@ public void onPacketReceiving(PacketEvent event) {
}
});
}
+ if (config.getBoolean("PreventPacketFly")) {
+ protocolManager.addPacketListener(
+ new PacketAdapter(this, ListenerPriority.HIGHEST, PacketType.Play.Client.TELEPORT_ACCEPT) {
+ @Override
+ public void onPacketReceiving(PacketEvent event) {
+ Player e = event.getPlayer();
+ Location l = event.getPlayer().getLocation();
+ if (event.getPlayer().getWorld().getBlockAt(l.getBlockX(), l.getBlockY() - 1, l.getBlockZ()).getType() == Material.AIR && !e.isGliding() && !e.isInsideVehicle()) {
+ if (event.getPacketType() == PacketType.Play.Client.TELEPORT_ACCEPT) {
+ if (levels.get(e) != null) {
+ if (levels.get(e) > config.getInt("MaxTeleportPacketsPer10Seconds")) {
+ event.setCancelled(true);
+ if (getConfig().getBoolean("LogPacketFlyEvents")) {
+ plugin.getLogger().warning(e.getName() + " prevented from packetflying");
+ }
+ } else {
+ levels.merge(e, 1, Integer::sum);
+ Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> levels.put(e, levels.get(e) - 1), 200L);
+ }
+ } else {
+ levels.put(e, 1);
+ Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> levels.put(e, levels.get(e) - 1), 200L);
+ }
+ }
+ }
+ }
+ });
+ }
} else {
getLogger().warning("Did not detect ProtocolLib, disabling packet patches");
}
diff --git a/src/main/java/me/moomoo/anarchyexploitfixes/patches/Elytra.java b/src/main/java/me/moomoo/anarchyexploitfixes/patches/Elytra.java
index ddeedafdc..f8e6ee8de 100644
--- a/src/main/java/me/moomoo/anarchyexploitfixes/patches/Elytra.java
+++ b/src/main/java/me/moomoo/anarchyexploitfixes/patches/Elytra.java
@@ -200,22 +200,20 @@ public void onOpen(EntityToggleGlideEvent evt) {
PlayerInventory i = ((Player) evt.getEntity()).getInventory();
if (evt.getEntity() instanceof Player) {
Player e = (Player) evt.getEntity();
- if (evt.getEntity().getName().equals("moom0o")) {
- if (levels.get(e) != null) {
- if (levels.get(e) > plugin.config.getInt("MaxElytraOpensPer10Seconds")) {
- if (i.getChestplate() != null && i.getChestplate().getType().equals(Material.ELYTRA)) {
- ItemStack elytra = i.getChestplate();
- i.setChestplate(null);
- evt.getEntity().getWorld().dropItemNaturally(i.getLocation(), elytra);
- }
- } else {
- levels.merge(e, 1, Integer::sum);
- Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> levels.put(e, levels.get(e) - 1), 200L);
+ if (levels.get(e) != null) {
+ if (levels.get(e) > plugin.config.getInt("MaxElytraOpensPer10Seconds")) {
+ if (i.getChestplate() != null && i.getChestplate().getType().equals(Material.ELYTRA)) {
+ ItemStack elytra = i.getChestplate();
+ i.setChestplate(null);
+ evt.getEntity().getWorld().dropItemNaturally(i.getLocation(), elytra);
}
} else {
- levels.put(e, 1);
+ levels.merge(e, 1, Integer::sum);
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> levels.put(e, levels.get(e) - 1), 200L);
}
+ } else {
+ levels.put(e, 1);
+ Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> levels.put(e, levels.get(e) - 1), 200L);
}
}
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index f48062e24..615342126 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -32,7 +32,6 @@ DisableWithers: false
DisableExplosions: false
FixChatcoIgnoreBug: true
FixWorldStatsCommandBug: true
-PreventGodMode: true
# Attempt to prevent chunk bans/fps lag.
PreventChunkBan: true
MaxEnchantmentTablePerChunk: 16
@@ -40,7 +39,7 @@ MaxEnderchestPerChunk: 64
MaxContainerPerChunk: 1000
MaxSignPerChunk: 100
# Antispam time in seconds
-AntiSpamTime: 3
+AntiSpamTime: 1
AntiSpamWordTime: 60
AntiSpamLinkTime: 300
PreventUnicodeDot: true
@@ -108,6 +107,12 @@ PatchPacketElytraFly: false
# Recommended to not go lower as there could be false positives.
MaxElytraOpensPer10Seconds: 25 # Will only allow players to go about 85km/h on kami blue, and won't even work on rusherhack.
+# Patch future/rusher packet fly
+PatchPacketFly: true
+# Max teleport packets per 10 seconds, this is how the packet fly works, 25 is usually fine, if you go lower players may get stuck.
+MaxTeleportPacketsPer10Seconds: 25
+LogPacketFlyEvents: true
+
# Patch futureclient boat fly exploit
# Note: this also prevents boats on land. Boats in water are fine
BoatflyPatch: true