How would I get podzol?

Discussion in 'Plugin Development' started by boomboompower, Sep 16, 2015.

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

    boomboompower

    What I am trying to do is when a player breaks podzol, it gives the player items and then changes the block back to podzol. How can I do this, I have this so far:
    Code:
    if (block.getType() == Material.DIRT) { 
                e.setCancelled(true);
                if (e.getBlock().getData() == 2) {
                    setBedrock(block);  
                    startPodzolRegen(block);
                    if (dp.containsEnchantment(Enchantment.DURABILITY)) {
                        if (dp.getEnchantmentLevel(Enchantment.DURABILITY) == 1)
                            dp.setDurability((short) (d + 3));
                    } else if (dp.getEnchantmentLevel(Enchantment.DURABILITY) == 2) {
                        dp.setDurability((short) (d + 2));
                    } else if (dp.getEnchantmentLevel(Enchantment.DURABILITY) == 3) {
                        dp.setDurability((short) (d + 1));
                    } else {
                        dp.setDurability((short) (d + 4));
                    }
                }
            }
    and for the regen:
    Code:
        public void startPodzolRegen(final Block block) {
            new BukkitRunnable() {
                @SuppressWarnings("deprecation")
                public void run() {
                    block.setType(Material.DIRT);
                    block.setData((byte) 2);
                }
            }.runTaskLater(this, 250L);
        }
     
  2. Offline

    mine-care

    And what is the problem with the code above? does it work? if not, where does it stop?
     
  3. Offline

    FabeGabeMC

  4. Offline

    boomboompower

    Well basically im making this a plugin for a server, there are currently 10+ blocks that do this but none of them use data. I don't want to test a code that won't work, as I don't use the Data tag often
     
Thread Status:
Not open for further replies.

Share This Page