Support block durability. Bump version number

This commit is contained in:
HappyPikachu 2016-08-06 00:01:42 -04:00
parent ecdfc8be57
commit 1b2bec04ad
13 changed files with 896 additions and 524 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId> <artifactId>quests</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
<name>quests</name> <name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url> <url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@ -3,7 +3,6 @@ package me.blackvein.quests;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -151,11 +150,12 @@ public abstract class CustomObjective implements Listener {
break; break;
} }
} }
if (index > -1) { if (index > -1) {
Material m = null; //TODO remove
if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= quester.getCurrentStage(quest).customObjectiveCounts.get(index)) { if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= quester.getCurrentStage(quest).customObjectiveCounts.get(index)) {
quester.finishObjective(quest, "customObj", m, null, null, null, null, null, null, null, null, obj);
quester.finishObjective(quest, "customObj", null, null, null, null, null, null, null, null, null, obj);
} }
} }
@ -231,4 +231,4 @@ Material m = null; //TODO remove
return false; return false;
} }
} }

View File

@ -241,7 +241,8 @@ public class PlayerListener implements Listener, ColorUtil {
for (Quest quest : quester.currentQuests.keySet()) { for (Quest quest : quester.currentQuests.keySet()) {
if (quester.hasObjective(quest, "useBlock")) { if (quester.hasObjective(quest, "useBlock")) {
quester.useBlock(quest, evt.getClickedBlock().getType()); ItemStack i = new ItemStack(evt.getClickedBlock().getType(), 1, evt.getClickedBlock().getState().getData().toItemStack().getDurability());
quester.useBlock(quest, i);
hasObjective = true; hasObjective = true;
} }
@ -446,8 +447,8 @@ public class PlayerListener implements Listener, ColorUtil {
for (Quest quest : quester.currentQuests.keySet()) { for (Quest quest : quester.currentQuests.keySet()) {
if (quester.hasObjective(quest, "damageBlock")) { if (quester.hasObjective(quest, "damageBlock")) {
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
quester.damageBlock(quest, evt.getBlock().getType()); quester.damageBlock(quest, i);
} }
@ -469,7 +470,8 @@ public class PlayerListener implements Listener, ColorUtil {
if (quester.hasObjective(quest, "placeBlock")) { if (quester.hasObjective(quest, "placeBlock")) {
if (evt.isCancelled() == false) { if (evt.isCancelled() == false) {
quester.placeBlock(quest, evt.getBlock().getType()); ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
quester.placeBlock(quest, i);
} }
} }
@ -499,25 +501,22 @@ public class PlayerListener implements Listener, ColorUtil {
} }
if (quester.hasObjective(quest, "placeBlock")) { if (quester.hasObjective(quest, "placeBlock")) {
if (quester.getQuestData(quest).blocksPlaced.containsKey(evt.getBlock().getType())) { for (ItemStack is : quester.getQuestData(quest).blocksPlaced) {
if (is.getAmount() > 0) {
if (quester.getQuestData(quest).blocksPlaced.get(evt.getBlock().getType()) > 0) {
if (evt.isCancelled() == false) { if (evt.isCancelled() == false) {
quester.getQuestData(quest).blocksPlaced.put(evt.getBlock().getType(), quester.getQuestData(quest).blocksPlaced.get(evt.getBlock().getType()) - 1); int index = quester.getQuestData(quest).blocksPlaced.indexOf(is);
is.setAmount(is.getAmount() - 1);
quester.getQuestData(quest).blocksPlaced.set(index, is);
} }
}
} }
}
} }
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective(quest, "cutBlock")) { if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective(quest, "cutBlock")) {
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
quester.cutBlock(quest, evt.getBlock().getType()); quester.cutBlock(quest, i);
} }
} }

View File

@ -26,20 +26,27 @@ public class QuestData {
doJournalUpdate = b; doJournalUpdate = b;
} }
public Map<Material, Integer> blocksDamaged = new EnumMap<Material, Integer>(Material.class) { public LinkedList<ItemStack> blocksDamaged = new LinkedList<ItemStack>() {
private static final long serialVersionUID = -4211891633163257743L; private static final long serialVersionUID = -4211891633163257743L;
@Override @Override
public Integer put(Material key, Integer val) { public ItemStack set(int index, ItemStack key) {
Integer data = super.put(key, val); ItemStack data = super.set(index, key);
if (doJournalUpdate) quester.updateJournal();
return data;
}
@Override
public boolean add(ItemStack key) {
boolean data = super.add(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return data; return data;
} }
@Override @Override
public Integer remove(Object key) { public boolean remove(Object key) {
Integer i = super.remove(key); boolean i = super.remove(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i; return i;
} }
@ -51,9 +58,10 @@ public class QuestData {
} }
@Override @Override
public void putAll(Map<? extends Material, ? extends Integer> m) { public boolean addAll(Collection<? extends ItemStack> m) {
super.putAll(m); boolean i = super.addAll(m);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i;
} }
}; };
@ -100,20 +108,27 @@ public class QuestData {
}; };
public Map<Material, Integer> blocksPlaced = new EnumMap<Material, Integer>(Material.class) { public LinkedList<ItemStack> blocksPlaced = new LinkedList<ItemStack>() {
private static final long serialVersionUID = 4226366446050903433L; private static final long serialVersionUID = 4226366446050903433L;
@Override @Override
public Integer put(Material key, Integer val) { public ItemStack set(int index, ItemStack key) {
Integer data = super.put(key, val); ItemStack data = super.set(index, key);
if (doJournalUpdate) quester.updateJournal();
return data;
}
@Override
public boolean add(ItemStack key) {
boolean data = super.add(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return data; return data;
} }
@Override @Override
public Integer remove(Object key) { public boolean remove(Object key) {
Integer i = super.remove(key); boolean i = super.remove(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i; return i;
} }
@ -125,28 +140,36 @@ public class QuestData {
} }
@Override @Override
public void putAll(Map<? extends Material, ? extends Integer> m) { public boolean addAll(Collection<? extends ItemStack> m) {
super.putAll(m); boolean i = super.addAll(m);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i;
} }
}; };
public Map<Material, Integer> blocksUsed = new EnumMap<Material, Integer>(Material.class) { public LinkedList<ItemStack> blocksUsed = new LinkedList<ItemStack>() {
private static final long serialVersionUID = -9057864863810306890L; private static final long serialVersionUID = -9057864863810306890L;
@Override @Override
public Integer put(Material key, Integer val) { public ItemStack set(int index, ItemStack key) {
Integer data = super.put(key, val); ItemStack data = super.set(index, key);
if (doJournalUpdate) quester.updateJournal();
return data;
}
@Override
public boolean add(ItemStack key) {
boolean data = super.add(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return data; return data;
} }
@Override @Override
public Integer remove(Object key) { public boolean remove(Object key) {
Integer i = super.remove(key); boolean i = super.remove(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i; return i;
} }
@ -158,28 +181,36 @@ public class QuestData {
} }
@Override @Override
public void putAll(Map<? extends Material, ? extends Integer> m) { public boolean addAll(Collection<? extends ItemStack> m) {
super.putAll(m); boolean i = super.addAll(m);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i;
} }
}; };
public Map<Material, Integer> blocksCut = new EnumMap<Material, Integer>(Material.class) { public LinkedList<ItemStack> blocksCut = new LinkedList<ItemStack>() {
private static final long serialVersionUID = -8204359763290995080L; private static final long serialVersionUID = -8204359763290995080L;
@Override @Override
public Integer put(Material key, Integer val) { public ItemStack set(int index, ItemStack key) {
Integer data = super.put(key, val); ItemStack data = super.set(index, key);
if (doJournalUpdate) quester.updateJournal();
return data;
}
@Override
public boolean add(ItemStack key) {
boolean data = super.add(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return data; return data;
} }
@Override @Override
public Integer remove(Object key) { public boolean remove(Object key) {
Integer i = super.remove(key); boolean i = super.remove(key);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i; return i;
} }
@ -191,9 +222,10 @@ public class QuestData {
} }
@Override @Override
public void putAll(Map<? extends Material, ? extends Integer> m) { public boolean addAll(Collection<? extends ItemStack> m) {
super.putAll(m); boolean i = super.addAll(m);
if (doJournalUpdate) quester.updateJournal(); if (doJournalUpdate) quester.updateJournal();
return i;
} }
}; };

View File

@ -1338,15 +1338,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<Integer> damageIds; LinkedList<Integer> damageIds;
LinkedList<Integer> damageAmounts; LinkedList<Integer> damageAmounts;
LinkedList<Integer> damageDurability;
LinkedList<Integer> placeIds; LinkedList<Integer> placeIds;
LinkedList<Integer> placeAmounts; LinkedList<Integer> placeAmounts;
LinkedList<Integer> placeDurability;
LinkedList<Integer> useIds; LinkedList<Integer> useIds;
LinkedList<Integer> useAmounts; LinkedList<Integer> useAmounts;
LinkedList<Integer> useDurability;
LinkedList<Integer> cutIds; LinkedList<Integer> cutIds;
LinkedList<Integer> cutAmounts; LinkedList<Integer> cutAmounts;
LinkedList<Integer> cutDurability;
Integer fish; Integer fish;
Integer players; Integer players;
@ -1411,15 +1415,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
damageIds = null; damageIds = null;
damageAmounts = null; damageAmounts = null;
damageDurability = null;
placeIds = null; placeIds = null;
placeAmounts = null; placeAmounts = null;
placeDurability = null;
useIds = null; useIds = null;
useAmounts = null; useAmounts = null;
useDurability = null;
cutIds = null; cutIds = null;
cutAmounts = null; cutAmounts = null;
cutDurability = null;
fish = null; fish = null;
players = null; players = null;
@ -1482,21 +1490,25 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
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);
} }
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);
} }
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);
} }
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);
} }
if (cc.getSessionData(pref + CK.S_FISH) != null) { if (cc.getSessionData(pref + CK.S_FISH) != null) {
@ -1616,21 +1628,25 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (damageIds != null && damageIds.isEmpty() == false) { if (damageIds != null && damageIds.isEmpty() == false) {
stage.set("damage-block-names", damageIds); stage.set("damage-block-names", damageIds);
stage.set("damage-block-amounts", damageAmounts); stage.set("damage-block-amounts", damageAmounts);
stage.set("damage-block-durability", damageDurability);
} }
if (placeIds != null && placeIds.isEmpty() == false) { if (placeIds != null && placeIds.isEmpty() == false) {
stage.set("place-block-names", placeIds); stage.set("place-block-names", placeIds);
stage.set("place-block-amounts", placeAmounts); stage.set("place-block-amounts", placeAmounts);
stage.set("place-block-durability", placeDurability);
} }
if (useIds != null && useIds.isEmpty() == false) { if (useIds != null && useIds.isEmpty() == false) {
stage.set("use-block-names", useIds); stage.set("use-block-names", useIds);
stage.set("use-block-amounts", useAmounts); stage.set("use-block-amounts", useAmounts);
stage.set("use-block-durability", useDurability);
} }
if (cutIds != null && cutIds.isEmpty() == false) { if (cutIds != null && cutIds.isEmpty() == false) {
stage.set("cut-block-names", cutIds); stage.set("cut-block-names", cutIds);
stage.set("cut-block-amounts", cutAmounts); stage.set("cut-block-amounts", cutAmounts);
stage.set("cut-block-durability", cutDurability);
} }
stage.set("fish-to-catch", fish); stage.set("fish-to-catch", fish);
@ -1922,16 +1938,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> names = new LinkedList<String>(); LinkedList<String> names = new LinkedList<String>();
LinkedList<Integer> amnts = new LinkedList<Integer>(); LinkedList<Integer> amnts = new LinkedList<Integer>();
LinkedList<Short> durab = new LinkedList<Short>();
for (Entry<Material, Integer> e : stage.blocksToDamage.entrySet()) { for (ItemStack e : stage.blocksToDamage) {
names.add(((Material) e.getKey()).name()); names.add(e.getType().name());
amnts.add((Integer) e.getValue()); amnts.add(e.getAmount());
durab.add(e.getDurability());
} }
cc.setSessionData(pref + CK.S_DAMAGE_NAMES, names); cc.setSessionData(pref + CK.S_DAMAGE_NAMES, names);
cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts); cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts);
cc.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durab);
} }
@ -1939,16 +1958,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> names = new LinkedList<String>(); LinkedList<String> names = new LinkedList<String>();
LinkedList<Integer> amnts = new LinkedList<Integer>(); LinkedList<Integer> amnts = new LinkedList<Integer>();
LinkedList<Short> durab = new LinkedList<Short>();
for (Entry<Material, Integer> e : stage.blocksToPlace.entrySet()) { for (ItemStack e : stage.blocksToPlace) {
names.add(((Material) e.getKey()).name()); names.add(e.getType().name());
amnts.add((Integer) e.getValue()); amnts.add(e.getAmount());
durab.add(e.getDurability());
} }
cc.setSessionData(pref + CK.S_PLACE_NAMES, names); cc.setSessionData(pref + CK.S_PLACE_NAMES, names);
cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts); cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts);
cc.setSessionData(pref + CK.S_PLACE_DURABILITY, durab);
} }
@ -1956,16 +1978,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> names = new LinkedList<String>(); LinkedList<String> names = new LinkedList<String>();
LinkedList<Integer> amnts = new LinkedList<Integer>(); LinkedList<Integer> amnts = new LinkedList<Integer>();
LinkedList<Short> durab = new LinkedList<Short>();
for (Entry<Material, Integer> e : stage.blocksToUse.entrySet()) { for (ItemStack e : stage.blocksToUse) {
names.add(((Material) e.getKey()).name()); names.add(e.getType().name());
amnts.add((Integer) e.getValue()); amnts.add(e.getAmount());
durab.add(e.getDurability());
} }
cc.setSessionData(pref + CK.S_USE_NAMES, names); cc.setSessionData(pref + CK.S_USE_NAMES, names);
cc.setSessionData(pref + CK.S_USE_AMOUNTS, amnts); cc.setSessionData(pref + CK.S_USE_AMOUNTS, amnts);
cc.setSessionData(pref + CK.S_USE_DURABILITY, durab);
} }
@ -1973,16 +1998,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
LinkedList<String> names = new LinkedList<String>(); LinkedList<String> names = new LinkedList<String>();
LinkedList<Integer> amnts = new LinkedList<Integer>(); LinkedList<Integer> amnts = new LinkedList<Integer>();
LinkedList<Short> durab = new LinkedList<Short>();
for (Entry<Material, Integer> e : stage.blocksToCut.entrySet()) { for (ItemStack e : stage.blocksToCut) {
names.add(((Material) e.getKey()).name()); names.add(e.getType().name());
amnts.add((Integer) e.getValue()); amnts.add(e.getAmount());
durab.add(e.getDurability());
} }
cc.setSessionData(pref + CK.S_CUT_NAMES, names); cc.setSessionData(pref + CK.S_CUT_NAMES, names);
cc.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts); cc.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts);
cc.setSessionData(pref + CK.S_CUT_DURABILITY, durab);
} }

File diff suppressed because it is too large Load Diff

View File

@ -3448,22 +3448,25 @@ try{
LinkedList<Material> itemsToEnchant = new LinkedList<Material>(); LinkedList<Material> itemsToEnchant = new LinkedList<Material>();
List<Integer> amountsToEnchant = new LinkedList<Integer>(); List<Integer> amountsToEnchant = new LinkedList<Integer>();
//List<ItemStack> breakBlocks = new LinkedList<ItemStack>();
List<String> breaknames = new LinkedList<String>(); List<String> breaknames = new LinkedList<String>();
List<Integer> breakamounts = new LinkedList<Integer>(); List<Integer> breakamounts = new LinkedList<Integer>();
List<Short> breakdurability = new LinkedList<Short>(); List<Short> breakdurability = new LinkedList<Short>();
List<String> damagenames = new LinkedList<String>(); List<String> damagenames = new LinkedList<String>();
List<Integer> damageamounts = new LinkedList<Integer>(); List<Integer> damageamounts = new LinkedList<Integer>();
List<Short> damagedurability = new LinkedList<Short>();
List<String> placenames = new LinkedList<String>(); List<String> placenames = new LinkedList<String>();
List<Integer> placeamounts = new LinkedList<Integer>(); List<Integer> placeamounts = new LinkedList<Integer>();
List<Short> placedurability = new LinkedList<Short>();
List<String> usenames = new LinkedList<String>(); List<String> usenames = new LinkedList<String>();
List<Integer> useamounts = new LinkedList<Integer>(); List<Integer> useamounts = new LinkedList<Integer>();
List<Short> usedurability = new LinkedList<Short>();
List<String> cutnames = new LinkedList<String>(); List<String> cutnames = new LinkedList<String>();
List<Integer> cutamounts = new LinkedList<Integer>(); List<Integer> cutamounts = new LinkedList<Integer>();
List<Short> cutdurability = new LinkedList<Short>();
//Denizen script load //Denizen script load
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".script-to-run")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".script-to-run")) {
@ -3511,6 +3514,22 @@ try{
} }
} }
for (String s : breaknames) {
ItemStack is;
if (breakdurability.get(breaknames.indexOf(s)) != -1) {
is = new ItemStack(Material.matchMaterial(s), breakamounts.get(breaknames.indexOf(s)), breakdurability.get(breaknames.indexOf(s)));
} else {
//Legacy
is = new ItemStack(Material.matchMaterial(s), breakamounts.get(breaknames.indexOf(s)), (short) 0);
}
if (Material.matchMaterial(s) != null) {
oStage.blocksToBreak.add(is);
} else {
stageFailed("" + s + " inside break-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!");
}
}
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".damage-block-names")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".damage-block-names")) {
@ -3531,18 +3550,36 @@ try{
} else { } else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing damage-block-amounts:"); stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing damage-block-amounts:");
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".damage-block-durability")) {
} if (checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".damage-block-durability"), Integer.class)) {
damagedurability = config.getShortList("quests." + questName + ".stages.ordered." + s2 + ".damage-block-durability");
} else {
stageFailed("damage-block-durability: in Stage " + s2 + " of Quest " + quest.name + " is not a list of numbers!");
}
for (String s : damagenames) {
if (Material.matchMaterial(s) != null) {
oStage.blocksToDamage.put(Material.matchMaterial(s), damageamounts.get(damagenames.indexOf(s)));
} else { } else {
stageFailed("" + s + " inside damage-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!"); stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing damage-block-durability:");
} }
} }
for (String s : damagenames) {
ItemStack is;
if (damagedurability.get(damagenames.indexOf(s)) != -1) {
is = new ItemStack(Material.matchMaterial(s), damageamounts.get(damagenames.indexOf(s)), damagedurability.get(damagenames.indexOf(s)));
} else {
//Legacy
is = new ItemStack(Material.matchMaterial(s), damageamounts.get(damagenames.indexOf(s)), (short) 0);
}
if (Material.matchMaterial(s) != null) {
oStage.blocksToDamage.add(is);
} else {
stageFailed("" + s + " inside damage-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!");
}
}
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".place-block-names")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".place-block-names")) {
@ -3563,17 +3600,35 @@ try{
} else { } else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing place-block-amounts:"); stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing place-block-amounts:");
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".place-block-durability")) {
if (checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".place-block-durability"), Integer.class)) {
placedurability = config.getShortList("quests." + questName + ".stages.ordered." + s2 + ".place-block-durability");
} else {
stageFailed("place-block-durability: in Stage " + s2 + " of Quest " + quest.name + " is not a list of numbers!");
}
} else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing place-block-durability:");
}
} }
for (String s : placenames) { for (String s : placenames) {
ItemStack is;
if (Material.matchMaterial(s) != null) { if (placedurability.get(placenames.indexOf(s)) != -1) {
oStage.blocksToPlace.put(Material.matchMaterial(s), placeamounts.get(placenames.indexOf(s))); is = new ItemStack(Material.matchMaterial(s), placeamounts.get(placenames.indexOf(s)), placedurability.get(placenames.indexOf(s)));
} else { } else {
stageFailed("" + s + " inside place-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!"); //Legacy
} is = new ItemStack(Material.matchMaterial(s), placeamounts.get(placenames.indexOf(s)), (short) 0);
}
if (Material.matchMaterial(s) != null) {
oStage.blocksToPlace.add(is);
} else {
stageFailed("" + s + " inside place-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!");
}
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".use-block-names")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".use-block-names")) {
@ -3595,17 +3650,35 @@ try{
} else { } else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing use-block-amounts:"); stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing use-block-amounts:");
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".use-block-durability")) {
if (checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".use-block-durability"), Integer.class)) {
usedurability = config.getShortList("quests." + questName + ".stages.ordered." + s2 + ".use-block-durability");
} else {
stageFailed("use-block-durability: in Stage " + s2 + " of Quest " + quest.name + " is not a list of numbers!");
}
} else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing use-block-durability:");
}
} }
for (String s : usenames) { for (String s : usenames) {
ItemStack is;
if (Material.matchMaterial(s) != null) { if (usedurability.get(usenames.indexOf(s)) != -1) {
oStage.blocksToUse.put(Material.matchMaterial(s), useamounts.get(usenames.indexOf(s))); is = new ItemStack(Material.matchMaterial(s), useamounts.get(usenames.indexOf(s)), usedurability.get(usenames.indexOf(s)));
} else { } else {
stageFailed("" + RED + s + " inside use-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!"); //Legacy
} is = new ItemStack(Material.matchMaterial(s), useamounts.get(usenames.indexOf(s)), (short) 0);
}
if (Material.matchMaterial(s) != null) {
oStage.blocksToUse.add(is);
} else {
stageFailed("" + s + " inside use-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!");
}
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".cut-block-names")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".cut-block-names")) {
@ -3627,17 +3700,35 @@ try{
} else { } else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing cut-block-amounts:"); stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing cut-block-amounts:");
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".cut-block-durability")) {
if (checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".cut-block-durability"), Integer.class)) {
cutdurability = config.getShortList("quests." + questName + ".stages.ordered." + s2 + ".cut-block-durability");
} else {
stageFailed("cut-block-durability: in Stage " + s2 + " of Quest " + quest.name + " is not a list of numbers!");
}
} else {
stageFailed("Stage " + s2 + " of Quest " + quest.name + " is missing cut-block-durability:");
}
} }
for (String s : cutnames) { for (String s : cutnames) {
ItemStack is;
if (Material.matchMaterial(s) != null) { if (cutdurability.get(cutnames.indexOf(s)) != -1) {
oStage.blocksToCut.put(Material.matchMaterial(s), cutamounts.get(cutnames.indexOf(s))); is = new ItemStack(Material.matchMaterial(s), cutamounts.get(cutnames.indexOf(s)), cutdurability.get(cutnames.indexOf(s)));
} else { } else {
stageFailed("" + s + " inside cut-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!"); //Legacy
} is = new ItemStack(Material.matchMaterial(s), cutamounts.get(cutnames.indexOf(s)), (short) 0);
}
if (Material.matchMaterial(s) != null) {
oStage.blocksToCut.add(is);
} else {
stageFailed("" + s + " inside cut-block-names: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid item name!");
}
} }
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".fish-to-catch")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".fish-to-catch")) {
@ -4004,22 +4095,6 @@ try{
oStage.itemsToEnchant = enchants; oStage.itemsToEnchant = enchants;
for (String s : breaknames) {
ItemStack is;
if (breakdurability.get(breaknames.indexOf(s)) != -1) {
is = new ItemStack(Material.matchMaterial(s), breakamounts.get(breaknames.indexOf(s)), breakdurability.get(breaknames.indexOf(s)));
} else {
//Legacy
is = new ItemStack(Material.matchMaterial(s), breakamounts.get(breaknames.indexOf(s)), (short) 0);
}
oStage.blocksToBreak.add(is);
}
if (index < questStages.getKeys(false).size()) {
index++;
}
if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".locations-to-reach")) { if (config.contains("quests." + questName + ".stages.ordered." + s2 + ".locations-to-reach")) {
if (Quests.checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".locations-to-reach"), String.class)) { if (Quests.checkList(config.getList("quests." + questName + ".stages.ordered." + s2 + ".locations-to-reach"), String.class)) {

View File

@ -15,12 +15,11 @@ import org.bukkit.inventory.ItemStack;
public class Stage { public class Stage {
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class); LinkedList<ItemStack> blocksToDamage = new LinkedList<ItemStack>();
LinkedList<ItemStack> blocksToBreak = new LinkedList<ItemStack>(); LinkedList<ItemStack> blocksToBreak = new LinkedList<ItemStack>();
//Map<Material, Integer> blocksToBreak = new EnumMap<Material, Integer>(Material.class); LinkedList<ItemStack> blocksToPlace = new LinkedList<ItemStack>();
Map<Material, Integer> blocksToPlace = new EnumMap<Material, Integer>(Material.class); LinkedList<ItemStack> blocksToUse = new LinkedList<ItemStack>();
Map<Material, Integer> blocksToUse = new EnumMap<Material, Integer>(Material.class); LinkedList<ItemStack> blocksToCut = new LinkedList<ItemStack>();
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
Integer fishToCatch; Integer fishToCatch;
Integer playersToKill; Integer playersToKill;
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>(); Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();

View File

@ -61,9 +61,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
String text = PINK + "- " + AQUA + (String) context.getSessionData(CK.Q_NAME) + PINK + " | " + Lang.get("stageEditorStage") + " " + PURPLE + stageNum + PINK + " -\n"; String text = PINK + "- " + AQUA + (String) context.getSessionData(CK.Q_NAME) + PINK + " | " + Lang.get("stageEditorStage") + " " + PURPLE + stageNum + PINK + " -\n";
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) { if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) {
text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + Lang.get("stageEditorBreakBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n"; text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + Lang.get("stageEditorBreakBlocks") + "\n"; text += PINK + "" + BOLD + "1 " + RESET + PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + "\n";
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_BREAK_NAMES); LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_BREAK_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_AMOUNTS); LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_AMOUNTS);
@ -379,7 +379,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, String input) { protected Prompt acceptValidatedInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1")) { if (input.equalsIgnoreCase("1")) {
return new BreakBlockListPrompt(); return new PlaceBlockListPrompt();
} else if (input.equalsIgnoreCase("2")) { } else if (input.equalsIgnoreCase("2")) {
return new DamageBlockListPrompt(); return new DamageBlockListPrompt();
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
@ -706,7 +706,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) { if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += GRAY + "2 - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noNamesSet") + ")\n";
text += GRAY + "3 - " + Lang.get("stageEditorSetBlockData") + " (" + Lang.get("noNamesSet") + ")\n"; text += GRAY + "3 - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} else { } else {
@ -732,11 +732,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) == null) { if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) == null) {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockData") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockData") + "\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
for (Integer i : getBlockData(context)) { for (Integer i : getBlockDurability(context)) {
text += GRAY + " - " + AQUA + i + "\n"; text += GRAY + " - " + AQUA + i + "\n";
@ -771,7 +771,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames")); context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames"));
return new BreakBlockListPrompt(); return new BreakBlockListPrompt();
} else { } else {
return new BreakBlockDataPrompt(); return new BreakBlockDurabilityPrompt();
} }
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("4")) {
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorBreakBlocksCleared")); context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorBreakBlocksCleared"));
@ -818,7 +818,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private List<Integer> getBlockData(ConversationContext context) { private List<Integer> getBlockDurability(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY); return (List<Integer>) context.getSessionData(pref + CK.S_BREAK_DURABILITY);
} }
} }
@ -912,7 +912,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class BreakBlockDataPrompt extends StringPrompt { private class BreakBlockDurabilityPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
@ -957,7 +957,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
public DamageBlockListPrompt() { public DamageBlockListPrompt() {
super("1", "2", "3", "4"); super("1", "2", "3", "4", "5");
} }
@ -968,8 +968,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) { if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += GRAY + "2 - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += GRAY + "3 - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} else { } else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
@ -992,8 +993,21 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) == null) {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
for (Integer i : getBlockDurability(context)) {
text += GRAY + " - " + AQUA + i + "\n";
}
}
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} }
@ -1015,11 +1029,19 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
return new DamageBlockAmountsPrompt(); return new DamageBlockAmountsPrompt();
} }
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) {
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames"));
return new DamageBlockListPrompt();
} else {
return new DamageBlockDurabilityPrompt();
}
} else if (input.equalsIgnoreCase("4")) {
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorDamageBlocksCleared")); context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorDamageBlocksCleared"));
context.setSessionData(pref + CK.S_DAMAGE_NAMES, null); context.setSessionData(pref + CK.S_DAMAGE_NAMES, null);
context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null); context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null);
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, null);
return new DamageBlockListPrompt(); return new DamageBlockListPrompt();
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("5")) {
int one; int one;
int two; int two;
@ -1056,6 +1078,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
private List<Integer> getBlockAmounts(ConversationContext context) { private List<Integer> getBlockAmounts(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS); return (List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
} }
@SuppressWarnings("unchecked")
private List<Integer> getBlockDurability(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_DAMAGE_DURABILITY);
}
} }
private class DamageBlockNamesPrompt extends StringPrompt { private class DamageBlockNamesPrompt extends StringPrompt {
@ -1146,12 +1173,53 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class DamageBlockDurabilityPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("stageEditorDamageBlocksPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<Integer> durability = new LinkedList<Integer>();
for (String s : args) {
try {
if (Integer.parseInt(s) > 0) {
durability.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
return new DamageBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockAmountsPrompt();
}
}
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durability);
}
return new DamageBlockListPrompt();
}
}
private class PlaceBlockListPrompt extends FixedSetPrompt { private class PlaceBlockListPrompt extends FixedSetPrompt {
public PlaceBlockListPrompt() { public PlaceBlockListPrompt() {
super("1", "2", "3", "4"); super("1", "2", "3", "4", "5");
} }
@ -1162,8 +1230,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) { if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += GRAY + "2 - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += GRAY + "3 - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} else { } else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
@ -1185,9 +1254,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) == null) {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); for (Integer i : getBlockDurability(context)) {
text += GRAY + " - " + AQUA + i + "\n";
}
}
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} }
@ -1209,11 +1291,19 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
return new PlaceBlockAmountsPrompt(); return new PlaceBlockAmountsPrompt();
} }
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) {
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames"));
return new PlaceBlockListPrompt();
} else {
return new PlaceBlockDurabilityPrompt();
}
} else if (input.equalsIgnoreCase("4")) {
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorPlaceBlocksCleared")); context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorPlaceBlocksCleared"));
context.setSessionData(pref + CK.S_PLACE_NAMES, null); context.setSessionData(pref + CK.S_PLACE_NAMES, null);
context.setSessionData(pref + CK.S_PLACE_AMOUNTS, null); context.setSessionData(pref + CK.S_PLACE_AMOUNTS, null);
context.setSessionData(pref + CK.S_PLACE_DURABILITY, null);
return new PlaceBlockListPrompt(); return new PlaceBlockListPrompt();
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("5")) {
int one; int one;
int two; int two;
@ -1250,6 +1340,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
private List<Integer> getBlockAmounts(ConversationContext context) { private List<Integer> getBlockAmounts(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_PLACE_AMOUNTS); return (List<Integer>) context.getSessionData(pref + CK.S_PLACE_AMOUNTS);
} }
@SuppressWarnings("unchecked")
private List<Integer> getBlockDurability(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_PLACE_DURABILITY);
}
} }
private class PlaceBlockNamesPrompt extends StringPrompt { private class PlaceBlockNamesPrompt extends StringPrompt {
@ -1340,12 +1435,53 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class PlaceBlockDurabilityPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("stageEditorPlaceBlocksPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<Integer> durability = new LinkedList<Integer>();
for (String s : args) {
try {
if (Integer.parseInt(s) > 0) {
durability.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
return new PlaceBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockAmountsPrompt();
}
}
context.setSessionData(pref + CK.S_PLACE_DURABILITY, durability);
}
return new PlaceBlockListPrompt();
}
}
private class UseBlockListPrompt extends FixedSetPrompt { private class UseBlockListPrompt extends FixedSetPrompt {
public UseBlockListPrompt() { public UseBlockListPrompt() {
super("1", "2", "3", "4"); super("1", "2", "3", "4", "5");
} }
@ -1356,8 +1492,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(pref + CK.S_USE_NAMES) == null) { if (context.getSessionData(pref + CK.S_USE_NAMES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += GRAY + "2 - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += GRAY + "3 - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} else { } else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
@ -1379,9 +1516,22 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
if (context.getSessionData(pref + CK.S_USE_DURABILITY) == null) {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); for (Integer i : getBlockDurability(context)) {
text += GRAY + " - " + AQUA + i + "\n";
}
}
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} }
@ -1403,11 +1553,19 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
return new UseBlockAmountsPrompt(); return new UseBlockAmountsPrompt();
} }
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
if (context.getSessionData(pref + CK.S_USE_NAMES) == null) {
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames"));
return new UseBlockListPrompt();
} else {
return new UseBlockDurabilityPrompt();
}
} else if (input.equalsIgnoreCase("4")) {
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorUseBlocksCleared")); context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorUseBlocksCleared"));
context.setSessionData(pref + CK.S_USE_NAMES, null); context.setSessionData(pref + CK.S_USE_NAMES, null);
context.setSessionData(pref + CK.S_USE_AMOUNTS, null); context.setSessionData(pref + CK.S_USE_AMOUNTS, null);
context.setSessionData(pref + CK.S_USE_DURABILITY, null);
return new UseBlockListPrompt(); return new UseBlockListPrompt();
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("5")) {
int one; int one;
int two; int two;
@ -1444,6 +1602,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
private List<Integer> getBlockAmounts(ConversationContext context) { private List<Integer> getBlockAmounts(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS); return (List<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS);
} }
@SuppressWarnings("unchecked")
private List<Integer> getBlockDurability(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_USE_DURABILITY);
}
} }
private class UseBlockNamesPrompt extends StringPrompt { private class UseBlockNamesPrompt extends StringPrompt {
@ -1534,12 +1697,53 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class UseBlockDurabilityPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("stageEditorUseBlocksPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<Integer> durability = new LinkedList<Integer>();
for (String s : args) {
try {
if (Integer.parseInt(s) > 0) {
durability.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
return new UseBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers"));
return new UseBlockAmountsPrompt();
}
}
context.setSessionData(pref + CK.S_USE_DURABILITY, durability);
}
return new UseBlockListPrompt();
}
}
private class CutBlockListPrompt extends FixedSetPrompt { private class CutBlockListPrompt extends FixedSetPrompt {
public CutBlockListPrompt() { public CutBlockListPrompt() {
super("1", "2", "3", "4"); super("1", "2", "3", "4", "5");
} }
@ -1550,8 +1754,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) { if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noNamesSet") + ")\n"; text += GRAY + "2 - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; text += GRAY + "3 - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noNamesSet") + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} else { } else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n"; text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
@ -1574,8 +1779,21 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n"; if (context.getSessionData(pref + CK.S_CUT_DURABILITY) == null) {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done"); text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockDurability") + "\n";
for (Integer i : getBlockDurability(context)) {
text += GRAY + " - " + AQUA + i + "\n";
}
}
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} }
@ -1597,11 +1815,19 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
return new CutBlockAmountsPrompt(); return new CutBlockAmountsPrompt();
} }
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoBlockNames"));
return new CutBlockListPrompt();
} else {
return new CutBlockDurabilityPrompt();
}
} else if (input.equalsIgnoreCase("4")) {
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorCutBlocksCleared")); context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorCutBlocksCleared"));
context.setSessionData(pref + CK.S_CUT_NAMES, null); context.setSessionData(pref + CK.S_CUT_NAMES, null);
context.setSessionData(pref + CK.S_CUT_AMOUNTS, null); context.setSessionData(pref + CK.S_CUT_AMOUNTS, null);
context.setSessionData(pref + CK.S_CUT_DURABILITY, null);
return new CutBlockListPrompt(); return new CutBlockListPrompt();
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("5")) {
int one; int one;
int two; int two;
@ -1638,6 +1864,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
private List<Integer> getBlockAmounts(ConversationContext context) { private List<Integer> getBlockAmounts(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_CUT_AMOUNTS); return (List<Integer>) context.getSessionData(pref + CK.S_CUT_AMOUNTS);
} }
@SuppressWarnings("unchecked")
private List<Integer> getBlockDurability(ConversationContext context) {
return (List<Integer>) context.getSessionData(pref + CK.S_CUT_DURABILITY);
}
} }
private class CutBlockNamesPrompt extends StringPrompt { private class CutBlockNamesPrompt extends StringPrompt {
@ -1728,6 +1959,47 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} }
} }
private class CutBlockDurabilityPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("stageEditorCutBlocksPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<Integer> durability = new LinkedList<Integer>();
for (String s : args) {
try {
if (Integer.parseInt(s) > 0) {
durability.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " " + Lang.get("stageEditortNotGreaterThanZero"));
return new CutBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(PINK + s + RED + Lang.get("stageEditorNotListofNumbers"));
return new CutBlockAmountsPrompt();
}
}
context.setSessionData(pref + CK.S_CUT_DURABILITY, durability);
}
return new CutBlockListPrompt();
}
}
private class FishPrompt extends NumericPrompt { private class FishPrompt extends NumericPrompt {

View File

@ -56,7 +56,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil {
menu += GOLD + "" + BOLD + "0. " + RESET + "" + YELLOW + Lang.get("itemCreateLoadHand") + "\n"; menu += GOLD + "" + BOLD + "0. " + RESET + "" + YELLOW + Lang.get("itemCreateLoadHand") + "\n";
menu += YELLOW + "" + BOLD + "1. " + RESET + "" + GOLD + Lang.get("itemCreateSetName") + "\n"; menu += YELLOW + "" + BOLD + "1. " + RESET + "" + GOLD + Lang.get("itemCreateSetName") + "\n";
menu += YELLOW + "" + BOLD + "2. " + RESET + "" + GOLD + Lang.get("itemCreateSetAmount") + "\n"; menu += YELLOW + "" + BOLD + "2. " + RESET + "" + GOLD + Lang.get("itemCreateSetAmount") + "\n";
menu += YELLOW + "" + BOLD + "3. " + RESET + "" + GOLD + Lang.get("itemCreateSetData") + "\n"; menu += YELLOW + "" + BOLD + "3. " + RESET + "" + GOLD + Lang.get("itemCreateSetDurab") + "\n";
menu += YELLOW + "" + BOLD + "4. " + RESET + "" + GOLD + Lang.get("itemCreateSetEnchs") + "\n"; menu += YELLOW + "" + BOLD + "4. " + RESET + "" + GOLD + Lang.get("itemCreateSetEnchs") + "\n";
menu += YELLOW + "" + BOLD + "5. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetDisplay") + "\n"; menu += YELLOW + "" + BOLD + "5. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetDisplay") + "\n";
menu += YELLOW + "" + BOLD + "6. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetLore") + "\n"; menu += YELLOW + "" + BOLD + "6. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetLore") + "\n";
@ -324,7 +324,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil {
@Override @Override
public String getPromptText(ConversationContext cc) { public String getPromptText(ConversationContext cc) {
return YELLOW + Lang.get("itemCreateEnterData"); return YELLOW + Lang.get("itemCreateEnterDurab");
} }
@Override @Override
@ -335,7 +335,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil {
int amt = Integer.parseInt(input); int amt = Integer.parseInt(input);
if (amt < 1) { if (amt < 1) {
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidData")); cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidDurab"));
return new DataPrompt(); return new DataPrompt();
} else { } else {
cc.setSessionData("tempData", Short.parseShort(input)); cc.setSessionData("tempData", Short.parseShort(input));

View File

@ -118,15 +118,19 @@ public class StagesPrompt extends StringPrompt implements ColorUtil {
cc.setSessionData(newPref + CK.S_DAMAGE_NAMES, cc.getSessionData(pref + CK.S_DAMAGE_NAMES)); cc.setSessionData(newPref + CK.S_DAMAGE_NAMES, cc.getSessionData(pref + CK.S_DAMAGE_NAMES));
cc.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS)); cc.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS));
cc.setSessionData(newPref + CK.S_DAMAGE_DURABILITY, cc.getSessionData(pref + CK.S_DAMAGE_DURABILITY));
cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_NAMES)); cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_NAMES));
cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_AMOUNTS)); cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_AMOUNTS));
cc.setSessionData(newPref + CK.S_PLACE_DURABILITY, cc.getSessionData(pref + CK.S_PLACE_DURABILITY));
cc.setSessionData(newPref + CK.S_USE_NAMES, cc.getSessionData(pref + CK.S_USE_NAMES)); cc.setSessionData(newPref + CK.S_USE_NAMES, cc.getSessionData(pref + CK.S_USE_NAMES));
cc.setSessionData(newPref + CK.S_USE_AMOUNTS, cc.getSessionData(pref + CK.S_USE_AMOUNTS)); cc.setSessionData(newPref + CK.S_USE_AMOUNTS, cc.getSessionData(pref + CK.S_USE_AMOUNTS));
cc.setSessionData(newPref + CK.S_USE_DURABILITY, cc.getSessionData(pref + CK.S_USE_DURABILITY));
cc.setSessionData(newPref + CK.S_CUT_NAMES, cc.getSessionData(pref + CK.S_CUT_NAMES)); cc.setSessionData(newPref + CK.S_CUT_NAMES, cc.getSessionData(pref + CK.S_CUT_NAMES));
cc.setSessionData(newPref + CK.S_CUT_AMOUNTS, cc.getSessionData(pref + CK.S_CUT_AMOUNTS)); cc.setSessionData(newPref + CK.S_CUT_AMOUNTS, cc.getSessionData(pref + CK.S_CUT_AMOUNTS));
cc.setSessionData(newPref + CK.S_CUT_DURABILITY, cc.getSessionData(pref + CK.S_CUT_DURABILITY));
cc.setSessionData(newPref + CK.S_FISH, cc.getSessionData(pref + CK.S_FISH)); cc.setSessionData(newPref + CK.S_FISH, cc.getSessionData(pref + CK.S_FISH));
@ -195,15 +199,19 @@ public class StagesPrompt extends StringPrompt implements ColorUtil {
cc.setSessionData(pref + CK.S_DAMAGE_NAMES, null); cc.setSessionData(pref + CK.S_DAMAGE_NAMES, null);
cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null); cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null);
cc.setSessionData(pref + CK.S_DAMAGE_DURABILITY, null);
cc.setSessionData(pref + CK.S_PLACE_NAMES, null); cc.setSessionData(pref + CK.S_PLACE_NAMES, null);
cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, null); cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, null);
cc.setSessionData(pref + CK.S_PLACE_DURABILITY, null);
cc.setSessionData(pref + CK.S_USE_NAMES, null); cc.setSessionData(pref + CK.S_USE_NAMES, null);
cc.setSessionData(pref + CK.S_USE_AMOUNTS, null); cc.setSessionData(pref + CK.S_USE_AMOUNTS, null);
cc.setSessionData(pref + CK.S_USE_DURABILITY, null);
cc.setSessionData(pref + CK.S_CUT_NAMES, null); cc.setSessionData(pref + CK.S_CUT_NAMES, null);
cc.setSessionData(pref + CK.S_CUT_AMOUNTS, null); cc.setSessionData(pref + CK.S_CUT_AMOUNTS, null);
cc.setSessionData(pref + CK.S_CUT_DURABILITY, null);
cc.setSessionData(pref + CK.S_FISH, null); cc.setSessionData(pref + CK.S_FISH, null);

View File

@ -57,12 +57,16 @@ public class CK {
public static final String S_BREAK_DURABILITY = "breakDurability"; public static final String S_BREAK_DURABILITY = "breakDurability";
public static final String S_DAMAGE_NAMES = "damageNames"; public static final String S_DAMAGE_NAMES = "damageNames";
public static final String S_DAMAGE_AMOUNTS = "damageAmounts"; public static final String S_DAMAGE_AMOUNTS = "damageAmounts";
public static final String S_DAMAGE_DURABILITY = "damageDurability";
public static final String S_PLACE_NAMES = "placeNames"; public static final String S_PLACE_NAMES = "placeNames";
public static final String S_PLACE_AMOUNTS = "placeAmounts"; public static final String S_PLACE_AMOUNTS = "placeAmounts";
public static final String S_PLACE_DURABILITY = "placeDurability";
public static final String S_USE_NAMES = "useNames"; public static final String S_USE_NAMES = "useNames";
public static final String S_USE_AMOUNTS = "useAmounts"; public static final String S_USE_AMOUNTS = "useAmounts";
public static final String S_USE_DURABILITY = "useDurability";
public static final String S_CUT_NAMES = "cutNames"; public static final String S_CUT_NAMES = "cutNames";
public static final String S_CUT_AMOUNTS = "cutAmounts"; public static final String S_CUT_AMOUNTS = "cutAmounts";
public static final String S_CUT_DURABILITY = "cutDurability";
public static final String S_FISH = "fish"; public static final String S_FISH = "fish";
public static final String S_PLAYER_KILL = "playerKill"; public static final String S_PLAYER_KILL = "playerKill";
public static final String S_ENCHANT_TYPES = "enchantTypes"; public static final String S_ENCHANT_TYPES = "enchantTypes";

View File

@ -298,7 +298,7 @@ public class Lang {
langMap.put("stageEditorSetBlockNames", "Set block names"); langMap.put("stageEditorSetBlockNames", "Set block names");
langMap.put("stageEditorSetBlockAmounts", "Set block amounts"); langMap.put("stageEditorSetBlockAmounts", "Set block amounts");
langMap.put("stageEditorSetBlockData", "Set block data"); langMap.put("stageEditorSetBlockDurability", "Set block durability");
langMap.put("stageEditorSetDamageAmounts", "Set damage amounts"); langMap.put("stageEditorSetDamageAmounts", "Set damage amounts");
langMap.put("stageEditorSetPlaceAmounts", "Set place amounts"); langMap.put("stageEditorSetPlaceAmounts", "Set place amounts");
langMap.put("stageEditorSetUseAmounts", "Set use amounts"); langMap.put("stageEditorSetUseAmounts", "Set use amounts");
@ -732,14 +732,14 @@ public class Lang {
langMap.put("itemCreateLoadHand", "Load item in hand"); langMap.put("itemCreateLoadHand", "Load item in hand");
langMap.put("itemCreateSetName", "Set name"); langMap.put("itemCreateSetName", "Set name");
langMap.put("itemCreateSetAmount", "Set amount"); langMap.put("itemCreateSetAmount", "Set amount");
langMap.put("itemCreateSetData", "Set data"); langMap.put("itemCreateSetDurab", "Set durability");
langMap.put("itemCreateSetEnchs", "Add/clear enchantments"); langMap.put("itemCreateSetEnchs", "Add/clear enchantments");
langMap.put("itemCreateSetDisplay", "Set display name"); langMap.put("itemCreateSetDisplay", "Set display name");
langMap.put("itemCreateSetLore", "Set lore"); langMap.put("itemCreateSetLore", "Set lore");
langMap.put("itemCreateEnterName", "Enter an item name, or 'cancel' to return."); langMap.put("itemCreateEnterName", "Enter an item name, or 'cancel' to return.");
langMap.put("itemCreateEnterAmount", "Enter item amount (max. 64), or 'cancel' to return."); langMap.put("itemCreateEnterAmount", "Enter item amount (max. 64), or 'cancel' to return.");
langMap.put("itemCreateEnterData", "Enter item data, or 'clear' to clear the data, or 'cancel' to return."); langMap.put("itemCreateEnterDurab", "Enter item durability, or 'clear' to clear the data, or 'cancel' to return.");
langMap.put("itemCreateEnterEnch", "Enter an enchantment name, or 'clear' to clear the enchantments, or 'cancel' to return."); langMap.put("itemCreateEnterEnch", "Enter an enchantment name, or 'clear' to clear the enchantments, or 'cancel' to return.");
langMap.put("itemCreateEnterLevel", "Enter a level (number) for <enchantment>"); langMap.put("itemCreateEnterLevel", "Enter a level (number) for <enchantment>");
langMap.put("itemCreateEnterDisplay", "Enter item display name, or 'clear' to clear the display name, or 'cancel' to return."); langMap.put("itemCreateEnterDisplay", "Enter item display name, or 'clear' to clear the display name, or 'cancel' to return.");
@ -750,7 +750,7 @@ public class Lang {
langMap.put("itemCreateNoName", "You must set a name first!"); langMap.put("itemCreateNoName", "You must set a name first!");
langMap.put("itemCreateInvalidName", "Invalid item name!"); langMap.put("itemCreateInvalidName", "Invalid item name!");
langMap.put("itemCreateInvalidAmount", "Amount must be between 1-64!"); langMap.put("itemCreateInvalidAmount", "Amount must be between 1-64!");
langMap.put("itemCreateInvalidData", "Invalid item data!"); langMap.put("itemCreateInvalidDurab", "Invalid item durability!");
langMap.put("itemCreateInvalidEnch", "Invalid enchantment name!"); langMap.put("itemCreateInvalidEnch", "Invalid enchantment name!");
langMap.put("itemCreateInvalidLevel", "Level must be greater than 0!"); langMap.put("itemCreateInvalidLevel", "Level must be greater than 0!");
langMap.put("itemCreateInvalidInput", "Invalid input!"); langMap.put("itemCreateInvalidInput", "Invalid input!");