Solved Replace wheat to seeds

Discussion in 'Plugin Development' started by WoutinBR, Jun 27, 2017.

Thread Status:
Not open for further replies.
  1. First of all, sorry for my english.

    I'm trying replace the wheat to seeds(crops), but the block I have clicked don't change!

    My problem:
    My code:

    Code:
    case("CROPS"):
                age = bloco.getState().getRawData();
                if(age == 7){
                    num1 = r.nextInt(101); //Chance of drop (seed), I want a better way too xD, that's terrible.
                    if(num1 >= 0 && num1 <= 10)
                        semente = 0;
                    else if(num1 >= 11 && num1 <= 50)
                        semente = 1;
                    else if(num1 >= 51 && num1 <= 76)
                        semente = 2;
                    else if(num1 > 76)
                        semente = 3;
                    num2 = r.nextInt(101);
                    if(num2 >= 0 && num2 <= 10) //Chance drop (wheat)
                        item = 0;
                    else if(num2 >= 11 && num2 <= 75)
                        item = 1;
                    else if(num2 > 76)
                        item = 2;
                    event.getPlayer().getInventory().addItem(new ItemStack(Material.SEEDS, semente));
                    event.getPlayer().getInventory().addItem(new ItemStack(Material.WHEAT, item));
                    acao = "trigo";
                    if(descontar(padrao, event, acao)) //That's removing items from the inventory, nothing important
                        bloco.setType(Material.CROPS);
                }
                break;
    bloco is the block location.


    What's wrong? (except my english xD)
    Thank you.
     
    Last edited: Jun 27, 2017
  2. Offline

    timtower Administrator Administrator Moderator

    @WoutinBR Could you post the full class?
     
  3. I fixed it three hours after create this thread just adding a delay 0.5s.
    Thank you anyway.
     
Thread Status:
Not open for further replies.

Share This Page