Development Assistance Odd issue with my code

Discussion in 'Plugin Help/Development/Requests' started by BizarrePlatinum, Aug 13, 2016.

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


    I am currently making a Would you Rather plugin. I am currently getting no errors in console, however when I am doing some dividing to get some percentages and send a message to the player, the percentage comes out as 0.

    Code (open)

    if(item != null) {
                if(item.hasItemMeta()) {
                    ItemMeta itemMeta = item.getItemMeta();
                    if(itemMeta.getDisplayName().contains(ChatColor.BLUE + "?")) {
                        percentages[current][0] += 1;
                        agree = (percentages[current][0]/(percentages[current][0] + percentages[current][1])) * 100;
                        p.sendMessage(ChatColor.BLUE + df.format(agree) + "% agree with you.");
                    } else if(itemMeta.getDisplayName().contains(ChatColor.RED + "?")) {
                        percentages[current][1] += 1;
                        agree = (percentages[current][1]/(percentages[current][0] + percentages[current][1])) * 100;
                        p.sendMessage(ChatColor.RED + df.format(agree) + "% agree with you.");
  2. bwfcwalshy likes this.
  3. Offline


    percentages is a 2 dimensional array of integers
  4. @BizarrePlatinum
    Well, it's impossible for us to help you without knowing what values the percentages array array is set to.
  5. Offline


    @AlvinB What more do you need? I can assure you my array is setup correctly.
  6. @BizarrePlatinum
    If you were, these issues wouldn't occurr, show us where you define and set the values of said nested array.
Thread Status:
Not open for further replies.

Share This Page