Improve incrementation of quest IDs

This commit is contained in:
PikaMug 2023-12-09 19:55:52 -05:00
parent 577f4d13ce
commit 7e42ec5ecb
1 changed files with 7 additions and 8 deletions

View File

@ -867,15 +867,14 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
ConfigurationSection newSection = null;
if (context.getSessionData(Key.Q_ID) == null) {
// Creating
int num = 1;
final Locale locale = Locale.US;
final int padding = 6;
final String customNum = String.format(Locale.US, "%0" + padding + "d", num);
while (true) {
if (questSection.contains(customNum)) {
num++;
} else {
break;
}
String format = "%0" + padding + "d";
int num = 1;
String customNum = String.format(locale, format, num);
while (questSection.contains(customNum)) {
num++;
customNum = String.format(locale, format, num);
}
newSection = questSection.createSection(customNum);
} else {