Most Effect Way to freeze player

Discussion in 'Spigot Plugin Development' started by Creepermanthe3rd, Apr 24, 2017.

  1. Ive looked around and saw many ways to freeze a player, but Im wondering what would the most effective way/
  2. Do a player move event and set the to location to the from location.
    • Winner Winner x 1
  3. Mas


    ^ And store the frozen players in a Set<UUID>
  4. For my SkyFreeze I did following:
    On freeze command add player to list

    On move:
    If player is in list
    > cancel
  5. Mas


    Use a Set not a List, they are generally faster.
    Cancelling PlayerMoveEvent causes buggy behaviour occasionally, so instead use event.setTo(event.getFrom())
  6. Ohh right, thanks for telling me!

    Looks like I'll be having to modify my plugin when I can to do that :p
    • Like Like x 1
  7. Or you could set the walk speed and flight speed to zero.
    • Like Like x 1
  8. I agree with you. Checking every time someone moves can be heavy on the server
  9. Open a gui and keep opening till unfrozen.
  10. If you wish to do it this way, use the inventory close event. Spamming it doesnt help. I personally still do recommend setting walk and flight speed to 0