Enforce maximum line width of 120, part 3

This commit is contained in:
PikaMug 2019-10-14 16:45:34 -04:00
parent 6e5d130322
commit 4d183edaea
35 changed files with 2257 additions and 1052 deletions

View File

@ -317,7 +317,8 @@ public class Action {
}
if (commands.isEmpty() == false) {
for (String s : commands) {
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s.replaceAll("<player>", quester.getPlayer().getName()));
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
s.replaceAll("<player>", quester.getPlayer().getName()));
}
}
if (potionEffects.isEmpty() == false) {
@ -341,7 +342,8 @@ public class Action {
if (!book.isEmpty()) {
if (plugin.getDependencies().getCitizensBooksApi() != null) {
if (plugin.getDependencies().getCitizensBooksApi().hasFilter(book)) {
plugin.getDependencies().getCitizensBooksApi().openBook(player, plugin.getDependencies().getCitizensBooksApi().getFilter(book));
plugin.getDependencies().getCitizensBooksApi().openBook(player, plugin.getDependencies()
.getCitizensBooksApi().getFilter(book));
}
}
}
@ -431,7 +433,9 @@ public class Action {
if (data.isBoolean(actionKey + "clear-inventory")) {
action.clearInv = data.getBoolean(actionKey + "clear-inventory");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "clear-inventory: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a true/false value!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "clear-inventory: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a true/false value!");
return null;
}
}
@ -439,7 +443,9 @@ public class Action {
if (data.isBoolean(actionKey + "fail-quest")) {
action.failQuest = data.getBoolean(actionKey + "fail-quest");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "fail-quest: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a true/false value!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "fail-quest: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a true/false value!");
return null;
}
}
@ -448,14 +454,19 @@ public class Action {
for (String s : data.getStringList(actionKey + "explosions")) {
Location loc = Quests.getLocation(s);
if (loc == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + loc + ChatColor.GOLD + " inside " + ChatColor.GREEN + "explosions: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + loc + ChatColor.GOLD
+ " inside " + ChatColor.GREEN + "explosions: " + ChatColor.GOLD + "inside Action "
+ ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD
+ "[Quests] Proper location format is: \"WorldName x y z\"");
return null;
}
action.explosions.add(loc);
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "explosions: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of locations!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "explosions: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of locations!");
return null;
}
}
@ -469,26 +480,39 @@ public class Action {
Effect effect = Effect.valueOf(s.toUpperCase());
Location l = Quests.getLocation(effectLocs.get(effectList.indexOf(s)));
if (effect == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + "effects: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid effect name!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s
+ ChatColor.GOLD + " inside " + ChatColor.GREEN + "effects: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a valid effect name!");
return null;
}
if (l == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + effectLocs.get(effectList.indexOf(s)) + ChatColor.GOLD + " inside " + ChatColor.GREEN + "effect-locations: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED
+ effectLocs.get(effectList.indexOf(s)) + ChatColor.GOLD + " inside "
+ ChatColor.GREEN + "effect-locations: " + ChatColor.GOLD + "inside Action "
+ ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD
+ "[Quests] Proper location format is: \"WorldName x y z\"");
return null;
}
action.effects.put(l, effect);
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "effect-locations: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of locations!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "effect-locations: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of locations!");
return null;
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "effect-locations:");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is missing " + ChatColor.RED + "effect-locations:");
return null;
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "effects: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of effects!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "effects: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of effects!");
return null;
}
}
@ -513,12 +537,17 @@ public class Action {
temp.add(stack);
}
} catch (Exception e) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] \"" + ChatColor.RED + item + ChatColor.GOLD + "\" inside " + ChatColor.GREEN + " items: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not formatted properly!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] \"" + ChatColor.RED + item
+ ChatColor.GOLD + "\" inside " + ChatColor.GREEN + " items: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not formatted properly!");
return null;
}
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "items: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of items!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "items: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of items!");
return null;
}
}
@ -527,38 +556,48 @@ public class Action {
if (data.contains(actionKey + "storm-world")) {
World w = plugin.getServer().getWorld(data.getString(actionKey + "storm-world"));
if (w == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "storm-world: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid World name!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "storm-world: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a valid World name!");
return null;
}
if (data.contains(actionKey + "storm-duration")) {
if (data.getInt(actionKey + "storm-duration", -999) != -999) {
action.stormDuration = data.getInt(actionKey + "storm-duration") * 1000;
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "storm-duration: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "storm-duration: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a number!");
return null;
}
action.stormWorld = w;
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "storm-duration:");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is missing " + ChatColor.RED + "storm-duration:");
return null;
}
}
if (data.contains(actionKey + "thunder-world")) {
World w = plugin.getServer().getWorld(data.getString(actionKey + "thunder-world"));
if (w == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "thunder-world: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid World name!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "thunder-world: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a valid World name!");
return null;
}
if (data.contains(actionKey + "thunder-duration")) {
if (data.getInt(actionKey + "thunder-duration", -999) != -999) {
action.thunderDuration = data.getInt(actionKey + "thunder-duration");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "thunder-duration: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "thunder-duration: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a number!");
return null;
}
action.thunderWorld = w;
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "thunder-duration:");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is missing " + ChatColor.RED + "thunder-duration:");
return null;
}
}
@ -571,12 +610,19 @@ public class Action {
EntityType type = Quests.getMobType(section.getString(s + ".mob-type"));
Integer mobAmount = section.getInt(s + ".spawn-amounts");
if (spawnLocation == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-locations: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD
+ " inside " + ChatColor.GREEN + " mob-spawn-locations: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD
+ "[Quests] Proper location format is: \"WorldName x y z\"");
return null;
}
if (type == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + section.getString(s + ".mob-type") + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-types: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid mob name!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED
+ section.getString(s + ".mob-type") + ChatColor.GOLD + " inside " + ChatColor.GREEN
+ " mob-spawn-types: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is not a valid mob name!");
return null;
}
ItemStack[] inventory = new ItemStack[5];
@ -603,14 +649,20 @@ public class Action {
for (String s : data.getStringList(actionKey + "lightning-strikes")) {
Location loc = Quests.getLocation(s);
if (loc == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " lightning-strikes: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD
+ " inside " + ChatColor.GREEN + " lightning-strikes: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD
+ "[Quests] Proper location format is: \"WorldName x y z\"");
return null;
}
action.lightningStrikes.add(loc);
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "lightning-strikes: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of locations!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "lightning-strikes: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of locations!");
return null;
}
}
@ -623,7 +675,9 @@ public class Action {
action.commands.add(s);
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "commands: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of commands!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "commands: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of commands!");
return null;
}
}
@ -639,30 +693,42 @@ public class Action {
for (String s : types) {
PotionEffectType type = PotionEffectType.getByName(s);
if (type == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " lightning-strikes: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid potion effect name!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s
+ ChatColor.GOLD + " inside " + ChatColor.GREEN + " lightning-strikes: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is not a valid potion effect name!");
return null;
}
PotionEffect effect = new PotionEffect(type, durations.get(types.indexOf(s)), amplifiers.get(types.indexOf(s)));
PotionEffect effect = new PotionEffect(type, durations
.get(types.indexOf(s)), amplifiers.get(types.indexOf(s)));
action.potionEffects.add(effect);
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "potion-effect-amplifiers: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of numbers!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED
+ "potion-effect-amplifiers: " + ChatColor.GOLD + "inside Action "
+ ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of numbers!");
return null;
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "potion-effect-amplifiers:");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is missing " + ChatColor.RED + "potion-effect-amplifiers:");
return null;
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "potion-effect-durations: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of numbers!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED
+ "potion-effect-durations: " + ChatColor.GOLD + "inside Action "
+ ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of numbers!");
return null;
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is missing " + ChatColor.RED + "potion-effect-durations:");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Action " + ChatColor.DARK_PURPLE + name
+ ChatColor.GOLD + " is missing " + ChatColor.RED + "potion-effect-durations:");
return null;
}
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "potion-effect-types: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a list of potion effects!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "potion-effect-types: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a list of potion effects!");
return null;
}
}
@ -670,7 +736,8 @@ public class Action {
if (data.getInt(actionKey + "hunger", -999) != -999) {
action.hunger = data.getInt(actionKey + "hunger");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "hunger: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "hunger: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
return null;
}
}
@ -678,7 +745,9 @@ public class Action {
if (data.getInt(actionKey + "saturation", -999) != -999) {
action.saturation = data.getInt(actionKey + "saturation");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "saturation: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "saturation: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a number!");
return null;
}
}
@ -686,7 +755,8 @@ public class Action {
if (data.getInt(actionKey + "health", -999) != -999) {
action.health = data.getInt(actionKey + "health");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "health: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "health: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
return null;
}
}
@ -694,13 +764,19 @@ public class Action {
if (data.isString(actionKey + "teleport-location")) {
Location l = Quests.getLocation(data.getString(actionKey + "teleport-location"));
if (l == null) {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + data.getString(actionKey + "teleport-location") + ChatColor.GOLD + "for " + ChatColor.GREEN + " teleport-location: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + data.getString(actionKey
+ "teleport-location") + ChatColor.GOLD + "for " + ChatColor.GREEN + " teleport-location: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not in proper location format!");
plugin.getLogger().severe(ChatColor.GOLD
+ "[Quests] Proper location format is: \"WorldName x y z\"");
return null;
}
action.teleport = l;
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "teleport-location: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a location!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "teleport-location: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a location!");
return null;
}
}
@ -708,7 +784,8 @@ public class Action {
if (data.isInt(actionKey + "timer")) {
action.timer = data.getInt(actionKey + "timer");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "timer: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "timer: " + ChatColor.GOLD
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a number!");
return null;
}
}
@ -716,7 +793,9 @@ public class Action {
if (data.isBoolean(actionKey + "cancel-timer")) {
action.cancelTimer = data.getBoolean(actionKey + "cancel-timer");
} else {
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "cancel-timer: " + ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a boolean!");
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "cancel-timer: "
+ ChatColor.GOLD + "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
+ " is not a boolean!");
return null;
}
}

View File

@ -74,7 +74,10 @@ public class ActionFactory implements ConversationAbandonedListener {
this.plugin = plugin;
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new MenuPrompt()).withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!").addConversationAbandonedListener(this);
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new MenuPrompt()).withTimeout(3600)
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
.addConversationAbandonedListener(this);
}
public Map<UUID, Block> getSelectedExplosionLocations() {
@ -150,7 +153,12 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("eventEditorTitle") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorCreate") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorEdit") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorDelete") + "\n" + ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("exit");
String text = ChatColor.GOLD + Lang.get("eventEditorTitle") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD
+ "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorCreate") + "\n"
+ ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorEdit") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET
+ ChatColor.YELLOW + " - " + Lang.get("eventEditorDelete") + "\n" + ChatColor.GREEN + ""
+ ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("exit");
return text;
}
@ -158,7 +166,8 @@ public class ActionFactory implements ConversationAbandonedListener {
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
final Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase("1")) {
if (player.hasPermission("quests.editor.actions.create") || player.hasPermission("quests.editor.events.create")) {
if (player.hasPermission("quests.editor.actions.create")
|| player.hasPermission("quests.editor.events.create")) {
context.setSessionData(CK.E_OLD_EVENT, "");
return new ActionNamePrompt();
} else {
@ -166,9 +175,11 @@ public class ActionFactory implements ConversationAbandonedListener {
return new MenuPrompt();
}
} else if (input.equalsIgnoreCase("2")) {
if (player.hasPermission("quests.editor.actions.edit") || player.hasPermission("quests.editor.events.edit")) {
if (player.hasPermission("quests.editor.actions.edit")
|| player.hasPermission("quests.editor.events.edit")) {
if (plugin.getActions().isEmpty()) {
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("eventEditorNoneToEdit"));
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
+ Lang.get("eventEditorNoneToEdit"));
return new MenuPrompt();
} else {
return new SelectEditPrompt();
@ -178,9 +189,11 @@ public class ActionFactory implements ConversationAbandonedListener {
return new MenuPrompt();
}
} else if (input.equalsIgnoreCase("3")) {
if (player.hasPermission("quests.editor.actions.delete") || player.hasPermission("quests.editor.events.delete")) {
if (player.hasPermission("quests.editor.actions.delete")
|| player.hasPermission("quests.editor.events.delete")) {
if (plugin.getActions().isEmpty()) {
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("eventEditorNoneToDelete"));
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
+ Lang.get("eventEditorNoneToDelete"));
return new MenuPrompt();
} else {
return new SelectDeletePrompt();
@ -376,7 +389,8 @@ public class ActionFactory implements ConversationAbandonedListener {
if (a != null) {
for (Quest quest : plugin.getQuests()) {
for (Stage stage : quest.getStages()) {
if (stage.getFinishEvent() != null && stage.getFinishEvent().getName().equalsIgnoreCase(a.getName())) {
if (stage.getFinishEvent() != null
&& stage.getFinishEvent().getName().equalsIgnoreCase(a.getName())) {
used.add(quest.getName());
break;
}
@ -386,11 +400,13 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.ED_EVENT_DELETE, a.getName());
return new DeletePrompt();
} else {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorEventInUse") + " \"" + ChatColor.DARK_PURPLE + a.getName() + ChatColor.RED + "\":");
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorEventInUse")
+ " \"" + ChatColor.DARK_PURPLE + a.getName() + ChatColor.RED + "\":");
for (String s : used) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "- " + ChatColor.DARK_RED + s);
}
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorMustModifyQuests"));
((Player) context.getForWhom()).sendMessage(ChatColor.RED
+ Lang.get("eventEditorMustModifyQuests"));
return new SelectDeletePrompt();
}
}
@ -406,9 +422,12 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - " + Lang.get("yesWord") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - " + Lang.get("noWord");
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW + (String) context.getSessionData(CK.ED_EVENT_DELETE) + ChatColor.RED + ")\n" + text;
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - "
+ Lang.get("yesWord") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - "
+ Lang.get("noWord");
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW
+ (String) context.getSessionData(CK.ED_EVENT_DELETE) + ChatColor.RED + ")\n" + text;
}
@Override
@ -433,28 +452,43 @@ public class ActionFactory implements ConversationAbandonedListener {
@SuppressWarnings("unchecked")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("event") + ": " + ChatColor.AQUA + context.getSessionData(CK.E_NAME) + ChatColor.GOLD + " -\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetName") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("eventEditorPlayer") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("eventEditorTimer") +"\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("eventEditorEffect") +"\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("eventEditorWeather") +"\n";
String text = ChatColor.GOLD + "- " + Lang.get("event") + ": " + ChatColor.AQUA
+ context.getSessionData(CK.E_NAME) + ChatColor.GOLD + " -\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetName") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GOLD + " - "
+ Lang.get("eventEditorPlayer") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GOLD + " - "
+ Lang.get("eventEditorTimer") +"\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GOLD + " - "
+ Lang.get("eventEditorEffect") +"\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GOLD + " - "
+ Lang.get("eventEditorWeather") +"\n";
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobSpawns") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobSpawns") + "\n";
for (String s : types) {
QuestMob qm = QuestMob.fromString(s);
text += ChatColor.GRAY + " - " + ChatColor.AQUA + qm.getType().name() + ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA + qm.getType().name()
+ ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x "
+ ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN
+ Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
}
}
if (context.getSessionData(CK.E_FAIL_QUEST) == null) {
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorFailQuest") + ": " + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST) + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("save") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("exit");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorFailQuest") + ": " + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST)
+ "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("save") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.RED + " - "
+ Lang.get("exit");
return text;
}
@ -504,18 +538,25 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorPlayer") + " -\n";
if (context.getSessionData(CK.E_MESSAGE) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMessage") + " (" + ChatColor.AQUA + context.getSessionData(CK.E_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMessage") + " (" + ChatColor.AQUA
+ context.getSessionData(CK.E_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(CK.E_CLEAR_INVENTORY) == null) {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord"));
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorClearInv") + ": " + ChatColor.AQUA + context.getSessionData(CK.E_CLEAR_INVENTORY) + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorClearInv") + ": " + ChatColor.AQUA
+ context.getSessionData(CK.E_CLEAR_INVENTORY) + "\n";
if (context.getSessionData(CK.E_ITEMS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetItems") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetItems") + "\n";
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
for (ItemStack is : items) {
if (is != null) {
@ -524,47 +565,66 @@ public class ActionFactory implements ConversationAbandonedListener {
}
}
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionEffects") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionEffects") + "\n";
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES);
LinkedList<Long> durations = (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS);
LinkedList<Integer> mags = (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT);
int index = -1;
for (String type : types) {
index++;
text += ChatColor.GRAY + " - " + ChatColor.AQUA + type + ChatColor.DARK_PURPLE + " " + RomanNumeral.getNumeral(mags.get(index)) + ChatColor.GRAY + " -> " + ChatColor.DARK_AQUA + Quests.getTime(durations.get(index) * 50L) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA + type + ChatColor.DARK_PURPLE + " "
+ RomanNumeral.getNumeral(mags.get(index)) + ChatColor.GRAY + " -> " + ChatColor.DARK_AQUA
+ Quests.getTime(durations.get(index) * 50L) + "\n";
}
}
if (context.getSessionData(CK.E_HUNGER) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetHunger") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetHunger") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetHunger") + ChatColor.AQUA + " (" + (Integer) context.getSessionData(CK.E_HUNGER) + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetHunger") + ChatColor.AQUA + " ("
+ (Integer) context.getSessionData(CK.E_HUNGER) + ")\n";
}
if (context.getSessionData(CK.E_SATURATION) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetSaturation") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetSaturation") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetSaturation") + ChatColor.AQUA + " (" + (Integer) context.getSessionData(CK.E_SATURATION) + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetSaturation") + ChatColor.AQUA + " ("
+ (Integer) context.getSessionData(CK.E_SATURATION) + ")\n";
}
if (context.getSessionData(CK.E_HEALTH) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetHealth") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetHealth") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetHealth") + ChatColor.AQUA + " (" + (Integer) context.getSessionData(CK.E_HEALTH) + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetHealth") + ChatColor.AQUA + " ("
+ (Integer) context.getSessionData(CK.E_HEALTH) + ")\n";
}
if (context.getSessionData(CK.E_TELEPORT) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetTeleport") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetTeleport") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetTeleport") + ChatColor.AQUA + " (" + (String) context.getSessionData(CK.E_TELEPORT) + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetTeleport") + ChatColor.AQUA + " ("
+ (String) context.getSessionData(CK.E_TELEPORT) + ")\n";
}
if (context.getSessionData(CK.E_COMMANDS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetCommands") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetCommands") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetCommands") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetCommands") + "\n";
for (String s : (LinkedList<String>) context.getSessionData(CK.E_COMMANDS)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.YELLOW + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.YELLOW + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -610,15 +670,21 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorTimer") + " -\n";
if (context.getSessionData(CK.E_TIMER) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetTimer") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetTimer") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetTimer") + "(" + ChatColor.AQUA + "\"" + context.getSessionData(CK.E_TIMER) + "\"" + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetTimer") + "(" + ChatColor.AQUA + "\""
+ context.getSessionData(CK.E_TIMER) + "\"" + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(CK.E_CANCEL_TIMER) == null) {
context.setSessionData(CK.E_CANCEL_TIMER, Lang.get("noWord"));
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorCancelTimer") + ": " + ChatColor.AQUA + context.getSessionData(CK.E_CANCEL_TIMER) + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.YELLOW + "- " + Lang.get("done") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorCancelTimer") + ": " + ChatColor.AQUA
+ context.getSessionData(CK.E_CANCEL_TIMER) + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.YELLOW + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -650,25 +716,31 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEffect") + " -\n";
if (context.getSessionData(CK.E_EFFECTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetEffects") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetEffects") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetEffects") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetEffects") + "\n";
LinkedList<String> effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
for (String effect : effects) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + effect + ChatColor.GRAY + " at " + ChatColor.DARK_AQUA + locations.get(effects.indexOf(effect)) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA + effect + ChatColor.GRAY + " at "
+ ChatColor.DARK_AQUA + locations.get(effects.indexOf(effect)) + "\n";
}
}
if (context.getSessionData(CK.E_EXPLOSIONS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetExplosions") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetExplosions") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetExplosions") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetExplosions") + "\n";
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS);
for (String loc : locations) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + loc + "\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.YELLOW + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.YELLOW + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -695,26 +767,39 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorWeather") + " -\n";
if (context.getSessionData(CK.E_WORLD_STORM) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetStorm") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetStorm") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetStorm") + " (" + ChatColor.AQUA + (String) context.getSessionData(CK.E_WORLD_STORM) + ChatColor.YELLOW + " -> " + ChatColor.DARK_AQUA + Quests.getTime(Long.valueOf((int)context.getSessionData(CK.E_WORLD_STORM_DURATION) * 1000)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetStorm") + " (" + ChatColor.AQUA
+ (String) context.getSessionData(CK.E_WORLD_STORM) + ChatColor.YELLOW + " -> "
+ ChatColor.DARK_AQUA + Quests.getTime(Long.valueOf((int)context
.getSessionData(CK.E_WORLD_STORM_DURATION) * 1000)) + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(CK.E_WORLD_THUNDER) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetThunder") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetThunder") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetThunder") + " (" + ChatColor.AQUA + (String) context.getSessionData(CK.E_WORLD_THUNDER) + ChatColor.YELLOW + " -> " + ChatColor.DARK_AQUA + Quests.getTime(Long.valueOf((int)context.getSessionData(CK.E_WORLD_THUNDER_DURATION) * 1000)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetThunder") + " (" + ChatColor.AQUA
+ (String) context.getSessionData(CK.E_WORLD_THUNDER) + ChatColor.YELLOW + " -> "
+ ChatColor.DARK_AQUA + Quests.getTime(Long.valueOf((int)context
.getSessionData(CK.E_WORLD_THUNDER_DURATION) * 1000)) + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(CK.E_LIGHTNING) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetLightning") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetLightning") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetLightning") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetLightning") + "\n";
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING);
for (String loc : locations) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + loc + "\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.GREEN + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.GREEN + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -769,7 +854,8 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA + context.getSessionData(CK.E_NAME) + ChatColor.YELLOW + "\"?\n";
String text = ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA
+ context.getSessionData(CK.E_NAME) + ChatColor.YELLOW + "\"?\n";
if (modified.isEmpty() == false) {
text += ChatColor.RED + Lang.get("eventEditorModifiedNote") + "\n";
for (String s : modified) {
@ -797,8 +883,9 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("yesWord") + "\n"
+ ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("noWord");
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("yesWord") + "\n" + ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET
+ ChatColor.RED + " - " + Lang.get("noWord");
return ChatColor.YELLOW + Lang.get("confirmDelete") + "\n" + text;
}
@ -1167,7 +1254,8 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
context.setSessionData(CK.E_MESSAGE, input);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.E_MESSAGE, null);
@ -1200,16 +1288,22 @@ public class ActionFactory implements ConversationAbandonedListener {
}
String text = ChatColor.GOLD + Lang.get("eventEditorGiveItemsTitle") + "\n";
if (context.getSessionData(CK.E_ITEMS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -1244,25 +1338,34 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEffects") + " -\n";
if (context.getSessionData(CK.E_EFFECTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddEffect") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorAddEffectLocation") + " (" + Lang.get("eventEditorNoEffects") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorAddEffect") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorAddEffectLocation") + " ("
+ Lang.get("eventEditorNoEffects") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddEffect") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorAddEffect") + "\n";
for (String s : getEffects(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(CK.E_EFFECTS_LOCATIONS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddEffectLocation") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorAddEffectLocation") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddEffectLocation") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorAddEffectLocation") + "\n";
for (String s : getEffectLocations(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -1361,16 +1464,22 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
String effects = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorEffectsTitle") + "\n";
effects += ChatColor.DARK_PURPLE + "BLAZE_SHOOT " + ChatColor.GRAY + "- " + Lang.get("effBlazeShoot") + "\n";
effects += ChatColor.DARK_PURPLE + "BLAZE_SHOOT " + ChatColor.GRAY + "- " + Lang.get("effBlazeShoot")
+ "\n";
effects += ChatColor.DARK_PURPLE + "BOW_FIRE " + ChatColor.GRAY + "- " + Lang.get("effBowFire") + "\n";
effects += ChatColor.DARK_PURPLE + "CLICK1 " + ChatColor.GRAY + "- " + Lang.get("effClick1") + "\n";
effects += ChatColor.DARK_PURPLE + "CLICK2 " + ChatColor.GRAY + "- " + Lang.get("effClick2") + "\n";
effects += ChatColor.DARK_PURPLE + "DOOR_TOGGLE " + ChatColor.GRAY + "- " + Lang.get("effDoorToggle") + "\n";
effects += ChatColor.DARK_PURPLE + "DOOR_TOGGLE " + ChatColor.GRAY + "- " + Lang.get("effDoorToggle")
+ "\n";
effects += ChatColor.DARK_PURPLE + "EXTINGUISH " + ChatColor.GRAY + "- " + Lang.get("effExtinguish") + "\n";
effects += ChatColor.DARK_PURPLE + "GHAST_SHOOT " + ChatColor.GRAY + "- " + Lang.get("effGhastShoot") + "\n";
effects += ChatColor.DARK_PURPLE + "GHAST_SHRIEK " + ChatColor.GRAY + "- " + Lang.get("effGhastShriek") + "\n";
effects += ChatColor.DARK_PURPLE + "ZOMBIE_CHEW_IRON_DOOR " + ChatColor.GRAY + "- " + Lang.get("effZombieWood") + "\n";
effects += ChatColor.DARK_PURPLE + "ZOMBIE_CHEW_WOODEN_DOOR " + ChatColor.GRAY + "- " + Lang.get("effZombieIron") + "\n";
effects += ChatColor.DARK_PURPLE + "GHAST_SHOOT " + ChatColor.GRAY + "- " + Lang.get("effGhastShoot")
+ "\n";
effects += ChatColor.DARK_PURPLE + "GHAST_SHRIEK " + ChatColor.GRAY + "- " + Lang.get("effGhastShriek")
+ "\n";
effects += ChatColor.DARK_PURPLE + "ZOMBIE_CHEW_IRON_DOOR " + ChatColor.GRAY + "- "
+ Lang.get("effZombieWood") + "\n";
effects += ChatColor.DARK_PURPLE + "ZOMBIE_CHEW_WOODEN_DOOR " + ChatColor.GRAY + "- "
+ Lang.get("effZombieIron") + "\n";
return ChatColor.YELLOW + effects + Lang.get("effEnterName");
}
@ -1391,7 +1500,8 @@ public class ActionFactory implements ConversationAbandonedListener {
selectedEffectLocations.remove(player.getUniqueId());
return new SoundEffectListPrompt();
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("eventEditorInvalidEffect"));
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("eventEditorInvalidEffect"));
return new SoundEffectPrompt();
}
} else {
@ -1411,20 +1521,31 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("eventEditorStormTitle") + "\n";
if (context.getSessionData(CK.E_WORLD_STORM) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetWorld") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorSetDuration") + " " + Lang.get("eventEditorNoWorld") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetWorld") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorSetDuration") + " "
+ Lang.get("eventEditorNoWorld") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetWorld") + " (" + ChatColor.AQUA + ((String) context.getSessionData(CK.E_WORLD_STORM)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetWorld") + " (" + ChatColor.AQUA
+ ((String) context.getSessionData(CK.E_WORLD_STORM)) + ChatColor.YELLOW + ")\n";
if (context.getSessionData(CK.E_WORLD_STORM_DURATION) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetDuration") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetDuration") + " (" + Lang.get("noneSet") + ")\n";
} else {
int dur = (int) context.getSessionData(CK.E_WORLD_STORM_DURATION);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetDuration") + " (" + ChatColor.AQUA + Quests.getTime(dur * 1000) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetDuration") + " (" + ChatColor.AQUA + Quests.getTime(dur * 1000)
+ ChatColor.YELLOW + ")\n";
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -1446,7 +1567,8 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_WORLD_STORM_DURATION, null);
return new StormPrompt();
} else if (input.equalsIgnoreCase("4")) {
if (context.getSessionData(CK.E_WORLD_STORM) != null && context.getSessionData(CK.E_WORLD_STORM_DURATION) == null) {
if (context.getSessionData(CK.E_WORLD_STORM) != null
&& context.getSessionData(CK.E_WORLD_STORM_DURATION) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetStormDuration"));
return new StormPrompt();
} else {
@ -1476,7 +1598,8 @@ public class ActionFactory implements ConversationAbandonedListener {
if (plugin.getServer().getWorld(input) != null) {
context.setSessionData(CK.E_WORLD_STORM, plugin.getServer().getWorld(input).getName());
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("eventEditorInvalidWorld"));
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("eventEditorInvalidWorld"));
return new StormWorldPrompt();
}
}
@ -1494,7 +1617,8 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new StormDurationPrompt();
} else {
context.setSessionData(CK.E_WORLD_STORM_DURATION, input.intValue());
@ -1513,20 +1637,31 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("eventEditorThunderTitle") + "\n";
if (context.getSessionData(CK.E_WORLD_THUNDER) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetWorld") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("eventEditorSetDuration") + " " + Lang.get("eventEditorNoWorld") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetWorld") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("eventEditorSetDuration") + " " + Lang.get("eventEditorNoWorld") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetWorld") + " (" + ChatColor.AQUA + ((String) context.getSessionData(CK.E_WORLD_THUNDER)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetWorld") + " (" + ChatColor.AQUA
+ ((String) context.getSessionData(CK.E_WORLD_THUNDER)) + ChatColor.YELLOW + ")\n";
if (context.getSessionData(CK.E_WORLD_THUNDER_DURATION) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetDuration") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetDuration") + " (" + Lang.get("noneSet") + ")\n";
} else {
int dur = (int) context.getSessionData(CK.E_WORLD_THUNDER_DURATION);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetDuration") + " (" + ChatColor.AQUA + Quests.getTime(dur * 1000) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetDuration") + " (" + ChatColor.AQUA + Quests.getTime(dur * 1000)
+ ChatColor.YELLOW + ")\n";
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -1548,7 +1683,8 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_WORLD_THUNDER_DURATION, null);
return new ThunderPrompt();
} else if (input.equalsIgnoreCase("4")) {
if (context.getSessionData(CK.E_WORLD_THUNDER) != null && context.getSessionData(CK.E_WORLD_THUNDER_DURATION) == null) {
if (context.getSessionData(CK.E_WORLD_THUNDER) != null
&& context.getSessionData(CK.E_WORLD_THUNDER_DURATION) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetThunderDuration"));
return new ThunderPrompt();
} else {
@ -1578,7 +1714,8 @@ public class ActionFactory implements ConversationAbandonedListener {
if (plugin.getServer().getWorld(input) != null) {
context.setSessionData(CK.E_WORLD_THUNDER, plugin.getServer().getWorld(input).getName());
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("eventEditorInvalidWorld"));
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("eventEditorInvalidWorld"));
return new ThunderWorldPrompt();
}
}
@ -1596,7 +1733,8 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new ThunderDurationPrompt();
} else {
context.setSessionData(CK.E_WORLD_THUNDER_DURATION, input.intValue());
@ -1611,20 +1749,29 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("eventEditorMobSpawnsTitle") + "\n";
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorAddMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
@SuppressWarnings("unchecked")
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
for (int i = 0; i < types.size(); i++) {
QuestMob qm = QuestMob.fromString(types.get(i));
text += ChatColor.BLUE + "" + ChatColor.BOLD + (i + 1) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("edit") + ": "
+ ChatColor.AQUA + qm.getType().name() + ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + (i + 1) + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("edit") + ": " + ChatColor.AQUA + qm.getType().name()
+ ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x "
+ ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN
+ Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + (types.size() + 1) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + (types.size() + 2) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + (types.size() + 3) + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + (types.size() + 1) + ChatColor.RESET + ChatColor.YELLOW
+ " - " + Lang.get("eventEditorAddMobTypes") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + (types.size() + 2) + ChatColor.RESET + ChatColor.YELLOW
+ " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + (types.size() + 3) + ChatColor.RESET + ChatColor.YELLOW
+ " - " + Lang.get("done");
}
return text;
}
@ -1648,7 +1795,8 @@ public class ActionFactory implements ConversationAbandonedListener {
try {
inp = Integer.parseInt(input);
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("reqNotANumber").replace("<input>", input));
return new MobPrompt();
}
if (inp == types.size() + 1) {
@ -1695,22 +1843,66 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData("newItem", null);
context.setSessionData("tempStack", null);
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobName") + ChatColor.GRAY + " (" + ((questMob.getName() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getName()) + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobType") + ChatColor.GRAY + " (" + ((questMob.getType() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getType().name()) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + ChatColor.GRAY + " (" + ((questMob.getSpawnLocation() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + Quests.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + ChatColor.GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + ChatColor.GRAY + " (" + ((questMob.getInventory()[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHandDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBoots") + ChatColor.GRAY + " (" + ((questMob.getInventory()[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBootsDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobLeggings") + ChatColor.GRAY + " (" + ((questMob.getInventory()[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobLeggingsDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobChestPlate") + ChatColor.GRAY + " (" + ((questMob.getInventory()[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobChestPlateDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobHelmet") + ChatColor.GRAY + " (" + ((questMob.getInventory()[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobHelmetDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "16" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("cancel");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobName") + ChatColor.GRAY + " ("
+ ((questMob.getName() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getName())
+ ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobType") + ChatColor.GRAY + " ("
+ ((questMob.getType() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getType().name())
+ ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorAddSpawnLocation") + ChatColor.GRAY + " ("
+ ((questMob.getSpawnLocation() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ Quests.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobSpawnAmount") + ChatColor.GRAY + " ("
+ ((questMob.getSpawnAmounts() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobItemInHand") + ChatColor.GRAY + " ("
+ ((questMob.getInventory()[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobItemInHandDrop") + ChatColor.GRAY + " ("
+ ((questMob.getDropChances()[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobBoots") + ChatColor.GRAY + " ("
+ ((questMob.getInventory()[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobBootsDrop") + ChatColor.GRAY + " ("
+ ((questMob.getDropChances()[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobLeggings") + ChatColor.GRAY + " ("
+ ((questMob.getInventory()[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobLeggingsDrop") + ChatColor.GRAY + " ("
+ ((questMob.getDropChances()[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobChestPlate") + ChatColor.GRAY + " ("
+ ((questMob.getInventory()[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobChestPlateDrop") + ChatColor.GRAY + " ("
+ ((questMob.getDropChances()[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobHelmet") + ChatColor.GRAY + " ("
+ ((questMob.getInventory()[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetMobHelmetDrop") + ChatColor.GRAY + " ("
+ ((questMob.getDropChances()[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "16" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("cancel");
return text;
}
@ -1762,7 +1954,8 @@ public class ActionFactory implements ConversationAbandonedListener {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetMobAmountsFirst"));
return new QuestMobPrompt(mobIndex, questMob);
}
if (context.getSessionData(CK.E_MOB_TYPES) == null || ((LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)).isEmpty()) {
if (context.getSessionData(CK.E_MOB_TYPES) == null
|| ((LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)).isEmpty()) {
LinkedList<String> list = new LinkedList<String>();
list.add(questMob.serialize());
context.setSessionData(CK.E_MOB_TYPES, list);
@ -1850,7 +2043,8 @@ public class ActionFactory implements ConversationAbandonedListener {
if (MiscUtil.getProperMobType(input) != null) {
questMob.setType(MiscUtil.getProperMobType(input));
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("eventEditorInvalidMob"));
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("eventEditorInvalidMob"));
return new MobTypePrompt(mobIndex, questMob);
}
}
@ -2028,35 +2222,48 @@ public class ActionFactory implements ConversationAbandonedListener {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("eventEditorPotionEffectsTitle") + "\n";
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionEffectTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorSetPotionDurations") + " " + Lang.get("noneSet") + "\n";
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("noneSet") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionEffectTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "2 - " + Lang.get("eventEditorSetPotionDurations") + " " + Lang.get("noneSet")
+ "\n";
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("noneSet")
+ "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionEffectTypes") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionEffectTypes") + "\n";
for (String s : (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(CK.E_POTION_DURATIONS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionDurations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("noneSet") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionDurations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " "
+ Lang.get("noneSet") + "\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("noneSet") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("noneSet") + "\n";
for (Long l : (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS)) {
text += ChatColor.GRAY + " - " + ChatColor.DARK_AQUA + Quests.getTime(l * 50L) + "\n";
}
if (context.getSessionData(CK.E_POTION_STRENGHT) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionMagnitudes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionMagnitudes") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetPotionMagnitudes") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("eventEditorSetPotionMagnitudes") + "\n";
for (int i : (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT)) {
text += ChatColor.GRAY + " - " + ChatColor.DARK_PURPLE + i + "\n";
}
}
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -2075,10 +2282,12 @@ public class ActionFactory implements ConversationAbandonedListener {
}
} else if (input.equalsIgnoreCase("3")) {
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetPotionTypesAndDurationsFirst"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("eventEditorMustSetPotionTypesAndDurationsFirst"));
return new PotionEffectPrompt();
} else if (context.getSessionData(CK.E_POTION_DURATIONS) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetPotionDurationsFirst"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("eventEditorMustSetPotionDurationsFirst"));
return new PotionEffectPrompt();
} else {
return new PotionMagnitudesPrompt();
@ -2140,7 +2349,8 @@ public class ActionFactory implements ConversationAbandonedListener {
effTypes.add(PotionEffectType.getByName(s.toUpperCase()).getName());
context.setSessionData(CK.E_POTION_TYPES, effTypes);
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("eventEditorInvalidPotionType"));
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("eventEditorInvalidPotionType"));
return new PotionTypesPrompt();
}
}
@ -2225,13 +2435,15 @@ public class ActionFactory implements ConversationAbandonedListener {
try {
int i = Integer.parseInt(input);
if (i < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
((Player) context.getForWhom()).sendMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new HungerPrompt();
} else {
context.setSessionData(CK.E_HUNGER, (Integer) i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("reqNotANumber").replace("<input>", input));
return new HungerPrompt();
}
} else {
@ -2254,13 +2466,15 @@ public class ActionFactory implements ConversationAbandonedListener {
try {
int i = Integer.parseInt(input);
if (i < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
((Player) context.getForWhom()).sendMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new SaturationPrompt();
} else {
context.setSessionData(CK.E_SATURATION, (Integer) i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("reqNotANumber").replace("<input>", input));
return new SaturationPrompt();
}
} else {
@ -2283,13 +2497,15 @@ public class ActionFactory implements ConversationAbandonedListener {
try {
int i = Integer.parseInt(input);
if (i < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
((Player) context.getForWhom()).sendMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new HealthPrompt();
} else {
context.setSessionData(CK.E_HEALTH, (Integer) i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("reqNotANumber").replace("<input>", input));
return new HealthPrompt();
}
} else {
@ -2343,7 +2559,8 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] commands = input.split(Lang.get("charSemi"));
LinkedList<String> cmdList = new LinkedList<String>();
cmdList.addAll(Arrays.asList(commands));

View File

@ -185,7 +185,8 @@ public class CmdExecutor implements CommandExecutor {
plugin.showObjectives(q, quester, false);
} else {
long time = plugin.getQuester(player.getUniqueId()).getStageTime(q);
String msg = ChatColor.YELLOW + "(" + Lang.get(player, "delay") + ") " + ChatColor.RED + Lang.get(player, "plnTooEarly");
String msg = ChatColor.YELLOW + "(" + Lang.get(player, "delay") + ") " + ChatColor.RED
+ Lang.get(player, "plnTooEarly");
msg = msg.replace("<quest>", q.getName());
msg = msg.replace("<time>", Quests.getTime(time));
player.sendMessage(msg);
@ -229,8 +230,8 @@ public class CmdExecutor implements CommandExecutor {
questsTop(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EDITOR") : "editor")) {
questsEditor(cs);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EVENTS_EDITOR") : "actions")
|| args[0].equalsIgnoreCase("action") || args[0].equalsIgnoreCase("events")) {
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EVENTS_EDITOR")
: "actions") || args[0].equalsIgnoreCase("action") || args[0].equalsIgnoreCase("events")) {
questsActions(cs);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_INFO") : "info")) {
questsInfo(cs);
@ -260,17 +261,22 @@ public class CmdExecutor implements CommandExecutor {
adminQuit(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points")) {
adminPoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints")) {
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS")
: "takepoints")) {
adminTakePoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints")) {
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS")
: "givepoints")) {
adminGivePoints(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall")) {
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL")
: "pointsall")) {
adminPointsAll(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish")) {
adminFinish(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage")) {
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE")
: "nextstage")) {
adminNextStage(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage")) {
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE")
: "setstage")) {
adminSetStage(cs, args);
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset")) {
adminReset(cs, args);
@ -337,16 +343,20 @@ public class CmdExecutor implements CommandExecutor {
}
if (reqs.getHeroesPrimaryClass() != null) {
if (plugin.testPrimaryHeroesClass(reqs.getHeroesPrimaryClass(), player.getUniqueId())) {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.GREEN + reqs.getHeroesPrimaryClass() + ChatColor.RESET + "" + ChatColor.DARK_GREEN + " " + Lang.get("heroesClass"));
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.GREEN + reqs.getHeroesPrimaryClass()
+ ChatColor.RESET + "" + ChatColor.DARK_GREEN + " " + Lang.get("heroesClass"));
} else {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.DARK_RED + reqs.getHeroesPrimaryClass() + ChatColor.RESET + "" + ChatColor.RED + " " + Lang.get("heroesClass"));
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.DARK_RED + reqs.getHeroesPrimaryClass()
+ ChatColor.RESET + "" + ChatColor.RED + " " + Lang.get("heroesClass"));
}
}
if (reqs.getHeroesSecondaryClass() != null) {
if (plugin.testSecondaryHeroesClass(reqs.getHeroesSecondaryClass(), player.getUniqueId())) {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.DARK_RED + reqs.getHeroesSecondaryClass() + ChatColor.RESET + "" + ChatColor.RED + " " + Lang.get("heroesClass"));
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.DARK_RED + reqs.getHeroesSecondaryClass()
+ ChatColor.RESET + "" + ChatColor.RED + " " + Lang.get("heroesClass"));
} else {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.GREEN + reqs.getHeroesSecondaryClass() + ChatColor.RESET + "" + ChatColor.DARK_GREEN + " " + Lang.get("heroesClass"));
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.GREEN + reqs.getHeroesSecondaryClass()
+ ChatColor.RESET + "" + ChatColor.DARK_GREEN + " " + Lang.get("heroesClass"));
}
}
if (reqs.getMcmmoSkills().isEmpty() == false) {
@ -363,23 +373,30 @@ public class CmdExecutor implements CommandExecutor {
}
if (reqs.getQuestPoints() != 0) {
if (quester.getQuestPoints() >= reqs.getQuestPoints()) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getQuestPoints() + " " + Lang.get("questPoints"));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getQuestPoints() + " "
+ Lang.get("questPoints"));
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getQuestPoints() + " " + Lang.get("questPoints"));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getQuestPoints() + " "
+ Lang.get("questPoints"));
}
}
if (reqs.getMoney() != 0) {
if (plugin.getDependencies().getVaultEconomy() != null && plugin.getDependencies().getVaultEconomy().getBalance(quester.getOfflinePlayer()) >= reqs.getMoney()) {
if (plugin.getDependencies().getVaultEconomy() != null && plugin.getDependencies()
.getVaultEconomy().getBalance(quester.getOfflinePlayer()) >= reqs.getMoney()) {
if (reqs.getMoney() == 1) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " " + plugin.getCurrency(false));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " "
+ plugin.getCurrency(false));
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " " + plugin.getCurrency(true));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " "
+ plugin.getCurrency(true));
}
} else {
if (reqs.getMoney() == 1) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " " + plugin.getCurrency(false));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " "
+ plugin.getCurrency(false));
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " " + plugin.getCurrency(true));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " "
+ plugin.getCurrency(true));
}
}
}
@ -395,9 +412,11 @@ public class CmdExecutor implements CommandExecutor {
if (reqs.getNeededQuests().isEmpty() == false) {
for (String s : reqs.getNeededQuests()) {
if (quester.getCompletedQuests().contains(s)) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + Lang.get("complete") + " " + ChatColor.ITALIC + s);
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + Lang.get("complete") + " "
+ ChatColor.ITALIC + s);
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + Lang.get("complete") + " " + ChatColor.ITALIC + s);
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + Lang.get("complete") + " "
+ ChatColor.ITALIC + s);
}
}
}
@ -405,11 +424,13 @@ public class CmdExecutor implements CommandExecutor {
for (String s : reqs.getBlockQuests()) {
if (quester.getCompletedQuests().contains(s)) {
String msg = Lang.get("haveCompleted");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE + s + ChatColor.RED);
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE + s
+ ChatColor.RED);
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + msg);
} else {
String msg = Lang.get("cannotComplete");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE + s + ChatColor.GREEN);
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE + s
+ ChatColor.GREEN);
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + msg);
}
}
@ -425,10 +446,12 @@ public class CmdExecutor implements CommandExecutor {
private boolean questsInfo(final CommandSender cs) {
if (cs.hasPermission("quests.info")) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("quests") + " " + ChatColor.GOLD + plugin.getDescription().getVersion());
cs.sendMessage(ChatColor.YELLOW + Lang.get("quests") + " " + ChatColor.GOLD
+ plugin.getDescription().getVersion());
cs.sendMessage(ChatColor.GOLD + Lang.get("createdBy") + " " + ChatColor.RED + "Blackvein"
+ ChatColor.GOLD + " " + Lang.get("continuedBy") + " " + ChatColor.RED + "PikaMug");
cs.sendMessage(ChatColor.DARK_AQUA + "" + ChatColor.UNDERLINE + "https://www.spigotmc.org/resources/quests.3711/");
cs.sendMessage(ChatColor.DARK_AQUA + "" + ChatColor.UNDERLINE
+ "https://www.spigotmc.org/resources/quests.3711/");
}
return true;
}
@ -455,7 +478,8 @@ public class CmdExecutor implements CommandExecutor {
Conversation cn = plugin.getQuestFactory().getConversationFactory().buildConversation(c);
if (cs instanceof Player) {
Quester quester = plugin.getQuester(((Player)cs).getUniqueId());
QuestsCommandPreQuestsEditorEvent event = new QuestsCommandPreQuestsEditorEvent(quester, cn.getContext());
QuestsCommandPreQuestsEditorEvent event
= new QuestsCommandPreQuestsEditorEvent(quester, cn.getContext());
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
@ -525,7 +549,8 @@ public class CmdExecutor implements CommandExecutor {
break;
}
numPrinted++;
cs.sendMessage(ChatColor.YELLOW + String.valueOf(numPrinted) + ". " + s + " - " + ChatColor.DARK_PURPLE + i + ChatColor.YELLOW + " " + Lang.get("questPoints"));
cs.sendMessage(ChatColor.YELLOW + String.valueOf(numPrinted) + ". " + s + " - " + ChatColor.DARK_PURPLE
+ i + ChatColor.YELLOW + " " + Lang.get("questPoints"));
if (numPrinted == topNumber) {
break;
}
@ -550,9 +575,10 @@ public class CmdExecutor implements CommandExecutor {
quester = plugin.getQuester(((Player) cs).getUniqueId());
cs.sendMessage(ChatColor.GOLD + "- " + ((Player) cs).getName() + " -");
}
cs.sendMessage(ChatColor.YELLOW + Lang.get("questPointsDisplay") + " " + ChatColor.DARK_PURPLE + quester.getQuestPoints());
cs.sendMessage(ChatColor.YELLOW + Lang.get("questPointsDisplay") + " " + ChatColor.DARK_PURPLE
+ quester.getQuestPoints());
if (quester.getCurrentQuests().isEmpty()) {
cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest") + " " + ChatColor.DARK_PURPLE + Lang.get("none"));
cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest") + " " + ChatColor.DARK_PURPLE+ Lang.get("none"));
} else {
cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest"));
for (Entry<Quest, Integer> set : quester.getCurrentQuests().entrySet()) {
@ -735,52 +761,64 @@ public class CmdExecutor implements CommandExecutor {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp"));
if (player.hasPermission("quests.list") || player.hasPermission("quests.list")) {
player.sendMessage(ChatColor.YELLOW + "/quests "+ Lang.get(player, "COMMAND_LIST_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_LIST") : "list") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_LIST")
: "list") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.take")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TAKE_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_TAKE") : "take") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_TAKE")
: "take") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.quit")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_QUIT_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_QUIT") : "quit") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_QUIT")
: "quit") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.journal")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_JOURNAL_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_JOURNAL") : "journal") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_JOURNAL")
: "journal") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.editor")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EDITOR_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_EDITOR") : "editor") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_EDITOR")
: "editor") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.events.*") || player.hasPermission("quests.actions.*")
|| player.hasPermission("quests.events.editor") || player.hasPermission("quests.actions.editor")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EVENTS_EDITOR_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_EVENTS_EDITOR") : "actions") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands
? Lang.get(player, "COMMAND_EVENTS_EDITOR") : "actions") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.stats")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_STATS_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_STATS") : "stats") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_STATS")
: "stats") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.top")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TOP_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_TOP") : "top") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_TOP")
: "top") + ChatColor.YELLOW));
}
if (player.hasPermission("quests.info")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_INFO_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_INFO") : "info") + ChatColor.YELLOW));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get(player, "COMMAND_INFO")
: "info") + ChatColor.YELLOW));
}
player.sendMessage(ChatColor.DARK_AQUA + "/quest " + ChatColor.YELLOW + Lang.get(player, "COMMAND_QUEST_HELP"));
if (player.hasPermission("quests.questinfo")) {
player.sendMessage(ChatColor.DARK_AQUA + "/quest " + ChatColor.YELLOW + Lang.get(player, "COMMAND_QUESTINFO_HELP"));
player.sendMessage(ChatColor.DARK_AQUA + "/quest " + ChatColor.YELLOW
+ Lang.get(player, "COMMAND_QUESTINFO_HELP"));
}
if (player.hasPermission("quests.admin.*") || player.hasPermission("quests.admin")) {
player.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get(player, "COMMAND_QUESTADMIN_HELP"));
player.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get(player, "COMMAND_QUESTADMIN_HELP"));
}
}
public String getQuestsCommandUsage(String cmd) {
return ChatColor.RED + Lang.get("usage") + ": " + ChatColor.YELLOW + "/quests " + Lang.get(Lang.getCommandKey(cmd) + "_HELP");
return ChatColor.RED + Lang.get("usage") + ": " + ChatColor.YELLOW + "/quests "
+ Lang.get(Lang.getCommandKey(cmd) + "_HELP");
}
private void adminHelp(final CommandSender cs) {
@ -796,7 +834,8 @@ public class CmdExecutor implements CommandExecutor {
plugin.reloadQuests();
cs.sendMessage(ChatColor.GOLD + Lang.get("questsReloaded"));
String msg = Lang.get("numQuestsLoaded");
msg = msg.replace("<number>", ChatColor.DARK_PURPLE + String.valueOf(plugin.getQuests().size()) + ChatColor.GOLD);
msg = msg.replace("<number>", ChatColor.DARK_PURPLE + String.valueOf(plugin.getQuests().size())
+ ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg);
} else {
cs.sendMessage(ChatColor.RED + Lang.get("noPermission"));
@ -920,8 +959,10 @@ public class CmdExecutor implements CommandExecutor {
for (Quest q : quester.getCurrentQuests().keySet()) {
if (q.getName().equalsIgnoreCase(questToGive.getName())) {
String msg = Lang.get("questsPlayerHasQuestAlready");
msg = msg.replace("<player>", ChatColor.ITALIC + "" + ChatColor.GREEN + target.getName() + ChatColor.RESET + ChatColor.YELLOW);
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE + questToGive.getName() + ChatColor.RESET + ChatColor.YELLOW);
msg = msg.replace("<player>", ChatColor.ITALIC + "" + ChatColor.GREEN + target.getName()
+ ChatColor.RESET + ChatColor.YELLOW);
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ questToGive.getName() + ChatColor.RESET + ChatColor.YELLOW);
cs.sendMessage(ChatColor.YELLOW + msg);
return;
}
@ -1200,7 +1241,8 @@ public class CmdExecutor implements CommandExecutor {
quest.delete();
String msg = Lang.get("questReset");
if (Bukkit.getOfflinePlayer(id).getName() != null) {
msg = msg.replace("<player>", ChatColor.GREEN + Bukkit.getOfflinePlayer(id).getName() + ChatColor.GOLD);
msg = msg.replace("<player>", ChatColor.GREEN + Bukkit.getOfflinePlayer(id).getName()
+ ChatColor.GOLD);
} else {
msg = msg.replace("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
}
@ -1242,7 +1284,8 @@ public class CmdExecutor implements CommandExecutor {
}
String msg = Lang.get("questRemoved");
if (Bukkit.getOfflinePlayer(quester.getUUID()).getName() != null) {
msg = msg.replace("<player>", ChatColor.GREEN + Bukkit.getOfflinePlayer(quester.getUUID()).getName() + ChatColor.GOLD);
msg = msg.replace("<player>", ChatColor.GREEN + Bukkit.getOfflinePlayer(quester.getUUID()).getName()
+ ChatColor.GOLD);
} else {
msg = msg.replace("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
}
@ -1263,60 +1306,76 @@ public class CmdExecutor implements CommandExecutor {
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands();
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.stats")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats") + ChatColor.RED));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS")
: "stats") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.give")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give") + ChatColor.RED));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE")
: "give") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.quit")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit") + ChatColor.RED));
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT")
: "quit") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.points")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_POINTS_HELP") .replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.takepoints")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP") .replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints")
+ ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.givepoints")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints")
+ ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.pointsall")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.finish")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_FINISH_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.nextstage")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.setstage")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reset")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED+ Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET")
: "reset") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.remove")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove") + ChatColor.RED));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reload")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload") + ChatColor.RED));
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload") + ChatColor.RED));
}
}
public String getQuestadminCommandUsage(String cmd) {
return ChatColor.RED + Lang.get("usage") + ": " + ChatColor.YELLOW + "/questadmin " + Lang.get(Lang.getCommandKey(cmd) + "_HELP");
return ChatColor.RED + Lang.get("usage") + ": " + ChatColor.YELLOW + "/questadmin "
+ Lang.get(Lang.getCommandKey(cmd) + "_HELP");
}
private static Map<String, Integer> sort(Map<String, Integer> unsortedMap) {

View File

@ -46,7 +46,8 @@ public class DungeonsListener implements Listener {
Player p = event.getDPlayer().getPlayer();
if (i != null && p != null) {
if (Lang.get("questDungeonsInvite").length() > 0) {
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite").replace("<player>", p.getName()));
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite")
.replace("<player>", p.getName()));
}
if (Lang.get("questDungeonsJoin").length() > 0) {
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questDungeonsJoin").replace("<player>", i.getName()));

View File

@ -55,7 +55,8 @@ public class NpcListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onNPCRightClick(NPCRightClickEvent evt) {
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getClicker())) {
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID " + evt.getNPC().getId());
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID "
+ evt.getNPC().getId());
return;
}
if (evt.getClicker().isConversing() == false) {
@ -90,64 +91,85 @@ public class NpcListener implements Listener {
String text = "";
boolean hasMeta = hand.hasItemMeta();
if (hasMeta) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC + (hand.getItemMeta().hasDisplayName() ? hand.getItemMeta().getDisplayName() + ChatColor.GRAY + " (" : "");
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC
+ (hand.getItemMeta().hasDisplayName() ? hand.getItemMeta().getDisplayName()
+ ChatColor.GRAY + " (" : "");
}
text += ChatColor.AQUA + "<item>" + (hand.getDurability() != 0 ? (":" + ChatColor.BLUE + hand.getDurability()) : "") + ChatColor.GRAY;
text += ChatColor.AQUA + "<item>" + (hand.getDurability() != 0 ? (":" + ChatColor.BLUE
+ hand.getDurability()) : "") + ChatColor.GRAY;
if (hasMeta) {
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
}
text += " x " + ChatColor.DARK_AQUA + hand.getAmount() + ChatColor.GRAY;
if (plugin.getSettings().canTranslateItems() && !hasMeta && !hand.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(player, Lang.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand.getType(), hand.getDurability(), null);
if (plugin.getSettings().canTranslateItems() && !hasMeta
&& !hand.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(player, Lang
.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand
.getType(), hand.getDurability(), null);
} else {
player.sendMessage(Lang.get(player, "questInvalidDeliveryItem").replace("<item>", text).replace("<item>", ItemUtil.getName(hand)));
player.sendMessage(Lang.get(player, "questInvalidDeliveryItem")
.replace("<item>", text).replace("<item>", ItemUtil.getName(hand)));
}
switch (reasonCode) {
case 1:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "one item is null"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "one item is null"));
break;
case 0:
// Should never happen
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "ERROR"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "ERROR"));
break;
case -1:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "name"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "name"));
break;
case -2:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "amount"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "amount"));
break;
case -3:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "durability"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "durability"));
break;
case -4:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "display name or lore"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "display name or lore"));
break;
case -5:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "enchantments"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "enchantments"));
break;
case -6:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "stored enchants"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "stored enchants"));
break;
case -7:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "item flags"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "item flags"));
break;
case -8:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "book data"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "book data"));
break;
case -9:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "potion type"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "potion type"));
break;
default:
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "unknown"));
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
.replace("<data>", "unknown"));
}
if (hasMeta) {
if (hand.getType().equals(Material.ENCHANTED_BOOK)) {
EnchantmentStorageMeta esmeta = (EnchantmentStorageMeta) hand.getItemMeta();
if (esmeta.hasStoredEnchants()) {
// TODO translate enchantment names
for (Entry<Enchantment, Integer> e : esmeta.getStoredEnchants().entrySet()) {
for (Entry<Enchantment, Integer> e : esmeta.getStoredEnchants()
.entrySet()) {
player.sendMessage(ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN
+ ItemUtil.getPrettyEnchantmentName(e.getKey()) + " " + RomanNumeral.getNumeral(e.getValue()) + "\n");
+ ItemUtil.getPrettyEnchantmentName(e.getKey()) + " "
+ RomanNumeral.getNumeral(e.getValue()) + "\n");
}
}
}
@ -162,7 +184,9 @@ public class NpcListener implements Listener {
boolean hasObjective = false;
for (Quest quest : quester.getCurrentQuests().keySet()) {
if (quester.containsObjective(quest, "talkToNPC")) {
if (quester.getQuestData(quest) != null && quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
if (quester.getQuestData(quest) != null
&& quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId())
&& quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
hasObjective = true;
}
quester.interactWithNPC(quest, evt.getNPC());
@ -175,14 +199,17 @@ public class NpcListener implements Listener {
if (quester.getCurrentQuests().containsKey(q))
continue;
if (q.getNpcStart() != null && q.getNpcStart().getId() == evt.getNPC().getId()) {
if (plugin.getSettings().canIgnoreLockedQuests() && (quester.getCompletedQuests().contains(q.getName()) == false || q.getPlanner().getCooldown() > -1)) {
if (plugin.getSettings().canIgnoreLockedQuests()
&& (quester.getCompletedQuests().contains(q.getName()) == false
|| q.getPlanner().getCooldown() > -1)) {
if (q.testRequirements(quester)) {
npcQuests.add(q);
if (q.getGUIDisplay() != null) {
hasAtLeastOneGUI = true;
}
}
} else if (quester.getCompletedQuests().contains(q.getName()) == false || q.getPlanner().getCooldown() > -1) {
} else if (quester.getCompletedQuests().contains(q.getName()) == false
|| q.getPlanner().getCooldown() > -1) {
npcQuests.add(q);
if (q.getGUIDisplay() != null) {
hasAtLeastOneGUI = true;
@ -193,7 +220,8 @@ public class NpcListener implements Listener {
if (npcQuests.isEmpty() == false && npcQuests.size() == 1) {
Quest q = npcQuests.get(0);
if (!quester.getCompletedQuests().contains(q.getName())) {
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests()
|| plugin.getSettings().getMaxQuests() < 1) {
quester.setQuestToTake(q.getName());
String s = extracted(quester);
for (String msg : s.split("<br>")) {
@ -213,15 +241,18 @@ public class NpcListener implements Listener {
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
player.sendMessage(ChatColor.YELLOW + msg);
}
} else if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
} else if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests()
|| plugin.getSettings().getMaxQuests() < 1) {
if (quester.getCooldownDifference(q) > 0) {
String early = Lang.get(player, "questTooEarly");
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getCooldownDifference(q)) + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE
+ Quests.getTime(quester.getCooldownDifference(q)) + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
} else if (q.getPlanner().getCooldown() < 0) {
String completed = Lang.get(player, "questAlreadyCompleted");
completed = completed.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
completed = completed.replace("<quest>", ChatColor.AQUA + q.getName()
+ ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
quester.setQuestToTake(q.getName());
@ -261,14 +292,16 @@ public class NpcListener implements Listener {
@EventHandler
public void onNPCLeftClick(NPCLeftClickEvent evt) {
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getClicker())) {
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + Lang.get("id") + " " + evt.getNPC().getId());
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN
+ Lang.get("id") + " " + evt.getNPC().getId());
}
}
@EventHandler
public void onNPCDeath(NPCDeathEvent evt) {
if (evt.getNPC().getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getNPC().getEntity().getLastDamageCause();
EntityDamageByEntityEvent damageEvent
= (EntityDamageByEntityEvent) evt.getNPC().getEntity().getLastDamageCause();
Entity damager = damageEvent.getDamager();
if (damager != null) {
if (damager instanceof Projectile) {
@ -311,6 +344,8 @@ public class NpcListener implements Listener {
}
private String extracted(final Quester quester) {
return MessageFormat.format("{0}- {1}{2}{3} -\n\n{4}{5}\n", ChatColor.GOLD, ChatColor.DARK_PURPLE, quester.getQuestToTake(), ChatColor.GOLD, ChatColor.RESET, plugin.getQuest(quester.getQuestToTake()).getDescription());
return MessageFormat.format("{0}- {1}{2}{3} -\n\n{4}{5}\n", ChatColor.GOLD, ChatColor.DARK_PURPLE,
quester.getQuestToTake(), ChatColor.GOLD, ChatColor.RESET, plugin.getQuest(quester.getQuestToTake())
.getDescription());
}
}

View File

@ -88,17 +88,20 @@ public class PlayerListener implements Listener {
public void onInventoryClickEvent(InventoryClickEvent evt) {
InventoryAction ac = evt.getAction();
if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem())) {
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_SLOT) || ac.equals(InventoryAction.DROP_ONE_SLOT)) {
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_SLOT)
|| ac.equals(InventoryAction.DROP_ONE_SLOT)) {
evt.setCancelled(true);
return;
}
} else if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCursor())) {
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_CURSOR) || ac.equals(InventoryAction.DROP_ONE_CURSOR)) {
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_CURSOR)
|| ac.equals(InventoryAction.DROP_ONE_CURSOR)) {
evt.setCancelled(true);
return;
}
}
if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem()) || ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {
if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem())
|| ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {
int upper = evt.getView().getTopInventory().getSize();
if (evt.getView().getTopInventory().getType().equals(InventoryType.CRAFTING))
upper += 4;
@ -117,21 +120,27 @@ public class PlayerListener implements Listener {
for (Quest quest : plugin.getQuests()) {
if (quest.getGUIDisplay() != null) {
if (ItemUtil.compareItems(clicked, quest.getGUIDisplay(), false) == 0) {
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests() > 0) {
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests()
&& plugin.getSettings().getMaxQuests() > 0) {
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
player.sendMessage(ChatColor.YELLOW + msg);
} else if (quester.getCompletedQuests().contains(quest.getName()) && quest.getPlanner().getCooldown() < 0) {
} else if (quester.getCompletedQuests().contains(quest.getName())
&& quest.getPlanner().getCooldown() < 0) {
String completed = Lang.get(player, "questAlreadyCompleted");
completed = completed.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
completed = completed.replace("<quest>", ChatColor.AQUA + quest.getName()
+ ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
boolean takeable = true;
if (quester.getCompletedQuests().contains(quest.getName())) {
if (quester.getCooldownDifference(quest) > 0) {
String early = Lang.get(player, "questTooEarly");
early = early.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getCooldownDifference(quest)) + ChatColor.YELLOW);
early = early.replace("<quest>", ChatColor.AQUA + quest.getName()
+ ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE
+ Quests.getTime(quester.getCooldownDifference(quest))
+ ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
takeable = false;
}
@ -139,7 +148,8 @@ public class PlayerListener implements Listener {
if (quest.getRegion() != null) {
if (!quest.isInRegion(quester)) {
String invalidLoc = Lang.get(player, "questInvalidLocation");
invalidLoc = invalidLoc.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
invalidLoc = invalidLoc.replace("<quest>", ChatColor.AQUA + quest.getName()
+ ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + invalidLoc);
takeable = false;
}
@ -164,7 +174,8 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryDragEvent(InventoryDragEvent evt) {
if (ItemUtil.isItem(evt.getOldCursor()) && ItemUtil.isJournal(evt.getOldCursor()) || ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {
if (ItemUtil.isItem(evt.getOldCursor()) && ItemUtil.isJournal(evt.getOldCursor())
|| ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {
int upper = evt.getView().getTopInventory().getSize();
if (evt.getView().getTopInventory().getType().equals(InventoryType.CRAFTING))
upper += 4;
@ -204,9 +215,11 @@ public class PlayerListener implements Listener {
final Player player = evt.getPlayer();
boolean hasObjective = false;
if (evt.isCancelled() == false) {
final ItemStack blockItemStack = new ItemStack(evt.getClickedBlock().getType(), 1, evt.getClickedBlock().getState().getData().toItemStack().getDurability());
final ItemStack blockItemStack = new ItemStack(evt.getClickedBlock().getType(), 1, evt
.getClickedBlock().getState().getData().toItemStack().getDurability());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "useBlock")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "useBlock")) {
quester.useBlock(quest, blockItemStack);
hasObjective = true;
}
@ -218,95 +231,137 @@ public class PlayerListener implements Listener {
}
}
if (!hasObjective) {
if (plugin.getQuestFactory().getSelectedBlockStarts().containsKey(evt.getPlayer().getUniqueId())) {
if (plugin.getQuestFactory().getSelectedBlockStarts().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedBlockStarts();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getQuestFactory().setSelectedBlockStarts(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation")
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getEventFactory().getSelectedExplosionLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getEventFactory().getSelectedExplosionLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedExplosionLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getEventFactory().setSelectedExplosionLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY()
+ ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getEventFactory().getSelectedEffectLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getEventFactory().getSelectedEffectLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedEffectLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getEventFactory().setSelectedEffectLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY()
+ ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getEventFactory().getSelectedMobLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getEventFactory().getSelectedMobLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedMobLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getEventFactory().setSelectedMobLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY()
+ ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getEventFactory().getSelectedLightningLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getEventFactory().getSelectedLightningLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedLightningLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getEventFactory().setSelectedLightningLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY()
+ ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getEventFactory().getSelectedTeleportLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getEventFactory().getSelectedTeleportLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedTeleportLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getEventFactory().setSelectedTeleportLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY()
+ ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getQuestFactory().getSelectedKillLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getQuestFactory().getSelectedKillLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getQuestFactory().setSelectedKillLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY()
+ ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (plugin.getQuestFactory().getSelectedReachLocations().containsKey(evt.getPlayer().getUniqueId())) {
} else if (plugin.getQuestFactory().getSelectedReachLocations().containsKey(evt.getPlayer()
.getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
temp.put(evt.getPlayer().getUniqueId(), block);
plugin.getQuestFactory().setSelectedReachLocations(temp);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", "
+ loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
+ ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.setCancelled(true);
} else if (player.isConversing() == false) {
for (final Quest q : plugin.getQuests()) {
if (q.getBlockStart() != null) {
if (q.getBlockStart().equals(evt.getClickedBlock().getLocation())) {
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests() > 0) {
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests()
&& plugin.getSettings().getMaxQuests() > 0) {
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
player.sendMessage(ChatColor.YELLOW + msg);
} else {
if (quester.getCompletedQuests().contains(q.getName())) {
if (q.getPlanner().getCooldown() > -1 && (quester.getCooldownDifference(q)) > 0) {
if (q.getPlanner().getCooldown() > -1
&& (quester.getCooldownDifference(q)) > 0) {
String early = Lang.get(player, "questTooEarly");
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getCooldownDifference(q)) + ChatColor.YELLOW);
early = early.replace("<quest>", ChatColor.AQUA + q.getName()
+ ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE
+ Quests.getTime(quester.getCooldownDifference(q))
+ ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
return;
} else if (quester.getCompletedQuests().contains(q.getName()) && q.getPlanner().getCooldown() < 0) {
} else if (quester.getCompletedQuests().contains(q.getName())
&& q.getPlanner().getCooldown() < 0) {
String completed = Lang.get(player, "questAlreadyCompleted");
completed = completed.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
completed = completed.replace("<quest>", ChatColor.AQUA
+ q.getName() + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
return;
}
}
quester.setQuestToTake(q.getName());
String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.getQuestToTake() + ChatColor.GOLD + " -\n" + "\n" + ChatColor.RESET + plugin.getQuest(quester.getQuestToTake()).getDescription() + "\n";
String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE
+ quester.getQuestToTake() + ChatColor.GOLD + " -\n" + "\n"
+ ChatColor.RESET + plugin.getQuest(quester.getQuestToTake())
.getDescription() + "\n";
for (String msg : s.split("<br>")) {
player.sendMessage(msg);
}
@ -342,14 +397,16 @@ public class PlayerListener implements Listener {
if (quester.getCurrentQuests().containsKey(quest)) {
final Stage currentStage = quester.getCurrentStage(quest);
if (currentStage == null) {
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString() + " on chat for quest " + quest.getName());
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
+ " on chat for quest " + quest.getName());
continue;
}
if (currentStage.getChatEvents().isEmpty() == false) {
String chat = evt.getMessage();
for (final String s : currentStage.getChatEvents().keySet()) {
if (s.equalsIgnoreCase(chat)) {
if (quester.getQuestData(quest).eventFired.get(s) == null || quester.getQuestData(quest).eventFired.get(s) == false) {
if (quester.getQuestData(quest).eventFired.get(s) == null
|| quester.getQuestData(quest).eventFired.get(s) == false) {
new BukkitRunnable() {
@Override
public void run() {
@ -383,23 +440,27 @@ public class PlayerListener implements Listener {
for (Quest quest : quester.getCurrentQuests().keySet()) {
if (!quest.getOptions().getAllowCommands()) {
if (!evt.getMessage().startsWith("/quest")) {
evt.getPlayer().sendMessage(ChatColor.RED + Lang.get(evt.getPlayer(), "optCommandsDenied").replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED));
evt.getPlayer().sendMessage(ChatColor.RED + Lang.get(evt.getPlayer(), "optCommandsDenied")
.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED));
evt.setCancelled(true);
plugin.getLogger().info("Player " + evt.getPlayer().getName() + " tried to use command " + evt.getMessage()
+ " but was denied because they are currently on quest " + quest.getName());
plugin.getLogger().info("Player " + evt.getPlayer().getName() + " tried to use command "
+ evt.getMessage() + " but was denied because they are currently on quest "
+ quest.getName());
return;
}
}
Stage currentStage = quester.getCurrentStage(quest);
if (currentStage == null) {
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString() + " on command for quest " + quest.getName());
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
+ " on command for quest " + quest.getName());
continue;
}
if (currentStage.getCommandEvents().isEmpty() == false) {
String command = evt.getMessage();
for (String s : currentStage.getCommandEvents().keySet()) {
if (command.equalsIgnoreCase("/" + s)) {
if (quester.getQuestData(quest).eventFired.get(s) == null || quester.getQuestData(quest).eventFired.get(s) == false) {
if (quester.getQuestData(quest).eventFired.get(s) == null
|| quester.getQuestData(quest).eventFired.get(s) == false) {
currentStage.getCommandEvents().get(s).fire(quester, quest);
quester.getQuestData(quest).eventFired.put(s, true);
}
@ -415,7 +476,8 @@ public class PlayerListener implements Listener {
@EventHandler
public void onBlockDamage(BlockDamageEvent evt) {
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState()
.getData().toItemStack().getDurability());
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "damageBlock")) {
@ -434,11 +496,13 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockPlaceEvent evt) {
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState()
.getData().toItemStack().getDurability());
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (evt.isCancelled() == false) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "placeBlock")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "placeBlock")) {
quester.placeBlock(quest, blockItemStack);
}
@ -455,11 +519,13 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent evt) {
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState()
.getData().toItemStack().getDurability());
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (evt.isCancelled() == false) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "breakBlock")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "breakBlock")) {
if (!evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
quester.breakBlock(quest, blockItemStack);
}
@ -470,7 +536,8 @@ public class PlayerListener implements Listener {
}
return null;
});
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "placeBlock")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "placeBlock")) {
for (ItemStack is : quester.getQuestData(quest).blocksPlaced) {
if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
int index = quester.getQuestData(quest).blocksPlaced.indexOf(is);
@ -512,7 +579,8 @@ public class PlayerListener implements Listener {
Sheep sheep = (Sheep) evt.getEntity();
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "shearSheep")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "shearSheep")) {
quester.shearSheep(quest, sheep.getColor());
}
@ -554,7 +622,8 @@ public class PlayerListener implements Listener {
final ItemStack craftedItem = getCraftedItem(evt);
Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "craftItem")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "craftItem")) {
quester.craftItem(quest, craftedItem);
}
@ -597,7 +666,8 @@ public class PlayerListener implements Listener {
if (evt.getSlotType() == SlotType.RESULT) {
Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "smeltItem")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "smeltItem")) {
quester.smeltItem(quest, evt.getCurrentItem());
}
@ -611,7 +681,8 @@ public class PlayerListener implements Listener {
if (evt.getSlotType() == SlotType.CRAFTING) {
Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "brewItem")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "brewItem")) {
quester.brewItem(quest, evt.getCurrentItem());
}
@ -779,7 +850,8 @@ public class PlayerListener implements Listener {
}
/**
* Checks if damager is blacklisted. Ensures damager and target are Player and not NPC. Kills target Player if objective exists
* Checks if damager is blacklisted. Ensures damager and target are Player and not NPC.
* Kills target Player if objective exists
*
* @param damager the attacking entity
* @param target the entity being attacked
@ -818,7 +890,8 @@ public class PlayerListener implements Listener {
if (plugin.canUseQuests(player.getUniqueId())) {
Quester quester = plugin.getQuester(player.getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "catchFish")
&& evt.getState().equals(State.CAUGHT_FISH)) {
quester.catchFish(quest);
}
@ -873,7 +946,8 @@ public class PlayerListener implements Listener {
for (String s : quester.getCompletedQuests()) {
Quest q = plugin.getQuest(s);
if (q != null) {
if (quester.getCompletedTimes().containsKey(q.getName()) == false && q.getPlanner().getCooldown() > -1) {
if (quester.getCompletedTimes().containsKey(q.getName()) == false
&& q.getPlanner().getCooldown() > -1) {
quester.getCompletedTimes().put(q.getName(), System.currentTimeMillis());
}
}
@ -898,7 +972,8 @@ public class PlayerListener implements Listener {
for (Quest quest : quester.getCurrentQuests().keySet()) {
Stage currentStage = quester.getCurrentStage(quest);
if (currentStage == null) {
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString() + " on quit for quest " + quest.getName());
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
+ " on quit for quest " + quest.getName());
continue;
}
if (currentStage.getDelay() > -1) {
@ -949,7 +1024,8 @@ public class PlayerListener implements Listener {
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
for (Quest quest : plugin.getQuests()) {
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "reachLocation")) {
if (quester.getCurrentQuests().containsKey(quest)
&& quester.containsObjective(quest, "reachLocation")) {
quester.reachLocation(quest, evt.getTo());
}

View File

@ -13,7 +13,6 @@
package me.blackvein.quests.particle;
import java.util.Map;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
@ -28,18 +27,21 @@ public abstract class ParticleProvider {
String packageName = ParticleProvider.class.getPackage().getName();
String internalsName = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
if (internalsName.startsWith("v1_8_R")) {
loaded = (ParticleProvider) Class.forName(packageName + ".ParticleProvider_" + internalsName).newInstance();
loaded = (ParticleProvider) Class.forName(packageName + ".ParticleProvider_" + internalsName)
.newInstance();
} else {
loaded = new ParticleProvider_Bukkit();
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException exception) {
Bukkit.getLogger().log(Level.SEVERE, "Quests could not find a valid implementation for this server version.");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| ClassCastException exception) {
Bukkit.getLogger().severe("[Quests] Could not find a valid implementation for this server version.");
}
}
abstract Map<PreBuiltParticle, Object> getParticleMap();
abstract void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data);
abstract void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY,
float offsetZ, float speed, int count, int[] data);
/**
* Sends the particle to the player.
@ -65,7 +67,8 @@ public abstract class ParticleProvider {
* packets such as block crack or particle colour on redstone /
* firework particles.
*/
public static void sendToPlayer(Player player, Location location, String particleId, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
public static void sendToPlayer(Player player, Location location, String particleId, float offsetX, float offsetY,
float offsetZ, float speed, int count, int[] data) {
Object particle;
PreBuiltParticle pbp = PreBuiltParticle.fromIdentifier(particleId);
if (pbp != null) {
@ -124,8 +127,7 @@ public abstract class ParticleProvider {
if (particle.getVector() != null) {
pos.add(particle.getVector());
}
loaded.spawnParticle(player, pos,
loaded.getParticleMap().get(particle),
particle.getOffsetX(), particle.getOffsetY(), particle.getOffsetZ(), particle.getSpeed(), particle.getCount(), null);
loaded.spawnParticle(player, pos, loaded.getParticleMap().get(particle), particle.getOffsetX(),
particle.getOffsetY(), particle.getOffsetZ(), particle.getSpeed(),particle.getCount(), null);
}
}

View File

@ -43,7 +43,8 @@ class ParticleProvider_Bukkit extends ParticleProvider {
}
@Override
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ,
float speed, int count, int[] data) {
player.spawnParticle((Particle) particle, location, count, offsetX, offsetY, offsetZ, speed, data);
}
}

View File

@ -53,7 +53,8 @@ public enum PreBuiltParticle {
this.count = count;
}
PreBuiltParticle(String identifier, float offsetX, float offsetY, float offsetZ, float speed, int count, Vector vector) {
PreBuiltParticle(String identifier, float offsetX, float offsetY, float offsetZ, float speed, int count,
Vector vector) {
this(identifier, offsetX, offsetY, offsetZ, speed, count);
this.vector = vector;
}

View File

@ -48,56 +48,72 @@ public class BlocksPrompt extends FixedSetPrompt {
context.setSessionData(pref, Boolean.TRUE);
String text = ChatColor.AQUA + "- " + Lang.get("stageEditorBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorBreakBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorBreakBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorBreakBlocks") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorBreakBlocks") + "\n";
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_BREAK_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_AMOUNTS);
for (int i = 0; i < names.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
+ ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorDamageBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorDamageBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorDamageBlocks") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorDamageBlocks") + "\n";
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_DAMAGE_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
for (int i = 0; i < names.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
+ ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorPlaceBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorPlaceBlocks") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorPlaceBlocks") + "\n";
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_PLACE_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_PLACE_AMOUNTS);
for (int i = 0; i < names.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
+ ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
if (context.getSessionData(pref + CK.S_USE_NAMES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorUseBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorUseBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorUseBlocks") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorUseBlocks") + "\n";
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_USE_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS);
for (int i = 0; i < names.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
+ ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCutBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorCutBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCutBlocks") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorCutBlocks") + "\n";
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_CUT_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUT_AMOUNTS);
for (int i = 0; i < names.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
+ ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "6 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "6 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -132,34 +148,46 @@ public class BlocksPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorBreakBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + "\n";
for (String s : getBlockNames(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
}
if (context.getSessionData(pref + CK.S_BREAK_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockAmounts") + "\n";
for (Integer i : getBlockAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_BREAK_DURABILITY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} 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 (Short s : getBlockDurability(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -260,15 +288,18 @@ public class BlocksPrompt extends FixedSetPrompt {
if (m.isBlock()) {
names.add(s);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorNotSolid"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorNotSolid"));
return new BreakBlockNamesPrompt();
}
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorInvalidBlockName"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidBlockName"));
return new BreakBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new BreakBlockNamesPrompt();
}
}
@ -295,11 +326,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new BreakBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new BreakBlockAmountsPrompt();
}
}
@ -326,11 +359,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Short.parseShort(s) >= 0) {
durability.add(Short.parseShort(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new BreakBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new BreakBlockDurabilityPrompt();
}
}
@ -350,34 +385,46 @@ public class BlocksPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorDamageBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + "\n";
for (String s : getBlockNames(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
}
if (context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetDamageAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetDamageAmounts") + "\n";
for (Integer i : getBlockAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_DAMAGE_DURABILITY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} 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 (Short s : getBlockDurability(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -478,15 +525,18 @@ public class BlocksPrompt extends FixedSetPrompt {
if (m.isBlock()) {
names.add(s);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorNotSolid"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorNotSolid"));
return new DamageBlockNamesPrompt();
}
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorInvalidBlockName"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidBlockName"));
return new DamageBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockNamesPrompt();
}
}
@ -513,11 +563,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new DamageBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockAmountsPrompt();
}
}
@ -544,11 +596,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Short.parseShort(s) >= 0) {
durability.add(Short.parseShort(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new DamageBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockDurabilityPrompt();
}
}
@ -568,34 +622,46 @@ public class BlocksPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorPlaceBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + "\n";
for (String s : getBlockNames(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
}
if (context.getSessionData(pref + CK.S_PLACE_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetPlaceAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetPlaceAmounts") + "\n";
for (Integer i : getBlockAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_PLACE_DURABILITY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} 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 (Short s : getBlockDurability(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -696,15 +762,18 @@ public class BlocksPrompt extends FixedSetPrompt {
if (m.isBlock()) {
names.add(s);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorNotSolid"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorNotSolid"));
return new PlaceBlockNamesPrompt();
}
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorInvalidBlockName"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED
+ Lang.get("stageEditorInvalidBlockName"));
return new PlaceBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockNamesPrompt();
}
}
@ -731,11 +800,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new PlaceBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockAmountsPrompt();
}
}
@ -762,11 +833,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Short.parseShort(s) >= 0) {
durability.add(Short.parseShort(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new PlaceBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockDurabilityPrompt();
}
}
@ -786,34 +859,46 @@ public class BlocksPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_USE_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + "\n";
for (String s : getBlockNames(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
}
if (context.getSessionData(pref + CK.S_USE_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetUseAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetUseAmounts") + "\n";
for (Integer i : getBlockAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_USE_DURABILITY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} 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 (Short s : getBlockDurability(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -914,15 +999,18 @@ public class BlocksPrompt extends FixedSetPrompt {
if (m.isBlock()) {
names.add(s);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorNotSolid"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorNotSolid"));
return new UseBlockNamesPrompt();
}
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorInvalidBlockName"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidBlockName"));
return new UseBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new UseBlockNamesPrompt();
}
}
@ -949,11 +1037,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new UseBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new UseBlockAmountsPrompt();
}
}
@ -980,11 +1070,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Short.parseShort(s) >= 0) {
durability.add(Short.parseShort(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new UseBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new UseBlockDurabilityPrompt();
}
}
@ -1004,34 +1096,46 @@ public class BlocksPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCutBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + " (" + Lang.get("noNamesSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetBlockNames") + "\n";
for (String s : getBlockNames(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
}
if (context.getSessionData(pref + CK.S_CUT_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetCutAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetCutAmounts") + "\n";
for (Integer i : getBlockAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_CUT_DURABILITY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetBlockDurability") + " (" + Lang.get("noneSet") + ")\n";
} 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 (Short s : getBlockDurability(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -1132,15 +1236,18 @@ public class BlocksPrompt extends FixedSetPrompt {
if (m.isBlock()) {
names.add(s);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorNotSolid"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorNotSolid"));
return new CutBlockNamesPrompt();
}
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorInvalidBlockName"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidBlockName"));
return new CutBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new CutBlockNamesPrompt();
}
}
@ -1167,11 +1274,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "1"));
return new CutBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new CutBlockAmountsPrompt();
}
}
@ -1198,11 +1307,13 @@ public class BlocksPrompt extends FixedSetPrompt {
if (Short.parseShort(s) >= 0) {
durability.add(Short.parseShort(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("invalidMinimum").replace("<number>", "0"));
return new CutBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new CutBlockDurabilityPrompt();
}
}

View File

@ -228,21 +228,31 @@ public class CreateStagePrompt extends NumericPrompt {
public String getAdditionalText(ConversationContext context, int number) {
switch (number) {
case 1:
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null && context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null
&& context.getSessionData(pref + CK.S_PLACE_NAMES) == null && context.getSessionData(pref + CK.S_USE_NAMES) == null
&& context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null
&& context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null
&& context.getSessionData(pref + CK.S_PLACE_NAMES) == null
&& context.getSessionData(pref + CK.S_USE_NAMES) == null
&& context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 2:
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null && context.getSessionData(pref + CK.S_SMELT_ITEMS) == null && context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null && context.getSessionData(pref + CK.S_BREW_ITEMS) == null) {
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null
&& context.getSessionData(pref + CK.S_SMELT_ITEMS) == null
&& context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null
&& context.getSessionData(pref + CK.S_BREW_ITEMS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 3:
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null && context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null && context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null
&& context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null
&& context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 4:
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null && context.getSessionData(pref + CK.S_FISH) == null && context.getSessionData(pref + CK.S_TAME_TYPES) == null && context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null
&& context.getSessionData(pref + CK.S_FISH) == null
&& context.getSessionData(pref + CK.S_TAME_TYPES) == null
&& context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 5:
@ -250,18 +260,25 @@ public class CreateStagePrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
Integer players = (Integer) context.getSessionData(pref + CK.S_PLAYER_KILL);
return ChatColor.GRAY + "(" + ChatColor.AQUA + players + " " + Lang.get("stageEditorPlayers") + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + players + " " + Lang.get("stageEditorPlayers")
+ ChatColor.GRAY + ")";
}
case 6:
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
String text = "";
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(pref + CK.S_REACH_LOCATIONS);
LinkedList<Integer> radii = (LinkedList<Integer>) context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS);
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES);
LinkedList<String> locations
= (LinkedList<String>) context.getSessionData(pref + CK.S_REACH_LOCATIONS);
LinkedList<Integer> radii
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS);
LinkedList<String> names
= (LinkedList<String>) context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES);
for (int i = 0; i < locations.size(); i++) {
text += ChatColor.GRAY + " - " + Lang.get("stageEditorReachRadii1") + " " + ChatColor.BLUE + radii.get(i) + ChatColor.GRAY + " " + Lang.get("stageEditorReachRadii2") + " " + ChatColor.AQUA + names.get(i) + ChatColor.GRAY + " (" + ChatColor.DARK_AQUA + locations.get(i) + ChatColor.GRAY + ")\n";
text += ChatColor.GRAY + " - " + Lang.get("stageEditorReachRadii1") + " " + ChatColor.BLUE
+ radii.get(i) + ChatColor.GRAY + " " + Lang.get("stageEditorReachRadii2") + " "
+ ChatColor.AQUA + names.get(i) + ChatColor.GRAY + " (" + ChatColor.DARK_AQUA
+ locations.get(i) + ChatColor.GRAY + ")\n";
}
return text;
}
@ -270,8 +287,10 @@ public class CreateStagePrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
String text = "";
LinkedList<LinkedList<String>> passPhrases = (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<String> passDisplays = (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS);
LinkedList<LinkedList<String>> passPhrases
= (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<String> passDisplays
= (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS);
for (int i = 0; i < passPhrases.size(); i++) {
text += ChatColor.AQUA + " - \"" + passDisplays.get(i) + "\"\n";
LinkedList<String> phrases = passPhrases.get(i);
@ -286,8 +305,10 @@ public class CreateStagePrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
String text = "";
LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.DARK_PURPLE + " - " + Lang.get("stageEditorCustom") + "\n";
LinkedList<String> customObjs
= (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.DARK_PURPLE + " - "
+ Lang.get("stageEditorCustom") + "\n";
for (String s : customObjs) {
text += ChatColor.LIGHT_PURPLE + " - " + ChatColor.GOLD + s + "\n";
}
@ -314,7 +335,8 @@ public class CreateStagePrompt extends NumericPrompt {
} else if (context.getSessionData(pref + CK.S_DELAY_MESSAGE) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
+ context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")";
}
case 12:
if (plugin.getDependencies().getDenizenAPI() == null) {
@ -326,7 +348,8 @@ public class CreateStagePrompt extends NumericPrompt {
if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(pref + CK.S_DENIZEN) + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(pref + CK.S_DENIZEN)
+ ChatColor.GRAY + ")";
}
}
}
@ -338,7 +361,8 @@ public class CreateStagePrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
+ context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + ChatColor.GRAY + ")";
}
case 14:
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
@ -348,7 +372,8 @@ public class CreateStagePrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
+ context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + ChatColor.GRAY + ")";
}
case 15:
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
@ -358,7 +383,8 @@ public class CreateStagePrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\""
+ context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + ChatColor.GRAY + ")";
}
case 16:
case 17:
@ -373,12 +399,15 @@ public class CreateStagePrompt extends NumericPrompt {
context.setSessionData(pref, Boolean.TRUE);
checkObjective(context);
QuestsEditorPostOpenCreateStagePromptEvent event = new QuestsEditorPostOpenCreateStagePromptEvent(questFactory, stageNum, context);
QuestsEditorPostOpenCreateStagePromptEvent event
= new QuestsEditorPostOpenCreateStagePromptEvent(questFactory, stageNum, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.AQUA + getTitle(context).replaceFirst(" \\| ", ChatColor.LIGHT_PURPLE + " | ") + " -\n";
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.AQUA
+ getTitle(context).replaceFirst(" \\| ", ChatColor.LIGHT_PURPLE + " | ") + " -\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
}
return text;
}
@ -466,18 +495,28 @@ public class CreateStagePrompt extends NumericPrompt {
}
public void checkObjective(ConversationContext context) {
if (context.getSessionData(pref + CK.S_BREAK_NAMES) != null || context.getSessionData(pref + CK.S_DAMAGE_NAMES) != null
|| context.getSessionData(pref + CK.S_PLACE_NAMES) != null || context.getSessionData(pref + CK.S_USE_NAMES) != null
if (context.getSessionData(pref + CK.S_BREAK_NAMES) != null
|| context.getSessionData(pref + CK.S_DAMAGE_NAMES) != null
|| context.getSessionData(pref + CK.S_PLACE_NAMES) != null
|| context.getSessionData(pref + CK.S_USE_NAMES) != null
|| context.getSessionData(pref + CK.S_CUT_NAMES) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) != null || context.getSessionData(pref + CK.S_SMELT_ITEMS) != null || context.getSessionData(pref + CK.S_ENCHANT_TYPES) != null || context.getSessionData(pref + CK.S_BREW_ITEMS) != null) {
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) != null
|| context.getSessionData(pref + CK.S_SMELT_ITEMS) != null
|| context.getSessionData(pref + CK.S_ENCHANT_TYPES) != null
|| context.getSessionData(pref + CK.S_BREW_ITEMS) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) != null || context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) != null || context.getSessionData(pref + CK.S_NPCS_TO_KILL) != null) {
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) != null
|| context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) != null
|| context.getSessionData(pref + CK.S_NPCS_TO_KILL) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_MOB_TYPES) != null || context.getSessionData(pref + CK.S_FISH) != null || context.getSessionData(pref + CK.S_TAME_TYPES) != null || context.getSessionData(pref + CK.S_SHEAR_COLORS) != null) {
if (context.getSessionData(pref + CK.S_MOB_TYPES) != null
|| context.getSessionData(pref + CK.S_FISH) != null
|| context.getSessionData(pref + CK.S_TAME_TYPES) != null
|| context.getSessionData(pref + CK.S_SHEAR_COLORS) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_PLAYER_KILL) != null) {
@ -504,19 +543,26 @@ public class CreateStagePrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorPassword") + "-\n";
if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorAddPasswordDisplay") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorAddPasswordPhrases") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorAddPasswordDisplay") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorAddPasswordPhrases") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorAddPasswordDisplay") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorAddPasswordDisplay") + "\n";
for (String display : getPasswordDisplays(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + display + "\n";
}
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorAddPasswordPhrases") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorAddPasswordPhrases") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorAddPasswordPhrases") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorAddPasswordPhrases") + "\n";
for (LinkedList<String> phraseList : getPasswordPhrases(context)) {
text += ChatColor.GRAY + " - ";
for (String s : phraseList) {
@ -528,8 +574,10 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -560,7 +608,8 @@ public class CreateStagePrompt extends NumericPrompt {
one = 0;
}
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) {
two = ((LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES)).size();
two = ((LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES))
.size();
} else {
two = 0;
}
@ -626,7 +675,8 @@ public class CreateStagePrompt extends NumericPrompt {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) {
@SuppressWarnings("unchecked")
LinkedList<LinkedList<String>> phrases = (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<LinkedList<String>> phrases
= (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<String> newPhrases = new LinkedList<String>();
newPhrases.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
phrases.add(newPhrases);
@ -654,7 +704,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false
&& input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, input);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, null);
@ -673,7 +724,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
@ -683,7 +735,8 @@ public class CreateStagePrompt extends NumericPrompt {
context.setSessionData(pref + CK.S_PLAYER_KILL, i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new KillPlayerPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -703,34 +756,46 @@ public class CreateStagePrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorReachLocs") + " -\n";
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetLocations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetLocationNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetLocations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetLocationNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetLocations") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetLocations") + "\n";
for (String s : getLocations(context)) {
text += ChatColor.GRAY + " - " + ChatColor.DARK_AQUA + s + "\n";
}
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetLocationRadii") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetLocationRadii") + "\n";
for (Integer i : getLocationRadii(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetLocationNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetLocationNames") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetLocationNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetLocationNames") + "\n";
for (String s : getLocationNames(context)) {
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 + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -867,7 +932,8 @@ public class CreateStagePrompt extends NumericPrompt {
try {
int i = Integer.parseInt(s);
if (i < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new ReachRadiiPrompt();
}
radii.add(i);
@ -911,46 +977,70 @@ public class CreateStagePrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.AQUA + "- " + Lang.get("stageEditorStageEvents") + " -\n";
if (context.getSessionData(pref + CK.S_START_EVENT) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorStartEvent") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorStartEvent") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorStartEvent") + " (" + ChatColor.AQUA + ((String) context.getSessionData(pref + CK.S_START_EVENT)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorStartEvent") + " (" + ChatColor.AQUA
+ ((String) context.getSessionData(pref + CK.S_START_EVENT)) + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(pref + CK.S_FINISH_EVENT) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorFinishEvent") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorFinishEvent") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorFinishEvent") + " (" + ChatColor.AQUA + ((String) context.getSessionData(pref + CK.S_FINISH_EVENT)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorFinishEvent") + " (" + ChatColor.AQUA
+ ((String) context.getSessionData(pref + CK.S_FINISH_EVENT)) + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(pref + CK.S_DEATH_EVENT) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeathEvent") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeathEvent") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeathEvent") + " (" + ChatColor.AQUA + ((String) context.getSessionData(pref + CK.S_DEATH_EVENT)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeathEvent") + " (" + ChatColor.AQUA
+ ((String) context.getSessionData(pref + CK.S_DEATH_EVENT)) + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(pref + CK.S_DISCONNECT_EVENT) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDisconnectEvent") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDisconnectEvent") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDisconnectEvent") + " (" + ChatColor.AQUA + ((String) context.getSessionData(pref + CK.S_DISCONNECT_EVENT)) + ChatColor.YELLOW + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDisconnectEvent") + " (" + ChatColor.AQUA
+ ((String) context.getSessionData(pref + CK.S_DISCONNECT_EVENT)) + ChatColor.YELLOW + ")\n";
}
if (context.getSessionData(pref + CK.S_CHAT_EVENTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorChatEvents") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorChatEvents") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorChatEvents") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorChatEvents") + "\n";
LinkedList<String> chatEvents = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENTS);
LinkedList<String> chatEventTriggers = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
LinkedList<String> chatEventTriggers
= (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
for (String event : chatEvents) {
text += ChatColor.AQUA + " - " + event + ChatColor.BLUE + " (" + Lang.get("stageEditorTriggeredBy") + ": \"" + chatEventTriggers.get(chatEvents.indexOf(event)) + "\")\n";
text += ChatColor.AQUA + " - " + event + ChatColor.BLUE + " ("
+ Lang.get("stageEditorTriggeredBy") + ": \""
+ chatEventTriggers.get(chatEvents.indexOf(event)) + "\")\n";
}
}
if (context.getSessionData(pref + CK.S_COMMAND_EVENTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorCommandEvents") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorCommandEvents") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorCommandEvents") + "\n";
LinkedList<String> commandEvents = (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENTS);
LinkedList<String> commandEventTriggers = (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorCommandEvents") + "\n";
LinkedList<String> commandEvents
= (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENTS);
LinkedList<String> commandEventTriggers
= (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS);
for (String event : commandEvents) {
text += ChatColor.AQUA + " - " + event + ChatColor.BLUE + " (" + Lang.get("stageEditorTriggeredBy") + ": \"" + commandEventTriggers.get(commandEvents.indexOf(event)) + "\")\n";
text += ChatColor.AQUA + " - " + event + ChatColor.BLUE + " ("
+ Lang.get("stageEditorTriggeredBy") + ": \""
+ commandEventTriggers.get(commandEvents.indexOf(event)) + "\")\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("done");
text += ChatColor.GREEN + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("done");
return text;
}
@ -994,7 +1084,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action found = null;
for (Action e : plugin.getActions()) {
if (e.getName().equalsIgnoreCase(input)) {
@ -1003,7 +1094,8 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent"));
return new StartEventPrompt();
} else {
context.setSessionData(pref + CK.S_START_EVENT, found.getName());
@ -1039,7 +1131,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action found = null;
for (Action e : plugin.getActions()) {
if (e.getName().equalsIgnoreCase(input)) {
@ -1048,7 +1141,8 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent"));
return new FinishEventPrompt();
} else {
context.setSessionData(pref + CK.S_FINISH_EVENT, found.getName());
@ -1084,7 +1178,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action found = null;
for (Action e : plugin.getActions()) {
if (e.getName().equalsIgnoreCase(input)) {
@ -1093,7 +1188,8 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent"));
return new DeathEventPrompt();
} else {
context.setSessionData(pref + CK.S_DEATH_EVENT, found.getName());
@ -1129,7 +1225,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action found = null;
for (Action e : plugin.getActions()) {
if (e.getName().equalsIgnoreCase(input)) {
@ -1138,7 +1235,8 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent"));
return new DisconnectEventPrompt();
} else {
context.setSessionData(pref + CK.S_DISCONNECT_EVENT, found.getName());
@ -1174,7 +1272,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action found = null;
for (Action e : plugin.getActions()) {
if (e.getName().equalsIgnoreCase(input)) {
@ -1183,7 +1282,8 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent"));
return new ChatEventPrompt();
} else {
context.setSessionData(pref + CK.S_CHAT_TEMP_EVENT, found.getName());
@ -1208,7 +1308,8 @@ public class CreateStagePrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String tempEvent = (String) context.getSessionData(pref + CK.S_CHAT_TEMP_EVENT);
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorChatTrigger") + " -\n";
text += Lang.get("stageEditorChatEventsTriggerPrompt").replace("<event>", tempEvent).replace("<action>", tempEvent);
text += Lang.get("stageEditorChatEventsTriggerPrompt").replace("<event>", tempEvent)
.replace("<action>", tempEvent);
return text;
}
@ -1226,8 +1327,10 @@ public class CreateStagePrompt extends NumericPrompt {
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
return new EventListPrompt();
} else {
LinkedList<String> chatEvents = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENTS);
LinkedList<String> chatEventTriggers = (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
LinkedList<String> chatEvents
= (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENTS);
LinkedList<String> chatEventTriggers
= (LinkedList<String>) context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS);
String event = (String) context.getSessionData(pref + CK.S_CHAT_TEMP_EVENT);
chatEvents.add(event);
chatEventTriggers.add(input.trim());
@ -1261,7 +1364,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action found = null;
for (Action e : plugin.getActions()) {
if (e.getName().equalsIgnoreCase(input)) {
@ -1270,7 +1374,8 @@ public class CreateStagePrompt extends NumericPrompt {
}
}
if (found == null) {
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("stageEditorInvalidEvent"));
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("stageEditorInvalidEvent"));
return new CommandEventPrompt();
} else {
context.setSessionData(pref + CK.S_COMMAND_TEMP_EVENT, found.getName());
@ -1295,7 +1400,8 @@ public class CreateStagePrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String tempEvent = (String) context.getSessionData(pref + CK.S_COMMAND_TEMP_EVENT);
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCommandTrigger") + " -\n";
text += Lang.get("stageEditorCommandEventsTriggerPrompt").replace("<event>", tempEvent).replace("<action>", tempEvent);
text += Lang.get("stageEditorCommandEventsTriggerPrompt").replace("<event>", tempEvent)
.replace("<action>", tempEvent);
return text;
}
@ -1313,8 +1419,10 @@ public class CreateStagePrompt extends NumericPrompt {
context.setSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers);
return new EventListPrompt();
} else {
LinkedList<String> commandEvents = (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENTS);
LinkedList<String> commandEventTriggers = (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS);
LinkedList<String> commandEvents
= (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENTS);
LinkedList<String> commandEventTriggers
= (LinkedList<String>) context.getSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS);
String event = (String) context.getSessionData(pref + CK.S_COMMAND_TEMP_EVENT);
commandEvents.add(event);
commandEventTriggers.add(input.trim());
@ -1376,7 +1484,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
context.setSessionData(pref + CK.S_DELAY_MESSAGE, input);
return new CreateStagePrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -1403,7 +1512,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (plugin.getDependencies().getDenizenAPI().containsScript(input)) {
context.setSessionData(pref + CK.S_DENIZEN, input.toUpperCase());
return new CreateStagePrompt(plugin, stageNum, questFactory);
@ -1425,9 +1535,13 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - " + Lang.get("yesWord") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - " + Lang.get("noWord");
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW + Lang.get("stageEditorStage") + " " + stageNum + ChatColor.RED + ")\n" + ChatColor.GOLD + "(" + Lang.get("stageEditorConfirmStageNote") + ")\n" + text;
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - "
+ Lang.get("yesWord") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - "
+ Lang.get("noWord");
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW + Lang.get("stageEditorStage")
+ " " + stageNum + ChatColor.RED + ")\n" + ChatColor.GOLD + "("
+ Lang.get("stageEditorConfirmStageNote") + ")\n" + text;
}
@Override
@ -1456,7 +1570,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
context.setSessionData(pref + CK.S_START_MESSAGE, input);
return new CreateStagePrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -1479,7 +1594,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
context.setSessionData(pref + CK.S_COMPLETE_MESSAGE, input);
return new CreateStagePrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -1510,7 +1626,8 @@ public class CreateStagePrompt extends NumericPrompt {
@SuppressWarnings("unchecked")
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomObjective found = null;
// Check if we have a custom objective with the specified name
for (CustomObjective co : plugin.getCustomObjectives()) {
@ -1531,9 +1648,12 @@ public class CreateStagePrompt extends NumericPrompt {
if (found != null) {
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) {
// The custom objective may already have been added, so let's check that
LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
LinkedList<Entry<String, Object>> datamapList = (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
LinkedList<Integer> countList = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
LinkedList<String> list
= (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
LinkedList<Entry<String, Object>> datamapList = (LinkedList<Entry<String, Object>>) context
.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
LinkedList<Integer> countList
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
if (list.contains(found.getName()) == false) {
// Hasn't been added yet, so let's do it
list.add(found.getName());
@ -1543,7 +1663,8 @@ public class CreateStagePrompt extends NumericPrompt {
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList);
} else {
// Already added, so inform user
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorCustomAlreadyAdded"));
context.getForWhom().sendRawMessage(ChatColor.YELLOW
+ Lang.get("stageEditorCustomAlreadyAdded"));
return new CustomObjectivesPrompt();
}
} else {
@ -1563,7 +1684,8 @@ public class CreateStagePrompt extends NumericPrompt {
return new CustomObjectiveCountPrompt();
}
if (found.getData().isEmpty() == false) {
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, found.getDescriptions());
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, found
.getDescriptions());
return new ObjectiveCustomDataListPrompt();
}
} else {
@ -1607,7 +1729,8 @@ public class CreateStagePrompt extends NumericPrompt {
public Prompt acceptInput(ConversationContext context, String input) {
try {
int num = Integer.parseInt(input);
LinkedList<Integer> counts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
LinkedList<Integer> counts
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
counts.set(counts.size() - 1, num);
LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
String objName = list.getLast();
@ -1625,7 +1748,8 @@ public class CreateStagePrompt extends NumericPrompt {
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new CustomObjectiveCountPrompt();
}
}
@ -1638,7 +1762,8 @@ public class CreateStagePrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.AQUA + "- ";
LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
LinkedList<Entry<String, Object>> datamapList = (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
LinkedList<Entry<String, Object>> datamapList
= (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
String objName = list.getLast();
CustomObjective found = null;
for (CustomObjective co : plugin.getCustomObjectives()) {
@ -1655,7 +1780,8 @@ public class CreateStagePrompt extends NumericPrompt {
for (Entry<String, Object> datamap : found.getData()) {
for (Entry<String, Object> currentData : datamapList) {
if (currentData.getKey().equals(datamap.getKey())) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + index + ChatColor.RESET + ChatColor.YELLOW + " - " + datamap.getKey();
text += ChatColor.BLUE + "" + ChatColor.BOLD + index + ChatColor.RESET + ChatColor.YELLOW
+ " - " + datamap.getKey();
if (currentData.getValue() != null) {
text += ChatColor.GREEN + " (" + currentData.getValue().toString() + ")\n";
} else {
@ -1706,7 +1832,8 @@ public class CreateStagePrompt extends NumericPrompt {
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, selectedKey);
return new ObjectiveCustomDataPrompt();
} else {
for (Entry<String, Object> datamap : (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA)) {
for (Entry<String, Object> datamap : (LinkedList<Entry<String, Object>>) context.getSessionData(pref
+ CK.S_CUSTOM_OBJECTIVES_DATA)) {
if (datamap.getValue() == null) {
return new ObjectiveCustomDataListPrompt();
}
@ -1724,7 +1851,8 @@ public class CreateStagePrompt extends NumericPrompt {
String text = "";
String temp = (String) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP);
@SuppressWarnings("unchecked")
Map<String, String> descriptions = (Map<String, String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS);
Map<String, String> descriptions
= (Map<String, String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS);
if (descriptions.get(temp) != null) {
text += ChatColor.GOLD + descriptions.get(temp) + "\n";
}
@ -1737,7 +1865,8 @@ public class CreateStagePrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
@SuppressWarnings("unchecked")
LinkedList<Entry<String, Object>> datamapList = (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
LinkedList<Entry<String, Object>> datamapList
= (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
LinkedList<Entry<String, Object>> promptList = new LinkedList<Entry<String, Object>>();
String temp = (String) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP);
for (Entry<String, Object> datamap : datamapList) {

View File

@ -67,8 +67,9 @@ public class DateTimePrompt extends FixedSetPrompt {
if (cc.getSessionData("tempSecond") == null) {
cc.setSessionData("tempSecond", cal.get(Calendar.SECOND));
}
cal.set((Integer) cc.getSessionData("tempYear"), (Integer) cc.getSessionData("tempMonth"), (Integer) cc.getSessionData("tempDay"),
(Integer) cc.getSessionData("tempHour"), (Integer) cc.getSessionData("tempMinute"), (Integer) cc.getSessionData("tempSecond"));
cal.set((Integer) cc.getSessionData("tempYear"), (Integer) cc.getSessionData("tempMonth"),
(Integer) cc.getSessionData("tempDay"), (Integer) cc.getSessionData("tempHour"),
(Integer) cc.getSessionData("tempMinute"), (Integer) cc.getSessionData("tempSecond"));
dateData += ChatColor.DARK_AQUA + dateFormat.format(cal.getTime()) + " ";
dateData += ChatColor.AQUA + timeFormat.format(cal.getTime()) + " ";
@ -82,21 +83,31 @@ public class DateTimePrompt extends FixedSetPrompt {
Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
DecimalFormat zoneFormat = new DecimalFormat("00");
dateData += ChatColor.LIGHT_PURPLE + "UTC" + (hour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0])) + ":" + zoneFormat.format(Integer.valueOf(sep[1]))
+ ChatColor.GREEN + " (" + cal.getTimeZone().getDisplayName(loc) + ")";
dateData += ChatColor.LIGHT_PURPLE + "UTC" + (hour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0]))
+ ":" + zoneFormat.format(Integer.valueOf(sep[1])) + ChatColor.GREEN + " ("
+ cal.getTimeZone().getDisplayName(loc) + ")";
if (dateData != null) {
menu += dateData + "\n";
}
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeDay") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMonth") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeYear") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "4. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeHour") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "5. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMinute") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "6. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeSecond") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeZone") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "8. " + ChatColor.RESET + "" + ChatColor.RED + Lang.get("cancel") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "9. " + ChatColor.RESET + "" + ChatColor.GREEN + Lang.get("done") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeDay") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeMonth") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeYear") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "4. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeHour") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "5. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeMinute") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "6. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeSecond") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("timeZone") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "8. " + ChatColor.RESET + "" + ChatColor.RED
+ Lang.get("cancel") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "9. " + ChatColor.RESET + "" + ChatColor.GREEN
+ Lang.get("done") + "\n";
return menu;
}

View File

@ -61,7 +61,8 @@ public class GUIDisplayPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenGUIDisplayPromptEvent event = new QuestsEditorPostOpenGUIDisplayPromptEvent(questFactory, context);
QuestsEditorPostOpenGUIDisplayPromptEvent event
= new QuestsEditorPostOpenGUIDisplayPromptEvent(questFactory, context);
plugin.getServer().getPluginManager().callEvent(event);
if (context.getSessionData("tempStack") != null) {
@ -91,7 +92,8 @@ public class GUIDisplayPrompt extends NumericPrompt {
text += " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
}
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n";
}
return text;
}

View File

@ -70,9 +70,11 @@ public class ItemStackPrompt extends FixedSetPrompt {
for (String key : map.keySet()) {
if (key.equals("pages")) {
List<String> pages = (List<String>) map.get(key);
menu += ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN + key + "=" + pages.size() + "\n";
menu += ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN + key + "=" + pages.size()
+ "\n";
} else {
menu += ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN + key + "=" + map.get(key) + "\n";
menu += ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN + key + "=" + map.get(key)
+ "\n";
}
}
}
@ -81,24 +83,36 @@ public class ItemStackPrompt extends FixedSetPrompt {
} else {
menu += "\n";
}
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "0. " + ChatColor.RESET + "" + ChatColor.YELLOW + Lang.get("itemCreateLoadHand") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("itemCreateSetName") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("itemCreateSetAmount") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("itemCreateSetDurab") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "4. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("itemCreateSetEnchs") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "5. " + ChatColor.RESET + "" + ChatColor.ITALIC + ChatColor.GOLD + Lang.get("itemCreateSetDisplay") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "6. " + ChatColor.RESET + "" + ChatColor.ITALIC + ChatColor.GOLD + Lang.get("itemCreateSetLore") + "\n";
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "0. " + ChatColor.RESET + "" + ChatColor.YELLOW
+ Lang.get("itemCreateLoadHand") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("itemCreateSetName") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("itemCreateSetAmount") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("itemCreateSetDurab") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "4. " + ChatColor.RESET + "" + ChatColor.GOLD
+ Lang.get("itemCreateSetEnchs") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "5. " + ChatColor.RESET + "" + ChatColor.ITALIC
+ ChatColor.GOLD + Lang.get("itemCreateSetDisplay") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "6. " + ChatColor.RESET + "" + ChatColor.ITALIC
+ ChatColor.GOLD + Lang.get("itemCreateSetLore") + "\n";
if (map != null) {
if (!map.isEmpty()) {
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.DARK_GREEN + Lang.get("itemCreateSetClearMeta") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.DARK_GREEN
+ Lang.get("itemCreateSetClearMeta") + "\n";
} else {
menu += ChatColor.GRAY + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GRAY + Lang.get("itemCreateSetClearMeta") + "\n";
menu += ChatColor.GRAY + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GRAY
+ Lang.get("itemCreateSetClearMeta") + "\n";
}
} else {
menu += ChatColor.GRAY + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GRAY + Lang.get("itemCreateSetClearMeta") + "\n";
menu += ChatColor.GRAY + "" + ChatColor.BOLD + "7. " + ChatColor.RESET + "" + ChatColor.GRAY
+ Lang.get("itemCreateSetClearMeta") + "\n";
}
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "8. " + ChatColor.RESET + "" + ChatColor.RED + Lang.get("cancel") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "9. " + ChatColor.RESET + "" + ChatColor.GREEN + Lang.get("done") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "8. " + ChatColor.RESET + "" + ChatColor.RED
+ Lang.get("cancel") + "\n";
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "9. " + ChatColor.RESET + "" + ChatColor.GREEN
+ Lang.get("done") + "\n";
return menu;
}
@ -248,7 +262,8 @@ public class ItemStackPrompt extends FixedSetPrompt {
ItemMeta meta = stack.getItemMeta();
if ((Map<String, Object>) cc.getSessionData("tempMeta") != null) {
meta = ItemUtil.deserializeItemMeta(meta.getClass(), (Map<String, Object>) cc.getSessionData("tempMeta"));
meta = ItemUtil.deserializeItemMeta(meta.getClass(), (Map<String, Object>) cc
.getSessionData("tempMeta"));
}
if (enchs != null) {
@ -344,7 +359,8 @@ public class ItemStackPrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int amt = Integer.parseInt(input);
if (amt < 1) {
@ -384,7 +400,8 @@ public class ItemStackPrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
String s = input.replace(":", "");
if (s.equalsIgnoreCase(Lang.get("cmdClear")) == false && s.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (s.equalsIgnoreCase(Lang.get("cmdClear")) == false
&& s.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
Enchantment e = ItemUtil.getEnchantmentFromPrettyName(MiscUtil.getCapitalized(s));
if (e != null) {
cc.setSessionData("tempEnchant", e);
@ -419,12 +436,14 @@ public class ItemStackPrompt extends FixedSetPrompt {
try {
int num = Integer.parseInt(input);
if (num < 1) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new LevelPrompt(enchantment);
} else {
if (cc.getSessionData("tempEnchantments") != null) {
@SuppressWarnings("unchecked")
Map<Enchantment, Integer> enchs = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
Map<Enchantment, Integer> enchs
= (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
enchs.put((Enchantment) cc.getSessionData("tempEnchant"), num);
cc.setSessionData("tempEnchantments", enchs);
} else {
@ -452,7 +471,8 @@ public class ItemStackPrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
String s = input.replace(":", "");
if (s.equalsIgnoreCase(Lang.get("cmdCancel")) == false && s.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (s.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& s.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
s = Quests.parseString(s);
cc.setSessionData("tempDisplay", s);
} else if (s.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -472,7 +492,8 @@ public class ItemStackPrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
String s = input.replace(":", "");
if (s.equalsIgnoreCase(Lang.get("cmdCancel")) == false && s.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (s.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& s.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
s = Quests.parseString(s);
LinkedList<String> lore = new LinkedList<String>();
lore.addAll(Arrays.asList(s.split(Lang.get("charSemi"))));
@ -494,7 +515,8 @@ public class ItemStackPrompt extends FixedSetPrompt {
item += ":" + ChatColor.BLUE + (Short) cc.getSessionData("tempData");
}
} else {
item = ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC + (String) cc.getSessionData("tempDisplay") + ChatColor.RESET + "" + ChatColor.GRAY + " (";
item = ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC + (String) cc.getSessionData("tempDisplay")
+ ChatColor.RESET + "" + ChatColor.GRAY + " (";
String name = (String) cc.getSessionData("tempName");
item += ChatColor.AQUA + ItemUtil.getPrettyItemName(name);
if (cc.getSessionData("tempData") != null) {
@ -510,9 +532,11 @@ public class ItemStackPrompt extends FixedSetPrompt {
item += "\n";
if (cc.getSessionData("tempEnchantments") != null) {
@SuppressWarnings("unchecked")
Map<Enchantment, Integer> enchantments = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
Map<Enchantment, Integer> enchantments
= (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
for (Entry<Enchantment, Integer> e : enchantments.entrySet()) {
item += ChatColor.GRAY + " - " + ChatColor.RED + ItemUtil.getPrettyEnchantmentName(e.getKey()) + " " + RomanNumeral.getNumeral(e.getValue()) + "\n";
item += ChatColor.GRAY + " - " + ChatColor.RED + ItemUtil.getPrettyEnchantmentName(e.getKey())
+ " " + RomanNumeral.getNumeral(e.getValue()) + "\n";
}
}
if (cc.getSessionData("tempLore") != null) {

View File

@ -64,45 +64,59 @@ public class ItemsPrompt extends FixedSetPrompt {
context.setSessionData(pref, Boolean.TRUE);
String text = ChatColor.AQUA + "- " + Lang.get("stageEditorItems") + " -\n";
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCraftItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorCraftItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCraftItems") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorCraftItems") + "\n";
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
for (int i = 0; i < items.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY
+ " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
}
}
if (context.getSessionData(pref + CK.S_SMELT_ITEMS) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorSmeltItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorSmeltItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorSmeltItems") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorSmeltItems") + "\n";
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
for (int i = 0; i < items.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY
+ " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
}
}
if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorEnchantItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorEnchantItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorEnchantItems") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorEnchantItems") + "\n";
LinkedList<String> enchants = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_TYPES);
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS);
for (int i = 0; i < enchants.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA
+ ItemUtil.getPrettyEnchantmentName(ItemUtil.getEnchantmentFromProperName(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
+ ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA
+ ItemUtil.getPrettyEnchantmentName(ItemUtil.getEnchantmentFromProperName(enchants.get(i)))
+ ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
}
if (context.getSessionData(pref + CK.S_BREW_ITEMS) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorBrewPotions") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorBrewPotions") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorBrewPotions") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorBrewPotions") + "\n";
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS);
for (int i = 0; i < items.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY
+ " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -150,15 +164,19 @@ public class ItemsPrompt extends FixedSetPrompt {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCraftItems") + " -\n";
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null) {
text += ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
return text;
}
@ -207,15 +225,19 @@ public class ItemsPrompt extends FixedSetPrompt {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorSmeltItems") + " -\n";
if (context.getSessionData(pref + CK.S_SMELT_ITEMS) == null) {
text += ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
return text;
}
@ -249,34 +271,46 @@ public class ItemsPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n";
if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetEnchantments") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetItemNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetEnchantments") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetItemNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetEnchantments") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetEnchantments") + "\n";
for (String s : getEnchantTypes(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(pref + CK.S_ENCHANT_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetItemNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetItemNames") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetItemNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetItemNames") + "\n";
for (String s : getEnchantItems(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
}
}
if (context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetEnchantAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetEnchantAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetEnchantAmounts") + "\n";
for (int i : getEnchantAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -355,7 +389,8 @@ public class ItemsPrompt extends FixedSetPrompt {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.DARK_PURPLE + Lang.get("stageEditorEnchantments") + ChatColor.LIGHT_PURPLE + " -\n";
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.DARK_PURPLE + Lang.get("stageEditorEnchantments")
+ ChatColor.LIGHT_PURPLE + " -\n";
for (int i = 0; i < Enchantment.values().length; i++) {
if (i == Enchantment.values().length - 1) {
text += ChatColor.GREEN + ItemUtil.getPrettyEnchantmentName(Enchantment.values()[i]) + " ";
@ -389,7 +424,8 @@ public class ItemsPrompt extends FixedSetPrompt {
}
}
if (valid == false) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorInvalidEnchantment"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidEnchantment"));
return new EnchantTypesPrompt();
}
}
@ -421,11 +457,13 @@ public class ItemsPrompt extends FixedSetPrompt {
return new EnchantItemsPrompt();
}*/
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " " + Lang.get("stageEditorInvalidItemName"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidItemName"));
return new EnchantItemsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new EnchantItemsPrompt();
}
}
@ -452,11 +490,13 @@ public class ItemsPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new EnchantAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new EnchantAmountsPrompt();
}
}
@ -491,15 +531,19 @@ public class ItemsPrompt extends FixedSetPrompt {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorBrewPotions") + " -\n";
if (context.getSessionData(pref + CK.S_BREW_ITEMS) == null) {
text += ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
return text;
}

View File

@ -56,53 +56,72 @@ public class MobsPrompt extends FixedSetPrompt {
context.setSessionData(pref, Boolean.TRUE);
String text = ChatColor.AQUA + "- " + Lang.get("stageEditorMobs") + " -\n";
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorKillMobs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorKillMobs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorKillMobs") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorKillMobs") + "\n";
LinkedList<String> mobs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_TYPES);
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS);
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) {
for (int i = 0; i < mobs.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + MiscUtil.getPrettyMobName(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA
+ MiscUtil.getPrettyMobName(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x "
+ ChatColor.DARK_AQUA + amnts.get(i) + "\n";
}
} else {
LinkedList<String> locs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS);
LinkedList<Integer> radii = (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS);
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES);
LinkedList<Integer> radii
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS);
LinkedList<String> names
= (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES);
for (int i = 0; i < mobs.size(); i++) {
String msg = Lang.get("blocksWithin");
msg = msg.replaceAll("<amount>", ChatColor.DARK_PURPLE + "" + radii.get(i) + ChatColor.GRAY);
text += ChatColor.GRAY + " - " + ChatColor.BLUE + MiscUtil.getPrettyMobName(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + ChatColor.GRAY + msg + ChatColor.YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE
+ MiscUtil.getPrettyMobName(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x "
+ ChatColor.DARK_AQUA + amnts.get(i) + ChatColor.GRAY + msg + ChatColor.YELLOW
+ names.get(i) + " (" + locs.get(i) + ")\n";
}
}
}
if (context.getSessionData(pref + CK.S_FISH) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCatchFish") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorCatchFish") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
Integer fish = (Integer) context.getSessionData(pref + CK.S_FISH);
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCatchFish") + " " + ChatColor.GRAY + "(" + ChatColor.AQUA + fish + " " + Lang.get("stageEditorFish") + ChatColor.GRAY + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorCatchFish") + " " + ChatColor.GRAY + "(" + ChatColor.AQUA + fish
+ " " + Lang.get("stageEditorFish") + ChatColor.GRAY + ")\n";
}
if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorTameMobs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorTameMobs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorTameMobs") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorTameMobs") + "\n";
LinkedList<String> mobs = (LinkedList<String>) context.getSessionData(pref + CK.S_TAME_TYPES);
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_TAME_AMOUNTS);
for (int i = 0; i < mobs.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + mobs.get(i) + ChatColor.GRAY + " x " + ChatColor.AQUA + amounts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + mobs.get(i) + ChatColor.GRAY + " x "
+ ChatColor.AQUA + amounts.get(i) + "\n";
}
}
if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorShearSheep") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorShearSheep") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorShearSheep") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorShearSheep") + "\n";
LinkedList<String> colors = (LinkedList<String>) context.getSessionData(pref + CK.S_SHEAR_COLORS);
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS);
for (int i = 0; i < colors.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + colors.get(i) + ChatColor.GRAY + " x " + ChatColor.AQUA + amounts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + colors.get(i) + ChatColor.GRAY + " x "
+ ChatColor.AQUA + amounts.get(i) + "\n";
}
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -136,52 +155,70 @@ public class MobsPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorKillMobs") + " -\n";
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobTypes") + "\n";
for (String s : getMobTypes(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(pref + CK.S_MOB_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobAmounts") + "\n";
for (Integer i : getMobAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillLocations") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillLocations") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillLocations") + "\n";
for (String s : getKillLocations(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillLocationRadii") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillLocationRadii") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillLocationRadii") + "\n";
for (int i : getKillRadii(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillLocationNames") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillLocationNames") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillLocationNames") + "\n";
for (String s : getKillLocationNames(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -340,7 +377,8 @@ public class MobsPrompt extends FixedSetPrompt {
mobTypes.add(s);
context.setSessionData(pref + CK.S_MOB_TYPES, mobTypes);
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorInvalidMob"));
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidMob"));
return new MobTypesPrompt();
}
}
@ -365,7 +403,8 @@ public class MobsPrompt extends FixedSetPrompt {
try {
int i = Integer.parseInt(s);
if (i < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new MobAmountsPrompt();
}
mobAmounts.add(i);
@ -438,12 +477,14 @@ public class MobsPrompt extends FixedSetPrompt {
try {
int i = Integer.parseInt(s);
if (i < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new MobRadiiPrompt();
}
radii.add(i);
} catch (NumberFormatException e) {
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidItemName"));
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidItemName"));
return new MobRadiiPrompt();
}
}
@ -480,7 +521,8 @@ public class MobsPrompt extends FixedSetPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
@ -490,7 +532,8 @@ public class MobsPrompt extends FixedSetPrompt {
context.setSessionData(pref + CK.S_FISH, i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new FishPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -510,25 +553,34 @@ public class MobsPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorTameMobs") + " -\n";
if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY
+ Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetMobTypes") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetMobTypes") + "\n";
for (String s : getTameTypes(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(pref + CK.S_TAME_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetTameAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetTameAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetTameAmounts") + "\n";
for (Integer i : getTameAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -613,11 +665,13 @@ public class MobsPrompt extends FixedSetPrompt {
mobTypes.add(MiscUtil.getPrettyMobName(type));
context.setSessionData(pref + CK.S_TAME_TYPES, mobTypes);
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorInvalidMob"));
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidMob"));
return new TameTypesPrompt();
}
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorInvalidMob"));
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidMob"));
return new TameTypesPrompt();
}
}
@ -642,12 +696,14 @@ public class MobsPrompt extends FixedSetPrompt {
try {
int i = Integer.parseInt(s);
if (i < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new TameAmountsPrompt();
}
mobAmounts.add(i);
} catch (NumberFormatException e) {
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new TameAmountsPrompt();
}
}
@ -667,25 +723,34 @@ public class MobsPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorShearSheep") + " -\n";
if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetShearColors") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetShearColors") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY
+ Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetShearColors") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetShearColors") + "\n";
for (String s : getShearColors(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(pref + CK.S_SHEAR_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetShearAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetShearAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetShearAmounts") + "\n";
for (Integer i : getShearAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -767,7 +832,8 @@ public class MobsPrompt extends FixedSetPrompt {
colors.add(MiscUtil.getDyeString(MiscUtil.getDyeColor(s)));
context.setSessionData(pref + CK.S_SHEAR_COLORS, colors);
} else {
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorInvalidDye"));
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidDye"));
return new ShearColorsPrompt();
}
}
@ -792,7 +858,8 @@ public class MobsPrompt extends FixedSetPrompt {
try {
int i = Integer.parseInt(s);
if (i < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new ShearAmountsPrompt();
}
shearAmounts.add(i);

View File

@ -52,46 +52,71 @@ public class NPCsPrompt extends FixedSetPrompt {
String text = ChatColor.AQUA + "- " + Lang.get("stageEditorNPCs") + " -\n";
if (plugin.getDependencies().getCitizens() != null) {
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("noneSet")
+ ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorDeliverItems") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorDeliverItems") + "\n";
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DELIVERY_NPCS);
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS);
LinkedList<ItemStack> items
= (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS);
for (int i = 0; i < npcs.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + ChatColor.GRAY + " " + Lang.get("to") + " " + ChatColor.DARK_AQUA + plugin.getDependencies().getCitizens().getNPCRegistry().getById(npcs.get(i)).getName() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + ChatColor.GRAY + " "
+ Lang.get("to") + " " + ChatColor.DARK_AQUA
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(npcs.get(i)).getName()
+ "\n";
}
}
} else {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "1 " + ChatColor.RESET + ChatColor.GRAY + "- "
+ Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled")
+ ")\n";
}
if (plugin.getDependencies().getCitizens() != null) {
if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet")
+ ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorTalkToNPCs") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorTalkToNPCs") + "\n";
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO);
for (int i = 0; i < npcs.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + plugin.getDependencies().getCitizens().getNPCRegistry().getById(npcs.get(i)).getName() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(npcs.get(i)).getName()
+ "\n";
}
}
} else {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2 " + ChatColor.RESET + ChatColor.GRAY + "- "
+ Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled")
+ ")\n";
}
if (plugin.getDependencies().getCitizens() != null) {
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorKillNPCs") + "\n";
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.LIGHT_PURPLE
+ "- " + Lang.get("stageEditorKillNPCs") + "\n";
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL);
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS);
LinkedList<Integer> amounts
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS);
for (int i = 0; i < npcs.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + plugin.getDependencies().getCitizens().getNPCRegistry().getById(npcs.get(i)).getName() + ChatColor.GRAY + " x " + ChatColor.AQUA + amounts.get(i) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(npcs.get(i)).getName()
+ ChatColor.GRAY + " x " + ChatColor.AQUA + amounts.get(i) + "\n";
}
}
} else {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "3 " + ChatColor.RESET + ChatColor.GRAY + "- "
+ Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled")
+ ")\n";
}
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("done") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- "
+ Lang.get("done") + "\n";
return text;
}
@ -152,40 +177,52 @@ public class NPCsPrompt extends FixedSetPrompt {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorDeliverItems") + " -\n";
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
text += ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n";
if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorDeliveryMessages") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorDeliveryMessages") + "\n";
for (String s : getDeliveryMessages(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + "\"" + s + "\"";
}
}
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
}
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryNPCs") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryNPCs") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryNPCs") + "\n";
for (int i : getDeliveryNPCs(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + " (" + plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName() + ")\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + " ("
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName() + ")\n";
}
}
if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorDeliveryMessages") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorDeliveryMessages") + "\n";
for (String s : getDeliveryMessages(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + "\"" + s + "\"\n";
}
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
return text;
}
@ -274,11 +311,13 @@ public class NPCsPrompt extends FixedSetPrompt {
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) != null) {
npcs.add(i);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + i + ChatColor.RED + " " + Lang.get("stageEditorInvalidNPC"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + i + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidNPC"));
return new DeliveryNPCsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new DeliveryNPCsPrompt();
}
}
@ -318,12 +357,14 @@ public class NPCsPrompt extends FixedSetPrompt {
HashSet<Player> temp = questFactory.getSelectingNpcs();
temp.add((Player) context.getForWhom());
questFactory.setSelectingNpcs(temp);
return ChatColor.YELLOW + Lang.get("stageEditorNPCToTalkToPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
return ChatColor.YELLOW + Lang.get("stageEditorNPCToTalkToPrompt") + "\n" + ChatColor.GOLD
+ Lang.get("npcHint");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(" ");
LinkedList<Integer> npcs = new LinkedList<Integer>();
for (String s : args) {
@ -332,11 +373,13 @@ public class NPCsPrompt extends FixedSetPrompt {
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) != null) {
npcs.add(i);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + i + ChatColor.RED + " " + Lang.get("stageEditorInvalidNPC"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + i + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidNPC"));
return new NPCIDsToTalkToPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new NPCIDsToTalkToPrompt();
}
}
@ -361,25 +404,36 @@ public class NPCsPrompt extends FixedSetPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorKillNPCs") + " -\n";
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetKillIds") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noIdsSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("cancel") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetKillIds") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noIdsSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("cancel") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetKillIds") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetKillIds") + "\n";
for (Integer i : getNPCIds(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName() + ChatColor.DARK_AQUA + " (" + i + ")\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName()
+ ChatColor.DARK_AQUA + " (" + i + ")\n";
}
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.BLUE + " - " + Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.BLUE + " - "
+ Lang.get("stageEditorSetKillAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetKillAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorSetKillAmounts") + "\n";
for (Integer i : getKillAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + i + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -456,11 +510,13 @@ public class NPCsPrompt extends FixedSetPrompt {
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) != null) {
npcs.add(i);
} else {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + i + ChatColor.RED + " " + Lang.get("stageEditorInvalidNPC"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + i + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidNPC"));
return new NpcIdsToKillPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new NpcIdsToKillPrompt();
}
}
@ -490,11 +546,13 @@ public class NPCsPrompt extends FixedSetPrompt {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
.replace("<number>", "1"));
return new NpcAmountsToKillPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
+ Lang.get("stageEditorNotListofNumbers"));
return new NpcAmountsToKillPrompt();
}
}

View File

@ -82,9 +82,12 @@ public class OptionsPrompt extends NumericPrompt {
QuestsEditorPostOpenOptionsPromptEvent event = new QuestsEditorPostOpenOptionsPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.DARK_GREEN + getTitle(context).replace((String) context.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME) + ChatColor.DARK_GREEN) + "\n";
String text = ChatColor.DARK_GREEN + getTitle(context)
.replace((String) context.getSessionData(CK.Q_NAME), ChatColor.AQUA
+ (String) context.getSessionData(CK.Q_NAME) + ChatColor.DARK_GREEN) + "\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n";
}
return text;
}
@ -135,7 +138,8 @@ public class OptionsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenOptionsTrueFalsePromptEvent event = new QuestsEditorPostOpenOptionsTrueFalsePromptEvent(factory, context);
QuestsEditorPostOpenOptionsTrueFalsePromptEvent event
= new QuestsEditorPostOpenOptionsTrueFalsePromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = Lang.get("optBooleanPrompt");
@ -146,10 +150,12 @@ public class OptionsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
boolean b = Boolean.parseBoolean(input);
if (input.equalsIgnoreCase("t") || input.equalsIgnoreCase(Lang.get("true")) || input.equalsIgnoreCase(Lang.get("yesWord"))) {
if (input.equalsIgnoreCase("t") || input.equalsIgnoreCase(Lang.get("true"))
|| input.equalsIgnoreCase(Lang.get("yesWord"))) {
b = true;
}
context.setSessionData(tempKey, b);
@ -217,25 +223,32 @@ public class OptionsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenOptionsLevelPromptEvent event = new QuestsEditorPostOpenOptionsLevelPromptEvent(factory, context);
QuestsEditorPostOpenOptionsLevelPromptEvent event
= new QuestsEditorPostOpenOptionsLevelPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = Lang.get("optNumberPrompt");
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "1" + ChatColor.RESET + " = " + ChatColor.GRAY + Lang.get("everything");
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "2" + ChatColor.RESET + " = " + ChatColor.GRAY + Lang.get("objectives");;
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "3" + ChatColor.RESET + " = " + ChatColor.GRAY + Lang.get("stageEditorStages");
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "4" + ChatColor.RESET + " = " + ChatColor.GRAY + Lang.get("quests");
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "1" + ChatColor.RESET + " = " + ChatColor.GRAY
+ Lang.get("everything");
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "2" + ChatColor.RESET + " = " + ChatColor.GRAY
+ Lang.get("objectives");;
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "3" + ChatColor.RESET + " = " + ChatColor.GRAY
+ Lang.get("stageEditorStages");
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "4" + ChatColor.RESET + " = " + ChatColor.GRAY
+ Lang.get("quests");
return ChatColor.YELLOW + text;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
context.setSessionData(tempKey, i);
} catch (Exception e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(tempKey, null);
@ -275,22 +288,26 @@ public class OptionsPrompt extends NumericPrompt {
case 1:
if (context.getSessionData(CK.OPT_ALLOW_COMMANDS) == null) {
boolean defaultOpt = new Options().getAllowCommands();
return ChatColor.YELLOW + Lang.get("optAllowCommands") + " ("
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
return ChatColor.YELLOW + Lang.get("optAllowCommands") + " (" + (defaultOpt ? ChatColor.GREEN
+ String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt))
+ ChatColor.YELLOW + ")";
} else {
boolean commandsOpt = (Boolean) context.getSessionData(CK.OPT_ALLOW_COMMANDS);
return ChatColor.YELLOW + Lang.get("optAllowCommands") + " ("
+ (commandsOpt ? ChatColor.GREEN + String.valueOf(commandsOpt) : ChatColor.RED + String.valueOf(commandsOpt)) + ChatColor.YELLOW + ")";
return ChatColor.YELLOW + Lang.get("optAllowCommands") + " (" + (commandsOpt ? ChatColor.GREEN
+ String.valueOf(commandsOpt) : ChatColor.RED + String.valueOf(commandsOpt))
+ ChatColor.YELLOW + ")";
}
case 2:
if (context.getSessionData(CK.OPT_ALLOW_QUITTING) == null) {
boolean defaultOpt = new Options().getAllowQuitting();
return ChatColor.YELLOW + Lang.get("optAllowQuitting") + " ("
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
return ChatColor.YELLOW + Lang.get("optAllowQuitting") + " (" + (defaultOpt ? ChatColor.GREEN
+ String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt))
+ ChatColor.YELLOW + ")";
} else {
boolean quittingOpt = (Boolean) context.getSessionData(CK.OPT_ALLOW_QUITTING);
return ChatColor.YELLOW + Lang.get("optAllowQuitting") + " ("
+ (quittingOpt ? ChatColor.GREEN + String.valueOf(quittingOpt) : ChatColor.RED + String.valueOf(quittingOpt)) + ChatColor.YELLOW + ")";
return ChatColor.YELLOW + Lang.get("optAllowQuitting") + " (" + (quittingOpt ? ChatColor.GREEN
+ String.valueOf(quittingOpt) : ChatColor.RED + String.valueOf(quittingOpt))
+ ChatColor.YELLOW + ")";
}
case 3:
return ChatColor.YELLOW + Lang.get("done");
@ -301,12 +318,14 @@ public class OptionsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenOptionsGeneralPromptEvent event = new QuestsEditorPostOpenOptionsGeneralPromptEvent(factory, context);
QuestsEditorPostOpenOptionsGeneralPromptEvent event
= new QuestsEditorPostOpenOptionsGeneralPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.DARK_GREEN + "- " + getTitle() + " -\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n";
}
return text;
}
@ -372,21 +391,25 @@ public class OptionsPrompt extends NumericPrompt {
if (context.getSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN) == null) {
boolean defaultOpt = new Options().getUseDungeonsXLPlugin();
return ChatColor.YELLOW + Lang.get("optUseDungeonsXLPlugin") + " ("
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED
+ String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
} else {
boolean dungeonsOpt = (Boolean) context.getSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN);
return ChatColor.YELLOW + Lang.get("optUseDungeonsXLPlugin") + " ("
+ (dungeonsOpt ? ChatColor.GREEN + String.valueOf(dungeonsOpt) : ChatColor.RED + String.valueOf(dungeonsOpt)) + ChatColor.YELLOW + ")";
+ (dungeonsOpt ? ChatColor.GREEN + String.valueOf(dungeonsOpt) : ChatColor.RED
+ String.valueOf(dungeonsOpt)) + ChatColor.YELLOW + ")";
}
case 2:
if (context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) == null) {
boolean defaultOpt = new Options().getUsePartiesPlugin();
return ChatColor.YELLOW + Lang.get("optUsePartiesPlugin") + " ("
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED
+ String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
} else {
boolean partiesOpt = (Boolean) context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN);
return ChatColor.YELLOW + Lang.get("optUsePartiesPlugin") + " ("
+ (partiesOpt ? ChatColor.GREEN + String.valueOf(partiesOpt) : ChatColor.RED + String.valueOf(partiesOpt)) + ChatColor.YELLOW + ")";
+ (partiesOpt ? ChatColor.GREEN + String.valueOf(partiesOpt) : ChatColor.RED
+ String.valueOf(partiesOpt)) + ChatColor.YELLOW + ")";
}
case 3:
if (context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) == null) {
@ -402,11 +425,13 @@ public class OptionsPrompt extends NumericPrompt {
if (context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) == null) {
boolean defaultOpt = new Options().getRequireSameQuest();
return ChatColor.YELLOW + Lang.get("optRequireSameQuest") + " ("
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED
+ String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
} else {
boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST);
return ChatColor.YELLOW + Lang.get("optRequireSameQuest") + " ("
+ (requireOpt ? ChatColor.GREEN + String.valueOf(requireOpt) : ChatColor.RED + String.valueOf(requireOpt)) + ChatColor.YELLOW + ")";
+ (requireOpt ? ChatColor.GREEN + String.valueOf(requireOpt) : ChatColor.RED
+ String.valueOf(requireOpt)) + ChatColor.YELLOW + ")";
}
case 5:
return ChatColor.YELLOW + Lang.get("done");
@ -417,12 +442,14 @@ public class OptionsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenOptionsMultiplayerPromptEvent event = new QuestsEditorPostOpenOptionsMultiplayerPromptEvent(factory, context);
QuestsEditorPostOpenOptionsMultiplayerPromptEvent event
= new QuestsEditorPostOpenOptionsMultiplayerPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.DARK_GREEN + "- " + getTitle() + " -\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n";
}
return text;
}

View File

@ -57,7 +57,8 @@ public class PlannerPrompt extends NumericPrompt {
case 2:
return ChatColor.BLUE;
case 3:
if (context.getSessionData(CK.PLN_START_DATE) == null || context.getSessionData(CK.PLN_END_DATE) == null) {
if (context.getSessionData(CK.PLN_START_DATE) == null
|| context.getSessionData(CK.PLN_END_DATE) == null) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
@ -78,7 +79,8 @@ public class PlannerPrompt extends NumericPrompt {
case 2:
return ChatColor.YELLOW + Lang.get("plnEnd");
case 3:
if (context.getSessionData(CK.PLN_START_DATE) == null || context.getSessionData(CK.PLN_END_DATE) == null) {
if (context.getSessionData(CK.PLN_START_DATE) == null
|| context.getSessionData(CK.PLN_END_DATE) == null) {
return ChatColor.GRAY + Lang.get("plnRepeat");
} else {
return ChatColor.YELLOW + Lang.get("plnRepeat");
@ -98,29 +100,35 @@ public class PlannerPrompt extends NumericPrompt {
if (context.getSessionData(CK.PLN_START_DATE) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.YELLOW + " - " + getPrettyDate((String) context.getSessionData(CK.PLN_START_DATE));
return ChatColor.YELLOW + " - "
+ getPrettyDate((String) context.getSessionData(CK.PLN_START_DATE));
}
case 2:
if (context.getSessionData(CK.PLN_END_DATE) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.YELLOW + " - " + getPrettyDate((String) context.getSessionData(CK.PLN_END_DATE));
return ChatColor.YELLOW + " - "
+ getPrettyDate((String) context.getSessionData(CK.PLN_END_DATE));
}
case 3:
if (context.getSessionData(CK.PLN_START_DATE) == null || context.getSessionData(CK.PLN_END_DATE) == null) {
if (context.getSessionData(CK.PLN_START_DATE) == null
|| context.getSessionData(CK.PLN_END_DATE) == null) {
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else {
if (context.getSessionData(CK.PLN_REPEAT_CYCLE) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.YELLOW + "(" + Quests.getTime((Long) context.getSessionData(CK.PLN_REPEAT_CYCLE)) + ChatColor.RESET + ChatColor.YELLOW + ")";
return ChatColor.YELLOW + "("
+ Quests.getTime((Long) context.getSessionData(CK.PLN_REPEAT_CYCLE))
+ ChatColor.RESET + ChatColor.YELLOW + ")";
}
}
case 4:
if (context.getSessionData(CK.PLN_COOLDOWN) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.YELLOW + "(" + Quests.getTime((Long) context.getSessionData(CK.PLN_COOLDOWN)) + ChatColor.RESET + ChatColor.YELLOW + ")";
return ChatColor.YELLOW + "(" + Quests.getTime((Long) context.getSessionData(CK.PLN_COOLDOWN))
+ ChatColor.RESET + ChatColor.YELLOW + ")";
}
case 5:
return "";
@ -134,9 +142,12 @@ public class PlannerPrompt extends NumericPrompt {
QuestsEditorPostOpenPlannerPromptEvent event = new QuestsEditorPostOpenPlannerPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME) + ChatColor.DARK_AQUA) + "\n";
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME)
+ ChatColor.DARK_AQUA) + "\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
}
return text;
}
@ -190,7 +201,8 @@ public class PlannerPrompt extends NumericPrompt {
context.setSessionData(CK.PLN_REPEAT_CYCLE, delay);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new RepeatPrompt();
}
return new PlannerPrompt(plugin, factory);
@ -223,7 +235,8 @@ public class PlannerPrompt extends NumericPrompt {
context.setSessionData(CK.PLN_COOLDOWN, delay);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new CooldownPrompt();
}
return new PlannerPrompt(plugin, factory);
@ -253,8 +266,9 @@ public class PlannerPrompt extends NumericPrompt {
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
DecimalFormat zoneFormat = new DecimalFormat("00");
output += ChatColor.LIGHT_PURPLE + " UTC" + (zhour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0])) + ":"
+ zoneFormat.format(Integer.valueOf(sep[1])) + ChatColor.GREEN + " (" + cal.getTimeZone().getDisplayName(loc) + ")";
output += ChatColor.LIGHT_PURPLE + " UTC" + (zhour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0]))
+ ":" + zoneFormat.format(Integer.valueOf(sep[1])) + ChatColor.GREEN + " ("
+ cal.getTimeZone().getDisplayName(loc) + ")";
return output;
}
}

View File

@ -49,12 +49,16 @@ public class QuestOfferPrompt extends StringPrompt {
for (int i = 1; i <= quests.size(); i++) {
Quest quest = quests.get(i - 1);
if (quester.getCompletedQuests().contains(quest.getName())) {
menu += ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "" + i + ". " + ChatColor.RESET + "" + ChatColor.GREEN + "" + ChatColor.ITALIC + quest.getName() + ChatColor.RESET + "" + ChatColor.GREEN + " " + Lang.get("redoCompleted") + "\n";
menu += ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "" + i + ". " + ChatColor.RESET + ""
+ ChatColor.GREEN + "" + ChatColor.ITALIC + quest.getName() + ChatColor.RESET + ""
+ ChatColor.GREEN + " " + Lang.get("redoCompleted") + "\n";
} else {
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "" + i + ". " + ChatColor.RESET + "" + ChatColor.YELLOW + "" + ChatColor.ITALIC + quest.getName() + "\n";
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "" + i + ". " + ChatColor.RESET + "" + ChatColor.YELLOW
+ "" + ChatColor.ITALIC + quest.getName() + "\n";
}
}
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "" + (quests.size() + 1) + ". " + ChatColor.RESET + "" + ChatColor.GRAY + Lang.get("cancel") + "\n";
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "" + (quests.size() + 1) + ". " + ChatColor.RESET + ""
+ ChatColor.GRAY + Lang.get("cancel") + "\n";
menu += ChatColor.WHITE + Lang.get("enterAnOption");
return menu;
}
@ -100,7 +104,8 @@ public class QuestOfferPrompt extends StringPrompt {
} else {
Player player = quester.getPlayer();
if (!quester.getCompletedQuests().contains(q.getName())) {
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests()
|| plugin.getSettings().getMaxQuests() < 1) {
if (q.testRequirements(quester)) {
quester.setQuestToTake(q.getName());
String s = extracted(quester);
@ -121,11 +126,13 @@ public class QuestOfferPrompt extends StringPrompt {
player.sendMessage(ChatColor.YELLOW + msg);
}
} else if (quester.getCompletedQuests().contains(q.getName())) {
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests()
|| plugin.getSettings().getMaxQuests() < 1) {
if (quester.getCooldownDifference(q) > 0) {
String early = Lang.get("questTooEarly");
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getCooldownDifference(q)) + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE
+ Quests.getTime(quester.getCooldownDifference(q)) + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
} else if (q.getPlanner().getCooldown() < 0) {
String completed = Lang.get("questAlreadyCompleted");
@ -155,6 +162,8 @@ public class QuestOfferPrompt extends StringPrompt {
}
private String extracted(final Quester quester) {
return MessageFormat.format("{0}- {1}{2}{3} -\n\n{4}{5}\n", ChatColor.GOLD, ChatColor.DARK_PURPLE, quester.getQuestToTake(), ChatColor.GOLD, ChatColor.RESET, plugin.getQuest(quester.getQuestToTake()).getDescription());
return MessageFormat.format("{0}- {1}{2}{3} -\n\n{4}{5}\n", ChatColor.GOLD, ChatColor.DARK_PURPLE,
quester.getQuestToTake(), ChatColor.GOLD, ChatColor.RESET, plugin.getQuest(quester.getQuestToTake())
.getDescription());
}
}

View File

@ -83,10 +83,16 @@ public class RequirementsPrompt extends NumericPrompt {
case 9:
return ChatColor.BLUE;
case 10:
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_ITEMS) == null && context.getSessionData(CK.REQ_PERMISSION) == null && context.getSessionData(CK.REQ_QUEST) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_MCMMO_SKILLS) == null && context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null && context.getSessionData(CK.REQ_CUSTOM) == null) {
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_ITEMS) == null
&& context.getSessionData(CK.REQ_PERMISSION) == null
&& context.getSessionData(CK.REQ_QUEST) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_MCMMO_SKILLS) == null
&& context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null
&& context.getSessionData(CK.REQ_CUSTOM) == null) {
return ChatColor.GRAY;
} else if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
return ChatColor.RED;
@ -121,10 +127,16 @@ public class RequirementsPrompt extends NumericPrompt {
case 9:
return ChatColor.DARK_PURPLE + Lang.get("reqSetCustom");
case 10:
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_ITEMS) == null && context.getSessionData(CK.REQ_PERMISSION) == null && context.getSessionData(CK.REQ_QUEST) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_MCMMO_SKILLS) == null && context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null && context.getSessionData(CK.REQ_CUSTOM) == null) {
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_ITEMS) == null
&& context.getSessionData(CK.REQ_PERMISSION) == null
&& context.getSessionData(CK.REQ_QUEST) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_MCMMO_SKILLS) == null
&& context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null
&& context.getSessionData(CK.REQ_CUSTOM) == null) {
return ChatColor.GRAY + Lang.get("reqSetFail");
} else if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
return ChatColor.RED + Lang.get("reqSetFail");
@ -146,13 +158,16 @@ public class RequirementsPrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
int moneyReq = (Integer) context.getSessionData(CK.REQ_MONEY);
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyReq + " " + (moneyReq > 1 ? plugin.getCurrency(true) : plugin.getCurrency(false)) + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyReq + " "
+ (moneyReq > 1 ? plugin.getCurrency(true) : plugin.getCurrency(false)) + ChatColor.GRAY
+ ")";
}
case 2:
if (context.getSessionData(CK.REQ_QUEST_POINTS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REQ_QUEST_POINTS) + " " + Lang.get("questPoints") + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REQ_QUEST_POINTS) + " "
+ Lang.get("questPoints") + ChatColor.GRAY + ")";
}
case 3:
if (context.getSessionData(CK.REQ_ITEMS) == null) {
@ -161,7 +176,8 @@ public class RequirementsPrompt extends NumericPrompt {
String text = "";
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.REQ_ITEMS);
for (int i = 0; i < items.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
}
return text;
}
@ -207,7 +223,9 @@ public class RequirementsPrompt extends NumericPrompt {
List<String> skills = (List<String>) context.getSessionData(CK.REQ_MCMMO_SKILLS);
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
for (String s : skills) {
text += ChatColor.GRAY + " - " + ChatColor.DARK_GREEN + s + ChatColor.RESET + ChatColor.YELLOW + " " + Lang.get("mcMMOLevel") + " " + ChatColor.GREEN + amounts.get(skills.indexOf(s)) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.DARK_GREEN + s + ChatColor.RESET
+ ChatColor.YELLOW + " " + Lang.get("mcMMOLevel") + " " + ChatColor.GREEN
+ amounts.get(skills.indexOf(s)) + "\n";
}
return text;
}
@ -216,15 +234,18 @@ public class RequirementsPrompt extends NumericPrompt {
}
case 8:
if (plugin.getDependencies().getHeroes() != null) {
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null && context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
} else {
String text = "";
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
text += ChatColor.AQUA + " " + Lang.get("reqHeroesPrimaryDisplay") + " " + ChatColor.BLUE + (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS);
text += ChatColor.AQUA + " " + Lang.get("reqHeroesPrimaryDisplay") + " "
+ ChatColor.BLUE + (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS);
}
if (context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) {
text += ChatColor.AQUA + " " + Lang.get("reqHeroesSecondaryDisplay") + " " + ChatColor.BLUE + (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS);
text += ChatColor.AQUA + " " + Lang.get("reqHeroesSecondaryDisplay") + " "
+ ChatColor.BLUE + (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS);
}
return text;
}
@ -238,20 +259,28 @@ public class RequirementsPrompt extends NumericPrompt {
String text = "";
LinkedList<String> customReqs = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
for (String s : customReqs) {
text += ChatColor.RESET + "" + ChatColor.DARK_PURPLE + " - " + ChatColor.LIGHT_PURPLE + s + "\n";
text += ChatColor.RESET + "" + ChatColor.DARK_PURPLE + " - " + ChatColor.LIGHT_PURPLE + s
+ "\n";
}
return text;
}
case 10:
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_ITEMS) == null && context.getSessionData(CK.REQ_PERMISSION) == null && context.getSessionData(CK.REQ_QUEST) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_MCMMO_SKILLS) == null && context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null && context.getSessionData(CK.REQ_CUSTOM) == null) {
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_ITEMS) == null
&& context.getSessionData(CK.REQ_PERMISSION) == null
&& context.getSessionData(CK.REQ_QUEST) == null
&& context.getSessionData(CK.REQ_QUEST_BLOCK) == null
&& context.getSessionData(CK.REQ_MCMMO_SKILLS) == null
&& context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null
&& context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null
&& context.getSessionData(CK.REQ_CUSTOM) == null) {
return ChatColor.GRAY + "(" + Lang.get("reqNone") + ")";
} else if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
return ChatColor.RED + "(" + Lang.get("questRequiredNoneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(CK.Q_FAIL_MESSAGE) + "\"" + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(CK.Q_FAIL_MESSAGE)
+ "\"" + ChatColor.GRAY + ")";
}
case 11:
case 12:
@ -266,12 +295,16 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenRequirementsPromptEvent event = new QuestsEditorPostOpenRequirementsPromptEvent(factory, context);
QuestsEditorPostOpenRequirementsPromptEvent event
= new QuestsEditorPostOpenRequirementsPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME) + ChatColor.DARK_AQUA) + "\n";
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME)
+ ChatColor.DARK_AQUA) + "\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
}
return text;
}
@ -308,7 +341,15 @@ public class RequirementsPrompt extends NumericPrompt {
case 10:
return new FailMessagePrompt();
case 11:
if (context.getSessionData(CK.REQ_MONEY) != null || context.getSessionData(CK.REQ_QUEST_POINTS) != null || context.getSessionData(CK.REQ_ITEMS) != null || context.getSessionData(CK.REQ_PERMISSION) != null || context.getSessionData(CK.REQ_QUEST) != null || context.getSessionData(CK.REQ_QUEST_BLOCK) != null || context.getSessionData(CK.REQ_MCMMO_SKILLS) != null || context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null || context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null || context.getSessionData(CK.REQ_CUSTOM) != null) {
if (context.getSessionData(CK.REQ_MONEY) != null || context.getSessionData(CK.REQ_QUEST_POINTS) != null
|| context.getSessionData(CK.REQ_ITEMS) != null
|| context.getSessionData(CK.REQ_PERMISSION) != null
|| context.getSessionData(CK.REQ_QUEST) != null
|| context.getSessionData(CK.REQ_QUEST_BLOCK) != null
|| context.getSessionData(CK.REQ_MCMMO_SKILLS) != null
|| context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null
|| context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null
|| context.getSessionData(CK.REQ_CUSTOM) != null) {
if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNoMessage"));
return new RequirementsPrompt(plugin, factory);
@ -326,7 +367,9 @@ public class RequirementsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = Lang.get("reqMoneyPrompt");
if (plugin.getDependencies().getVaultEconomy() != null) {
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + ((plugin.getDependencies().getVaultEconomy().currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy().currencyNamePlural())) + ChatColor.YELLOW);
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE+ ((plugin.getDependencies().getVaultEconomy()
.currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy()
.currencyNamePlural())) + ChatColor.YELLOW);
} else {
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + Lang.get("money") + ChatColor.YELLOW);
}
@ -335,7 +378,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
@ -345,7 +389,8 @@ public class RequirementsPrompt extends NumericPrompt {
return new MoneyPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new MoneyPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -365,7 +410,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
@ -375,7 +421,8 @@ public class RequirementsPrompt extends NumericPrompt {
return new QuestPointsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new QuestPointsPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -414,7 +461,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(Lang.get("charSemi"));
LinkedList<String> questNames = new LinkedList<String>();
for (String s : args) {
@ -477,25 +525,35 @@ public class RequirementsPrompt extends NumericPrompt {
}
String text = ChatColor.GOLD + Lang.get("itemRequirementsTitle") + "\n";
if (context.getSessionData(CK.REQ_ITEMS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("reqSetRemoveItems") + " (" + Lang.get("reqNoItemsSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("reqSetRemoveItems") + " (" + Lang.get("reqNoItemsSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
if (context.getSessionData(CK.REQ_ITEMS_REMOVE) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetRemoveItems") + " (" + Lang.get("reqNoValuesSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("reqSetRemoveItems") + " (" + Lang.get("reqNoValuesSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetRemoveItems") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("reqSetRemoveItems") + "\n";
for (Boolean b : getRemoveItems(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + (b.equals(Boolean.TRUE) ? Lang.get("yesWord") : Lang.get("noWord")) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA
+ (b.equals(Boolean.TRUE) ? Lang.get("yesWord") : Lang.get("noWord")) + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -590,7 +648,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(" ");
LinkedList<String> permissions = new LinkedList<String>();
permissions.addAll(Arrays.asList(args));
@ -620,7 +679,8 @@ public class RequirementsPrompt extends NumericPrompt {
@SuppressWarnings("unchecked")
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomRequirement found = null;
// Check if we have a custom requirement with the specified name
for (CustomRequirement cr : plugin.getCustomRequirements()) {
@ -642,7 +702,8 @@ public class RequirementsPrompt extends NumericPrompt {
if (context.getSessionData(CK.REQ_CUSTOM) != null) {
// The custom requirement may already have been added, so let's check that
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
if (list.contains(found.getName()) == false) {
// Hasn't been added yet, so let's do it
list.add(found.getName());
@ -689,7 +750,8 @@ public class RequirementsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.AQUA + "- ";
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
String reqName = list.getLast();
Map<String, Object> datamap = datamapList.getLast();
text += reqName + " -\n";
@ -700,7 +762,8 @@ public class RequirementsPrompt extends NumericPrompt {
}
Collections.sort(datamapKeys);
for (String dataKey : datamapKeys) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + index + ChatColor.RESET + ChatColor.YELLOW + " - " + dataKey;
text += ChatColor.BLUE + "" + ChatColor.BOLD + index + ChatColor.RESET + ChatColor.YELLOW + " - "
+ dataKey;
if (datamap.get(dataKey) != null) {
text += ChatColor.GREEN + " (" + datamap.get(dataKey).toString() + ")\n";
} else {
@ -715,7 +778,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
@SuppressWarnings("unchecked")
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
Map<String, Object> datamap = datamapList.getLast();
int numInput;
try {
@ -753,7 +817,8 @@ public class RequirementsPrompt extends NumericPrompt {
String text = "";
String temp = (String) context.getSessionData(CK.REQ_CUSTOM_DATA_TEMP);
@SuppressWarnings("unchecked")
Map<String, String> descriptions = (Map<String, String>) context.getSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS);
Map<String, String> descriptions
= (Map<String, String>) context.getSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS);
if (descriptions.get(temp) != null) {
text += ChatColor.GOLD + descriptions.get(temp) + "\n";
}
@ -766,7 +831,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
@SuppressWarnings("unchecked")
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
Map<String, Object> datamap = datamapList.getLast();
datamap.put((String) context.getSessionData(CK.REQ_CUSTOM_DATA_TEMP), input);
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
@ -784,9 +850,11 @@ public class RequirementsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext cc) {
String text = ChatColor.DARK_GREEN + Lang.get("mcMMORequirementsTitle") + "\n";
if (cc.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqSetSkills") + "(" + Lang.get("noneSet") + ")\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqSetSkills") + "(" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqSetSkills") + "\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqSetSkills") + "\n";
@SuppressWarnings("unchecked")
LinkedList<String> skills = (LinkedList<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
for (String skill : skills) {
@ -794,16 +862,19 @@ public class RequirementsPrompt extends NumericPrompt {
}
}
if (cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) == null) {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqSetSkillAmounts") + "\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqSetSkillAmounts") + "\n";
@SuppressWarnings("unchecked")
LinkedList<Integer> amounts = (LinkedList<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
for (int i : amounts) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
text += ChatColor.BOLD + "" + ChatColor.GREEN + "3" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("done");
text += ChatColor.BOLD + "" + ChatColor.GREEN + "3" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("done");
return text;
}
@ -838,7 +909,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
LinkedList<String> skills = new LinkedList<String>();
for (String s : input.split(" ")) {
String formatted = MiscUtil.getCapitalized(s);
@ -876,7 +948,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
LinkedList<Integer> amounts = new LinkedList<Integer>();
for (String s : input.split(" ")) {
try {
@ -912,16 +985,23 @@ public class RequirementsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext cc) {
String text = ChatColor.DARK_GREEN + Lang.get("heroesRequirementsTitle") + "\n";
if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null) {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqHeroesSetPrimary") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqHeroesSetPrimary") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqHeroesSetPrimary") + " (" + ChatColor.AQUA + (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + ChatColor.GREEN + ")\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqHeroesSetPrimary") + " (" + ChatColor.AQUA
+ (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + ChatColor.GREEN + ")\n";
}
if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqHeroesSetSecondary") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqHeroesSetSecondary") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("reqHeroesSetSecondary") + " (" + ChatColor.AQUA + (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + ChatColor.GREEN + ")\n";
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("reqHeroesSetSecondary") + " (" + ChatColor.AQUA
+ (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + ChatColor.GREEN + ")\n";
}
text += ChatColor.BOLD + "" + ChatColor.GREEN + "3" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("done");
text += ChatColor.BOLD + "" + ChatColor.GREEN + "3" + ChatColor.RESET + ChatColor.GREEN + " - "
+ Lang.get("done");
return text;
}
@ -963,7 +1043,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false
&& input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(input);
if (hc != null) {
if (hc.isPrimary()) {
@ -1014,7 +1095,8 @@ public class RequirementsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false
&& input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(input);
if (hc != null) {
if (hc.isSecondary()) {

View File

@ -132,13 +132,16 @@ public class RewardsPrompt extends NumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
int moneyRew = (Integer) context.getSessionData(CK.REW_MONEY);
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyRew + " " + (moneyRew > 1 ? plugin.getCurrency(true) : plugin.getCurrency(false)) + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyRew + " "
+ (moneyRew > 1 ? plugin.getCurrency(true) : plugin.getCurrency(false)) + ChatColor.GRAY
+ ")";
}
case 2:
if (context.getSessionData(CK.REW_QUEST_POINTS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REW_QUEST_POINTS) + " " + Lang.get("questPoints") + ChatColor.GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REW_QUEST_POINTS) + " "
+ Lang.get("questPoints") + ChatColor.GRAY + ")";
}
case 3:
if (context.getSessionData(CK.REW_ITEMS) == null) {
@ -147,7 +150,8 @@ public class RewardsPrompt extends NumericPrompt {
String text = "";
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.REW_ITEMS);
for (int i = 0; i < items.size(); i++) {
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i)) + ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
}
return text;
}
@ -155,7 +159,8 @@ public class RewardsPrompt extends NumericPrompt {
if (context.getSessionData(CK.REW_EXP) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REW_EXP) + " " + Lang.get("points") + ChatColor.DARK_GRAY + ")";
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REW_EXP) + " "
+ Lang.get("points") + ChatColor.DARK_GRAY + ")";
}
case 5:
if (context.getSessionData(CK.REW_COMMAND) == null) {
@ -169,7 +174,8 @@ public class RewardsPrompt extends NumericPrompt {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + cmd;
if (overrides != null) {
if (index < overrides.size()) {
text += ChatColor.GRAY + " (\"" + ChatColor.AQUA + overrides.get(index) + ChatColor.GRAY + "\")";
text += ChatColor.GRAY + " (\"" + ChatColor.AQUA + overrides.get(index)
+ ChatColor.GRAY + "\")";
}
}
text += "\n";
@ -197,7 +203,8 @@ public class RewardsPrompt extends NumericPrompt {
List<String> skills = (List<String>) context.getSessionData(CK.REW_MCMMO_SKILLS);
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REW_MCMMO_AMOUNTS);
for (String skill : skills) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + skill + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amounts.get(skills.indexOf(skill)) + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA + skill + ChatColor.GRAY + " x "
+ ChatColor.DARK_AQUA + amounts.get(skills.indexOf(skill)) + "\n";
}
return text;
}
@ -213,7 +220,9 @@ public class RewardsPrompt extends NumericPrompt {
List<String> heroClasses = (List<String>) context.getSessionData(CK.REW_HEROES_CLASSES);
List<Double> amounts = (List<Double>) context.getSessionData(CK.REW_HEROES_AMOUNTS);
for (String heroClass : heroClasses) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + amounts.get(heroClasses.indexOf(heroClass)) + " " + ChatColor.DARK_AQUA + heroClass + " " + Lang.get("experience") + "\n";
text += ChatColor.GRAY + " - " + ChatColor.AQUA
+ amounts.get(heroClasses.indexOf(heroClass)) + " " + ChatColor.DARK_AQUA
+ heroClass + " " + Lang.get("experience") + "\n";
}
return text;
}
@ -242,7 +251,8 @@ public class RewardsPrompt extends NumericPrompt {
String text = "";
LinkedList<String> customRews = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
for (String s : customRews) {
text += ChatColor.RESET + "" + ChatColor.DARK_PURPLE + " - " + ChatColor.LIGHT_PURPLE + s + "\n";
text += ChatColor.RESET + "" + ChatColor.DARK_PURPLE + " - " + ChatColor.LIGHT_PURPLE + s
+ "\n";
}
return text;
}
@ -262,9 +272,12 @@ public class RewardsPrompt extends NumericPrompt {
QuestsEditorPostOpenRewardsPromptEvent event = new QuestsEditorPostOpenRewardsPromptEvent(factory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.LIGHT_PURPLE + getTitle(context).replace((String) context.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME) + ChatColor.LIGHT_PURPLE) + "\n";
String text = ChatColor.LIGHT_PURPLE + getTitle(context).replace((String) context
.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME)
+ ChatColor.LIGHT_PURPLE) + "\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
}
return text;
}
@ -317,7 +330,9 @@ public class RewardsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = Lang.get("rewMoneyPrompt");
if (plugin.getDependencies().getVaultEconomy() != null) {
text = text.replace("<money>", ChatColor.AQUA + (plugin.getDependencies().getVaultEconomy().currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy().currencyNamePlural()) + ChatColor.YELLOW);
text = text.replace("<money>", ChatColor.AQUA + (plugin.getDependencies().getVaultEconomy()
.currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy()
.currencyNamePlural()) + ChatColor.YELLOW);
} else {
text = text.replace("<money>", ChatColor.AQUA + Lang.get("money") + ChatColor.YELLOW);
}
@ -326,7 +341,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
@ -336,7 +352,8 @@ public class RewardsPrompt extends NumericPrompt {
return new MoneyPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new MoneyPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -356,7 +373,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
@ -366,7 +384,8 @@ public class RewardsPrompt extends NumericPrompt {
return new ExperiencePrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new ExperiencePrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -386,7 +405,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
@ -396,7 +416,8 @@ public class RewardsPrompt extends NumericPrompt {
return new QuestPointsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new QuestPointsPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -432,16 +453,22 @@ public class RewardsPrompt extends NumericPrompt {
String text = ChatColor.GOLD + Lang.get("itemRewardsTitle") + "\n";
if (context.getSessionData(CK.REW_ITEMS) == null) {
text += ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
for (ItemStack is : getItems(context)) {
text += ChatColor.GRAY + "- " + ItemUtil.getDisplayString(is) + "\n";
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("stageEditorDeliveryAddItem") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -476,25 +503,34 @@ public class RewardsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("rewCommands") + " -\n";
if (context.getSessionData(CK.REW_COMMAND) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetCommands") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("rewSetCommandsOverrides") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetCommands") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("rewSetCommandsOverrides") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetCommands") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetCommands") + "\n";
for (String s : getCommand(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetCommandsOverrides") + " (" + Lang.get("stageEditorOptional") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetCommandsOverrides") + " (" + Lang.get("stageEditorOptional") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetCommandsOverrides") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetCommandsOverrides") + "\n";
for (String s : getCommandOverrideDisplay(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
}
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.RED + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -537,14 +573,16 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
String lang1 = Lang.get("rewCommandPrompt");
lang1 = lang1.replace("<comma>", ChatColor.BOLD + "" + ChatColor.RED + "comma" + ChatColor.RESET + ChatColor.YELLOW);
lang1 = lang1.replace("<comma>", ChatColor.BOLD + "" + ChatColor.RED + "comma" + ChatColor.RESET
+ ChatColor.YELLOW);
String lang2 = Lang.get("rewCommandPromptHint");
return ChatColor.YELLOW + lang1 + "\n" + ChatColor.GOLD + lang2;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(Lang.get("charSemi"));
List<String> commands = new LinkedList<String>();
for (String s : args) {
@ -572,7 +610,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(Lang.get("charSemi"));
List<String> overrides = new LinkedList<String>();
for (String s : args) {
@ -598,7 +637,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(" ");
List<String> permissions = new LinkedList<String>();
permissions.addAll(Arrays.asList(args));
@ -620,25 +660,34 @@ public class RewardsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("mcMMORewardsTitle") + "\n";
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetSkills") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("reqSetSkillAmounts") + " (" + Lang.get("rewNoMcMMOSkills") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("reqSetSkills") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("reqSetSkillAmounts") + " (" + Lang.get("rewNoMcMMOSkills") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetSkills") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("reqSetSkills") + "\n";
for (String s : getSkills(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(CK.REW_MCMMO_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetSkillAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("reqSetSkillAmounts") + "\n";
for (Integer i : getSkillAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
}
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -774,25 +823,34 @@ public class RewardsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + Lang.get("heroesRewardsTitle") + "\n";
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetHeroesClasses") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("rewSetHeroesAmounts") + "(" + Lang.get("rewNoHeroesClasses") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetHeroesClasses") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.GRAY + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GRAY + " - "
+ Lang.get("rewSetHeroesAmounts") + "(" + Lang.get("rewNoHeroesClasses") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetHeroesClasses") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetHeroesClasses") + "\n";
for (String s : getClasses(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
}
if (context.getSessionData(CK.REW_HEROES_AMOUNTS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetHeroesAmounts") + " (" + Lang.get("noneSet") + ")\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetHeroesAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetHeroesAmounts") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("rewSetHeroesAmounts") + "\n";
for (Double d : getClassAmounts(context)) {
text += ChatColor.GRAY + " - " + ChatColor.AQUA + d + "\n";
}
}
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("clear") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
+ Lang.get("done");
}
return text;
}
@ -941,7 +999,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] arr = input.split(" ");
List<String> loots = new LinkedList<String>();
for (String s : arr) {
@ -983,7 +1042,8 @@ public class RewardsPrompt extends NumericPrompt {
@SuppressWarnings("unchecked")
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomReward found = null;
// Check if we have a custom reward with the specified name
for (CustomReward cr : plugin.getCustomRewards()) {
@ -1005,7 +1065,8 @@ public class RewardsPrompt extends NumericPrompt {
if (context.getSessionData(CK.REW_CUSTOM) != null) {
// The custom reward may already have been added, so let's check that
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
if (list.contains(found.getName()) == false) {
// Hasn't been added yet, so let's do it
list.add(found.getName());
@ -1052,7 +1113,8 @@ public class RewardsPrompt extends NumericPrompt {
public String getPromptText(ConversationContext context) {
String text = ChatColor.AQUA + "- ";
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
String rewName = list.getLast();
Map<String, Object> datamap = datamapList.getLast();
text += rewName + " -\n";
@ -1063,7 +1125,8 @@ public class RewardsPrompt extends NumericPrompt {
}
Collections.sort(datamapKeys);
for (String dataKey : datamapKeys) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + index + ChatColor.RESET + ChatColor.YELLOW + " - " + dataKey;
text += ChatColor.BLUE + "" + ChatColor.BOLD + index + ChatColor.RESET + ChatColor.YELLOW + " - "
+ dataKey;
if (datamap.get(dataKey) != null) {
text += ChatColor.GREEN + " (" + datamap.get(dataKey).toString() + ")\n";
} else {
@ -1078,7 +1141,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
@SuppressWarnings("unchecked")
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
Map<String, Object> datamap = datamapList.getLast();
int numInput;
try {
@ -1116,7 +1180,8 @@ public class RewardsPrompt extends NumericPrompt {
String text = "";
String temp = (String) context.getSessionData(CK.REW_CUSTOM_DATA_TEMP);
@SuppressWarnings("unchecked")
Map<String, String> descriptions = (Map<String, String>) context.getSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS);
Map<String, String> descriptions
= (Map<String, String>) context.getSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS);
if (descriptions.get(temp) != null) {
text += ChatColor.GOLD + descriptions.get(temp) + "\n";
}
@ -1129,7 +1194,8 @@ public class RewardsPrompt extends NumericPrompt {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
@SuppressWarnings("unchecked")
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
LinkedList<Map<String, Object>> datamapList
= (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
Map<String, Object> datamap = datamapList.getLast();
datamap.put((String) context.getSessionData(CK.REW_CUSTOM_DATA_TEMP), input);
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);

View File

@ -77,7 +77,8 @@ public class StagesPrompt extends NumericPrompt {
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle() + " -\n";
for (int i = 1; i <= (getStages(context) + size); i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n";
}
return text;
}
@ -129,63 +130,92 @@ public class StagesPrompt extends NumericPrompt {
newPref = "stage" + (current - 1);
context.setSessionData(newPref + CK.S_BREAK_NAMES, context.getSessionData(pref + CK.S_BREAK_NAMES));
context.setSessionData(newPref + CK.S_BREAK_AMOUNTS, context.getSessionData(pref + CK.S_BREAK_AMOUNTS));
context.setSessionData(newPref + CK.S_BREAK_DURABILITY, context.getSessionData(pref + CK.S_BREAK_DURABILITY));
context.setSessionData(newPref + CK.S_BREAK_DURABILITY, context.getSessionData(pref
+ CK.S_BREAK_DURABILITY));
context.setSessionData(newPref + CK.S_DAMAGE_NAMES, context.getSessionData(pref + CK.S_DAMAGE_NAMES));
context.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS));
context.setSessionData(newPref + CK.S_DAMAGE_DURABILITY, context.getSessionData(pref + CK.S_DAMAGE_DURABILITY));
context.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, context.getSessionData(pref
+ CK.S_DAMAGE_AMOUNTS));
context.setSessionData(newPref + CK.S_DAMAGE_DURABILITY, context.getSessionData(pref
+ CK.S_DAMAGE_DURABILITY));
context.setSessionData(newPref + CK.S_PLACE_NAMES, context.getSessionData(pref + CK.S_PLACE_NAMES));
context.setSessionData(newPref + CK.S_PLACE_NAMES, context.getSessionData(pref + CK.S_PLACE_AMOUNTS));
context.setSessionData(newPref + CK.S_PLACE_DURABILITY, context.getSessionData(pref + CK.S_PLACE_DURABILITY));
context.setSessionData(newPref + CK.S_PLACE_DURABILITY, context.getSessionData(pref
+ CK.S_PLACE_DURABILITY));
context.setSessionData(newPref + CK.S_USE_NAMES, context.getSessionData(pref + CK.S_USE_NAMES));
context.setSessionData(newPref + CK.S_USE_AMOUNTS, context.getSessionData(pref + CK.S_USE_AMOUNTS));
context.setSessionData(newPref + CK.S_USE_DURABILITY, context.getSessionData(pref + CK.S_USE_DURABILITY));
context.setSessionData(newPref + CK.S_USE_DURABILITY, context.getSessionData(pref
+ CK.S_USE_DURABILITY));
context.setSessionData(newPref + CK.S_CUT_NAMES, context.getSessionData(pref + CK.S_CUT_NAMES));
context.setSessionData(newPref + CK.S_CUT_AMOUNTS, context.getSessionData(pref + CK.S_CUT_AMOUNTS));
context.setSessionData(newPref + CK.S_CUT_DURABILITY, context.getSessionData(pref + CK.S_CUT_DURABILITY));
context.setSessionData(newPref + CK.S_CUT_DURABILITY, context.getSessionData(pref
+ CK.S_CUT_DURABILITY));
context.setSessionData(newPref + CK.S_CRAFT_ITEMS, context.getSessionData(pref + CK.S_CRAFT_ITEMS));
context.setSessionData(newPref + CK.S_SMELT_ITEMS, context.getSessionData(pref + CK.S_SMELT_ITEMS));
context.setSessionData(newPref + CK.S_ENCHANT_TYPES, context.getSessionData(pref + CK.S_ENCHANT_TYPES));
context.setSessionData(newPref + CK.S_ENCHANT_NAMES, context.getSessionData(pref + CK.S_ENCHANT_NAMES));
context.setSessionData(newPref + CK.S_ENCHANT_AMOUNTS, context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS));
context.setSessionData(newPref + CK.S_ENCHANT_AMOUNTS, context.getSessionData(pref
+ CK.S_ENCHANT_AMOUNTS));
context.setSessionData(newPref + CK.S_BREW_ITEMS, context.getSessionData(pref + CK.S_BREW_ITEMS));
context.setSessionData(newPref + CK.S_FISH, context.getSessionData(pref + CK.S_FISH));
context.setSessionData(newPref + CK.S_PLAYER_KILL, context.getSessionData(pref + CK.S_PLAYER_KILL));
context.setSessionData(newPref + CK.S_DELIVERY_ITEMS, context.getSessionData(pref + CK.S_DELIVERY_ITEMS));
context.setSessionData(newPref + CK.S_DELIVERY_ITEMS, context.getSessionData(pref
+ CK.S_DELIVERY_ITEMS));
context.setSessionData(newPref + CK.S_DELIVERY_NPCS, context.getSessionData(pref + CK.S_DELIVERY_NPCS));
context.setSessionData(newPref + CK.S_DELIVERY_MESSAGES, context.getSessionData(pref + CK.S_DELIVERY_MESSAGES));
context.setSessionData(newPref + CK.S_NPCS_TO_TALK_TO, context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO));
context.setSessionData(newPref + CK.S_DELIVERY_MESSAGES, context.getSessionData(pref
+ CK.S_DELIVERY_MESSAGES));
context.setSessionData(newPref + CK.S_NPCS_TO_TALK_TO, context.getSessionData(pref
+ CK.S_NPCS_TO_TALK_TO));
context.setSessionData(newPref + CK.S_NPCS_TO_KILL, context.getSessionData(pref + CK.S_NPCS_TO_KILL));
context.setSessionData(newPref + CK.S_NPCS_TO_KILL_AMOUNTS, context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS));
context.setSessionData(newPref + CK.S_NPCS_TO_KILL_AMOUNTS, context.getSessionData(pref
+ CK.S_NPCS_TO_KILL_AMOUNTS));
context.setSessionData(newPref + CK.S_MOB_TYPES, context.getSessionData(pref + CK.S_MOB_TYPES));
context.setSessionData(newPref + CK.S_MOB_AMOUNTS, context.getSessionData(pref + CK.S_MOB_AMOUNTS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS, context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_RADIUS, context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_NAMES, context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS, context.getSessionData(pref + CK.S_REACH_LOCATIONS));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS_RADIUS, context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS_NAMES, context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS, context.getSessionData(pref
+ CK.S_MOB_KILL_LOCATIONS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_RADIUS, context.getSessionData(pref
+ CK.S_MOB_KILL_LOCATIONS_RADIUS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_NAMES, context.getSessionData(pref
+ CK.S_MOB_KILL_LOCATIONS_NAMES));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS, context.getSessionData(pref
+ CK.S_REACH_LOCATIONS));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS_RADIUS, context.getSessionData(pref
+ CK.S_REACH_LOCATIONS_RADIUS));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS_NAMES, context.getSessionData(pref
+ CK.S_REACH_LOCATIONS_NAMES));
context.setSessionData(newPref + CK.S_TAME_TYPES, context.getSessionData(pref + CK.S_TAME_TYPES));
context.setSessionData(newPref + CK.S_TAME_AMOUNTS, context.getSessionData(pref + CK.S_TAME_AMOUNTS));
context.setSessionData(newPref + CK.S_SHEAR_COLORS, context.getSessionData(pref + CK.S_SHEAR_COLORS));
context.setSessionData(newPref + CK.S_SHEAR_AMOUNTS, context.getSessionData(pref + CK.S_SHEAR_AMOUNTS));
context.setSessionData(newPref + CK.S_START_EVENT, context.getSessionData(pref + CK.S_START_EVENT));
context.setSessionData(newPref + CK.S_DISCONNECT_EVENT, context.getSessionData(pref + CK.S_DISCONNECT_EVENT));
context.setSessionData(newPref + CK.S_DISCONNECT_EVENT, context.getSessionData(pref
+ CK.S_DISCONNECT_EVENT));
context.setSessionData(newPref + CK.S_DEATH_EVENT, context.getSessionData(pref + CK.S_DEATH_EVENT));
context.setSessionData(newPref + CK.S_CHAT_EVENTS, context.getSessionData(pref + CK.S_CHAT_EVENTS));
context.setSessionData(newPref + CK.S_CHAT_EVENT_TRIGGERS, context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS));
context.setSessionData(newPref + CK.S_CHAT_EVENT_TRIGGERS, context.getSessionData(pref
+ CK.S_CHAT_EVENT_TRIGGERS));
context.setSessionData(newPref + CK.S_FINISH_EVENT, context.getSessionData(pref + CK.S_FINISH_EVENT));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_COUNT, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP));
context.setSessionData(newPref + CK.S_PASSWORD_DISPLAYS, context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS));
context.setSessionData(newPref + CK.S_PASSWORD_PHRASES, context.getSessionData(pref + CK.S_PASSWORD_PHRASES));
context.setSessionData(newPref + CK.S_OVERRIDE_DISPLAY, context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES, context.getSessionData(pref
+ CK.S_CUSTOM_OBJECTIVES));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA, context.getSessionData(pref
+ CK.S_CUSTOM_OBJECTIVES_DATA));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_COUNT, context.getSessionData(pref
+ CK.S_CUSTOM_OBJECTIVES_COUNT));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, context.getSessionData(pref
+ CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, context.getSessionData(pref
+ CK.S_CUSTOM_OBJECTIVES_DATA_TEMP));
context.setSessionData(newPref + CK.S_PASSWORD_DISPLAYS, context.getSessionData(pref
+ CK.S_PASSWORD_DISPLAYS));
context.setSessionData(newPref + CK.S_PASSWORD_PHRASES, context.getSessionData(pref
+ CK.S_PASSWORD_PHRASES));
context.setSessionData(newPref + CK.S_OVERRIDE_DISPLAY, context.getSessionData(pref
+ CK.S_OVERRIDE_DISPLAY));
context.setSessionData(newPref + CK.S_DELAY, context.getSessionData(pref + CK.S_DELAY));
context.setSessionData(newPref + CK.S_DELAY_MESSAGE, context.getSessionData(pref + CK.S_DELAY_MESSAGE));
context.setSessionData(newPref + CK.S_DELAY_MESSAGE, context.getSessionData(pref
+ CK.S_DELAY_MESSAGE));
context.setSessionData(newPref + CK.S_DENIZEN, context.getSessionData(pref + CK.S_DENIZEN));
context.setSessionData(newPref + CK.S_COMPLETE_MESSAGE, context.getSessionData(pref + CK.S_COMPLETE_MESSAGE));
context.setSessionData(newPref + CK.S_COMPLETE_MESSAGE, context.getSessionData(pref
+ CK.S_COMPLETE_MESSAGE));
context.setSessionData(newPref + CK.S_START_MESSAGE, context.getSessionData(pref + CK.S_START_MESSAGE));
}
context.setSessionData(pref + CK.S_BREAK_NAMES, null);

View File

@ -39,7 +39,8 @@ public class ActionTimer extends BukkitRunnable {
quest.failQuest(quester);
quester.updateJournal();
} else {
quester.getPlayer().sendMessage(Lang.get(quester.getPlayer(), "timerMessage").replace("<time>", String.valueOf(time)));
quester.getPlayer().sendMessage(Lang.get(quester.getPlayer(), "timerMessage")
.replace("<time>", String.valueOf(time)));
}
}
}

View File

@ -56,7 +56,8 @@ public class DenizenAPI {
denizen = Class.forName("net.aufdemrand.denizen.Denizen");
scriptRegistry = Class.forName("net.aufdemrand.denizencore.scripts.ScriptRegistry");
scriptContainer = Class.forName("net.aufdemrand.denizencore.scripts.containers.ScriptContainer");
taskScriptContainer = Class.forName("net.aufdemrand.denizencore.scripts.containers.core.TaskScriptContainer");
taskScriptContainer
= Class.forName("net.aufdemrand.denizencore.scripts.containers.core.TaskScriptContainer");
dPlayer = Class.forName("net.aufdemrand.denizen.objects.dPlayer");
dNPC = Class.forName("net.aufdemrand.denizen.objects.dNPC");
scriptEntryData = Class.forName("net.aufdemrand.denizencore.scripts.ScriptEntryData");
@ -78,11 +79,13 @@ public class DenizenAPI {
try {
containsScriptMethod = scriptRegistry.getMethod("containsScript", String.class);
getScriptNamesMethod = scriptRegistry.getMethod("_getScriptNames");
getScriptContainerAsMethod = scriptRegistry.getMethod("getScriptContainerAs", String.class, taskScriptContainer.getClass());
getScriptContainerAsMethod = scriptRegistry
.getMethod("getScriptContainerAs", String.class, taskScriptContainer.getClass());
mirrorBukkitPlayerMethod = dPlayer.getMethod("mirrorBukkitPlayer", OfflinePlayer.class);
mirrorCitizensNPCMethod = dNPC.getMethod("mirrorCitizensNPC", NPC.class);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests failed to bind to Denizen, integration will not work!", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests failed to bind to Denizen, integration will not work!", e);
return;
}
}
@ -103,7 +106,8 @@ public class DenizenAPI {
try {
script = (boolean)containsScriptMethod.invoke(scriptRegistry, input);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen ScriptRegistry#containsScript", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen ScriptRegistry#containsScript", e);
}
return script;
}
@ -123,7 +127,8 @@ public class DenizenAPI {
instance = constructor.newInstance(null, input);
name = (String)instance.getClass().getMethod("getName").invoke(scriptContainer);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen ScriptContainer#getName", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen ScriptContainer#getName", e);
}
return name;
}
@ -141,7 +146,8 @@ public class DenizenAPI {
try {
names = (Set<String>)getScriptNamesMethod.invoke(scriptRegistry);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen ScriptRegistry#_getScriptNames", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen ScriptRegistry#_getScriptNames", e);
}
return names;
}
@ -158,7 +164,8 @@ public class DenizenAPI {
try {
container = getScriptContainerAsMethod.invoke(scriptRegistry, scriptName, taskScriptContainer);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen #getScriptContainerAs", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen #getScriptContainerAs", e);
}
return container;
}
@ -175,7 +182,8 @@ public class DenizenAPI {
try {
dp = mirrorBukkitPlayerMethod.invoke(dPlayer, player);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen dPlayer#mirrorBukkitPlayer", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen dPlayer#mirrorBukkitPlayer", e);
}
return dp;
}
@ -192,7 +200,8 @@ public class DenizenAPI {
try {
dp = mirrorCitizensNPCMethod.invoke(dNPC, npc);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen dNPC#mirrorCitizensNPC", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen dNPC#mirrorCitizensNPC", e);
}
return dp;
}
@ -211,7 +220,8 @@ public class DenizenAPI {
Method runTaskScript = tsc.getClass().getMethod("runTaskScript", scriptEntryData, Map.class);
runTaskScript.invoke(tsc, constructor.newInstance(mirrorBukkitPlayer(player), null), null);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error invoking Denizen TaskScriptContainer#runTaskScript", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error invoking Denizen TaskScriptContainer#runTaskScript", e);
}
}
}

View File

@ -27,7 +27,8 @@ import com.denizenscript.denizencore.scripts.containers.core.TaskScriptContainer
import net.citizensnpcs.api.npc.NPC;
/**
* This class's imports must exist separately from DenizenAPI.java in order to not crash from NoClassDefFoundError at runtime
* This class's imports must exist separately from DenizenAPI.java in order to not crash from NoClassDefFoundError at
* runtime
*/
public class DenizenAPI_1_1_0 {

View File

@ -83,9 +83,12 @@ public class ItemUtil {
return -4;
} else if (one.getItemMeta().hasLore() == false && two.getItemMeta().hasLore()) {
return -4;
} else if (one.getItemMeta().hasDisplayName() && two.getItemMeta().hasDisplayName() && ChatColor.stripColor(one.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(two.getItemMeta().getDisplayName())) == false) {
} else if (one.getItemMeta().hasDisplayName() && two.getItemMeta().hasDisplayName()
&& ChatColor.stripColor(one.getItemMeta().getDisplayName())
.equals(ChatColor.stripColor(two.getItemMeta().getDisplayName())) == false) {
return -4;
} else if (one.getItemMeta().hasLore() && two.getItemMeta().hasLore() && one.getItemMeta().getLore().equals(two.getItemMeta().getLore()) == false) {
} else if (one.getItemMeta().hasLore() && two.getItemMeta().hasLore()
&& one.getItemMeta().getLore().equals(two.getItemMeta().getLore()) == false) {
return -4;
}
try {
@ -114,10 +117,12 @@ public class ItemUtil {
if (one.getItemMeta() instanceof PotionMeta) {
if (Material.getMaterial("LINGERING_POTION") != null) {
// Bukkit version is 1.9+
if (one.getType().equals(Material.POTION) || one.getType().equals(Material.LINGERING_POTION) || one.getType().equals(Material.SPLASH_POTION)) {
if (one.getType().equals(Material.POTION) || one.getType().equals(Material.LINGERING_POTION)
|| one.getType().equals(Material.SPLASH_POTION)) {
PotionMeta pmeta1 = (PotionMeta) one.getItemMeta();
PotionMeta pmeta2 = (PotionMeta) two.getItemMeta();
if (pmeta1.getBasePotionData().getType().equals(pmeta2.getBasePotionData().getType()) == false) {
if (pmeta1.getBasePotionData().getType()
.equals(pmeta2.getBasePotionData().getType()) == false) {
return -9;
}
}
@ -167,7 +172,8 @@ public class ItemUtil {
return new ItemStack(Material.getMaterial(material.toUpperCase()), amount, durability);
} catch (Exception e) {
try {
Bukkit.getLogger().warning(material + " is invalid! You may need to update your quests.yml or events.yml "
Bukkit.getLogger().warning(material
+ " is invalid! You may need to update your quests.yml or events.yml "
+ "in accordance with https://bit.ly/2BkBNNN");
return new ItemStack(Material.matchMaterial(material, true), amount, durability);
} catch (Exception e2) {
@ -181,7 +187,8 @@ public class ItemUtil {
/**
* Get ItemStack from formatted string. See serialize() for reverse function.
*
* <p>Supplied format = name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname:lore-lore
* <p>Supplied format = name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname
* :lore-lore
* <p>May continue with extraneous data such as :ItemFlags-flags:stored-enchants:{enc, level}:internal-hashstring
*
* @param data formatted string
@ -227,18 +234,21 @@ public class ItemUtil {
if (e != null) {
enchs.put(e, Integer.parseInt(temp[1]));
} else {
Bukkit.getLogger().severe("Legacy enchantment name \'" + temp[0] + "\' on " + name + " is invalid. Make sure it is spelled correctly");
Bukkit.getLogger().severe("Legacy enchantment name \'" + temp[0] + "\' on " + name
+ " is invalid. Make sure it is spelled correctly");
}
} else {
// Modern enum name
if (Enchantment.getByName(temp[0]) != null) {
enchs.put(Enchantment.getByName(temp[0]), Integer.parseInt(temp[1]));
} else {
Bukkit.getLogger().severe("Enum enchantment name \'" + temp[0] + "\' on " + name + " is invalid. Make sure it is spelled correctly");
Bukkit.getLogger().severe("Enum enchantment name \'" + temp[0] + "\' on " + name
+ " is invalid. Make sure it is spelled correctly");
}
}
} catch (Exception e) {
Bukkit.getLogger().severe("The enchantment name \'" + temp[0] + "\' on " + name + " is invalid. Make sure quests.yml is UTF-8 encoded");
Bukkit.getLogger().severe("The enchantment name \'" + temp[0] + "\' on " + name
+ " is invalid. Make sure quests.yml is UTF-8 encoded");
return null;
}
} else if (arg.startsWith("displayname-")) {
@ -393,7 +403,8 @@ public class ItemUtil {
/**
* Get formatted string from ItemStack. See readItemStack() for reverse function.
*
* <p>Returned format = name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname:lore-lore:
* <p>Returned format = name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname
* :lore-lore:
*
* @param is ItemStack
* @return formatted string, or null if invalid stack
@ -467,7 +478,8 @@ public class ItemUtil {
return null;
}
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.AQUA + " x " + is.getAmount();
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET
+ ChatColor.AQUA + " x " + is.getAmount();
} else {
text = ChatColor.AQUA + getName(is);
if (is.getDurability() != 0) {
@ -499,7 +511,8 @@ public class ItemUtil {
}
String text;
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.AQUA + " x " + is.getAmount();
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET
+ ChatColor.AQUA + " x " + is.getAmount();
} else {
text = ChatColor.AQUA + getPrettyItemName(is.getType().name());
if (is.getDurability() != 0) {

View File

@ -124,15 +124,19 @@ public class Lang {
}
public void loadLang() throws InvalidConfigurationException, IOException {
File langFile = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso + File.separator + "strings.yml");
File langFile_new = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso + File.separator + "strings_new.yml");
File langFile = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso + File.separator
+ "strings.yml");
File langFile_new = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso
+ File.separator + "strings_new.yml");
boolean exists_new = langFile_new.exists();
LinkedHashMap<String, String> allStrings = new LinkedHashMap<String, String>();
if (langFile.exists()) {
FileConfiguration config = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(langFile), "UTF-8"));
FileConfiguration config= YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(langFile), "UTF-8"));
FileConfiguration config_new = null;
if (exists_new) {
config_new = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(langFile_new), "UTF-8"));
config_new = YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(langFile_new), "UTF-8"));
}
// Load user's lang file and determine new strings
for (String key : config.getKeys(false)) {
@ -147,21 +151,27 @@ public class Lang {
String value = config_new.getString(key);
if (value != null) {
allStrings.put(key, value);
plugin.getLogger().warning("There are new language phrases in /lang/" + iso + "/strings_new.yml for the current version!"
plugin.getLogger().warning("There are new language phrases in /lang/" + iso
+ "/strings_new.yml for the current version!"
+ " You must transfer them to, or regenerate, strings.yml to remove this warning!");
}
}
config_new.options().header("Below are any new strings for your current version of Quests! Transfer them to the strings.yml of the"
+ " same folder to stay up-to-date and suppress console warnings.");
config_new.options().header("Below are any new strings for your current version of Quests! "
+ "Transfer them to the strings.yml of the"
+ " same folder to stay up-to-date and suppress console warnings.");
config_new.options().copyHeader(true);
config_new.save(langFile_new);
}
} else {
plugin.getLogger().severe("Failed loading lang files for " + iso + " because they were not found. Using default en-US");
plugin.getLogger().info("If the plugin has not generated language files, ensure Quests has write permissions");
plugin.getLogger().info("For help, visit https://github.com/FlyingPikachu/Quests/wiki/Casual-%E2%80%90-Translations");
plugin.getLogger().severe("Failed loading lang files for " + iso
+ " because they were not found. Using default en-US");
plugin.getLogger()
.info("If the plugin has not generated language files, ensure Quests has write permissions");
plugin.getLogger()
.info("For help, visit https://github.com/FlyingPikachu/Quests/wiki/Casual-%E2%80%90-Translations");
iso = "en-US";
FileConfiguration config = YamlConfiguration.loadConfiguration(new InputStreamReader(plugin.getResource("strings.yml"), "UTF-8"));
FileConfiguration config = YamlConfiguration
.loadConfiguration(new InputStreamReader(plugin.getResource("strings.yml"), "UTF-8"));
for (String key : config.getKeys(false)) {
allStrings.put(key, config.getString(key));
}

View File

@ -51,7 +51,8 @@ public class LocaleQuery {
this.plugin = plugin;
String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
try {
craftMagicNumbers = Class.forName("org.bukkit.craftbukkit.{v}.util.CraftMagicNumbers".replace("{v}", version));
craftMagicNumbers = Class.forName("org.bukkit.craftbukkit.{v}.util.CraftMagicNumbers"
.replace("{v}", version));
itemClazz = Class.forName("net.minecraft.server.{v}.Item".replace("{v}", version));
} catch (ClassNotFoundException e) {
e.printStackTrace();
@ -83,7 +84,8 @@ public class LocaleQuery {
* @param enchantments Enchantments for the item being translated
* @param meta ItemMeta for the item being translated
*/
public boolean sendMessage(Player player, String message, Material material, short durability, Map<Enchantment, Integer> enchantments, ItemMeta meta) {
public boolean sendMessage(Player player, String message, Material material, short durability,
Map<Enchantment, Integer> enchantments, ItemMeta meta) {
if (material == null) {
return false;
}
@ -106,9 +108,11 @@ public class LocaleQuery {
if (material.equals(Material.POTION)) {
matKey = oldPotions.get(((PotionMeta)i.getItemMeta()).getBasePotionData().getType().name());
} else if (material.equals(Material.LINGERING_POTION)) {
matKey = oldLingeringPotions.get(((PotionMeta)i.getItemMeta()).getBasePotionData().getType().name());
matKey = oldLingeringPotions.get(((PotionMeta)i.getItemMeta()).getBasePotionData().getType()
.name());
} else if (material.equals(Material.SPLASH_POTION)) {
matKey = oldSplashPotions.get(((PotionMeta)i.getItemMeta()).getBasePotionData().getType().name());
matKey = oldSplashPotions.get(((PotionMeta)i.getItemMeta()).getBasePotionData().getType()
.name());
}
} else if (new Potion(durability).getType() != null) {
matKey = oldPotions_18.get(new Potion(durability).getType().name());
@ -138,9 +142,10 @@ public class LocaleQuery {
return false;
}
if (meta != null && meta instanceof PotionMeta) {
matKey = "item.minecraft.potion.effect." + ((PotionMeta)meta).getBasePotionData().getType().name().toLowerCase()
.replace("regen", "regeneration").replace("speed", "swiftness").replace("jump", "leaping")
.replace("instant_heal", "healing").replace("instant_damage", "harming");
matKey = "item.minecraft.potion.effect." + ((PotionMeta)meta).getBasePotionData().getType().name()
.toLowerCase().replace("regen", "regeneration").replace("speed", "swiftness")
.replace("jump", "leaping").replace("instant_heal", "healing")
.replace("instant_damage", "harming");
}
if (enchantments != null && !enchantments.isEmpty()) {
int count = 0;
@ -175,7 +180,8 @@ public class LocaleQuery {
* @param durability Durability for the item being translated
* @param enchantments Enchantments for the item being translated
*/
public boolean sendMessage(Player player, String message, Material material, short durability, Map<Enchantment, Integer> enchantments) {
public boolean sendMessage(Player player, String message, Material material, short durability,
Map<Enchantment, Integer> enchantments) {
return sendMessage(player, message, material, durability, enchantments, null);
}

View File

@ -60,7 +60,8 @@ public class MiscUtil {
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
int index = name.indexOf('_');
if (index != -1) {
name = name.substring(0, (index + 1)) + Character.toUpperCase(name.charAt(index + 1)) + name.substring(index + 2);
name = name.substring(0, (index + 1)) + Character.toUpperCase(name.charAt(index + 1))
+ name.substring(index + 2);
name = name.replaceFirst("_", "");
}
return name;
@ -120,7 +121,8 @@ public class MiscUtil {
} else if (s.equalsIgnoreCase("Red") || s.equalsIgnoreCase(Lang.get("COLOR_RED"))) {
return DyeColor.RED;
// 1.13 changed DyeColor.SILVER -> DyeColor.LIGHT_GRAY
} else if (s.equalsIgnoreCase("Silver") || s.equalsIgnoreCase("LightGray") || s.equalsIgnoreCase(Lang.get("COLOR_SILVER"))) {
} else if (s.equalsIgnoreCase("Silver") || s.equalsIgnoreCase("LightGray")
|| s.equalsIgnoreCase(Lang.get("COLOR_SILVER"))) {
return DyeColor.getByColor(Color.SILVER);
} else if (s.equalsIgnoreCase("White") || s.equalsIgnoreCase(Lang.get("COLOR_WHITE"))) {
return DyeColor.WHITE;

View File

@ -82,14 +82,16 @@ public class WorldGuardAPI {
vector = Class.forName("com.sk89q.worldedit.Vector");
vectorConstructor = vector.getConstructor(double.class, double.class, double.class);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests failed to bind to WorldGuard, integration will not work!", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests failed to bind to WorldGuard, integration will not work!", e);
regionContainer = null;
return;
}
}
if (regionContainer == null) {
Bukkit.getLogger().warning("Quests failed to find RegionContainer, WorldGuard integration will not function!");
Bukkit.getLogger()
.warning("Quests failed to find RegionContainer, WorldGuard integration will not function!");
}
}
}
@ -105,7 +107,8 @@ public class WorldGuardAPI {
try {
regionManager = (RegionManager)regionContainerGetMethod.invoke(regionContainer, world);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error getting WorldGuard RegionManager", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error getting WorldGuard RegionManager", e);
}
return regionManager;
}
@ -120,10 +123,12 @@ public class WorldGuardAPI {
ApplicableRegionSet ars = null;
if (regionManager == null) return null;
try {
Method getApplicableRegionsMethod = regionManager.getClass().getMethod("getApplicableRegions", Location.class);
Method getApplicableRegionsMethod = regionManager.getClass()
.getMethod("getApplicableRegions", Location.class);
ars = (ApplicableRegionSet)getApplicableRegionsMethod.invoke(regionManager, location);
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error getting RegionManager#getApplicableRegions", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error getting RegionManager#getApplicableRegions", e);
}
return ars;
}
@ -139,11 +144,13 @@ public class WorldGuardAPI {
List<String> ari = null;
if (regionManager == null) return null;
try {
Method getApplicableRegionsMethod = regionManager.getClass().getMethod("getApplicableRegionsIDs", vector);
Method getApplicableRegionsMethod = regionManager.getClass()
.getMethod("getApplicableRegionsIDs", vector);
ari = (List<String>)getApplicableRegionsMethod.invoke(regionManager,
vectorConstructor.newInstance(location.getX(), location.getY(), location.getZ()));
} catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Quests encountered an error getting RegionManager#getApplicableRegionsIDs", e);
Bukkit.getLogger().log(Level.WARNING,
"Quests encountered an error getting RegionManager#getApplicableRegionsIDs", e);
}
return ari;
}

View File

@ -25,7 +25,8 @@ import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
/**
* This class's imports must exist separately from WorldGuardAPI.java in order to not crash from NoClassDefFoundError at runtime
* This class's imports must exist separately from WorldGuardAPI.java in order to not crash from NoClassDefFoundError
* at runtime
*/
public class WorldGuardAPI_7_0_0 {

View File

@ -45,8 +45,11 @@ public class ParticleProvider_v1_8_R1 extends ParticleProvider {
}
@Override
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles((EnumParticle) particle, false, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, count, data);
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ,
float speed, int count, int[] data) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles((EnumParticle) particle, false,
(float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ,
speed, count, data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}

View File

@ -45,8 +45,11 @@ public class ParticleProvider_v1_8_R2 extends ParticleProvider {
}
@Override
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles((EnumParticle) particle, false, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, count, data);
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ,
float speed, int count, int[] data) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles((EnumParticle) particle, false,
(float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ,
speed, count, data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}

View File

@ -45,8 +45,11 @@ public class ParticleProvider_v1_8_R3 extends ParticleProvider {
}
@Override
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles((EnumParticle) particle, false, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, count, data);
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ,
float speed, int count, int[] data) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles((EnumParticle) particle, false,
(float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ,
speed, count, data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}