mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-11 21:57:40 +00:00
Modified giveItem() method to give the player item(s) with all attributes of the ScriptItemStack parameter.
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user