Min/Max Party Size, Execute Command for, Lang Updates

This commit is contained in:
Kam committed 2024-03-04 05:15:50 -05:00
1 parent 6e59aa3a27
commit 64d8d00fad
7 files changed
+169 -41

No files matched your search

@@ -9,13 +9,17 @@ import noppes.npcs.constants.EnumPartyRequirements;
public class PartyOptions implements IPartyOptions {
public boolean allowParty = false;
public boolean onlyParty = false;
public EnumPartyRequirements partyRequirements = EnumPartyRequirements.Leader;
public EnumPartyExchange rewardControl = EnumPartyExchange.Leader;
public EnumPartyExchange completeFor = EnumPartyExchange.Leader;
public EnumPartyExchange executeCommand = EnumPartyExchange.Leader;
public EnumPartyObjectives objectiveRequirement = EnumPartyObjectives.Shared;
public int minPartySize = ConfigMain.DefaultMinPartySize;
public int maxPartySize = ConfigMain.DefaultMaxPartySize;
public void readFromNBT(NBTTagCompound compound)
@@ -23,13 +27,19 @@ public class PartyOptions implements IPartyOptions {
// Party Management
allowParty = compound.getBoolean("AllowParty");
if(allowParty){
onlyParty = compound.getBoolean("OnlyParty");
partyRequirements = EnumPartyRequirements.values()[compound.getInteger("PartyRequirements")];
rewardControl = EnumPartyExchange.values()[compound.getInteger("RewardControl")];
completeFor = EnumPartyExchange.values()[compound.getInteger("CompleteFor")];
executeCommand = EnumPartyExchange.values()[compound.getInteger("ExecuteCommand")];
minPartySize = compound.getInteger("MinPartySize");
maxPartySize = compound.getInteger("MaxPartySize");
objectiveRequirement = EnumPartyObjectives.values()[compound.getInteger("ObjectiveRequirement")];
}
else {
if(compound.hasKey("OnlyParty")){
compound.removeTag("OnlyParty");
}
if(compound.hasKey("PartyRequirements")){
compound.removeTag("PartyRequirements");
}
@@ -39,6 +49,12 @@ public class PartyOptions implements IPartyOptions {
if(compound.hasKey("CompleteFor")){
compound.removeTag("CompleteFor");
}
if(compound.hasKey("ExecuteCommand")){
compound.removeTag("ExecuteCommand");
}
if(compound.hasKey("MinPartySize")){
compound.removeTag("MinPartySize");
}
if(compound.hasKey("MaxPartySize")){
compound.removeTag("MaxPartySize");
}
@@ -46,9 +62,12 @@ public class PartyOptions implements IPartyOptions {
compound.removeTag("ObjectiveRequirement");
}
onlyParty = false;
partyRequirements = EnumPartyRequirements.Leader;
rewardControl = EnumPartyExchange.Leader;
completeFor = EnumPartyExchange.Leader;
executeCommand = EnumPartyExchange.Leader;
minPartySize = ConfigMain.DefaultMinPartySize;
maxPartySize = ConfigMain.DefaultMaxPartySize;
objectiveRequirement = EnumPartyObjectives.Shared;
}
@@ -58,13 +77,19 @@ public class PartyOptions implements IPartyOptions {
NBTTagCompound compound = new NBTTagCompound();
compound.setBoolean("AllowParty", allowParty);
if(allowParty){
compound.setBoolean("OnlyParty", onlyParty);
compound.setInteger("PartyRequirements", partyRequirements.ordinal());
compound.setInteger("RewardControl", rewardControl.ordinal());
compound.setInteger("CompleteFor", completeFor.ordinal());
compound.setInteger("ExecuteCommand", executeCommand.ordinal());
compound.setInteger("MinPartySize", minPartySize);
compound.setInteger("MaxPartySize", maxPartySize);
compound.setInteger("ObjectiveRequirement", objectiveRequirement.ordinal());
}
else {
if(compound.hasKey("OnlyParty")){
compound.removeTag("OnlyParty");
}
if(compound.hasKey("PartyRequirements")){
compound.removeTag("PartyRequirements");
}
@@ -74,6 +99,12 @@ public class PartyOptions implements IPartyOptions {
if(compound.hasKey("CompleteFor")){
compound.removeTag("CompleteFor");
}
if(compound.hasKey("ExecuteCommand")){
compound.removeTag("ExecuteCommand");
}
if(compound.hasKey("MinPartySize")){
compound.removeTag("MinPartySize");
}
if(compound.hasKey("MaxPartySize")){
compound.removeTag("MaxPartySize");
}
@@ -95,6 +126,16 @@ public class PartyOptions implements IPartyOptions {
this.allowParty = allowParty;
}
@Override
public boolean isOnlyParty() {
return onlyParty;
}
@Override
public void setOnlyParty(boolean onlyParty) {
this.onlyParty = onlyParty;
}
@Override
public int getPartyRequirements() {
return partyRequirements.ordinal();
@@ -134,10 +175,25 @@ public class PartyOptions implements IPartyOptions {
this.completeFor = EnumPartyExchange.values()[compFor];
}
@Override
public int getExecuteCommandFor() {
return executeCommand.ordinal();
}
@Override
public void setExecuteCommandFor(int commandFor) {
if (commandFor < 0 || commandFor >= EnumPartyExchange.values().length) {
return;
}
this.executeCommand = EnumPartyExchange.values()[commandFor];
}
@Override
public int getObjectiveRequirement() {
return objectiveRequirement.ordinal();
}
@Override
public void setObjectiveRequirement(int requirement) {
if (requirement < 0 || requirement >= EnumPartyObjectives.values().length) {
return;
@@ -145,13 +201,32 @@ public class PartyOptions implements IPartyOptions {
this.objectiveRequirement = EnumPartyObjectives.values()[requirement];
}
@Override
@Override
public int getMinPartySize() {
return minPartySize;
}
@Override
public void setMinPartySize(int newSize) {
if(newSize < 1)
newSize = 1;
if(newSize > maxPartySize)
newSize = maxPartySize;
minPartySize = newSize;
}
@Override
public int getMaxPartySize() {
return maxPartySize;
}
@Override
public void setMaxPartySize(int newSize) {
if(newSize < minPartySize)
newSize = minPartySize;
maxPartySize = newSize;
}
}