Development Assistance Flint 'n' Steel

Discussion in 'Plugin Help/Development/Requests' started by tutorguy, Nov 25, 2014.

Thread Status:
Not open for further replies.
  1. Hey so I'm coding an FFA plugin and I want to make it so after 3 seconds the fire gets removed, any idea how that would work?

    GrandmaJam likes this.
  2. Offline


    Have you started this yet? If so, post what you have so far.
  3. Haven't started this part yet, i've started all the rest - thats easy - just this small part I dont get
  4. Offline


    Hopefully this helps you, I would suggest placing the fire manually and then resetting it. I have not tested this method so I apologize for any errors or if it doesn't work at all.
    1. @EventHandler
    2. public void onPlayerInteract1(final PlayerInteractEvent e) {
    3. Player p = e.getPlayer();
    4. if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
    5. if (p.getItemInHand().getType() == Material.FLINT_AND_STEEL) {
    6. final Material old = e.getClickedBlock().getLocation().add(0, 1, 0).getBlock().getType();
    7. e.getClickedBlock().getLocation().add(0, 1, 0).getBlock().setType(Material.FIRE);
    8. Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    9. public void run() {
    10. if (e.getClickedBlock().getLocation().add(0, 1, 0).getBlock().getType() == Material.FIRE)
    11. e.getClickedBlock().getLocation().add(0, 1, 0).getBlock().setType(old);
    12. }
    13. }, 3 * 20L);
    14. }
    15. }
    16. }
    GrandmaJam likes this.

  5. Thank you so much <3
  6. Offline


    Think you might be spoon-feeding there mate... Instead of just giving the code, explain how it would work and let the person figure it out for themselves -- that way, they learn something from the experience.
Thread Status:
Not open for further replies.

Share This Page