From cf6f122f9b4070182f3907ebd7f7498c23257da2 Mon Sep 17 00:00:00 2001 From: Kam Date: Wed, 6 Mar 2024 05:02:37 -0500 Subject: [PATCH] IParty API and Party Events --- java/noppes/npcs/api/event/IPartyEvent.java | 49 ++++++++ java/noppes/npcs/api/handler/data/IParty.java | 117 ++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 java/noppes/npcs/api/event/IPartyEvent.java create mode 100644 java/noppes/npcs/api/handler/data/IParty.java diff --git a/java/noppes/npcs/api/event/IPartyEvent.java b/java/noppes/npcs/api/event/IPartyEvent.java new file mode 100644 index 0000000..d07ebc3 --- /dev/null +++ b/java/noppes/npcs/api/event/IPartyEvent.java @@ -0,0 +1,49 @@ +package noppes.npcs.api.event; + +import cpw.mods.fml.common.eventhandler.Cancelable; +import noppes.npcs.api.entity.IPlayer; +import noppes.npcs.api.handler.data.IParty; +import noppes.npcs.api.handler.data.IQuest; +import noppes.npcs.api.item.IItemStack; + +public interface IPartyEvent { + + IParty getParty(); + + IQuest getQuest(); + + interface PartyQuestCompletedEvent extends IPartyEvent { + } + + @Cancelable + interface PartyQuestSetEvent extends IPartyEvent { + } + + @Cancelable + interface PartyQuestTurnedInEvent extends IPartyEvent { } + + @Cancelable + interface PartyInviteEvent extends IPartyEvent { + + IPlayer getPlayer(); + + String getPlayerName(); + + } + + @Cancelable + interface PartyKickEvent extends IPartyEvent { + IPlayer getPlayer(); + + String getPlayerName(); + } + + interface PartyLeaveEvent extends IPartyEvent { + IPlayer getPlayer(); + + String getPlayerName(); + } + + interface PartyDisbandEvent extends IPartyEvent { + } +} diff --git a/java/noppes/npcs/api/handler/data/IParty.java b/java/noppes/npcs/api/handler/data/IParty.java new file mode 100644 index 0000000..6609b9c --- /dev/null +++ b/java/noppes/npcs/api/handler/data/IParty.java @@ -0,0 +1,117 @@ +package noppes.npcs.api.handler.data; + +import noppes.npcs.api.entity.IPlayer; +import java.util.List; + +public interface IParty { + + /** + * @return UUID of Party + */ + String getPartyUUIDString(); + + /** + * @return if party is locked (quest is set) + */ + boolean getIsLocked(); + + /** + * Set a quest to the party (this does not validate use validateQuest()) + * @param quest Quest Object + */ + void setQuest(IQuest quest); + + /** + * Get the Quest for the Party, can be null + * @return quest + */ + IQuest getQuest(); + + /** + * Get the Quest ID for Party | -1 if no quest + * @return quest id + */ + int getCurrentQuestID(); + + /** + * Get the Quest Name for Party | BLANK if no quest + * @return quest name + */ + String getCurrentQuestName(); + + + /** + * @param playerName Username of Player (Case Sensitive) + * @return successful or not + */ + boolean addPlayer(String playerName); + + /** + * @param playerName Username of Player (Case Sensitive) + * @return successful or not + */ + boolean removePlayer(String playerName); + + /** + * @param player IPlayer + * @return successful or not + */ + boolean addPlayer(IPlayer player); + + /** + * @param player IPlayer + * @return successful or not + */ + boolean removePlayer(IPlayer player); + + + /** + * Check if Player is in Party with IPlayer + * @return true/false if player is in party + */ + boolean hasPlayer(IPlayer player); + + /** + * Check if Player is in Party with Player Name + * @return true/false if player is in party + */ + boolean hasPlayer(String playerName); + + /** + * @return Party Leader's Name + */ + String getPartyLeaderName(); + + /** + * @return Collection of all Player Names in Party + */ + List getPlayerNamesList(); + + + /** + * @param questID ID for the Quest to Verify + * @param sendLeaderMessages IF true will send ERROR message to Party Leader on why the quest could not be set + * @return true/false if the party CAN have the quest set + */ + boolean validateQuest(int questID, boolean sendLeaderMessages); + + /** + * Toggles Friendly Fire + */ + void toggleFriendlyFire(); + + /** + * @return Current Friendly Fire settings in Party + */ + boolean friendlyFire(); + + /** + * Sends information for Quest Objectives to all Party Participants [Lower Data] + */ + void updateQuestObjectiveData(); + + /** + * Sends all PARTY INFORMATION to all Party Participants [Higher Data] + */ + void updatePartyData(); +}