mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-10 17:41:21 +01:00
Improve code syntax, part 7
This commit is contained in:
parent
8c2b077786
commit
3c8aa5ee4c
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,7 @@ import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@ -46,11 +47,11 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
final int stages = getStages(context);
|
||||
if (number > 0) {
|
||||
if (number < (stages + 1)) {
|
||||
if (number < stages + 1) {
|
||||
return ChatColor.BLUE;
|
||||
} else if (number == (stages + 1)) {
|
||||
} else if (number == stages + 1) {
|
||||
return ChatColor.BLUE;
|
||||
} else if (number == (stages + 2)) {
|
||||
} else if (number == stages + 2) {
|
||||
return ChatColor.GREEN;
|
||||
}
|
||||
}
|
||||
@ -61,11 +62,11 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
final int stages = getStages(context);
|
||||
if (number > 0) {
|
||||
if (number < (stages + 1) && number > 0) {
|
||||
if (number < stages + 1) {
|
||||
return ChatColor.GOLD + Lang.get("stageEditorEditStage") + " " + number;
|
||||
} else if (number == (stages + 1)) {
|
||||
} else if (number == stages + 1) {
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorNewStage");
|
||||
} else if (number == (stages + 2)) {
|
||||
} else if (number == stages + 2) {
|
||||
return ChatColor.YELLOW + Lang.get("done");
|
||||
}
|
||||
}
|
||||
@ -78,20 +79,23 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -";
|
||||
for (int i = 1; i <= (getStages(context) + size); i++) {
|
||||
text += "\n" + getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
+ getSelectionText(context, i);
|
||||
public @NotNull String getPromptText(final @NotNull ConversationContext context) {
|
||||
if (context.getPlugin() != null) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
return text;
|
||||
|
||||
final StringBuilder text = new StringBuilder(ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -");
|
||||
for (int i = 1; i <= (getStages(context) + size); i++) {
|
||||
text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i)
|
||||
.append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i));
|
||||
}
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
protected Prompt acceptValidatedInput(final @NotNull ConversationContext context, final Number input) {
|
||||
final int i = input.intValue();
|
||||
final int stages = getStages(context);
|
||||
if (i > 0) {
|
||||
@ -123,10 +127,7 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
int current = stageNum;
|
||||
String pref = "stage" + current;
|
||||
String newPref;
|
||||
boolean last = false;
|
||||
if (stageNum == stages) {
|
||||
last = true;
|
||||
}
|
||||
boolean last = stageNum == stages;
|
||||
while (true) {
|
||||
if (!last) {
|
||||
current++;
|
||||
|
Loading…
Reference in New Issue
Block a user