Set chat format if player has a certain amount of kills?

Discussion in 'Plugin Development' started by Advanxed, Dec 3, 2016.

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

    Advanxed

    Okay so I am coding a kitpvp core and basically if you have 1-99 kills your chat formatting like your name and everything is &7, 100-499 &9, 501-999 &a, 1001-1499 &c, and 1500+ &6&l.

    I am not sure how to check for this to set their format based on it and I don't want to type out every single integer.

    I am not looking for you to spoon feed me code. If you just tell me how I'd do that I can hopefully figure it out.

    Thanks ;)
     
  2. Offline

    timtower Administrator Administrator Moderator

    Moved to plugin development
     
  3. @Advanxed Check if kills are >= 1 && < 99 set format 1, >= 100 && < 500 set format 2 etc
     
  4. Offline

    DoggyCode™

    First of, you need to start storing their kills, as there are no Player#getKills() method. I would suggest making a new Object called for example KitPvPPlayer (not the best name but yeah), with the getKills(); method. Whenever the plugin disables, or on intervals, get all KitPvPPlayer objects (which you could then store in a HashMap) and store data in a file where you can later collect from (YML works just fine, but I suggest JSON).


    Sent from my iPhone using Tapatalk
     
  5. Offline

    Advanxed

    Thank you, will do.
    Already done.
     
  6. Offline

    Lordloss

    So this thread is solved? If so, mark it as solved please.
     
  7. Offline

    Advanxed

    Not necessarily, haven't got to try it out yet, been busy with an incident.
     
  8. Offline

    Advanxed

  9. Offline

    timtower Administrator Administrator Moderator

    @Advanxed Don't get the string value of an integer.
     
  10. @Advanxed You are getting String not an integer, also don't cast that class to JavaPlugin that is your main class only! Use Bukkit.getServer()
     
  11. Offline

    Advanxed

    I'm sorry to keep bothering you guys but can you help me find this fix?

    (Nvm found it)
     

    Attached Files:

Thread Status:
Not open for further replies.

Share This Page