Fix item drop check in Wizards

Currently players are unable to drop items if the held item
slot is below 5.  This works fine when dropping items simply
by pressing q, but it often interferes with players dropping
items from an open inventory.  This commit changes the check
to iterate over the first five slots and only cancel the event
if they're dropping one of them.
This commit is contained in:
Nate Mortensen 2016-11-22 19:53:28 -07:00 committed by cnr
parent abbb46ec0a
commit 9444da9dae

View File

@ -1285,11 +1285,15 @@ public class Wizards extends SoloGame
@EventHandler
public void onDropItem(PlayerDropItemEvent event)
{
if (event.getPlayer().getInventory().getHeldItemSlot() < 5)
// Check to see if they item they're dropping is from one of the first five slots(wand slots)
for (int i = 0; i < 5; i++)
{
if (event.getPlayer().getInventory().getItem(i) == null)
{
event.setCancelled(true);
}
}
}
@EventHandler
public void onEndOrPrepare(GameStateChangeEvent event)