mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 12:25:59 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -20,121 +20,119 @@ import java.util.*;
|
||||
|
||||
public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
|
||||
public HashMap<Integer,Integer> dialogs = new HashMap<Integer,Integer>();
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound) {
|
||||
dialogs = NBTTags.getIntegerIntegerMap(compound.getTagList("QuestDialogs", 10));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("QuestDialogs", NBTTags.nbtIntegerIntegerMap(dialogs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted(PlayerData playerData) {
|
||||
for(int dialogId : dialogs.values())
|
||||
if(!playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleComplete(EntityPlayer player) {
|
||||
super.handleComplete(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<String> getQuestLogStatus(EntityPlayer player) {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
for(int dialogId : dialogs.values()){
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
continue;
|
||||
String title = dialog.title;
|
||||
if(PlayerDataController.Instance.getPlayerData(player).dialogData.dialogsRead.contains(dialogId))
|
||||
title += " (read)";
|
||||
else
|
||||
title += " (unread)";
|
||||
vec.add(title);
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
public HashMap<Integer, Integer> dialogs = new HashMap<Integer, Integer>();
|
||||
|
||||
@Override
|
||||
public IQuestObjective[] getObjectives(EntityPlayer player) {
|
||||
List<IQuestObjective> list = new ArrayList();
|
||||
public void readEntityFromNBT(NBTTagCompound compound) {
|
||||
dialogs = NBTTags.getIntegerIntegerMap(compound.getTagList("QuestDialogs", 10));
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; ++i) {
|
||||
if (this.dialogs.containsKey(i)) {
|
||||
Dialog dialog = (Dialog)DialogController.Instance.dialogs.get(this.dialogs.get(i));
|
||||
if (dialog != null) {
|
||||
list.add(new noppes.npcs.quests.QuestDialog.QuestDialogObjective(this, player, dialog));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("QuestDialogs", NBTTags.nbtIntegerIntegerMap(dialogs));
|
||||
}
|
||||
|
||||
return (IQuestObjective[])list.toArray(new IQuestObjective[list.size()]);
|
||||
}
|
||||
@Override
|
||||
public boolean isCompleted(PlayerData playerData) {
|
||||
for (int dialogId : dialogs.values())
|
||||
if (!playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleComplete(EntityPlayer player) {
|
||||
super.handleComplete(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<String> getQuestLogStatus(EntityPlayer player) {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
for (int dialogId : dialogs.values()) {
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if (dialog == null)
|
||||
continue;
|
||||
String title = dialog.title;
|
||||
if (PlayerDataController.Instance.getPlayerData(player).dialogData.dialogsRead.contains(dialogId))
|
||||
title += " (read)";
|
||||
else
|
||||
title += " (unread)";
|
||||
vec.add(title);
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IQuestObjective[] getObjectives(EntityPlayer player) {
|
||||
List<IQuestObjective> list = new ArrayList();
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (this.dialogs.containsKey(i)) {
|
||||
Dialog dialog = (Dialog) DialogController.Instance.dialogs.get(this.dialogs.get(i));
|
||||
if (dialog != null) {
|
||||
list.add(new noppes.npcs.quests.QuestDialog.QuestDialogObjective(this, player, dialog));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (IQuestObjective[]) list.toArray(new IQuestObjective[list.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IQuestObjective[] getPartyObjectives(Party party) {
|
||||
List<IQuestObjective> list = new ArrayList();
|
||||
|
||||
for(int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (this.dialogs.containsKey(i)) {
|
||||
Dialog dialog = (Dialog)DialogController.Instance.dialogs.get(this.dialogs.get(i));
|
||||
Dialog dialog = (Dialog) DialogController.Instance.dialogs.get(this.dialogs.get(i));
|
||||
if (dialog != null) {
|
||||
list.add(new noppes.npcs.quests.QuestDialog.QuestDialogObjective(this, party, dialog));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (IQuestObjective[])list.toArray(new IQuestObjective[list.size()]);
|
||||
return (IQuestObjective[]) list.toArray(new IQuestObjective[list.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<String> getPartyQuestLogStatus(Party party) {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
if(party == null)
|
||||
if (party == null)
|
||||
return vec;
|
||||
|
||||
if(party.getQuestData() == null)
|
||||
if (party.getQuestData() == null)
|
||||
return vec;
|
||||
|
||||
if(party.getQuestData().quest == null)
|
||||
if (party.getQuestData().quest == null)
|
||||
return vec;
|
||||
|
||||
EnumPartyObjectives objectives = party.getQuestData().quest.partyOptions.objectiveRequirement;
|
||||
if(objectives == EnumPartyObjectives.All){
|
||||
for(int dialogId : dialogs.values()){
|
||||
if (objectives == EnumPartyObjectives.All) {
|
||||
for (int dialogId : dialogs.values()) {
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
if (dialog == null)
|
||||
continue;
|
||||
|
||||
ArrayList<String> unread = new ArrayList<>();
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer player = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData playerData;
|
||||
if(player != null){
|
||||
if (player != null) {
|
||||
playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
playerData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(playerData != null){
|
||||
if(!playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
if (playerData != null) {
|
||||
if (!playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
unread.add(playerData.playername);
|
||||
}
|
||||
}
|
||||
|
||||
String title = dialog.title;
|
||||
if(!unread.isEmpty()){
|
||||
if (!unread.isEmpty()) {
|
||||
title += " (unread)";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
title += " (read)";
|
||||
}
|
||||
vec.add(title);
|
||||
@@ -151,23 +149,22 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
}
|
||||
return vec;
|
||||
} else if(objectives == EnumPartyObjectives.Leader){
|
||||
} else if (objectives == EnumPartyObjectives.Leader) {
|
||||
EntityPlayer leader = NoppesUtilServer.getPlayer(party.getLeaderUUID());
|
||||
PlayerData playerData;
|
||||
if(leader != null){
|
||||
if (leader != null) {
|
||||
playerData = PlayerDataController.Instance.getPlayerData(leader);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
playerData = PlayerDataController.Instance.getPlayerDataCache(party.getLeaderUUID().toString());
|
||||
}
|
||||
if(playerData == null)
|
||||
if (playerData == null)
|
||||
return vec;
|
||||
for(int dialogId : dialogs.values()){
|
||||
for (int dialogId : dialogs.values()) {
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
if (dialog == null)
|
||||
continue;
|
||||
String title = dialog.title;
|
||||
if(playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
if (playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
title += " (read)";
|
||||
else
|
||||
title += " (unread)";
|
||||
@@ -176,31 +173,30 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
return vec;
|
||||
} else {
|
||||
Set<Integer> readValues = new HashSet<>();
|
||||
for(int dialogId : dialogs.values()){
|
||||
for (int dialogId : dialogs.values()) {
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
if (dialog == null)
|
||||
continue;
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer player = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData sharedData;
|
||||
if(player != null){
|
||||
if (player != null) {
|
||||
sharedData = PlayerDataController.Instance.getPlayerData(player);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sharedData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(sharedData != null){
|
||||
if(sharedData.dialogData.dialogsRead.contains(dialogId))
|
||||
if (sharedData != null) {
|
||||
if (sharedData.dialogData.dialogsRead.contains(dialogId))
|
||||
readValues.add(dialogId);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int dialogId : dialogs.values()){
|
||||
for (int dialogId : dialogs.values()) {
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
if (dialog == null)
|
||||
continue;
|
||||
String title = dialog.title;
|
||||
if(readValues.contains(dialogId))
|
||||
if (readValues.contains(dialogId))
|
||||
title += " (read)";
|
||||
else
|
||||
title += " (unread)";
|
||||
@@ -212,30 +208,29 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
|
||||
@Override
|
||||
public boolean isPartyCompleted(Party party) {
|
||||
if(party == null)
|
||||
if (party == null)
|
||||
return false;
|
||||
|
||||
if(party.getQuestData() == null)
|
||||
if (party.getQuestData() == null)
|
||||
return false;
|
||||
|
||||
if(party.getQuestData().quest == null)
|
||||
if (party.getQuestData().quest == null)
|
||||
return false;
|
||||
|
||||
EnumPartyObjectives objectives = party.getQuestData().quest.partyOptions.objectiveRequirement;
|
||||
if(objectives == EnumPartyObjectives.All){
|
||||
if (objectives == EnumPartyObjectives.All) {
|
||||
List<String> incomplete = new ArrayList<>();
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer individual = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData individualData;
|
||||
if(individual != null){
|
||||
if (individual != null) {
|
||||
individualData = PlayerDataController.Instance.getPlayerData(individual);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
individualData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(individualData != null){
|
||||
for(int dialogId : dialogs.values()){
|
||||
if(!individualData.dialogData.dialogsRead.contains(dialogId)){
|
||||
if (individualData != null) {
|
||||
for (int dialogId : dialogs.values()) {
|
||||
if (!individualData.dialogData.dialogsRead.contains(dialogId)) {
|
||||
incomplete.add(individualData.playername);
|
||||
break;
|
||||
}
|
||||
@@ -243,18 +238,17 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
}
|
||||
return incomplete.isEmpty();
|
||||
} else if(objectives == EnumPartyObjectives.Leader){
|
||||
} else if (objectives == EnumPartyObjectives.Leader) {
|
||||
EntityPlayer leaderPlayer = NoppesUtilServer.getPlayer(party.getLeaderUUID());
|
||||
PlayerData leaderData;
|
||||
if(leaderPlayer != null){
|
||||
if (leaderPlayer != null) {
|
||||
leaderData = PlayerDataController.Instance.getPlayerData(leaderPlayer);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
leaderData = PlayerDataController.Instance.getPlayerDataCache(party.getLeaderUUID().toString());
|
||||
}
|
||||
if(leaderData != null){
|
||||
for(int dialogId : dialogs.values()){
|
||||
if(!leaderData.dialogData.dialogsRead.contains(dialogId)){
|
||||
if (leaderData != null) {
|
||||
for (int dialogId : dialogs.values()) {
|
||||
if (!leaderData.dialogData.dialogsRead.contains(dialogId)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -264,25 +258,24 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
return true;
|
||||
} else {
|
||||
HashMap<Integer, Boolean> readValues = new HashMap<>();
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer player = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData playerData;
|
||||
if(player != null){
|
||||
if (player != null) {
|
||||
playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
playerData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(playerData != null){
|
||||
for(int dialogId : dialogs.values()){
|
||||
if(playerData.dialogData.dialogsRead.contains(dialogId)){
|
||||
if (playerData != null) {
|
||||
for (int dialogId : dialogs.values()) {
|
||||
if (playerData.dialogData.dialogsRead.contains(dialogId)) {
|
||||
readValues.put(dialogId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(boolean result : readValues.values()){
|
||||
if(!result)
|
||||
for (boolean result : readValues.values()) {
|
||||
if (!result)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -290,17 +283,17 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
|
||||
class QuestDialogObjective implements IQuestObjective {
|
||||
private final QuestDialog parent;
|
||||
private final EntityPlayer player;
|
||||
private final QuestDialog parent;
|
||||
private final EntityPlayer player;
|
||||
private final Party party;
|
||||
private final Dialog dialog;
|
||||
private final Dialog dialog;
|
||||
|
||||
public QuestDialogObjective(QuestDialog this$0, EntityPlayer player, Dialog dialog) {
|
||||
this.parent = this$0;
|
||||
this.player = player;
|
||||
this.dialog = dialog;
|
||||
public QuestDialogObjective(QuestDialog this$0, EntityPlayer player, Dialog dialog) {
|
||||
this.parent = this$0;
|
||||
this.player = player;
|
||||
this.dialog = dialog;
|
||||
this.party = null;
|
||||
}
|
||||
}
|
||||
|
||||
public QuestDialogObjective(QuestDialog this$0, Party party, Dialog dialog) {
|
||||
this.parent = this$0;
|
||||
@@ -309,13 +302,13 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
this.player = null;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return this.isCompleted() ? 1 : 0;
|
||||
}
|
||||
public int getProgress() {
|
||||
return this.isCompleted() ? 1 : 0;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
if (progress >= 0 && progress <= 1) {
|
||||
if(player != null){
|
||||
public void setProgress(int progress) {
|
||||
if (progress >= 0 && progress <= 1) {
|
||||
if (player != null) {
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
boolean completed = data.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
@@ -331,19 +324,18 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
data.updateClient = true;
|
||||
data.save();
|
||||
}
|
||||
} else if (party != null){
|
||||
if(party.getObjectiveRequirement() != null){
|
||||
} else if (party != null) {
|
||||
if (party.getObjectiveRequirement() != null) {
|
||||
EnumPartyObjectives objectives = party.getObjectiveRequirement();
|
||||
if(objectives == EnumPartyObjectives.Leader){
|
||||
if (objectives == EnumPartyObjectives.Leader) {
|
||||
EntityPlayer leaderPlayer = NoppesUtilServer.getPlayer(party.getLeaderUUID());
|
||||
PlayerData leaderData;
|
||||
if(leaderPlayer != null){
|
||||
if (leaderPlayer != null) {
|
||||
leaderData = PlayerDataController.Instance.getPlayerData(leaderPlayer);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
leaderData = PlayerDataController.Instance.getPlayerDataCache(party.getLeaderUUID().toString());
|
||||
}
|
||||
if(leaderData == null)
|
||||
if (leaderData == null)
|
||||
return;
|
||||
|
||||
boolean completed = leaderData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
@@ -360,16 +352,15 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
leaderData.save();
|
||||
}
|
||||
} else {
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer individual = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData individualData;
|
||||
if(individual != null){
|
||||
if (individual != null) {
|
||||
individualData = PlayerDataController.Instance.getPlayerData(individual);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
individualData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(individualData != null){
|
||||
if (individualData != null) {
|
||||
boolean completed = individualData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
individualData.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
@@ -387,16 +378,16 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomNPCsException("Progress has to be 0 or 1", new Object[0]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomNPCsException("Progress has to be 0 or 1", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerProgress(String playerName, int progress) {
|
||||
if (progress >= 0 && progress <= 1) {
|
||||
EntityPlayer foundplayer = NoppesUtilServer.getPlayerByName(playerName);
|
||||
if(foundplayer != null && party == null){
|
||||
if (foundplayer != null && party == null) {
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(foundplayer);
|
||||
boolean completed = data.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
@@ -412,19 +403,18 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
data.updateClient = true;
|
||||
data.save();
|
||||
}
|
||||
} else if (foundplayer != null){
|
||||
if(party.getObjectiveRequirement() != null){
|
||||
} else if (foundplayer != null) {
|
||||
if (party.getObjectiveRequirement() != null) {
|
||||
EnumPartyObjectives objectives = party.getObjectiveRequirement();
|
||||
if(objectives == EnumPartyObjectives.Leader){
|
||||
if (objectives == EnumPartyObjectives.Leader) {
|
||||
EntityPlayer leaderPlayer = NoppesUtilServer.getPlayer(party.getLeaderUUID());
|
||||
PlayerData leaderData;
|
||||
if(leaderPlayer != null){
|
||||
if (leaderPlayer != null) {
|
||||
leaderData = PlayerDataController.Instance.getPlayerData(leaderPlayer);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
leaderData = PlayerDataController.Instance.getPlayerDataCache(party.getLeaderUUID().toString());
|
||||
}
|
||||
if(leaderData == null)
|
||||
if (leaderData == null)
|
||||
return;
|
||||
|
||||
boolean completed = leaderData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
@@ -442,7 +432,7 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
} else {
|
||||
PlayerData individualData = PlayerDataController.Instance.getPlayerData(foundplayer);
|
||||
if(individualData != null){
|
||||
if (individualData != null) {
|
||||
boolean completed = individualData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
individualData.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
@@ -465,45 +455,42 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
|
||||
public int getMaxProgress() {
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
if(player != null){
|
||||
public boolean isCompleted() {
|
||||
if (player != null) {
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
return data.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
}
|
||||
else if (party != null){
|
||||
if(party.getObjectiveRequirement() != null){
|
||||
} else if (party != null) {
|
||||
if (party.getObjectiveRequirement() != null) {
|
||||
EnumPartyObjectives objectives = party.getObjectiveRequirement();
|
||||
if(objectives == EnumPartyObjectives.Leader){
|
||||
if (objectives == EnumPartyObjectives.Leader) {
|
||||
EntityPlayer leaderPlayer = NoppesUtilServer.getPlayer(party.getLeaderUUID());
|
||||
PlayerData leaderData;
|
||||
if(leaderPlayer != null){
|
||||
if (leaderPlayer != null) {
|
||||
leaderData = PlayerDataController.Instance.getPlayerData(leaderPlayer);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
leaderData = PlayerDataController.Instance.getPlayerDataCache(party.getLeaderUUID().toString());
|
||||
}
|
||||
if(leaderData == null)
|
||||
if (leaderData == null)
|
||||
return false;
|
||||
return leaderData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
} else {
|
||||
boolean requiresOneRead = objectives == EnumPartyObjectives.Shared;
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer individual = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData individualData;
|
||||
if(individual != null){
|
||||
if (individual != null) {
|
||||
individualData = PlayerDataController.Instance.getPlayerData(individual);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
individualData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(individualData != null){
|
||||
if (individualData != null) {
|
||||
boolean read = individualData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if(requiresOneRead && read){
|
||||
if (requiresOneRead && read) {
|
||||
return true;
|
||||
} else if(!requiresOneRead && !read){
|
||||
} else if (!requiresOneRead && !read) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -513,34 +500,33 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.dialog.title + (this.isCompleted() ? " (read)" : " (unread)");
|
||||
}
|
||||
public String getText() {
|
||||
return this.dialog.title + (this.isCompleted() ? " (read)" : " (unread)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText() {
|
||||
if(party != null && party.getObjectiveRequirement() == EnumPartyObjectives.All){
|
||||
if (party != null && party.getObjectiveRequirement() == EnumPartyObjectives.All) {
|
||||
List<String> incomplete = new ArrayList<>();
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
for (UUID uuid : party.getPlayerUUIDs()) {
|
||||
EntityPlayer individual = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData individualData;
|
||||
if(individual != null){
|
||||
if (individual != null) {
|
||||
individualData = PlayerDataController.Instance.getPlayerData(individual);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
individualData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(individualData != null){
|
||||
if (individualData != null) {
|
||||
boolean read = individualData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if(!read) {
|
||||
if (!read) {
|
||||
incomplete.add(individualData.playername);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!incomplete.isEmpty())
|
||||
return "[" + String.join(", ", incomplete) + "]";
|
||||
if (!incomplete.isEmpty())
|
||||
return "[" + String.join(", ", incomplete) + "]";
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user