mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 07:04:25 +00:00
Party Scripting / Better Party Objective Handling (Sync)
- IParty API - PartyEvents and Registers - Register Hooks to Player Scripts
This commit is contained in:
1 parent
da9f77e9ba
commit
614c6ca474
13 files changed
+377
-49
No files matched your search
@@ -29,6 +29,7 @@ import noppes.npcs.roles.RoleFollower;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptSound;
|
||||
import noppes.npcs.scripted.event.DialogEvent;
|
||||
import noppes.npcs.scripted.event.PartyEvent;
|
||||
import noppes.npcs.scripted.event.QuestEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -468,6 +469,14 @@ public class NoppesUtilPlayer {
|
||||
if(quest == null)
|
||||
return false;
|
||||
|
||||
if (data.quest.completion == EnumQuestCompletion.Instant)
|
||||
EventHooks.onPartyFinished(party, data.quest);
|
||||
|
||||
PartyEvent.PartyQuestTurnedInEvent partyEv = new PartyEvent.PartyQuestTurnedInEvent(party, data.quest);
|
||||
EventHooks.onPartyTurnIn(partyEv);
|
||||
if (partyEv.isCancelled())
|
||||
return false;
|
||||
|
||||
PartyOptions partyOptions = quest.partyOptions;
|
||||
EnumPartyExchange complete = partyOptions.completeFor;
|
||||
EnumPartyExchange reward = partyOptions.rewardControl;
|
||||
@@ -481,7 +490,6 @@ public class NoppesUtilPlayer {
|
||||
if(playerData == null)
|
||||
continue;
|
||||
|
||||
|
||||
boolean isLeader = party.getLeaderUUID().equals(player.getUniqueID());
|
||||
boolean hasActiveQuest = playerData.questData.hasActiveQuest(quest.getId());
|
||||
boolean hasFinishedQuest = playerData.questData.hasFinishedQuest(quest.getId());
|
||||
@@ -521,7 +529,7 @@ public class NoppesUtilPlayer {
|
||||
|
||||
EventHooks.onQuestTurnedIn(event);
|
||||
if (event.isCancelled())
|
||||
return false;
|
||||
continue;
|
||||
|
||||
IItemStack[] var12 = event.itemRewards;
|
||||
int var14 = var12.length;
|
||||
@@ -566,7 +574,6 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
|
||||
playerData.save();
|
||||
|
||||
if(meetsComplete){
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user