Plugin Help adding a wealth players lore.

Discussion in 'Plugin Help/Development/Requests' started by Scorpionvssub, Jul 5, 2015.

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

    Scorpionvssub

    I been having help on creating this plugin but i thought i would ask it here aswell see if it solves anything or may give some usefull advice i can read up on...

    wealth lore (open)

    1. public String getMoney(String money) {
    2. String suffix;
    3. String[] point;

    4. point = money.split(".");
    5. money = point[0];
    6. if (money.length() >= 4 && money.length() < 7) {
    7. money = String.valueOf(Double.valueOf(money) / 1000);
    8. suffix = "K";
    9. } else if (money.length() >= 7 && money.length() < 9) {
    10. money = String.valueOf(Double.valueOf(money) / 1000000);

    11. suffix = "M";
    12. }else if (money.length() >= 9) { // if it is = or more than 9
    13. money = String.valueOf(Double.valueOf(money) / 1000000000);

    14. suffix = "B";
    15. } else
    16. suffix = "";

    17. money = String.valueOf(Math.round(Double.valueOf(money) * 100.0) / 100.0);

    18. if (money.endsWith(".0"))
    19. money = money.substring(0, money.length() - 2);

    20. money = money + suffix;
    21. return money;
    22. }

    What this should do is turn the money from a 1000000 to a 1M but as soon as i add this in it will still load just wont do anything on a players death.

    where the item is given inc. lores (open)

    1. String money = getMoney(String.valueOf(economy.getBalance(victimname)));
    2. meta.setDisplayName(victimname + "'s head");
    3. List<String> lore = new ArrayList<>();
    4. lore.add(ChatColor.BLUE + "Couldnt keep his head");
    5. lore.add(ChatColor.BLUE + "Wealth:" + ChatColor.GOLD + money);
    6. meta.setLore(lore);
    7. meta.setOwner(victimname);
    8. skull.setItemMeta(meta);

    9. killer.getInventory().addItem(skull);
    10. killer.updateInventory();

    11. String message = ChatColor.GOLD + victimname + ChatColor.BLUE + " was killed by " + ChatColor.GOLD + killername + ChatColor.BLUE + " using " + ChatColor.GOLD + name + ChatColor.BLUE + " and got their head";
    12. event.setDeathMessage(prefix + message);

    This part on a by player death event should trigger and give a skull of the person that died to the guy that killed him. Now without above wealth lore code it works fine it has NO errors at all but as soon as i add this those 1m configuration in i get this: http://pastebin.com/Ndd3mBAD
     
    Last edited: Jul 5, 2015
Thread Status:
Not open for further replies.

Share This Page