mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Merge pull request #504 from Glitchfinder/master
Making it impossible to attempt to drop air
This commit is contained in:
commit
e7aafb7242
@ -281,13 +281,15 @@ public class Misc {
|
|||||||
*/
|
*/
|
||||||
public static void dropItem(Location location, ItemStack itemStack) {
|
public static void dropItem(Location location, ItemStack itemStack) {
|
||||||
|
|
||||||
|
if(itemStack.getType() == Material.AIR)
|
||||||
|
return;
|
||||||
|
|
||||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Item newItem = location.getWorld().dropItemNaturally(location, itemStack);
|
Item newItem = location.getWorld().dropItemNaturally(location, itemStack);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user