Correctly gray-out certain submenu text when not installed

This commit is contained in:
PikaMug 2020-03-29 22:32:45 -04:00
parent 8c62788b05
commit aa6afae89f
2 changed files with 46 additions and 15 deletions

View File

@ -63,6 +63,11 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
public ChatColor getNumberColor(ConversationContext context, int number) { public ChatColor getNumberColor(ConversationContext context, int number) {
switch (number) { switch (number) {
case 1: case 1:
if (plugin.getDependencies().getVaultEconomy() != null) {
return ChatColor.BLUE;
} else {
return ChatColor.GRAY;
}
case 2: case 2:
case 3: case 3:
case 4: case 4:
@ -84,12 +89,6 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
case 9: case 9:
return ChatColor.BLUE; return ChatColor.BLUE;
case 10: case 10:
if (!hasRequirement) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
case 11:
if (context.getSessionData(CK.REQ_FAIL_MESSAGE) == null) { if (context.getSessionData(CK.REQ_FAIL_MESSAGE) == null) {
if (!hasRequirement) { if (!hasRequirement) {
return ChatColor.GRAY; return ChatColor.GRAY;
@ -99,7 +98,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
} else { } else {
return ChatColor.BLUE; return ChatColor.BLUE;
} }
case 12: case 11:
return ChatColor.GREEN; return ChatColor.GREEN;
default: default:
return null; return null;
@ -109,7 +108,11 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
public String getSelectionText(ConversationContext context, int number) { public String getSelectionText(ConversationContext context, int number) {
switch (number) { switch (number) {
case 1: case 1:
return ChatColor.YELLOW + Lang.get("reqSetMoney"); if (plugin.getDependencies().getVaultEconomy() != null) {
return ChatColor.YELLOW + Lang.get("reqSetMoney");
} else {
return ChatColor.GRAY + Lang.get("reqSetMoney");
}
case 2: case 2:
return ChatColor.YELLOW + Lang.get("reqSetQuestPoints"); return ChatColor.YELLOW + Lang.get("reqSetQuestPoints");
case 3: case 3:
@ -121,9 +124,17 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
case 6: case 6:
return ChatColor.YELLOW + Lang.get("reqSetQuestBlocks"); return ChatColor.YELLOW + Lang.get("reqSetQuestBlocks");
case 7: case 7:
return ChatColor.YELLOW + Lang.get("reqSetMcMMO"); if (plugin.getDependencies().getMcmmoClassic() != null) {
return ChatColor.YELLOW + Lang.get("reqSetMcMMO");
} else {
return ChatColor.GRAY + Lang.get("reqSetMcMMO");
}
case 8: case 8:
return ChatColor.YELLOW + Lang.get("reqSetHeroes"); if (plugin.getDependencies().getHeroes() != null) {
return ChatColor.YELLOW + Lang.get("reqSetHeroes");
} else {
return ChatColor.GRAY + Lang.get("reqSetHeroes");
}
case 9: case 9:
return ChatColor.DARK_PURPLE + Lang.get("reqSetCustom"); return ChatColor.DARK_PURPLE + Lang.get("reqSetCustom");
case 10: case 10:
@ -307,7 +318,11 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) { protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
switch (input.intValue()) { switch (input.intValue()) {
case 1: case 1:
return new MoneyPrompt(); if (plugin.getDependencies().getVaultEconomy() != null) {
return new MoneyPrompt();
} else {
return new RequirementsPrompt(context);
}
case 2: case 2:
return new QuestPointsPrompt(); return new QuestPointsPrompt();
case 3: case 3:

View File

@ -114,7 +114,11 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
public String getSelectionText(ConversationContext context, int number) { public String getSelectionText(ConversationContext context, int number) {
switch (number) { switch (number) {
case 1: case 1:
return ChatColor.YELLOW + Lang.get("rewSetMoney"); if (plugin.getDependencies().getVaultEconomy() != null) {
return ChatColor.YELLOW + Lang.get("rewSetMoney");
} else {
return ChatColor.GRAY + Lang.get("rewSetMoney");
}
case 2: case 2:
return ChatColor.YELLOW + Lang.get("rewSetQuestPoints"); return ChatColor.YELLOW + Lang.get("rewSetQuestPoints");
case 3: case 3:
@ -126,11 +130,23 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
case 6: case 6:
return ChatColor.YELLOW + Lang.get("rewSetPermission"); return ChatColor.YELLOW + Lang.get("rewSetPermission");
case 7: case 7:
return ChatColor.YELLOW + Lang.get("rewSetMcMMO"); if (plugin.getDependencies().getMcmmoClassic() != null) {
return ChatColor.YELLOW + Lang.get("rewSetMcMMO");
} else {
return ChatColor.GRAY + Lang.get("rewSetMcMMO");
}
case 8: case 8:
return ChatColor.YELLOW + Lang.get("rewSetHeroes"); if (plugin.getDependencies().getHeroes() != null) {
return ChatColor.YELLOW + Lang.get("rewSetHeroes");
} else {
return ChatColor.GRAY + Lang.get("rewSetHeroes");
}
case 9: case 9:
return ChatColor.YELLOW + Lang.get("rewSetPhat"); if (plugin.getDependencies().getPhatLoots() != null) {
return ChatColor.YELLOW + Lang.get("rewSetPhat");
} else {
return ChatColor.GRAY + Lang.get("rewSetPhat");
}
case 10: case 10:
return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom"); return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom");
case 11: case 11: