CombatLog help

Discussion in 'Plugin Development' started by flash1110, Jun 8, 2016.

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

    flash1110

    Basically, I have on my PlayerQuitEvent;
    Code:
    if (cp.getCombatTime() > 0) {
                player.setHealth(0.0);
                Bukkit.broadcastMessage(ChatColor.GRAY + player.getDisplayName() + ChatColor.RED + " logged out in combat");
               
            }
    When that is ran on quit, it kills them and removes their armor. However, when they join back their inventory is gone, which is good. But, their armor value stays even though they aren't wearing any armor. Any fixes?
     
  2. Offline

    N00BHUN73R

    @flash1110
    I'm pretty sure the easiest solution would be to add them to an ArrayList when they combat log..
    Then once they re-join, kill them.
     
  3. Offline

    flash1110

    @N00BHUN73R

    That ruins the point of the CombatLog plugin. The entire point is that when a player logs off, it kills them if they are in combat. Not if they rejoin the server. That shouldn't be the error anyway.
     
  4. Offline

    N00BHUN73R

    @flash1110
    Oh yeah, I see. Well looking at another plugin, I see that it first drops their inventory, and then sets their health to 0. You could try that aswell. I've never run into this bug myself whilst making a plugin of this sort.
     
  5. Offline

    flash1110

    @N00BHUN73R

    Hmm, I'll look into it. Thanks for your help so far.
     
  6. Offline

    Zombie_Striker

    @flash1110
    Have you tried adding a piece of armor to the player and then taking it away when they re-join? This should cause the player to update their stats.
     
  7. Offline

    flash1110

Thread Status:
Not open for further replies.

Share This Page