Solved Double death help

Discussion in 'Plugin Development' started by MattTheBeast, Feb 12, 2017.

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

    MattTheBeast

    So I'm currently making a gun server, and for some reason when a player would get shot to death there would sometimes be a double death, this is bad because ot affects users stats. I have a auto-respawn, but I dont think thats the problem since I'v seen this glitch on alot of gun servers.

    I'm trying to find a fix, somekind of onDeathEvent where the player who died cant die again for like a second or 2. Anybody know how to do this, or any other way to fix my problem?
     
  2. Offline

    Drkmaster83

    PlayerDeathEvent, cancel the event, call respawn event, set their health to max, teleport them to where they need to be?

    If that doesn't work, EntityDamageEvent, check the health and the damage, call respawn event, etc.
     
  3. Offline

    timtower Administrator Administrator Moderator

  4. Offline

    Drkmaster83

    I wasn't quite sure it could, so I just prematurely provided another solution, the EntityDamage one
     
  5. Offline

    Disgastings

    Correct me if i'm wrong, but you could add a player to an arraylist when the player dies. And when the player is damaged by entities you can check wether the player is in the arraylist and cancel it.
     
  6. Offline

    timtower Administrator Administrator Moderator

    @MattTheBeast Is the gun plugin yours? If so: might be an issue with how everything is handled.
    For what I know: you are now trying to work around something instead of fixing.
    Does the same happen without the auto-respawn?
     
  7. Offline

    MaxFireIce

    @MattTheBeast just something to think about, is there damage happening to the player after they spawn?
     
  8. Offline

    MattTheBeast

    @timtower No, the gun plugin is one of my friends, and the way it determines if a player died is by checking the last damage cause and by who, and there is no hit delay so when a player would get shot by multiple bullets, lets say a shotgun it would register it twice. I solved the glitch tho, basicly made it so that when a player dies if they died again within like 5 ticks the kill isn't counted.

    Unfortunatly im way to new to all this to code a gun plugin xD, I'm getting there tho this summer I'm planning on learning java proprerly

    @MaxFireIce nope, the player litteraly dies twice when shot to death, I also have a auto respawn so that probably why it calculates twice.

    This is a typical minecraft gun server glitch, almost every gun server I know of handles deaths the same way and all face this glitch, iv even seen servers go as far as make it 2 kills to count as one, its a horrible way to handle it because if someone snipes a other and they get 1 shot no double death is calculated thus making the kill not count.
     
Thread Status:
Not open for further replies.

Share This Page