Foraging plugin help

Discussion in 'Spigot Plugin Help' started by skydist, Jun 25, 2021.

  1. Hihi. I'm making my first listener plugin. This plugin is basically Hypixel skyblock's foraging plugin.

    Block b = a.getBlock();
    Material mat = a.getBlock().getType();

    if (mat == Material.WOOD) {

    if (mat == Material.LEAVES);
    b.setType(Material.LEAVES );

    This is the src I wrote but I want it to wait a few seconds before it replaces the block but idk what to write. Pls help
  2. You can make it using Runnable
  3. Exactly, try to use "delayedTask". This should help with your problem

    Code (Text):
    Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
        public void run() {
            Bukkit.broadcastMessage("This message is shown after one second");
    }, 20L); //20 Tick (1 Second) delay before run() is called