mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-01 07:03:55 +01:00
Process durability as Short rather than Integer, fixes #76
This commit is contained in:
parent
a326308d37
commit
eae9461f7f
@ -1018,19 +1018,19 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
String pref;
|
String pref;
|
||||||
LinkedList<Integer> breakIds;
|
LinkedList<Integer> breakIds;
|
||||||
LinkedList<Integer> breakAmounts;
|
LinkedList<Integer> breakAmounts;
|
||||||
LinkedList<Integer> breakDurability;
|
LinkedList<Short> breakDurability;
|
||||||
LinkedList<Integer> damageIds;
|
LinkedList<Integer> damageIds;
|
||||||
LinkedList<Integer> damageAmounts;
|
LinkedList<Integer> damageAmounts;
|
||||||
LinkedList<Integer> damageDurability;
|
LinkedList<Short> damageDurability;
|
||||||
LinkedList<Integer> placeIds;
|
LinkedList<Integer> placeIds;
|
||||||
LinkedList<Integer> placeAmounts;
|
LinkedList<Integer> placeAmounts;
|
||||||
LinkedList<Integer> placeDurability;
|
LinkedList<Short> placeDurability;
|
||||||
LinkedList<Integer> useIds;
|
LinkedList<Integer> useIds;
|
||||||
LinkedList<Integer> useAmounts;
|
LinkedList<Integer> useAmounts;
|
||||||
LinkedList<Integer> useDurability;
|
LinkedList<Short> useDurability;
|
||||||
LinkedList<Integer> cutIds;
|
LinkedList<Integer> cutIds;
|
||||||
LinkedList<Integer> cutAmounts;
|
LinkedList<Integer> cutAmounts;
|
||||||
LinkedList<Integer> cutDurability;
|
LinkedList<Short> cutDurability;
|
||||||
Integer fish;
|
Integer fish;
|
||||||
Integer players;
|
Integer players;
|
||||||
LinkedList<String> enchantments;
|
LinkedList<String> enchantments;
|
||||||
@ -1132,27 +1132,27 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (cc.getSessionData(pref + CK.S_BREAK_NAMES) != null) {
|
if (cc.getSessionData(pref + CK.S_BREAK_NAMES) != null) {
|
||||||
breakIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_NAMES);
|
breakIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_NAMES);
|
||||||
breakAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_AMOUNTS);
|
breakAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_AMOUNTS);
|
||||||
breakDurability = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_BREAK_DURABILITY);
|
breakDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_BREAK_DURABILITY);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) {
|
if (cc.getSessionData(pref + CK.S_DAMAGE_NAMES) != null) {
|
||||||
damageIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_NAMES);
|
damageIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_NAMES);
|
||||||
damageAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
|
damageAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
|
||||||
damageDurability = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
|
damageDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(pref + CK.S_PLACE_NAMES) != null) {
|
if (cc.getSessionData(pref + CK.S_PLACE_NAMES) != null) {
|
||||||
placeIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_NAMES);
|
placeIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_NAMES);
|
||||||
placeAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_AMOUNTS);
|
placeAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_AMOUNTS);
|
||||||
placeDurability = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_PLACE_DURABILITY);
|
placeDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_PLACE_DURABILITY);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(pref + CK.S_USE_NAMES) != null) {
|
if (cc.getSessionData(pref + CK.S_USE_NAMES) != null) {
|
||||||
useIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_NAMES);
|
useIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_NAMES);
|
||||||
useAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_AMOUNTS);
|
useAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_AMOUNTS);
|
||||||
useDurability = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_USE_DURABILITY);
|
useDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_USE_DURABILITY);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(pref + CK.S_CUT_NAMES) != null) {
|
if (cc.getSessionData(pref + CK.S_CUT_NAMES) != null) {
|
||||||
cutIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_NAMES);
|
cutIds = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_NAMES);
|
||||||
cutAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_AMOUNTS);
|
cutAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_AMOUNTS);
|
||||||
cutDurability = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUT_DURABILITY);
|
cutDurability = (LinkedList<Short>) cc.getSessionData(pref + CK.S_CUT_DURABILITY);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(pref + CK.S_FISH) != null) {
|
if (cc.getSessionData(pref + CK.S_FISH) != null) {
|
||||||
fish = (Integer) cc.getSessionData(pref + CK.S_FISH);
|
fish = (Integer) cc.getSessionData(pref + CK.S_FISH);
|
||||||
|
@ -577,8 +577,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
||||||
for (Integer i : getBlockDurability(context)) {
|
for (Short s : getBlockDurability(context)) {
|
||||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||||
@ -627,16 +627,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
int missing;
|
int missing;
|
||||||
LinkedList<Integer> elements;
|
LinkedList<Short> elements;
|
||||||
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) != null) {
|
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) != null) {
|
||||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY)).size();
|
missing = one - ((List<Short>) context.getSessionData(pref + CK.S_BREAK_DURABILITY)).size();
|
||||||
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
|
elements = (LinkedList<Short>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
|
||||||
} else {
|
} else {
|
||||||
missing = one;
|
missing = one;
|
||||||
elements = new LinkedList<Integer>();
|
elements = new LinkedList<Short>();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < missing; i++) {
|
for (int i = 0; i < missing; i++) {
|
||||||
elements.add(0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_BREAK_DURABILITY, elements);
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
@ -659,8 +659,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Integer> getBlockDurability(ConversationContext context) {
|
private List<Short> getBlockDurability(ConversationContext context) {
|
||||||
return (List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
|
return (List<Short>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,11 +742,11 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
String[] args = input.split(" ");
|
String[] args = input.split(" ");
|
||||||
LinkedList<Integer> durability = new LinkedList<Integer>();
|
LinkedList<Short> durability = new LinkedList<Short>();
|
||||||
for (String s : args) {
|
for (String s : args) {
|
||||||
try {
|
try {
|
||||||
if (Integer.parseInt(s) > 0) {
|
if (Short.parseShort(s) > 0) {
|
||||||
durability.add(Integer.parseInt(s));
|
durability.add(Short.parseShort(s));
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
||||||
return new BreakBlockDurabilityPrompt();
|
return new BreakBlockDurabilityPrompt();
|
||||||
@ -794,8 +794,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
||||||
for (Integer i : getBlockDurability(context)) {
|
for (Short s : getBlockDurability(context)) {
|
||||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||||
@ -844,16 +844,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
int missing;
|
int missing;
|
||||||
LinkedList<Integer> elements;
|
LinkedList<Short> elements;
|
||||||
if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) != null) {
|
if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) != null) {
|
||||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY)).size();
|
missing = one - ((List<Short>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY)).size();
|
||||||
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
|
elements = (LinkedList<Short>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
|
||||||
} else {
|
} else {
|
||||||
missing = one;
|
missing = one;
|
||||||
elements = new LinkedList<Integer>();
|
elements = new LinkedList<Short>();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < missing; i++) {
|
for (int i = 0; i < missing; i++) {
|
||||||
elements.add(0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, elements);
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
@ -876,8 +876,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Integer> getBlockDurability(ConversationContext context) {
|
private List<Short> getBlockDurability(ConversationContext context) {
|
||||||
return (List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
|
return (List<Short>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,11 +959,11 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
String[] args = input.split(" ");
|
String[] args = input.split(" ");
|
||||||
LinkedList<Integer> durability = new LinkedList<Integer>();
|
LinkedList<Short> durability = new LinkedList<Short>();
|
||||||
for (String s : args) {
|
for (String s : args) {
|
||||||
try {
|
try {
|
||||||
if (Integer.parseInt(s) > 0) {
|
if (Short.parseShort(s) > 0) {
|
||||||
durability.add(Integer.parseInt(s));
|
durability.add(Short.parseShort(s));
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
||||||
return new DamageBlockDurabilityPrompt();
|
return new DamageBlockDurabilityPrompt();
|
||||||
@ -1011,8 +1011,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
||||||
for (Integer i : getBlockDurability(context)) {
|
for (Short s : getBlockDurability(context)) {
|
||||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||||
@ -1061,16 +1061,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
int missing;
|
int missing;
|
||||||
LinkedList<Integer> elements;
|
LinkedList<Short> elements;
|
||||||
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) != null) {
|
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) != null) {
|
||||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY)).size();
|
missing = one - ((List<Short>) context.getSessionData(pref + CK.S_PLACE_DURABILITY)).size();
|
||||||
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
|
elements = (LinkedList<Short>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
|
||||||
} else {
|
} else {
|
||||||
missing = one;
|
missing = one;
|
||||||
elements = new LinkedList<Integer>();
|
elements = new LinkedList<Short>();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < missing; i++) {
|
for (int i = 0; i < missing; i++) {
|
||||||
elements.add(0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_PLACE_DURABILITY, elements);
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
@ -1093,8 +1093,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Integer> getBlockDurability(ConversationContext context) {
|
private List<Short> getBlockDurability(ConversationContext context) {
|
||||||
return (List<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
|
return (List<Short>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1176,11 +1176,11 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
String[] args = input.split(" ");
|
String[] args = input.split(" ");
|
||||||
LinkedList<Integer> durability = new LinkedList<Integer>();
|
LinkedList<Short> durability = new LinkedList<Short>();
|
||||||
for (String s : args) {
|
for (String s : args) {
|
||||||
try {
|
try {
|
||||||
if (Integer.parseInt(s) > 0) {
|
if (Short.parseShort(s) > 0) {
|
||||||
durability.add(Integer.parseInt(s));
|
durability.add(Short.parseShort(s));
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
||||||
return new PlaceBlockDurabilityPrompt();
|
return new PlaceBlockDurabilityPrompt();
|
||||||
@ -1228,8 +1228,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
||||||
for (Integer i : getBlockDurability(context)) {
|
for (Short s : getBlockDurability(context)) {
|
||||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||||
@ -1278,16 +1278,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
int missing;
|
int missing;
|
||||||
LinkedList<Integer> elements;
|
LinkedList<Short> elements;
|
||||||
if (context.getSessionData(pref + CK.S_USE_DURABILITY) != null) {
|
if (context.getSessionData(pref + CK.S_USE_DURABILITY) != null) {
|
||||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY)).size();
|
missing = one - ((List<Short>) context.getSessionData(pref + CK.S_USE_DURABILITY)).size();
|
||||||
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY);
|
elements = (LinkedList<Short>) context.getSessionData(pref + CK.S_USE_DURABILITY);
|
||||||
} else {
|
} else {
|
||||||
missing = one;
|
missing = one;
|
||||||
elements = new LinkedList<Integer>();
|
elements = new LinkedList<Short>();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < missing; i++) {
|
for (int i = 0; i < missing; i++) {
|
||||||
elements.add(0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_USE_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_USE_DURABILITY, elements);
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
@ -1310,8 +1310,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Integer> getBlockDurability(ConversationContext context) {
|
private List<Short> getBlockDurability(ConversationContext context) {
|
||||||
return (List<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY);
|
return (List<Short>) context.getSessionData(pref + CK.S_USE_DURABILITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1393,11 +1393,11 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
String[] args = input.split(" ");
|
String[] args = input.split(" ");
|
||||||
LinkedList<Integer> durability = new LinkedList<Integer>();
|
LinkedList<Short> durability = new LinkedList<Short>();
|
||||||
for (String s : args) {
|
for (String s : args) {
|
||||||
try {
|
try {
|
||||||
if (Integer.parseInt(s) > 0) {
|
if (Short.parseShort(s) > 0) {
|
||||||
durability.add(Integer.parseInt(s));
|
durability.add(Short.parseShort(s));
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
||||||
return new UseBlockDurabilityPrompt();
|
return new UseBlockDurabilityPrompt();
|
||||||
@ -1445,8 +1445,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
|
||||||
for (Integer i : getBlockDurability(context)) {
|
for (Short s : getBlockDurability(context)) {
|
||||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
|
||||||
@ -1495,16 +1495,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
int missing;
|
int missing;
|
||||||
LinkedList<Integer> elements;
|
LinkedList<Short> elements;
|
||||||
if (context.getSessionData(pref + CK.S_CUT_DURABILITY) != null) {
|
if (context.getSessionData(pref + CK.S_CUT_DURABILITY) != null) {
|
||||||
missing = one - ((List<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY)).size();
|
missing = one - ((List<Short>) context.getSessionData(pref + CK.S_CUT_DURABILITY)).size();
|
||||||
elements = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
|
elements = (LinkedList<Short>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
|
||||||
} else {
|
} else {
|
||||||
missing = one;
|
missing = one;
|
||||||
elements = new LinkedList<Integer>();
|
elements = new LinkedList<Short>();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < missing; i++) {
|
for (int i = 0; i < missing; i++) {
|
||||||
elements.add(0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_CUT_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_CUT_DURABILITY, elements);
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
@ -1527,8 +1527,8 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Integer> getBlockDurability(ConversationContext context) {
|
private List<Short> getBlockDurability(ConversationContext context) {
|
||||||
return (List<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
|
return (List<Short>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,11 +1610,11 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
String[] args = input.split(" ");
|
String[] args = input.split(" ");
|
||||||
LinkedList<Integer> durability = new LinkedList<Integer>();
|
LinkedList<Short> durability = new LinkedList<Short>();
|
||||||
for (String s : args) {
|
for (String s : args) {
|
||||||
try {
|
try {
|
||||||
if (Integer.parseInt(s) > 0) {
|
if (Short.parseShort(s) > 0) {
|
||||||
durability.add(Integer.parseInt(s));
|
durability.add(Short.parseShort(s));
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
|
||||||
return new CutBlockDurabilityPrompt();
|
return new CutBlockDurabilityPrompt();
|
||||||
|
Loading…
Reference in New Issue
Block a user