mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-11 21:57:40 +00:00
Added updatePlayerInventory to ScriptPlayer
This commit is contained in:
1 parent
b068c76fc8
commit
18aa2d099f
2 files changed
+13
-1
No files matched your search
@@ -15,6 +15,7 @@ import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
@@ -232,6 +233,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updatePlayerInventory();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -258,7 +260,9 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
public boolean giveItem(ScriptItemStack item, int amount){
|
||||
if(item != null && item.getMCItemStack() != null) {
|
||||
item.setStackSize(amount);
|
||||
return this.player.inventory.addItemStackToInventory(item.getMCItemStack());
|
||||
boolean bool = this.player.inventory.addItemStackToInventory(item.getMCItemStack());
|
||||
this.updatePlayerInventory();
|
||||
return bool;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -357,4 +361,10 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
public ITimers getTimers() {
|
||||
return PlayerDataController.instance.getPlayerData(player).timers;
|
||||
}
|
||||
|
||||
public void updatePlayerInventory() {
|
||||
((EntityPlayerMP)this.entity).inventoryContainer.detectAndSendChanges();
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
playerdata.checkQuestCompletion((EntityPlayer)this.entity, EnumQuestType.Item);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user