mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Fill in ALL durability values when adding multiple items, fixes #58
This commit is contained in:
parent
038c3dc86f
commit
7c752674e1
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<version>2.9.2</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
|
@ -626,11 +626,17 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) == null) {
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
noEntry.add(0);
|
||||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, noEntry);
|
||||
int missing;
|
||||
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) != null) {
|
||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY)).size();
|
||||
} else {
|
||||
missing = one;
|
||||
}
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
for (int i = 0; i < missing; i++) {
|
||||
noEntry.add(0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, noEntry);
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorListNotSameSize"));
|
||||
@ -835,14 +841,17 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) == null) {
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
noEntry.add(0);
|
||||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, noEntry);
|
||||
int missing;
|
||||
if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) != null) {
|
||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY)).size();
|
||||
} else {
|
||||
missing = one;
|
||||
}
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorListNotSameSize"));
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
for (int i = 0; i < missing; i++) {
|
||||
noEntry.add(0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, noEntry);
|
||||
return new DamageBlockListPrompt();
|
||||
}
|
||||
}
|
||||
@ -1044,14 +1053,17 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) == null) {
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
noEntry.add(0);
|
||||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, noEntry);
|
||||
int missing;
|
||||
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) != null) {
|
||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY)).size();
|
||||
} else {
|
||||
missing = one;
|
||||
}
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorListNotSameSize"));
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
for (int i = 0; i < missing; i++) {
|
||||
noEntry.add(0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, noEntry);
|
||||
return new PlaceBlockListPrompt();
|
||||
}
|
||||
}
|
||||
@ -1253,15 +1265,17 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
if (context.getSessionData(pref + CK.S_USE_DURABILITY) == null) {
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
noEntry.add(0);
|
||||
context.setSessionData(pref + CK.S_USE_DURABILITY, noEntry);
|
||||
int missing;
|
||||
if (context.getSessionData(pref + CK.S_USE_DURABILITY) != null) {
|
||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY)).size();
|
||||
} else {
|
||||
missing = one;
|
||||
}
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorListNotSameSize"));
|
||||
return new UseBlockListPrompt();
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
for (int i = 0; i < missing; i++) {
|
||||
noEntry.add(0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_USE_DURABILITY, noEntry);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -1462,14 +1476,17 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
if (context.getSessionData(pref + CK.S_CUT_DURABILITY) == null) {
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
noEntry.add(0);
|
||||
context.setSessionData(pref + CK.S_CUT_DURABILITY, noEntry);
|
||||
int missing;
|
||||
if (context.getSessionData(pref + CK.S_CUT_DURABILITY) != null) {
|
||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY)).size();
|
||||
} else {
|
||||
missing = one;
|
||||
}
|
||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorListNotSameSize"));
|
||||
LinkedList<Integer> noEntry = new LinkedList<Integer>();
|
||||
for (int i = 0; i < missing; i++) {
|
||||
noEntry.add(0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_CUT_DURABILITY, noEntry);
|
||||
return new CutBlockListPrompt();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user