PrisonUtils

Bukkit Plugins
728,662 Downloads Last Updated: Mar 5, 2016 Game Version: 1.9   +2

API


API Documentation

PrisonUtils has an API to allow developers to do anything you would like after breaking a block, along with modifying the drops.

// Anything you want to do when someone breaks a block is all going to go inside this MiningHandler interface.
MiningHandler handler = new MiningHandler(){
        @Override
        public List<ItemStack> onMine(Player p, Block b, List<ItemStack> drops, ItemStack tool) {
                // Here you can use any of the above arguments to do almost anything.
                // In this case we will be checking if the block broken is a Diamond ore block,
                // and broadcasting if it is.
                if (b.getType().equals(Material.DIAMOND_ORE)) {
                        Bukkit.getServer().broadcastMessage(ChatColor.GOLD + p.getName() + " broke diamond ore!");
                }
 
                // Here is where you can modify drops.
                // You must return an array of ItemStacks, but in this case we will just leave the original Array as it is.
                return drops;
        }
                       
});
 
// And of course we have to register our MiningHandler so that PrisonUtils will refrence it.
PrisonUtils.registerMiningHandler(hanler);

Comments

  • To post a comment, please or register a new account.
Posts Quoted: