Solved Cancelling void damage

Discussion in 'Spigot Plugin Development' started by Rlaxing, Jul 28, 2018.

  1. Are the newer versions of spigot and/or Minecraft handling the void differently now? I seem to be struggling to cancel out the damage done by the void. Each time I am dying by a different thing: fall damage, suffocation, and the old ticking as you fall.

    What is the most effective way to cancel damage done by the void so I can teleport the player back up?
    #1 Rlaxing, Jul 28, 2018
    Last edited: Jul 28, 2018
  2. If it keeps returning a different damage cause, why don't you try checking the player's Y value and then canceling the damage?
  3. Yeah, I thought that as well and tried it. However, it seems they are making the void a death as fall damage as well. As I teleport back to the top you die of fall damage as you land lol. Way more complex that it needs to be.
  4. Yeah, it sounds like it. Maybe after you cancel the void damage and teleport the player back to the top, store their UUID in a Map and cancel the very next damage event for them, so they can safely return to the top of the map. This is a bit hacky, but it's the only solution I can think of at the moment.
  5. By "newer" versions of MC do you mean via 1.13?
  6. I'm kinda out of the loop. I don't know much about MC past 1.9.

    Was gonna do that, but apparently, a lot of Skyblock servers just cancel fall damage on the islands in general. Wouldn't doubt this is one of the reasons for it lol.
  7. Alright, so I'll give you a little bit of how I handle this situation inside one of the cores I've made in the past for a network.

    Whenever someone takes damage, I check the cause, if it's from the void, the damage caused will be called "void". If it's from "void" I just straight up cancel it.

    Now as far as I do my "VoidSpawn" part of it is typically different than others do it simply because when I design stuff I look at long-term efficiency. Basically, you should just check the player's Y level every X seconds and if it's below Z, teleport them to a location, if you teleport them via the code, it will not generate (or shouldn't at least) fall damage.
  8. Would resetting a player's velocity before teleporting them prevent fall damage from being taken?
  9. Gotcha. Are you checking the location of their Y after they take the void damage, or at all times? Also, teleporting them via the code definitely gives fall damage in 1.12. Happened to me a million times in the last half an hour.
  10. I added the approach I was taking to the op.
  11. I have the checking of their Y on a runnable vs a PlayerMoveEvent, much more efficient if you have over 100 players online. A PlayerMoveEvent is fired about 4 times a second at least PER player while they are turning/moving. If you have over 100 players on, constantly moving, that's over 400 PMEs a SECOND firing, the way I have it set up is a single event running every 3 seconds no matter how many players are online. I check and teleport in the event vs checking the damage.
  12. A simple solution for you is if they take void damage, put them in a Set. Teleport them, if they take fall damage and they are in the set, cancel the damage and remove them from the set.
  13. To each his own; however, I don't see why you wouldn't just teleport them whenever they start taking damage. That is the point at which they would go up regardless. Nobody would build down there.
  14. Yeah, thought about that hacky solution but I don't need fall damage on the island anyway.
  15. Right, that was my suggestion, but I incorrectly wrote a Map instead of a Set or even a List.