mirror of https://github.com/PikaMug/Quests.git
Improve incrementation of quest IDs
This commit is contained in:
parent
577f4d13ce
commit
7e42ec5ecb
|
@ -867,15 +867,14 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||||
ConfigurationSection newSection = null;
|
ConfigurationSection newSection = null;
|
||||||
if (context.getSessionData(Key.Q_ID) == null) {
|
if (context.getSessionData(Key.Q_ID) == null) {
|
||||||
// Creating
|
// Creating
|
||||||
int num = 1;
|
final Locale locale = Locale.US;
|
||||||
final int padding = 6;
|
final int padding = 6;
|
||||||
final String customNum = String.format(Locale.US, "%0" + padding + "d", num);
|
String format = "%0" + padding + "d";
|
||||||
while (true) {
|
int num = 1;
|
||||||
if (questSection.contains(customNum)) {
|
String customNum = String.format(locale, format, num);
|
||||||
num++;
|
while (questSection.contains(customNum)) {
|
||||||
} else {
|
num++;
|
||||||
break;
|
customNum = String.format(locale, format, num);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
newSection = questSection.createSection(customNum);
|
newSection = questSection.createSection(customNum);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue