Help for chat

Discussion in 'Plugin Development' started by MordorKing78, Apr 23, 2014.

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

    MordorKing78

    So im trying to make if an kills the [Victor] he will get [Victor]. But [Victor] does not reset..

    My event:
    Code:java
    1. @EventHandler
    2. public void onDeath(PlayerDeathEvent e){
    3. Player killed = e.getEntity();
    4. Player killer = e.getEntity().getKiller();
    5. if(killed instanceof Player){
    6. if(killer instanceof Player){
    7. if(killed.isDead());
    8. this.getConfig().set(killer.getName(), "§a[Victor] " + killer.getDisplayName());
    9. saveConfig();
    10. }
    11. if(this.getConfig().getString(killed.getPlayer().getName(), "§a[Victor] ") != null){
    12. this.getConfig().set(killed.getName(), "" + killed.getDisplayName());
    13. }
    14. }
    15. }
     
  2. Offline

    stink123456

    try using .contains instead of the null check?
     
  3. Offline

    MordorKing78

    Gonna try

    Does not work:
    Code:java
    1. this.getConfig().getString(killed.getPlayer().getName(), "§a[Victor] ").contains("§a[Victor] ")
    2. ^^ Does not work
    3. if(this.getConfig().contains(killed.getPlayer().getName() + "§a[Victor] ")
    4. ^^ Does not work


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    stink123456

    on the first one you shouldn't do it, only on the if statement


    ==============================================================================
     
  5. Offline

    MordorKing78

    kk but how would i do it in another way?
     
  6. Offline

    stink123456

    I do not see another way, this should surely work!
     
Thread Status:
Not open for further replies.

Share This Page