Hello Bukkiteers! I need help developing a special plugin, which creates all-new weapons and effects and stuff. The Battle System is changed, and so a Player can only have one weapon (marked by Damage: X in the lore) in the quickbar, unless he changes it in special areas. Any ideas how to do this? I would like to use InventoryCloseEvent, but I have no idea how to use it. Could you guys help me? 1st: How do I get the player who just closed the inventory? (getPlayer() only returns a HumanEntity, And I'm not sure whether that would work. What's the difference by the way?) 2nd: Which slots do I have to check to have the quickbar controlled? 3rd: Can I get the armor of the player using the player.getEquipment().getHelmet() method right during handling the event?
1st: http://jd.bukkit.org/rb/apidocs/org/bukkit/entity/HumanEntity.html right now only Players are HumanEntity so just cast it to player otherwise instanceof check first and the ncast 2nd: http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryType.SlotType.html you can get the SlotType.QuickBar 3rd: if I understand correctly what you want to do yes. otherwise test it out
Thanks for the quick help! Well, you anwered 1 and 3 very well, and thx for this, but I meant with 2nd how I would loop through the slots of the quickbar, Like slot-numbers or something like that.