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
107fc9d5f6
commit
5c363d27fd
@ -1277,9 +1277,13 @@ 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++)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
if (event.getPlayer().getInventory().getItem(i) == null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user