Setting the flower pot content

Discussion in 'Plugin Development' started by zioGiok, Aug 23, 2016.

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

    zioGiok

    I am doing a plugin and I need to set the flower pot content to an acacia sapling (data = 12). I have googled it and i found some people that use setContent, some people use setTypeIdAndData and replace it but these don't work for me. I am actually using 1.8.8 and this is my code, it practically replace the flower pot with air and after 5 ticks it should replace the air with a flower pot containing an acacia sapling.
    This is my code:
    Code:
    loc.getBlock().setType(Material.AIR);
                                   Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                                    @SuppressWarnings("deprecation")
                                    public void run() {    ;
                                           loc.getBlock().setTypeIdAndData(140, (byte) 12, false);
                                       }
                                }, 5);  
    There aren't errors but it just replace air with an empty flower pot after 5 ticks, not as i want.
    I can see the flower pot disappear and reappear really quickly but it's still empty.
    Please help me doing this.
    Thanks.
    Sorry for my bad English.
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    zioGiok

  4. Offline

    Zombie_Striker

    @zioGiok
    Have you tried using the "setContent" method?
     
Thread Status:
Not open for further replies.

Share This Page