Solved Xp bugged

Discussion in 'Plugin Development' started by SnelleFrikandel, May 31, 2014.

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

    SnelleFrikandel

    Hi guys, I am making a KitPvp plugin and i am store the kills that a player has. I am useing that in the normal player chat. And i want to set the players XP to the kills that the player has. So i made this. Only the thing is if a player has 2+ kills the XP bar is freaked out.. Does anyone know what the problem is?

    Code:java
    1. @EventHandler
    2. public void onPlayerChat(AsyncPlayerChatEvent e) {
    3. Player p = e.getPlayer();
    4. int kill = this.getConfig().getInt("Players." + e.getPlayer().getUniqueId() +".Kills");
    5. if(p.hasPermission("kitvpvp.player"));
    6. e.setFormat(ChatColor.GOLD + "[" + kill + "] " + ChatColor.DARK_GRAY +
    7. p.getDisplayName() + ChatColor.GRAY + ": " + e.getMessage());
    8. p.setLevel(kill);
     
  2. Offline

    iTornado1234

  3. Offline

    SnelleFrikandel

    iTornado1234 I did, this is my code now
    Code:java
    1. @EventHandler
    2. public void onPlayerChat(AsyncPlayerChatEvent e) {
    3. Player p = e.getPlayer();
    4. int kill = this.getConfig().getInt("Players." + e.getPlayer().getUniqueId() +".Kills");
    5. if(p.hasPermission("kitvpvp.player"));
    6. e.setFormat(ChatColor.GOLD + "[" + kill + "] " + ChatColor.DARK_GRAY +
    7. p.getDisplayName() + ChatColor.GRAY + ": " + e.getMessage());
    8. ExperienceManager expMan = new ExperienceManager(p);
    9. expMan.setExp(kill);


    The point is if i kill someone i get 1 little bar thingy, What i can do then is make this:
    Code:java
    1. expMan.setExp(kill*17);

    The point is that is only working at the levels 1-15. Do you have a solution for that?
     
  4. Offline

    fireblast709

  5. Offline

    SnelleFrikandel

    fireblast709 Doesnt work, If the score is 2 the XP bar is all messed up.
     
  6. Offline

    fireblast709

Thread Status:
Not open for further replies.

Share This Page