Solved remove teleport() invincibility from Player damage?

Discussion in 'Plugin Development' started by artish1, Aug 10, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    artish1

    I've noticed that after a player has teleported (using the teleport(Location loc) method), they don't take any damage from players for like 2-3 seconds.

    So i thought this was like some NoDamageTicks thing... so i did setNoDamageTicks(0). Still not working.

    EDIT: Just some extra info: they take other types of damage such as Fall damage, but not from players hitting them and such.
     
  2. Offline

    bennie3211

    Do you use other plugins on your server? Because if you use Essentials, it can be that noDamage after a Tp is set to 2-3 seconds. Or any other plugin that handles the teleportations
     
    Syd likes this.
  3. Offline

    xize

    artish1

    its because its probably client sided, because the entity is not rendered yet the damage will not count if the entity is not appeared on the client.

    however to fix the invisibillity problem, you should vanish them and unvanish them that should refresh both clients.

    or just do for example:

    Code:
    Player p1 = Bukkit.getPlayer("Xeph0re");
    Player p2 = Bukkit.getPlayer("xize");
    p1.teleport(p2); //p1 teleports to p2.
    p2.showPlayer(p1);
    p1.showPlayer(p2); //this is probably not needed.
    
     
  4. Offline

    thomasb454

    Use NMS,

    Grab the player, get the field "invulnerableTicks" and set that to 0.
    No invincibility at all then :)
     
  5. thomasb454 Why would you do that when there's a Bukkit API method for it?
     
  6. Offline

    Syd

    This is most likely the answer to the OPs problem.
    I had this on my server as well once. I've looked though all my (for years working) code to find out where the error is just to find out that Essentials added this function. ;)
     
  7. Offline

    thomasb454


    No there isn't, this is editing the internal Minecraft invulnerable ticks. This means NO (like none, ya know?) invulnerability.
     
  8. Offline

    Necrodoom

    thomasb454
    Not to mention invicibilty would mean no damage by any source, not just players.
     
    AdamQpzm likes this.
  9. Offline

    thomasb454


    I'd like to see this method, and that's the point. To allow all damage (I run a Factions server, so if someone combat logs, this is needed).
     
  10. thomasb454 Then in that case, that's a bad idea. No reason to break the way minecraft was intended to 'fix' this problem, especially considering it's not likely to be the source of the problem.
     
  11. Offline

    thomasb454


    It really is though. There's nothing wrong with it.
     
  12. thomasb454
    If this is the OP's case, then your fix wouldn't change anything, aside from the fact that the player will be able to take damage more often. It wouldn't fix the problem being asked about, though.
     
  13. Offline

    thomasb454

    It allows damage to be always taken, so yes..it does.
     
  14. thomasb454 It wouldn't if you cancel the damage event, which is what essentials does.
     
  15. Offline

    DevilMental

    What about when the player gets teleported (by listening to the PlayerTeleportEvent), add his name/UUID to a list, create a scheduled task that runs 2 secs or 3 secs after the teleportation and removes the player from the list. Meanwhile, you need to listen to the EntityDamageEvent, and check is the entity is a player and if his name is in the list or not, if he is, cancel the event . Simple ;)
    ----------------------------------------
    EDIT : Sorry I didn't clearly understand the OP, so don't mind ;)
     
  16. DevilMental Well you described how to recreate the OP's problem, so I guess that's something :p
     
  17. Offline

    artish1

    bennie3211 Syd AdamQpzm
    Essentials seemed to be the problem here... thank you :) Solved.
    EDIT: Although instead of removing Essentials, i just set the teleport-invulnerability in their config to 0 seconds.
     
    bennie3211 and AdamQpzm like this.
Thread Status:
Not open for further replies.

Share This Page