mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
Objective Requirements for Party
This commit is contained in:
1 parent
83b08917d3
commit
2dfa12aae3
2 files changed
+51
-9
No files matched your search
@@ -4,13 +4,18 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IPartyOptions;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPartyExchange;
|
||||
import noppes.npcs.constants.EnumPartyObjectives;
|
||||
import noppes.npcs.constants.EnumPartyRequirements;
|
||||
|
||||
public class PartyOptions implements IPartyOptions {
|
||||
public boolean allowParty = false;
|
||||
public EnumPartyRequirements partyRequirements = EnumPartyRequirements.Leader;
|
||||
public EnumPartyExchange rewardControl = EnumPartyExchange.Leader;
|
||||
|
||||
public EnumPartyRequirements partyRequirements = EnumPartyRequirements.Leader;
|
||||
|
||||
public EnumPartyExchange rewardControl = EnumPartyExchange.Leader;
|
||||
public EnumPartyExchange completeFor = EnumPartyExchange.Leader;
|
||||
|
||||
public EnumPartyObjectives objectiveRequirement = EnumPartyObjectives.All;
|
||||
public int maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound)
|
||||
@@ -22,6 +27,7 @@ public class PartyOptions implements IPartyOptions {
|
||||
rewardControl = EnumPartyExchange.values()[compound.getInteger("RewardControl")];
|
||||
completeFor = EnumPartyExchange.values()[compound.getInteger("CompleteFor")];
|
||||
maxPartySize = compound.getInteger("MaxPartySize");
|
||||
objectiveRequirement = EnumPartyObjectives.values()[compound.getInteger("ObjectiveRequirement")];
|
||||
}
|
||||
else {
|
||||
if(compound.hasKey("PartyRequirements")){
|
||||
@@ -36,11 +42,15 @@ public class PartyOptions implements IPartyOptions {
|
||||
if(compound.hasKey("MaxPartySize")){
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
if(compound.hasKey("ObjectiveRequirement")){
|
||||
compound.removeTag("ObjectiveRequirement");
|
||||
}
|
||||
|
||||
partyRequirements = EnumPartyRequirements.Leader;
|
||||
partyRequirements = EnumPartyRequirements.Leader;
|
||||
rewardControl = EnumPartyExchange.Leader;
|
||||
completeFor = EnumPartyExchange.Leader;
|
||||
maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
objectiveRequirement = EnumPartyObjectives.All;
|
||||
}
|
||||
}
|
||||
public NBTTagCompound writeToNBT()
|
||||
@@ -52,6 +62,7 @@ public class PartyOptions implements IPartyOptions {
|
||||
compound.setInteger("RewardControl", rewardControl.ordinal());
|
||||
compound.setInteger("CompleteFor", completeFor.ordinal());
|
||||
compound.setInteger("MaxPartySize", maxPartySize);
|
||||
compound.setInteger("ObjectiveRequirement", objectiveRequirement.ordinal());
|
||||
}
|
||||
else {
|
||||
if(compound.hasKey("PartyRequirements")){
|
||||
@@ -66,23 +77,30 @@ public class PartyOptions implements IPartyOptions {
|
||||
if(compound.hasKey("MaxPartySize")){
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
if(compound.hasKey("ObjectiveRequirement")){
|
||||
compound.removeTag("ObjectiveRequirement");
|
||||
}
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowParty() {
|
||||
return allowParty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllowParty(boolean allowParty) {
|
||||
this.allowParty = allowParty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartyRequirements() {
|
||||
return partyRequirements.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartyRequirements(int partyReq) {
|
||||
if (partyReq < 0 || partyReq >= EnumPartyRequirements.values().length) {
|
||||
return;
|
||||
@@ -90,10 +108,12 @@ public class PartyOptions implements IPartyOptions {
|
||||
this.partyRequirements = EnumPartyRequirements.values()[partyReq];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRewardControl() {
|
||||
return rewardControl.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRewardControl(int rewardCon) {
|
||||
if (rewardCon < 0 || rewardCon >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
@@ -101,10 +121,12 @@ public class PartyOptions implements IPartyOptions {
|
||||
this.rewardControl = EnumPartyExchange.values()[rewardCon];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompleteFor() {
|
||||
return completeFor.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompleteFor(int compFor) {
|
||||
if (compFor < 0 || compFor >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
@@ -112,6 +134,17 @@ public class PartyOptions implements IPartyOptions {
|
||||
this.completeFor = EnumPartyExchange.values()[compFor];
|
||||
}
|
||||
|
||||
public int getObjectiveRequirement() {
|
||||
return objectiveRequirement.ordinal();
|
||||
}
|
||||
|
||||
public void setObjectiveRequirement(int requirement) {
|
||||
if (requirement < 0 || requirement >= EnumPartyObjectives.values().length) {
|
||||
return;
|
||||
}
|
||||
this.objectiveRequirement = EnumPartyObjectives.values()[requirement];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPartySize() {
|
||||
return maxPartySize;
|
||||
|
||||
Reference in new issue
Block a user