9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

fix(bukkit): 他喵的直接给你防御拉满

This commit is contained in:
jhqwqmc
2025-03-26 00:25:56 +08:00
parent b47f8dd9db
commit a762368bb0
3 changed files with 11 additions and 2 deletions

View File

@@ -314,7 +314,7 @@ public class PacketConsumers {
&& !(boolean) Reflections.method$ItemStack$canBreakBlockInAdventureMode.invoke(
itemStack, blockInWorld
)) {
player.abortMiningBlock();
player.preventMiningBlock();
return;
}
} else {
@@ -322,7 +322,7 @@ public class PacketConsumers {
&& !(boolean) Reflections.method$ItemStack$canDestroy.invoke(
itemStack, Reflections.instance$BuiltInRegistries$BLOCK, blockInWorld
)) {
player.abortMiningBlock();
player.preventMiningBlock();
return;
}
}

View File

@@ -365,6 +365,13 @@ public class BukkitServerPlayer extends Player {
setIsDestroyingBlock(false, false);
}
@Override
public void preventMiningBlock() {
setCanBreakBlock(false);
setIsDestroyingBlock(false, false);
abortMiningBlock();
}
private void resetEffect(Object mobEffect) throws ReflectiveOperationException {
Object effectInstance = Reflections.method$ServerPlayer$getEffect.invoke(serverPlayer(), mobEffect);
Object packet;

View File

@@ -27,6 +27,8 @@ public abstract class Player extends Entity implements NetWorkUser {
public abstract void stopMiningBlock();
public abstract void preventMiningBlock();
public abstract void abortMiningBlock();
public abstract double getInteractionRange();