mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-20 15:39:22 +00:00
fix(bukkit): 他喵的直接给你防御拉满
This commit is contained in:
@@ -314,7 +314,7 @@ public class PacketConsumers {
|
|||||||
&& !(boolean) Reflections.method$ItemStack$canBreakBlockInAdventureMode.invoke(
|
&& !(boolean) Reflections.method$ItemStack$canBreakBlockInAdventureMode.invoke(
|
||||||
itemStack, blockInWorld
|
itemStack, blockInWorld
|
||||||
)) {
|
)) {
|
||||||
player.abortMiningBlock();
|
player.preventMiningBlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -322,7 +322,7 @@ public class PacketConsumers {
|
|||||||
&& !(boolean) Reflections.method$ItemStack$canDestroy.invoke(
|
&& !(boolean) Reflections.method$ItemStack$canDestroy.invoke(
|
||||||
itemStack, Reflections.instance$BuiltInRegistries$BLOCK, blockInWorld
|
itemStack, Reflections.instance$BuiltInRegistries$BLOCK, blockInWorld
|
||||||
)) {
|
)) {
|
||||||
player.abortMiningBlock();
|
player.preventMiningBlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,6 +365,13 @@ public class BukkitServerPlayer extends Player {
|
|||||||
setIsDestroyingBlock(false, false);
|
setIsDestroyingBlock(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preventMiningBlock() {
|
||||||
|
setCanBreakBlock(false);
|
||||||
|
setIsDestroyingBlock(false, false);
|
||||||
|
abortMiningBlock();
|
||||||
|
}
|
||||||
|
|
||||||
private void resetEffect(Object mobEffect) throws ReflectiveOperationException {
|
private void resetEffect(Object mobEffect) throws ReflectiveOperationException {
|
||||||
Object effectInstance = Reflections.method$ServerPlayer$getEffect.invoke(serverPlayer(), mobEffect);
|
Object effectInstance = Reflections.method$ServerPlayer$getEffect.invoke(serverPlayer(), mobEffect);
|
||||||
Object packet;
|
Object packet;
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public abstract class Player extends Entity implements NetWorkUser {
|
|||||||
|
|
||||||
public abstract void stopMiningBlock();
|
public abstract void stopMiningBlock();
|
||||||
|
|
||||||
|
public abstract void preventMiningBlock();
|
||||||
|
|
||||||
public abstract void abortMiningBlock();
|
public abstract void abortMiningBlock();
|
||||||
|
|
||||||
public abstract double getInteractionRange();
|
public abstract double getInteractionRange();
|
||||||
|
|||||||
Reference in New Issue
Block a user