1.16.5 Mining Fatigue Packet Still Mining Blocks

Discussion in 'Spigot Plugin Development' started by KaboomRoads, Jul 25, 2021.

  1. So i have a packet sender sending a mining fatigue packet to players so that they cant mine blocks but the hand animation is not slowed down. but instamining blocks still works and also when mining a block for a long time it can still break event thought the mining fatigue packet is level 255 mining fatigue. no other level works cos it either slows the hand or stops it from moving, anyway it still doesent solve the problem. so how would i send the server packets that the player has mining fatigue but stop the server from sending those packets to the player and showing the slow hand animation.

    Code (Java):
                        PlayerConnection connection = ((CraftPlayer) p).getHandle().playerConnection;
                        @SuppressWarnings("deprecation")
                        PacketPlayOutEntityEffect entityEffect = new PacketPlayOutEntityEffect(p.getEntityId(), new MobEffect(MobEffectList.fromId(PotionEffectType.SLOW_DIGGING.getId()), Integer.MAX_VALUE, 255, false, false, false));
                        connection.sendPacket(entityEffect);
     
  2. Here is a video to show the problem.

    the reason the instamine pick is not instamining is because i set insta break to false on block damage event and it doesent break because i cancel block break event. im using a gold pick because i realized it would be faster to show on the video.
     
  3. Okay so if I understand correctly you want the player to not be able to break blocks when you enter a specific command?

    How about instead of using mining fatigue you just cancel the BlockBreakEvent?
     
  4. no, what i am trying to do is disable block damage. I am already cancelling BlockBreakEvent anyway so if i wanted just that i would not have added the mining fatigue
     
  5. There's a BlockDamageEvent you can cancel if that's what you're looking for?
     
  6. Either try that, or try reducing the level if mining f. Sometimes (like with jump boost) a too high level somehow breaks the effect. Try mining fatigue 50?
     
  7. mining fatigue 5 or so is already enough to completely negate mining speed, which reduces your mining speed by about 4000x
     
  8. You could set the player gamemode to adventure and let him destroy/place only the blocks you want
     
  9. you cant cancel block damage event. if i set mining fatigue lower the hand is slow or stops completely. and id rather use mining fatigue because its nicer to see the block outlines, anyway i know its possible to do its been done before.
    the mining fatigue prob not working because the server does not think the player has mining fatigue
    but i cant tell the server that without slowing the hand down
     
    #9 KaboomRoads, Jul 26, 2021
    Last edited: Jul 28, 2021
  10. Yes, you can. Or does it not produce the effect you're looking for?
    upload_2021-7-29_14-48-52.png
     
  11. cancelling it hardly does anything at all, maybe it does something else, but it does not cancel the block damage or breaking
     
  12. maybe it would be possible to send the mining fatigue packet to the server too but then stop the server from sending it to the player
     
  13. Why can't you set players' gamemode to adventure and let them destroy only what they can?
     
  14. i just dont really like the look of it and it wouldnt solve the problem anyway because i could set the mining speed to 1 for exaple and before the block is broken with my mining system it will be broken normally
     
  15. I think you missunderstood me. I did not mean to trick the client into thinking be in gamemode 2, I meant to actually set their gamemode to adventure and give them a pickaxe with a CanDestroy tag. What are you exactly trying to achieve?
     
  16. i know but as i said if i set the mining speed to very slow and set the block strength to very high it will be broken faster with the mining fatigue before the strong block is broken in the way intended