-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
225 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...moomoo/anarchyexploitfixes/modules/protocollib/boatfly/BoatFlyPositionPacketListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...a/me/moomoo/anarchyexploitfixes/modules/protocollib/windowclick/AntiWindowClickCrash.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package me.moomoo.anarchyexploitfixes.modules.protocollib.windowclick; | ||
|
||
import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; | ||
import me.moomoo.anarchyexploitfixes.config.Config; | ||
import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; | ||
import me.moomoo.anarchyexploitfixes.utils.LogUtils; | ||
|
||
import java.util.logging.Level; | ||
|
||
public class AntiWindowClickCrash implements AnarchyExploitFixesModule { | ||
|
||
|
||
public AntiWindowClickCrash() { | ||
Config config = AnarchyExploitFixes.getConfiguration(); | ||
config.addComment("patches.window-click-crash-patch.enable", "Patches Container click / Window click crash exploit."); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "window-click-crash-patch"; | ||
} | ||
|
||
@Override | ||
public String category() { | ||
return "patches"; | ||
} | ||
|
||
@Override | ||
public void enable() { | ||
new WindowClickListener().register(); | ||
} | ||
|
||
@Override | ||
public boolean shouldEnable() { | ||
Config config = AnarchyExploitFixes.getConfiguration(); | ||
if (config.getBoolean("patches.window-click-crash-patch.enable", true)) { | ||
if (config.protocolLib_IsDisabled) { | ||
LogUtils.moduleLog(Level.WARNING, name(), "Not patching exploit because you disabled ProtocolLib in config!"); | ||
return false; | ||
} | ||
if (!AnarchyExploitFixes.isProtocolLibInstalled()) { | ||
LogUtils.moduleLog(Level.SEVERE, name(), "Unable to patch exploit because ProtocolLib is not installed!"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public void disable() {} | ||
} |
44 changes: 44 additions & 0 deletions
44
...va/me/moomoo/anarchyexploitfixes/modules/protocollib/windowclick/WindowClickListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package me.moomoo.anarchyexploitfixes.modules.protocollib.windowclick; | ||
|
||
import com.comphenix.protocol.PacketType; | ||
import com.comphenix.protocol.ProtocolLibrary; | ||
import com.comphenix.protocol.events.ListenerPriority; | ||
import com.comphenix.protocol.events.PacketAdapter; | ||
import com.comphenix.protocol.events.PacketEvent; | ||
import com.comphenix.protocol.reflect.StructureModifier; | ||
import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; | ||
|
||
public class WindowClickListener extends PacketAdapter { | ||
|
||
public WindowClickListener() { | ||
super(AnarchyExploitFixes.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Client.WINDOW_CLICK); | ||
} | ||
|
||
protected void register() { | ||
ProtocolLibrary.getProtocolManager().addPacketListener(this); | ||
} | ||
|
||
@Override | ||
public void onPacketReceiving(PacketEvent event) { | ||
final StructureModifier<Integer> integers = event.getPacket().getIntegers(); | ||
if (getButton(integers) < 0 || getSlot(integers) < 0) { | ||
event.setCancelled(true); | ||
} | ||
} | ||
|
||
private int getSyncId(StructureModifier<Integer> packet) { | ||
return packet.read(0); | ||
} | ||
|
||
private int getRevision(StructureModifier<Integer> packet) { | ||
return packet.read(1); | ||
} | ||
|
||
private int getSlot(StructureModifier<Integer> packet) { | ||
return packet.read(2); | ||
} | ||
|
||
private int getButton(StructureModifier<Integer> packet) { | ||
return packet.read(3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...a/me/moomoo/anarchyexploitfixes/modules/protocollib/windowclick/AntiWindowClickCrash.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package me.moomoo.anarchyexploitfixes.modules.protocollib.windowclick; | ||
|
||
import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; | ||
import me.moomoo.anarchyexploitfixes.config.Config; | ||
import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; | ||
import me.moomoo.anarchyexploitfixes.utils.LogUtils; | ||
|
||
import java.util.logging.Level; | ||
|
||
public class AntiWindowClickCrash implements AnarchyExploitFixesModule { | ||
|
||
|
||
public AntiWindowClickCrash() { | ||
Config config = AnarchyExploitFixes.getConfiguration(); | ||
config.addComment("patches.window-click-crash-patch.enable", "Patches Container click / Window click crash exploit."); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "window-click-crash-patch"; | ||
} | ||
|
||
@Override | ||
public String category() { | ||
return "patches"; | ||
} | ||
|
||
@Override | ||
public void enable() { | ||
new WindowClickListener().register(); | ||
} | ||
|
||
@Override | ||
public boolean shouldEnable() { | ||
Config config = AnarchyExploitFixes.getConfiguration(); | ||
if (config.getBoolean("patches.window-click-crash-patch.enable", true)) { | ||
if (config.protocolLib_IsDisabled) { | ||
LogUtils.moduleLog(Level.WARNING, name(), "Not patching exploit because you disabled ProtocolLib in config!"); | ||
return false; | ||
} | ||
if (!AnarchyExploitFixes.isProtocolLibInstalled()) { | ||
LogUtils.moduleLog(Level.SEVERE, name(), "Unable to patch exploit because ProtocolLib is not installed!"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...va/me/moomoo/anarchyexploitfixes/modules/protocollib/windowclick/WindowClickListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package me.moomoo.anarchyexploitfixes.modules.protocollib.windowclick; | ||
|
||
import com.comphenix.protocol.PacketType; | ||
import com.comphenix.protocol.ProtocolLibrary; | ||
import com.comphenix.protocol.events.ListenerPriority; | ||
import com.comphenix.protocol.events.PacketAdapter; | ||
import com.comphenix.protocol.events.PacketEvent; | ||
import com.comphenix.protocol.reflect.StructureModifier; | ||
import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; | ||
|
||
public class WindowClickListener extends PacketAdapter { | ||
|
||
public WindowClickListener() { | ||
super(AnarchyExploitFixes.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Client.WINDOW_CLICK); | ||
} | ||
|
||
protected void register() { | ||
ProtocolLibrary.getProtocolManager().addPacketListener(this); | ||
} | ||
|
||
@Override | ||
public void onPacketReceiving(PacketEvent event) { | ||
final StructureModifier<Integer> integers = event.getPacket().getIntegers(); | ||
if (getButton(integers) < 0 || getSlot(integers) < 0) { | ||
event.setCancelled(true); | ||
} | ||
} | ||
|
||
private int getSyncId(StructureModifier<Integer> packet) { | ||
return packet.read(0); | ||
} | ||
|
||
private int getRevision(StructureModifier<Integer> packet) { | ||
return packet.read(1); | ||
} | ||
|
||
private int getSlot(StructureModifier<Integer> packet) { | ||
return packet.read(2); | ||
} | ||
|
||
private int getButton(StructureModifier<Integer> packet) { | ||
return packet.read(3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters