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:
parent
abbb46ec0a
commit
9444da9dae
@ -1285,11 +1285,15 @@ public class Wizards extends SoloGame
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDropItem(PlayerDropItemEvent event)
|
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEndOrPrepare(GameStateChangeEvent event)
|
public void onEndOrPrepare(GameStateChangeEvent event)
|
||||||
|
Loading…
Reference in New Issue
Block a user