Greetings, I am trying to make a RANDOM item fall out of a decaying leaf. How would I go about this. I need to check, if the random number that is generated is equal to a valid item id and I NEED TO KNOW HOW TO DISPENSE ITEMS. I need to know how to make the items fall out of the leaves. Thanks a bunch! Joey.
Dropping items: Get the world and location of the leaf and drop an ItemStack there. Code: Block block = event.getBlock(); ItemStack drop = new ItemStack(Material.LEAVES, 1); block.getWorld().dropItem(block.getLocation(), drop);
Thanks! umm, I am trying to make an egg throw event but it does not work :O Here is my OnEnable: Code: public void onEnable() { MakeConfig(); PluginDescriptionFile desc = getDescription(); PluginManager pm = getServer().getPluginManager(); pm.registerEvent(Event.Type.PLAYER_EGG_THROW , (Listener)ESeventListener, Event.Priority.Normal, this); System.out.println("[INFO]" + desc.getName() + " - Version: " + desc.getVersion() + " has been initialized!"); } and here is my event class: Code: package com.eye.EggSpawner; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerEggThrowEvent; import org.bukkit.event.player.PlayerListener; public class ESPlayerEventListener extends PlayerListener { private static EggSpawner plugin; public ESPlayerEventListener(EggSpawner ES){ plugin = ES; } public void onEggThrow(PlayerEggThrowEvent eggEvent){ System.out.println("OMG, SOMEONE THREW AN EGG!!!!"); Player player = eggEvent.getPlayer(); player.sendMessage("YO DAWG, STOP THROWING THOSE EGGS!"); } } and help appreciated!
Thanks man, you are truly epicly awesome But wait! Still does not work: must override a supertype method. I am guessing the PlayerListener does not have an onThrowEgg function :/ NOTE: FIXED. IT WAS 'onPlayerEggThrow' EDIT by Moderator: merged posts, please use the edit button instead of double posting.