mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
add imanity anti xray sdk
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Integration with Imanity Software's Raytrace AntiXray for better use of this plugin
|
||||
* <p>
|
||||
* Original project: <a href="https://github.com/Imanity-Software/raytrace-antixray-spigot-sdk">GitHub Repository</a>
|
||||
*/
|
||||
package dev.imanity.antixray.sdk;
|
||||
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 27 Apr 2025 14:24:19 +0300
|
||||
Subject: [PATCH] Raytrace AntiXray SDK integration
|
||||
|
||||
Integration with Imanity Software's Raytrace AntiXray for better use of this plugin
|
||||
|
||||
Original project: https://github.com/Imanity-Software/raytrace-antixray-spigot-sdk
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index d1f74d10e5e3d65895d7e87dd77f298cd9689b33..8fdc5ab8bfba0e40cedfac64d6bc5e24d1cca969 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -296,6 +296,12 @@ public class ServerPlayerGameMode {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelectedItem()); // CraftBukkit
|
||||
}
|
||||
}
|
||||
+ // Imanity start - AntiXraySDK integration
|
||||
+ dev.imanity.antixray.sdk.AntiXrayAdapter adapter = dev.imanity.antixray.sdk.AntiXraySDK.getAdapter();
|
||||
+ if (adapter != null) {
|
||||
+ adapter.callPlayerLeftClickBlock(this.level.getWorld(), this.player.getBukkitEntity(), pos.getX(), pos.getY(), pos.getZ());
|
||||
+ }
|
||||
+ // Imanity end - AntiXraySDK integration
|
||||
this.level.chunkPacketBlockController.onPlayerLeftClickBlock(this, pos, action, face, maxBuildHeight, sequence); // Paper - Anti-Xray
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index c01463194470624ecd84209100fdbdc851028fb7..3577017125e508db86a022e96355bdb6923ce3d4 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -1173,6 +1173,12 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
snapshot.setFlags(flags); // Paper - always set the flag of the most recent call to mitigate issues with multiple update at the same pos with different flags
|
||||
}
|
||||
BlockState blockState = chunkAt.setBlockState(pos, state, flags);
|
||||
+ // Imanity start - AntiXraySDK integration
|
||||
+ dev.imanity.antixray.sdk.AntiXrayAdapter adapter = dev.imanity.antixray.sdk.AntiXraySDK.getAdapter();
|
||||
+ if (adapter != null) {
|
||||
+ adapter.callBlockChange(world, pos.getX(), pos.getY(), pos.getZ(), state.getBukkitMaterial());
|
||||
+ }
|
||||
+ // Imanity end - AntiXraySDK integration
|
||||
this.chunkPacketBlockController.onBlockChange(this, pos, state, blockState, flags, recursionLeft); // Paper - Anti-Xray
|
||||
// CraftBukkit end
|
||||
if (blockState == null) {
|
||||
Reference in New Issue
Block a user