SPIGOT-3143: Don't decrease item stack size if VehicleCreateEvent is cancelled
By: BlackHole <black-hole@live.com>
This commit is contained in:
@@ -50,10 +50,20 @@
|
||||
entityminecartabstract.setCustomName(itemstack.getName());
|
||||
}
|
||||
|
||||
world.addEntity(entityminecartabstract);
|
||||
- world.addEntity(entityminecartabstract);
|
||||
- itemstack.subtract(1);
|
||||
+ if (!world.addEntity(entityminecartabstract)) itemstack.add(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -83,7 +117,7 @@
|
||||
entityminecartabstract.setCustomName(itemstack.getName());
|
||||
}
|
||||
|
||||
- world.addEntity(entityminecartabstract);
|
||||
+ if (!world.addEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
|
||||
}
|
||||
|
||||
itemstack.subtract(1);
|
||||
|
||||
Reference in New Issue
Block a user