Block Break Counter

Discussion in 'Plugin Development' started by Randall123459, Jan 5, 2015.

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


    Hey, I'm making a plugin can someone provide me with a little bit of code to count amount of blocks broken with the pickaxe in hand!

  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline


    Nothing this is the feature that I'm implementing first
  4. Offline


    Do you mind showing me how to do this I'm new to bukkit coding! :D I usually code PHP
    This is what I have done so far!
    Show Spoiler

    package me.bukkit.Randall123459;


    public class SuperPickaxe extends JavaPlugin {

    public void onEnable() {
    getLogger().info("[SuperPickaxes] Super Pickaxes Has Been Enabled!" + "This is Version 1.0!");



  5. Offline


    You could do this, or you could set their metadata to the old metadata adding 1 per block broken.

    Edit: Ok, here you go:

    public void onBreak(BlockBreakEvent event) {
            Block block = event.getBlock();
            Player player = event.getPlayer();
            ItemMeta meta = item.getItemMeta();
             ArrayList<String> lore = new ArrayList<String>();
             int blocks = player.getMetadata("brokenblocks").get(0).asInt() + 1;
             lore.add(ChatColor.GREEN + "Blocks Broken: " + blocks);
             player.setMetadata("brokenblocks", new FixedMetadataValue(plugin, blocks));
    Last edited: Jan 5, 2015
    Randall123459 likes this.
  6. @Randall123459 No need to use Logger Bukkit does it for you. Also I am not going to spoonfeed.
  7. Offline


    Again I'm new to bukkit coding I don't really understand this :p

    Is there any place I can read up on it like a page with documentation?

    <Edited by bwfcwalshy: Merged posts, please use the edit button rather than double posting.>
  8. Offline


    Thanks and sorry bout the double post!
    TacticalQuiver likes this.
Thread Status:
Not open for further replies.

Share This Page