Added dialog events to scripted player events

This commit is contained in:
luisc committed 2022-01-12 22:59:03 -06:00
1 parent b024f800ae
commit 04def38b63
11 files changed
+102 -18

No files matched your search

@@ -2,8 +2,13 @@ package noppes.npcs.controllers;
import java.util.HashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.EventHooks;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.event.FactionEvent;
public class PlayerFactionData {
public HashMap<Integer,Integer> factionData = new HashMap<Integer,Integer>();
@@ -45,7 +50,8 @@ public class PlayerFactionData {
return factionData.get(id);
}
public void increasePoints(int factionId, int points) {
public void increasePoints(int factionId, int points, EntityPlayer player) {
EventHooks.onFactionPoints(new FactionEvent.FactionPoints(new ScriptPlayer((EntityPlayerMP) player), FactionController.getInstance().get(factionId), points < 0, points));
if(!factionData.containsKey(factionId)){
Faction faction = FactionController.getInstance().get(factionId);
factionData.put(factionId, faction == null? -1 : faction.defaultPoints);