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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user