Improve incrementation of quest IDs

This commit is contained in:
PikaMug 2023-12-09 19:55:52 -05:00
parent 577f4d13ce
commit 7e42ec5ecb

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)) {
String format = "%0" + padding + "d";
int num = 1;
String customNum = String.format(locale, format, num);
while (questSection.contains(customNum)) {
num++;
} else {
break;
}
customNum = String.format(locale, format, num);
}
newSection = questSection.createSection(customNum);
} else {