From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: LeeGodSRC Date: Sat, 8 Mar 2025 11:40:46 +0800 Subject: [PATCH] Raytrace AntiXray SDK integration Integrated with Imanity Software's Raytrace AntiXray for better performance Original project: https://github.com/Imanity-Software/raytrace-antixray-spigot-sdk diff --git a/src/main/java/dev/imanity/antixray/sdk/AntiXrayAdapter.java b/src/main/java/dev/imanity/antixray/sdk/AntiXrayAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..3104caaf8463de31231f7503c86e9c7016f13372 --- /dev/null +++ b/src/main/java/dev/imanity/antixray/sdk/AntiXrayAdapter.java @@ -0,0 +1,34 @@ +package dev.imanity.antixray.sdk; + +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; + +public interface AntiXrayAdapter { + + /** + * Call a block change to the AntiXray system + * It should be at Level.setBlock(BlockPos, BlockState, flags, maxUpdateDepth) + * Or World.setTypeAndData(BlockPosition, IBlockData, i) in legacy spigot versions + * + * @param world the bukkit world + * @param x the x + * @param y the y + * @param z the z + * @param material the bukkit material + */ + void callBlockChange(World world, int x, int y, int z, Material material); + + /** + * Call a player left click block to the AntiXray system + * It should be at ServerPlayerGameMode.handleBlockBreakAction(BlockPos, ServerboundPlayerActionPacket.Action, Direction, worldHeight, sequence) + * Or PlayerInteractManager.a(BlockPosition, EnumDirection) in legacy spigot versions + * + * @param world the bukkit world + * @param player the bukkit player + * @param x the x + * @param y the y + * @param z the z + */ + void callPlayerLeftClickBlock(World world, Player player, int x, int y, int z); +} diff --git a/src/main/java/dev/imanity/antixray/sdk/AntiXraySDK.java b/src/main/java/dev/imanity/antixray/sdk/AntiXraySDK.java new file mode 100644 index 0000000000000000000000000000000000000000..33fae921cb4cf4631d17837c5f26a01af9619957 --- /dev/null +++ b/src/main/java/dev/imanity/antixray/sdk/AntiXraySDK.java @@ -0,0 +1,14 @@ +package dev.imanity.antixray.sdk; + +public class AntiXraySDK { + + private static AntiXrayAdapter ADAPTER; + + public static AntiXrayAdapter getAdapter() { + return ADAPTER; + } + + public static void setAdapter(AntiXrayAdapter adapter) { + ADAPTER = adapter; + } +}