Modified giveItem() method to give the player item(s) with all attributes of the ScriptItemStack parameter.

This commit is contained in:
luisc committed 2021-09-05 21:48:36 -05:00
1 parent a2e869ddb3
commit 459976c54d
1 file changed
+6 -2
@@ -245,8 +245,12 @@ public class ScriptPlayer extends ScriptLivingBase{
* @return Returns whether or not it gave the item succesfully
*/
public boolean giveItem(ScriptItemStack item, int amount){
String itemname = Item.itemRegistry.getNameForObject(item.getMCItemStack().getItem());
return giveItem(itemname, item.getItemDamage(), amount);
if(item != null && item.getMCItemStack() != null) {
item.setStackSize(amount);
return this.player.inventory.addItemStackToInventory(item.getMCItemStack());
} else {
return false;
}
}
/**