mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-12 13:43:57 +01:00
Revise override capabilities. Add permission world prompt, fixes #1113
This commit is contained in:
parent
6eb71d6021
commit
0fec3b35fe
@ -440,10 +440,8 @@ public class Quest {
|
||||
q.timers.remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
String none = null;
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
none = ChatColor.GRAY + "- (" + Lang.get(p, "none") + ")";
|
||||
final String[] ps = ConfigUtil.parseStringWithPossibleLineBreaks(ChatColor.AQUA + finished, this, p);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@ -453,10 +451,6 @@ public class Quest {
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
if (rews.getMoney() > 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
||||
plugin.getDependencies().getVaultEconomy().depositPlayer(player, rews.getMoney());
|
||||
none = null;
|
||||
}
|
||||
if (pln.getCooldown() > -1) {
|
||||
q.completedTimes.put(this.name, System.currentTimeMillis());
|
||||
if (q.amountsCompleted.containsKey(this.name)) {
|
||||
@ -465,6 +459,13 @@ public class Quest {
|
||||
q.amountsCompleted.put(this.name, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Issue rewards
|
||||
boolean issuedReward = false;
|
||||
if (rews.getMoney() > 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
||||
plugin.getDependencies().getVaultEconomy().depositPlayer(player, rews.getMoney());
|
||||
issuedReward = true;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
for (ItemStack i : rews.getItems()) {
|
||||
@ -476,7 +477,7 @@ public class Quest {
|
||||
p.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
+ "Please contact an administrator.");
|
||||
}
|
||||
none = null;
|
||||
issuedReward = true;
|
||||
}
|
||||
}
|
||||
for (String s : rews.getCommands()) {
|
||||
@ -496,25 +497,24 @@ public class Quest {
|
||||
}
|
||||
});
|
||||
}
|
||||
none = null;
|
||||
issuedReward = true;
|
||||
}
|
||||
for (int i = 0; i < rews.getPermissions().size(); i++) {
|
||||
if (plugin.getDependencies().getVaultPermission() != null) {
|
||||
String perm = rews.getPermissions().get(i);
|
||||
plugin.getDependencies().getVaultPermission().playerAdd(null, player, perm);
|
||||
/*String world = rews.getPermissionWorlds().get(i);
|
||||
if (world == null) {
|
||||
String world = rews.getPermissionWorlds().get(i);
|
||||
if (world == null || world.equals("null")) {
|
||||
plugin.getDependencies().getVaultPermission().playerAdd(null, player, perm);
|
||||
} else {
|
||||
plugin.getDependencies().getVaultPermission().playerAdd(world, player, perm);
|
||||
}*/
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
issuedReward = true;
|
||||
}
|
||||
for (String s : rews.getMcmmoSkills()) {
|
||||
UserManager.getOfflinePlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s),
|
||||
rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)));
|
||||
none = null;
|
||||
issuedReward = true;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
for (String s : rews.getHeroesClasses()) {
|
||||
@ -522,7 +522,7 @@ public class Quest {
|
||||
hero.addExp(rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)),
|
||||
plugin.getDependencies().getHeroes().getClassManager().getClass(s),
|
||||
((Player)player).getLocation());
|
||||
none = null;
|
||||
issuedReward = true;
|
||||
}
|
||||
}
|
||||
LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
|
||||
@ -566,17 +566,25 @@ public class Quest {
|
||||
if (lb.getMessageList().isEmpty() == false) {
|
||||
phatLootMessages.addAll(lb.getMessageList());
|
||||
}
|
||||
issuedReward = true;
|
||||
}
|
||||
if (rews.getExp() > 0 && player.isOnline()) {
|
||||
((Player)player).giveExp(rews.getExp());
|
||||
none = null;
|
||||
issuedReward = true;
|
||||
}
|
||||
if (rews.getQuestPoints() > 0) {
|
||||
q.questPoints += rews.getQuestPoints();
|
||||
issuedReward = true;
|
||||
}
|
||||
if (rews.getCustomRewards().isEmpty() == false) {
|
||||
issuedReward = true;
|
||||
}
|
||||
|
||||
// Inform player
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
String complete = Lang.get(p, "questCompleteTitle");
|
||||
complete = complete.replace("<quest>", ChatColor.YELLOW + name + ChatColor.GOLD);
|
||||
p.sendMessage(ChatColor.GOLD + complete);
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questRewardsTitle"));
|
||||
p.sendMessage(ChatColor.GOLD + Lang.get(p, "questCompleteTitle").replace("<quest>", ChatColor.YELLOW + name
|
||||
+ ChatColor.GOLD));
|
||||
if (plugin.getSettings().canShowQuestTitles()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + p.getName()
|
||||
+ " title " + "{\"text\":\"" + Lang.get(p, "quest") + " " + Lang.get(p, "complete")
|
||||
@ -584,11 +592,22 @@ public class Quest {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + p.getName()
|
||||
+ " subtitle " + "{\"text\":\"" + name + "\",\"color\":\"yellow\"}");
|
||||
}
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questRewardsTitle"));
|
||||
if (!issuedReward) {
|
||||
p.sendMessage(ChatColor.GRAY + "- (" + Lang.get("none") + ")");
|
||||
} else if (!rews.getDetailsOverride().isEmpty()) {
|
||||
for (String s: rews.getDetailsOverride()) {
|
||||
String message = ChatColor.DARK_GREEN + ConfigUtil.parseString(
|
||||
ChatColor.translateAlternateColorCodes('&', s));
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(p, message);
|
||||
}
|
||||
p.sendMessage("- " + message);
|
||||
}
|
||||
} else {
|
||||
if (rews.getQuestPoints() > 0) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " "
|
||||
+ Lang.get(p, "questPoints"));
|
||||
q.questPoints += rews.getQuestPoints();
|
||||
none = null;
|
||||
}
|
||||
for (ItemStack i : rews.getItems()) {
|
||||
String text = "error";
|
||||
@ -642,7 +661,6 @@ public class Quest {
|
||||
}
|
||||
}
|
||||
p.sendMessage(text);
|
||||
none = null;
|
||||
}
|
||||
for (ItemStack i : phatLootItems) {
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
@ -672,22 +690,18 @@ public class Quest {
|
||||
+ i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(p, "enchantedItem"));
|
||||
}
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
if (rews.getMoney() > 1) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||
+ plugin.getDependencies().getCurrency(true));
|
||||
none = null;
|
||||
} else if (rews.getMoney() == 1) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||
+ plugin.getDependencies().getCurrency(false));
|
||||
none = null;
|
||||
}
|
||||
if (rews.getExp() > 0 || phatLootExp > 0) {
|
||||
int tot = rews.getExp() + phatLootExp;
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " "
|
||||
+ Lang.get(p, "experience"));
|
||||
none = null;
|
||||
}
|
||||
if (rews.getCommands().isEmpty() == false) {
|
||||
int index = 0;
|
||||
@ -703,7 +717,19 @@ public class Quest {
|
||||
}
|
||||
index++;
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
if (rews.getPermissions().isEmpty() == false) {
|
||||
int index = 0;
|
||||
for (String s : rews.getPermissions()) {
|
||||
if (rews.getPermissionWorlds() != null) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + s + " (" + rews.getPermissionWorlds().get(index)
|
||||
+ ")");
|
||||
} else {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + s);
|
||||
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (rews.getMcmmoSkills().isEmpty() == false) {
|
||||
for (String s : rews.getMcmmoSkills()) {
|
||||
@ -711,7 +737,6 @@ public class Quest {
|
||||
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " " + ChatColor.DARK_PURPLE
|
||||
+ s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
if (rews.getHeroesClasses().isEmpty() == false) {
|
||||
for (String s : rews.getHeroesClasses()) {
|
||||
@ -719,13 +744,11 @@ public class Quest {
|
||||
+ rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE
|
||||
+ s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
if (phatLootMessages.isEmpty() == false) {
|
||||
for (String s : phatLootMessages) {
|
||||
p.sendMessage("- " + s);
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
for (String s : rews.getCustomRewards().keySet()) {
|
||||
CustomReward found = null;
|
||||
@ -751,10 +774,7 @@ public class Quest {
|
||||
plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \"" + name
|
||||
+ "\", but the Custom Reward \"" + s + "\" could not be found. Does it still exist?");
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
if (none != null) {
|
||||
p.sendMessage(none);
|
||||
}
|
||||
}
|
||||
q.saveData();
|
||||
|
@ -648,8 +648,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(CK.REQ_CUSTOM, list);
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA, datamapList);
|
||||
}
|
||||
if (reqs.getFailRequirements() != null) {
|
||||
context.setSessionData(CK.REQ_FAIL_MESSAGE, reqs.getFailRequirements());
|
||||
if (reqs.getDetailsOverride().isEmpty() == false) {
|
||||
context.setSessionData(CK.REQ_FAIL_MESSAGE, reqs.getDetailsOverride());
|
||||
}
|
||||
Rewards rews = q.getRewards();
|
||||
if (rews.getMoney() != 0) {
|
||||
@ -673,6 +673,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (rews.getPermissions().isEmpty() == false) {
|
||||
context.setSessionData(CK.REW_PERMISSION, rews.getPermissions());
|
||||
}
|
||||
if (rews.getPermissions().isEmpty() == false) {
|
||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, rews.getPermissionWorlds());
|
||||
}
|
||||
if (rews.getMcmmoSkills().isEmpty() == false) {
|
||||
context.setSessionData(CK.REW_MCMMO_SKILLS, rews.getMcmmoSkills());
|
||||
context.setSessionData(CK.REW_MCMMO_AMOUNTS, rews.getMcmmoAmounts());
|
||||
@ -688,6 +691,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(CK.REW_CUSTOM, new LinkedList<String>(rews.getCustomRewards().keySet()));
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList<Object>(rews.getCustomRewards().values()));
|
||||
}
|
||||
if (rews.getDetailsOverride().isEmpty() == false) {
|
||||
context.setSessionData(CK.REW_DETAILS_OVERRIDE, rews.getDetailsOverride());
|
||||
}
|
||||
Planner pln = q.getPlanner();
|
||||
if (pln.getStart() != null) {
|
||||
context.setSessionData(CK.PLN_START_DATE, pln.getStart());
|
||||
@ -962,8 +968,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (stage.startMessage != null) {
|
||||
context.setSessionData(pref + CK.S_START_MESSAGE, stage.startMessage);
|
||||
}
|
||||
if (stage.objectiveOverride != null) {
|
||||
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, stage.objectiveOverride);
|
||||
if (stage.objectiveOverrides.isEmpty() == false) {
|
||||
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, stage.objectiveOverrides);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1547,7 +1553,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
String heroesSecondaryReq = null;
|
||||
LinkedList<String> customReqs = null;
|
||||
LinkedList<Map<String, Object>> customReqsData = null;
|
||||
String failMessage = null;
|
||||
List<String> detailsOverrideReqs = null;
|
||||
Integer moneyRew = null;
|
||||
Integer questPointsRew = null;
|
||||
List<ItemStack> itemRews = null;
|
||||
@ -1557,6 +1563,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
List<String> commandRews = null;
|
||||
List<String> commandDisplayOverrideRews = null;
|
||||
List<String> permRews = null;
|
||||
List<String> permWorldRews = null;
|
||||
List<String> mcMMOSkillRews = null;
|
||||
List<Integer> mcMMOSkillAmounts = null;
|
||||
List<String> heroesClassRews = null;
|
||||
@ -1564,6 +1571,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
List<String> phatLootRews = null;
|
||||
LinkedList<String> customRews = null;
|
||||
LinkedList<Map<String, Object>> customRewsData = null;
|
||||
List<String> detailsOverrideRews = null;
|
||||
String startDatePln = null;
|
||||
String endDatePln = null;
|
||||
Long repeatCyclePln = null;
|
||||
@ -1621,7 +1629,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
customReqsData = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
|
||||
}
|
||||
if (context.getSessionData(CK.REQ_FAIL_MESSAGE) != null) {
|
||||
failMessage = (String) context.getSessionData(CK.REQ_FAIL_MESSAGE);
|
||||
detailsOverrideReqs = new LinkedList<String>();
|
||||
detailsOverrideReqs.addAll((List<String>)context.getSessionData(CK.REQ_FAIL_MESSAGE));
|
||||
}
|
||||
if (context.getSessionData(CK.Q_INITIAL_EVENT) != null) {
|
||||
initialEvent = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
|
||||
@ -1656,6 +1665,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
permRews = new LinkedList<String>();
|
||||
permRews.addAll((List<String>) context.getSessionData(CK.REW_PERMISSION));
|
||||
}
|
||||
if (context.getSessionData(CK.REW_PERMISSION_WORLDS) != null) {
|
||||
permWorldRews = new LinkedList<String>();
|
||||
permWorldRews.addAll((List<String>) context.getSessionData(CK.REW_PERMISSION_WORLDS));
|
||||
}
|
||||
if (context.getSessionData(CK.REW_MCMMO_SKILLS) != null) {
|
||||
mcMMOSkillRews = new LinkedList<String>();
|
||||
mcMMOSkillAmounts = new LinkedList<Integer>();
|
||||
@ -1676,6 +1689,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
customRews = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
|
||||
customRewsData = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
}
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null) {
|
||||
detailsOverrideRews = new LinkedList<String>();
|
||||
detailsOverrideRews.addAll((List<String>)context.getSessionData(CK.REW_DETAILS_OVERRIDE));
|
||||
}
|
||||
if (context.getSessionData(CK.PLN_START_DATE) != null) {
|
||||
startDatePln = (String) context.getSessionData(CK.PLN_START_DATE);
|
||||
}
|
||||
@ -1740,7 +1757,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
customReqSec.set("data", customReqsData.get(i));
|
||||
}
|
||||
}
|
||||
reqs.set("fail-requirement-message", failMessage);
|
||||
reqs.set("fail-requirement-message", detailsOverrideReqs);
|
||||
} else {
|
||||
cs.set("requirements", null);
|
||||
}
|
||||
@ -1804,7 +1821,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
LinkedList<String> commandEvents;
|
||||
LinkedList<String> commandEventTriggers;
|
||||
Long delay;
|
||||
String overrideDisplay;
|
||||
LinkedList<String> overrideDisplay;
|
||||
String delayMessage;
|
||||
String startMessage;
|
||||
String completeMessage;
|
||||
@ -1992,7 +2009,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
script = (String) context.getSessionData(pref + CK.S_DENIZEN);
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) != null) {
|
||||
overrideDisplay = (String) context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY);
|
||||
overrideDisplay = (LinkedList<String>) context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY);
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_START_MESSAGE) != null) {
|
||||
startMessage = (String) context.getSessionData(pref + CK.S_START_MESSAGE);
|
||||
@ -2124,8 +2141,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
stage.set("delay", delay.intValue() / 1000);
|
||||
}
|
||||
stage.set("delay-message", delayMessage == null ? delayMessage : delayMessage.replace("\\n", "\n"));
|
||||
stage.set("objective-override", overrideDisplay == null ? overrideDisplay
|
||||
: overrideDisplay.replace("\\n", "\n"));
|
||||
stage.set("objective-override", overrideDisplay);
|
||||
stage.set("start-message", startMessage == null ? startMessage : startMessage.replace("\\n", "\n"));
|
||||
stage.set("complete-message", completeMessage == null ? completeMessage
|
||||
: completeMessage.replace("\\n", "\n"));
|
||||
@ -2144,6 +2160,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
rews.set("quest-points", questPointsRew);
|
||||
rews.set("exp", expRew);
|
||||
rews.set("permissions", permRews);
|
||||
rews.set("permission-worlds", permWorldRews);
|
||||
rews.set("commands", commandRews);
|
||||
rews.set("commands-override-display", commandDisplayOverrideRews);
|
||||
rews.set("mcmmo-skills", mcMMOSkillRews);
|
||||
@ -2161,6 +2178,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
customRewSec.set("data", customRewsData.get(i));
|
||||
}
|
||||
}
|
||||
rews.set("details-override", detailsOverrideRews);
|
||||
} else {
|
||||
cs.set("rewards", null);
|
||||
}
|
||||
|
@ -638,15 +638,17 @@ public class Quester {
|
||||
}
|
||||
Requirements reqs = quest.getRequirements();
|
||||
if (!ignoreOverrides) {
|
||||
if (reqs.getFailRequirements() != null) {
|
||||
if (reqs.getDetailsOverride() != null) {
|
||||
LinkedList<String> requirements = new LinkedList<String>();
|
||||
for (String s : reqs.getDetailsOverride()) {
|
||||
String message = ChatColor.RED + ConfigUtil.parseString(
|
||||
ChatColor.translateAlternateColorCodes('&', reqs.getFailRequirements()),
|
||||
quest, getPlayer());
|
||||
ChatColor.translateAlternateColorCodes('&', s), quest, getPlayer());
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
requirements.add(message);
|
||||
|
||||
}
|
||||
return requirements;
|
||||
}
|
||||
}
|
||||
@ -770,15 +772,16 @@ public class Quester {
|
||||
public LinkedList<String> getCurrentObjectives(Quest quest, boolean ignoreOverrides) {
|
||||
if (!ignoreOverrides) {
|
||||
if (getCurrentStage(quest) != null) {
|
||||
if (getCurrentStage(quest).objectiveOverride != null) {
|
||||
if (getCurrentStage(quest).objectiveOverrides.isEmpty() == false) {
|
||||
LinkedList<String> objectives = new LinkedList<String>();
|
||||
for (String s: getCurrentStage(quest).objectiveOverrides) {
|
||||
String message = ChatColor.GREEN + ConfigUtil.parseString(
|
||||
ChatColor.translateAlternateColorCodes('&', getCurrentStage(quest).objectiveOverride),
|
||||
quest, getPlayer());
|
||||
ChatColor.translateAlternateColorCodes('&', s), quest, getPlayer());
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
objectives.add(message);
|
||||
}
|
||||
return objectives;
|
||||
}
|
||||
}
|
||||
@ -2226,14 +2229,15 @@ public class Quester {
|
||||
Enchantment enchantment, EntityType mob, String extra, NPC npc, Location location, DyeColor color,
|
||||
String pass, CustomObjective co) {
|
||||
Player p = getPlayer();
|
||||
if (getCurrentStage(quest).objectiveOverride != null) {
|
||||
if (getCurrentStage(quest).objectiveOverrides.isEmpty() == false) {
|
||||
for (String s: getCurrentStage(quest).objectiveOverrides) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") "
|
||||
+ ConfigUtil.parseString(ChatColor.translateAlternateColorCodes('&',
|
||||
getCurrentStage(quest).objectiveOverride), quest, p);
|
||||
+ ConfigUtil.parseString(ChatColor.translateAlternateColorCodes('&', s), quest, p);
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(p, message);
|
||||
}
|
||||
p.sendMessage(message);
|
||||
}
|
||||
} else if (objective.equalsIgnoreCase("password")) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass;
|
||||
p.sendMessage(message);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@ public class Requirements {
|
||||
private String heroesPrimaryClass = null;
|
||||
private String heroesSecondaryClass = null;
|
||||
private Map<String, Map<String, Object>> customRequirements = new HashMap<String, Map<String, Object>>();
|
||||
private String failRequirements = null;
|
||||
private List<String> detailsOverride = new LinkedList<String>();
|
||||
|
||||
public int getMoney() {
|
||||
return money;
|
||||
@ -106,10 +106,10 @@ public class Requirements {
|
||||
protected void setCustomRequirements(Map<String, Map<String, Object>> customRequirements) {
|
||||
this.customRequirements = customRequirements;
|
||||
}
|
||||
public String getFailRequirements() {
|
||||
return failRequirements;
|
||||
public List<String> getDetailsOverride() {
|
||||
return detailsOverride;
|
||||
}
|
||||
public void setFailRequirements(String failRequirements) {
|
||||
this.failRequirements = failRequirements;
|
||||
public void setDetailsOverride(List<String> detailsOverride) {
|
||||
this.detailsOverride = detailsOverride;
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ public class Rewards {
|
||||
private List<Double> heroesAmounts = new LinkedList<Double>();
|
||||
private List<String> phatLoots = new LinkedList<String>();
|
||||
private Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
|
||||
private List<String> detailsOverride = new LinkedList<String>();
|
||||
|
||||
public int getMoney() {
|
||||
return money;
|
||||
@ -119,4 +120,10 @@ public class Rewards {
|
||||
protected void setCustomRewards(Map<String, Map<String, Object>> customRewards) {
|
||||
this.customRewards = customRewards;
|
||||
}
|
||||
public List<String> getDetailsOverride() {
|
||||
return detailsOverride;
|
||||
}
|
||||
public void setDetailsOverride(List<String> detailsOverride) {
|
||||
this.detailsOverride = detailsOverride;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class Stage {
|
||||
protected String delayMessage = null;
|
||||
protected String completeMessage = null;
|
||||
protected String startMessage = null;
|
||||
protected String objectiveOverride = null;
|
||||
protected LinkedList<String> objectiveOverrides = new LinkedList<String>();
|
||||
protected LinkedList<CustomObjective> customObjectives = new LinkedList<CustomObjective>();
|
||||
protected LinkedList<Integer> customObjectiveCounts = new LinkedList<Integer>();
|
||||
protected LinkedList<String> customObjectiveDisplays = new LinkedList<String>();
|
||||
@ -470,12 +470,12 @@ public class Stage {
|
||||
this.startMessage = startMessage;
|
||||
}
|
||||
|
||||
public String getObjectiveOverride() {
|
||||
return objectiveOverride;
|
||||
public LinkedList<String> getObjectiveOverrides() {
|
||||
return objectiveOverrides;
|
||||
}
|
||||
|
||||
public void setObjectiveOverride(String objectiveOverride) {
|
||||
this.objectiveOverride = objectiveOverride;
|
||||
public void setObjectiveOverrides(LinkedList<String> objectiveOverrides) {
|
||||
this.objectiveOverrides = objectiveOverrides;
|
||||
}
|
||||
|
||||
public LinkedList<CustomObjective> getCustomObjectives() {
|
||||
|
@ -364,7 +364,8 @@ public class Action {
|
||||
quest.failQuest(quester);
|
||||
}
|
||||
if (timer > 0) {
|
||||
player.sendMessage(Lang.get(player, "timerStart").replace("<time>", String.valueOf(timer)));
|
||||
player.sendMessage(ChatColor.GREEN + Lang.get(player, "timerStart")
|
||||
.replace("<time>", ChatColor.RED + String.valueOf(timer) + ChatColor.GREEN));
|
||||
if (timer > 60) {
|
||||
quester.getTimers().put(new ActionTimer(quester, quest, 60, false)
|
||||
.runTaskLater(plugin, (timer-60)*20).getTaskId(), quest);
|
||||
|
@ -21,6 +21,7 @@ public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
|
||||
private ConversationContext context;
|
||||
private QuestFactory factory;
|
||||
|
||||
//TODO - passing factory may be unnecessary
|
||||
public QuestsEditorStringPrompt(final ConversationContext context, final QuestFactory factory) {
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
|
@ -38,16 +38,18 @@ import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
import me.blackvein.quests.util.RomanNumeral;
|
||||
|
||||
/**
|
||||
* Stores ItemStack in "tempStack" context data<p>
|
||||
* Stores name in "tempName" context data<p>
|
||||
* Stores amount in "tempAmount" context data<p>
|
||||
* Stores durability in "tempData" context data<p>
|
||||
* Stores enchantments in "tempEnchantments" context data<p>
|
||||
* Stores display name in "tempDisplay" context data<p>
|
||||
* Stores lore in "tempLore" context data<p>
|
||||
* Stores metadata in "tempMeta" context data
|
||||
*/
|
||||
public class ItemStackPrompt extends FixedSetPrompt {
|
||||
|
||||
// Stores ItemStack in "tempStack" context data
|
||||
// Stores name in "tempName"
|
||||
// Stores amount in "tempAmount"
|
||||
// Stores durability in "tempData"
|
||||
// Stores enchantments in "tempEnchantments"
|
||||
// Stores display name in "tempDisplay"
|
||||
// Stores lore in "tempLore"
|
||||
// Stores metadata in "tempMeta"
|
||||
private final Prompt oldPrompt;
|
||||
|
||||
public ItemStackPrompt(Prompt old) {
|
||||
|
@ -41,14 +41,17 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("optionsTitle").replace("<quest>", (String) context.getSessionData(CK.Q_NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -62,6 +65,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -75,6 +79,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
return null;
|
||||
}
|
||||
@ -120,10 +125,12 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
String text = "Select '<true>' or '<false>'";
|
||||
text = text.replace("<true>", Lang.get("true"));
|
||||
@ -191,10 +198,12 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return "Pick level of progress sharing";
|
||||
}
|
||||
@ -281,14 +290,17 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return ChatColor.DARK_GREEN + Lang.get("optGeneral");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -302,6 +314,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -315,6 +328,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -395,14 +409,17 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final int size = 5;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return ChatColor.DARK_GREEN + Lang.get("optMultiplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -420,6 +437,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -437,6 +455,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
|
@ -0,0 +1,85 @@
|
||||
package me.blackvein.quests.convo.quests.prompts;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
public class OverridePrompt extends QuestsEditorStringPrompt {
|
||||
private final Prompt oldPrompt;
|
||||
private String promptText;
|
||||
private String classPrefix;
|
||||
|
||||
public OverridePrompt(ConversationContext context, Prompt old, String promptText) {
|
||||
super(context, null);
|
||||
oldPrompt = old;
|
||||
classPrefix = old.getClass().getSimpleName();
|
||||
this.promptText = promptText;
|
||||
}
|
||||
|
||||
private final int size = 1;
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event
|
||||
= new QuestsEditorPostOpenStringPromptEvent(context, null, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.YELLOW + promptText + "\n";;
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
context.setSessionData(classPrefix + "-override", input);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("cleared"));
|
||||
context.setSessionData(classPrefix + "-override", null);
|
||||
}
|
||||
return oldPrompt;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private ConversationContext context;
|
||||
private Prompt oldPrompt;
|
||||
private String promptText = "Enter input";
|
||||
|
||||
public Builder context(ConversationContext context) {
|
||||
this.context = context;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder source(Prompt prompt) {
|
||||
this.oldPrompt = prompt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder promptText(String text) {
|
||||
this.promptText = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OverridePrompt build() {
|
||||
return new OverridePrompt(context, oldPrompt, promptText);
|
||||
}
|
||||
}
|
||||
}
|
@ -127,7 +127,9 @@ public class QuestOfferPrompt extends StringPrompt {
|
||||
plugin.getConversationFactory().buildConversation((Conversable) player).begin();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(q.getRequirements().getFailRequirements());
|
||||
for (String msg : q.getRequirements().getDetailsOverride()) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
} else if (quester.getCurrentQuests().containsKey(q) == false) {
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
|
@ -43,6 +43,7 @@ import me.blackvein.quests.util.MiscUtil;
|
||||
public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final Quests plugin;
|
||||
private final String classPrefix;
|
||||
private final QuestFactory factory;
|
||||
private boolean hasRequirement = false;
|
||||
private final int size = 11;
|
||||
@ -50,6 +51,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
public RequirementsPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
||||
super(context, qf);
|
||||
this.plugin = plugin;
|
||||
this.classPrefix = getClass().getSimpleName();
|
||||
this.factory = qf;
|
||||
}
|
||||
|
||||
@ -91,6 +93,16 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
case 11:
|
||||
if (context.getSessionData(CK.REQ_FAIL_MESSAGE) == null) {
|
||||
if (!hasRequirement) {
|
||||
return ChatColor.GRAY;
|
||||
} else {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
} else {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
case 12:
|
||||
return ChatColor.GREEN;
|
||||
default:
|
||||
return null;
|
||||
@ -119,9 +131,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.DARK_PURPLE + Lang.get("reqSetCustom");
|
||||
case 10:
|
||||
if (!hasRequirement) {
|
||||
return ChatColor.GRAY + Lang.get("reqSetFail");
|
||||
return ChatColor.GRAY + Lang.get("overrideCreateAdd");
|
||||
} else {
|
||||
return ChatColor.YELLOW + Lang.get("reqSetFail");
|
||||
return ChatColor.YELLOW + Lang.get("overrideCreateAdd");
|
||||
}
|
||||
case 11:
|
||||
return ChatColor.YELLOW + Lang.get("done");
|
||||
@ -251,22 +263,34 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
}
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(CK.REQ_FAIL_MESSAGE)+ "\""
|
||||
+ ChatColor.GRAY + ")";
|
||||
String text = "\n";
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
overrides.addAll((List<String>) context.getSessionData(CK.REQ_FAIL_MESSAGE));
|
||||
for (int i = 0; i < overrides.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + overrides.get(i) + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
// Checkadd newly made override
|
||||
if (context.getSessionData(classPrefix + "-override") != null) {
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
if (context.getSessionData(CK.REQ_FAIL_MESSAGE) != null) {
|
||||
overrides.addAll((List<String>) context.getSessionData(CK.REQ_FAIL_MESSAGE));
|
||||
}
|
||||
overrides.add((String) context.getSessionData(classPrefix + "-override"));
|
||||
context.setSessionData(CK.REQ_FAIL_MESSAGE, overrides);
|
||||
context.setSessionData(classPrefix + "-override", null);
|
||||
}
|
||||
checkRequirement(context);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
@ -314,7 +338,10 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new CustomRequirementsPrompt();
|
||||
case 10:
|
||||
if (hasRequirement) {
|
||||
return new FailMessagePrompt();
|
||||
return new OverridePrompt.Builder()
|
||||
.source(this)
|
||||
.promptText(Lang.get("overrideCreateEnter"))
|
||||
.build();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new RequirementsPrompt(plugin, context, factory);
|
||||
@ -326,7 +353,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkRequirement(ConversationContext context) {
|
||||
public boolean checkRequirement(ConversationContext context) {
|
||||
if (context.getSessionData(CK.REQ_MONEY) != null
|
||||
|| context.getSessionData(CK.REQ_QUEST_POINTS) != null
|
||||
|| context.getSessionData(CK.REQ_ITEMS) != null
|
||||
@ -338,7 +365,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
|| context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null
|
||||
|| context.getSessionData(CK.REQ_CUSTOM) != null) {
|
||||
hasRequirement = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class MoneyPrompt extends StringPrompt {
|
||||
@ -573,13 +602,13 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(CK.REQ_ITEMS) != null) {
|
||||
List<ItemStack> itemRews = getItems(context);
|
||||
itemRews.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.REQ_ITEMS, itemRews);
|
||||
List<ItemStack> itemReqs = getItems(context);
|
||||
itemReqs.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.REQ_ITEMS, itemReqs);
|
||||
} else {
|
||||
LinkedList<ItemStack> itemRews = new LinkedList<ItemStack>();
|
||||
itemRews.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.REQ_ITEMS, itemRews);
|
||||
LinkedList<ItemStack> itemReqs = new LinkedList<ItemStack>();
|
||||
itemReqs.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.REQ_ITEMS, itemReqs);
|
||||
}
|
||||
context.setSessionData("newItem", null);
|
||||
context.setSessionData("tempStack", null);
|
||||
@ -1162,20 +1191,4 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class FailMessagePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("reqFailMessagePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get(Lang.get("cancel"))) == false) {
|
||||
context.setSessionData(CK.REQ_FAIL_MESSAGE, input);
|
||||
}
|
||||
return new RequirementsPrompt(plugin, context, factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,12 +43,15 @@ import me.blackvein.quests.util.MiscUtil;
|
||||
public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final Quests plugin;
|
||||
private final String classPrefix;
|
||||
private final QuestFactory factory;
|
||||
private final int size = 11;
|
||||
private boolean hasReward = false;
|
||||
private final int size = 12;
|
||||
|
||||
public RewardsPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
||||
super(context, qf);
|
||||
this.plugin = plugin;
|
||||
this.classPrefix = getClass().getSimpleName();
|
||||
factory = qf;
|
||||
}
|
||||
|
||||
@ -63,6 +66,11 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
return ChatColor.BLUE;
|
||||
} else {
|
||||
return ChatColor.GRAY;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
@ -90,6 +98,16 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 10:
|
||||
return ChatColor.BLUE;
|
||||
case 11:
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) {
|
||||
if (!hasReward) {
|
||||
return ChatColor.GRAY;
|
||||
} else {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
} else {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
case 12:
|
||||
return ChatColor.GREEN;
|
||||
default:
|
||||
return null;
|
||||
@ -119,6 +137,12 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 10:
|
||||
return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom");
|
||||
case 11:
|
||||
if (!hasReward) {
|
||||
return ChatColor.GRAY + Lang.get("overrideCreateAdd");
|
||||
} else {
|
||||
return ChatColor.YELLOW + Lang.get("overrideCreateAdd");
|
||||
}
|
||||
case 12:
|
||||
return ChatColor.YELLOW + Lang.get("done");
|
||||
default:
|
||||
return null;
|
||||
@ -129,6 +153,8 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
if (context.getSessionData(CK.REW_MONEY) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -137,6 +163,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
+ (moneyRew > 1 ? plugin.getDependencies().getCurrency(true)
|
||||
: plugin.getDependencies().getCurrency(false)) + ChatColor.GRAY + ")";
|
||||
}
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REW_QUEST_POINTS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
@ -148,7 +177,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
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))
|
||||
@ -167,7 +196,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_COMMAND) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
List<String> commands = (List<String>) context.getSessionData(CK.REW_COMMAND);
|
||||
List<String> overrides = (List<String>) context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY);
|
||||
int index = 0;
|
||||
@ -188,10 +217,20 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_PERMISSION) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
List<String> permissions = (List<String>) context.getSessionData(CK.REW_PERMISSION);
|
||||
List<String> worlds = (List<String>) context.getSessionData(CK.REW_PERMISSION_WORLDS);
|
||||
int index = 0;
|
||||
for (String perm : permissions) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + perm + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + perm;
|
||||
if (worlds != null) {
|
||||
if (index < worlds.size()) {
|
||||
text += ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + worlds.get(index)
|
||||
+ ChatColor.GRAY + "]";
|
||||
}
|
||||
}
|
||||
text += "\n";
|
||||
index++;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
@ -200,7 +239,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
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) {
|
||||
@ -217,7 +256,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
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) {
|
||||
@ -235,7 +274,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_PHAT_LOOTS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
List<String> phatLoots = (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS);
|
||||
for (String phatLoot : phatLoots) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + phatLoot + "\n";
|
||||
@ -249,7 +288,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(CK.REW_CUSTOM) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "";
|
||||
String text = "\n";
|
||||
LinkedList<String> customRews = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
|
||||
for (String s : customRews) {
|
||||
text += ChatColor.RESET + "" + ChatColor.DARK_PURPLE + " - " + ChatColor.LIGHT_PURPLE + s
|
||||
@ -258,18 +297,43 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
return text;
|
||||
}
|
||||
case 11:
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) {
|
||||
if (!hasReward) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
}
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
overrides.addAll((List<String>) context.getSessionData(CK.REW_DETAILS_OVERRIDE));
|
||||
for (int i = 0; i < overrides.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + overrides.get(i) + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
// Check/add newly made override
|
||||
if (context.getSessionData(classPrefix + "-override") != null) {
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null) {
|
||||
overrides.addAll((List<String>) context.getSessionData(CK.REW_DETAILS_OVERRIDE));
|
||||
}
|
||||
overrides.add((String) context.getSessionData(classPrefix + "-override"));
|
||||
context.setSessionData(CK.REW_DETAILS_OVERRIDE, overrides);
|
||||
context.setSessionData(classPrefix + "-override", null);
|
||||
}
|
||||
checkReward(context);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
@ -288,7 +352,11 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
return new MoneyPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, context, factory);
|
||||
}
|
||||
case 2:
|
||||
return new QuestPointsPrompt();
|
||||
case 3:
|
||||
@ -296,9 +364,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 4:
|
||||
return new ExperiencePrompt();
|
||||
case 5:
|
||||
return new CommandsListPrompt();
|
||||
return new CommandsPrompt();
|
||||
case 6:
|
||||
return new PermissionsPrompt();
|
||||
return new PermissionsListPrompt(context, factory);
|
||||
case 7:
|
||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||
return new mcMMOListPrompt();
|
||||
@ -320,12 +388,39 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 10:
|
||||
return new CustomRewardsPrompt();
|
||||
case 11:
|
||||
if (hasReward) {
|
||||
return new OverridePrompt.Builder()
|
||||
.source(this)
|
||||
.promptText(Lang.get("overrideCreateEnter"))
|
||||
.build();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new RewardsPrompt(plugin, context, factory);
|
||||
}
|
||||
case 12:
|
||||
return factory.returnToMenu(context);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkReward(ConversationContext context) {
|
||||
if (context.getSessionData(CK.REW_MONEY) != null
|
||||
|| context.getSessionData(CK.REW_EXP) != null
|
||||
|| context.getSessionData(CK.REW_QUEST_POINTS) != null
|
||||
|| context.getSessionData(CK.REW_ITEMS) != null
|
||||
|| context.getSessionData(CK.REW_COMMAND) != null
|
||||
|| context.getSessionData(CK.REW_PERMISSION) != null
|
||||
|| context.getSessionData(CK.REW_MCMMO_SKILLS) != null
|
||||
|| context.getSessionData(CK.REW_HEROES_CLASSES) != null
|
||||
|| context.getSessionData(CK.REW_PHAT_LOOTS) != null
|
||||
|| context.getSessionData(CK.REW_CUSTOM) != null) {
|
||||
hasReward = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class MoneyPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
@ -495,81 +590,6 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class CommandsListPrompt extends FixedSetPrompt {
|
||||
|
||||
public CommandsListPrompt() {
|
||||
super("1", "2", "3", "4");
|
||||
}
|
||||
|
||||
@Override
|
||||
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");
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new CommandsPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
if (context.getSessionData(CK.REW_COMMAND) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewNoCommands"));
|
||||
return new CommandsListPrompt();
|
||||
} else {
|
||||
return new CommandsOverrideDisplayPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewCommandsCleared"));
|
||||
context.setSessionData(CK.REW_COMMAND, null);
|
||||
context.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, null);
|
||||
return new CommandsListPrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
return new RewardsPrompt(plugin, context, factory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> getCommand(ConversationContext context) {
|
||||
return (List<String>) context.getSessionData(CK.REW_COMMAND);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> getCommandOverrideDisplay(ConversationContext context) {
|
||||
return (List<String>) context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY);
|
||||
}
|
||||
}
|
||||
|
||||
private class CommandsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
@ -597,37 +617,137 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_COMMAND, null);
|
||||
}
|
||||
return new CommandsListPrompt();
|
||||
return new RewardsPrompt(plugin, context, factory);
|
||||
}
|
||||
}
|
||||
|
||||
private class CommandsOverrideDisplayPrompt extends StringPrompt {
|
||||
private class PermissionsListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public PermissionsListPrompt(ConversationContext context, QuestFactory factory) {
|
||||
super(context, factory);
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("permissionRewardsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REW_PERMISSION) == null) {
|
||||
return ChatColor.GRAY;
|
||||
} else {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
case 3:
|
||||
return ChatColor.RED;
|
||||
case 4:
|
||||
return ChatColor.GREEN;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("rewSetPermission");
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REW_PERMISSION) == null) {
|
||||
return ChatColor.GRAY + Lang.get("rewSetPermissionWorlds");
|
||||
} else {
|
||||
return ChatColor.YELLOW + Lang.get("rewSetPermissionWorlds");
|
||||
}
|
||||
case 3:
|
||||
return ChatColor.RED + Lang.get("clear");
|
||||
case 4:
|
||||
return ChatColor.GREEN + Lang.get("done");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.REW_PERMISSION) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(CK.REW_PERMISSION)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REW_PERMISSION) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
if (context.getSessionData(CK.REW_PERMISSION_WORLDS) == null) {
|
||||
return ChatColor.YELLOW + "(" + Lang.get("stageEditorOptional") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(CK.REW_PERMISSION_WORLDS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
case 4:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.YELLOW + Lang.get("rewCommandsOverridePrompt") + "\n";
|
||||
text += ChatColor.ITALIC + "" + ChatColor.GOLD + Lang.get("rewCommandsOverrideHint");
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
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) {
|
||||
if (s.startsWith("/")) {
|
||||
s = s.substring(1);
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new PermissionsPrompt();
|
||||
case 2:
|
||||
return new PermissionsWorldsPrompt();
|
||||
case 3:
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPermissionsCleared"));
|
||||
context.setSessionData(CK.REW_PERMISSION, null);
|
||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
||||
return new PermissionsListPrompt(context, factory);
|
||||
case 4:
|
||||
return new RewardsPrompt(plugin, context, factory);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
overrides.add(s);
|
||||
}
|
||||
context.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, overrides.isEmpty() ? null : overrides);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, null);
|
||||
}
|
||||
return new CommandsListPrompt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PermissionsPrompt extends StringPrompt {
|
||||
@ -648,7 +768,36 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_PERMISSION, null);
|
||||
}
|
||||
return new RewardsPrompt(plugin, context, factory);
|
||||
return new PermissionsListPrompt(context, factory);
|
||||
}
|
||||
}
|
||||
|
||||
private class PermissionsWorldsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("rewPermissionsWorldPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
String[] args = input.split(Lang.get("charSemi"));
|
||||
List<String> worlds = new LinkedList<String>();
|
||||
worlds.addAll(Arrays.asList(args));
|
||||
for (String w : worlds) {
|
||||
if (!w.equals("null") && w != null && plugin.getServer().getWorld(w) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + w + " "
|
||||
+ Lang.get("eventEditorInvalidWorld"));
|
||||
return new PermissionsWorldsPrompt();
|
||||
}
|
||||
}
|
||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, worlds);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
||||
}
|
||||
return new PermissionsListPrompt(context, factory);
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ package me.blackvein.quests.tasks;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import de.erethon.dungeonsxl.util.commons.chat.ChatColor;
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -39,8 +40,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(ChatColor.GREEN + Lang.get(quester.getPlayer(), "timerMessage")
|
||||
.replace("<time>", ChatColor.RED + String.valueOf(time) + ChatColor.GREEN));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,6 +119,7 @@ public class CK {
|
||||
public static final String REW_COMMAND = "commandRews";
|
||||
public static final String REW_COMMAND_OVERRIDE_DISPLAY = "commandOverrideDisplay";
|
||||
public static final String REW_PERMISSION = "permissionRews";
|
||||
public static final String REW_PERMISSION_WORLDS = "permissionWorlds";
|
||||
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
|
||||
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
|
||||
public static final String REW_HEROES_CLASSES = "heroesClassRews";
|
||||
@ -128,6 +129,7 @@ public class CK {
|
||||
public static final String REW_CUSTOM_DATA = "customRewData";
|
||||
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
|
||||
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
|
||||
public static final String REW_DETAILS_OVERRIDE = "detailsOverrideRew";
|
||||
// Planner
|
||||
public static final String PLN_START_DATE = "startDatePln";
|
||||
public static final String PLN_END_DATE = "endDatePln";
|
||||
|
@ -183,7 +183,6 @@ stageEditorSetShearAmounts: "Set shear amounts"
|
||||
stageEditorPassword: "Password"
|
||||
stageEditorAddPasswordDisplay: "Add password display"
|
||||
stageEditorAddPasswordPhrases: "Add password phrase(s)"
|
||||
stageEditorObjectiveOverride: "Objective display override"
|
||||
stageEditorCustom: "Custom objectives"
|
||||
stageEditorNoModules: "No modules loaded"
|
||||
stageEditorModuleNotFound: "Custom objective module not found."
|
||||
@ -217,20 +216,15 @@ stageEditorShearColorsPrompt: "Enter sheep colors, <space>, <cancel>"
|
||||
stageEditorShearAmountsPrompt: "Enter shear amounts, <space>, <cancel>"
|
||||
stageEditorEventsPrompt: "Enter an action name, <clear>, <cancel>"
|
||||
stageEditorChatEventsPrompt: "Enter an action name to add, <clear>, <cancel>"
|
||||
stageEditorChatEventsTriggerPrompt: "%yellow%Enter a chat trigger for%aqua% <action>%yellow% <cancel>"
|
||||
stageEditorChatEventsTriggerPrompt: "Enter a chat trigger for <action>, <cancel>"
|
||||
stageEditorCommandEventsPrompt: "Enter an action name to add, <clear>, <cancel>"
|
||||
stageEditorCommandEventsTriggerPrompt: "%yellow%Enter a command trigger for%aqua% <action>%yellow% <cancel>"
|
||||
stageEditorCommandEventsTriggerPrompt: "Enter a command trigger for <action>, <cancel>"
|
||||
stageEditorDelayMessagePrompt: "Enter delay message, <clear>, <cancel>"
|
||||
stageEditorScriptPrompt: "Enter script name, <clear>, <cancel>"
|
||||
stageEditorStartMessagePrompt: "Enter start message, <clear>, <cancel>"
|
||||
stageEditorCompleteMessagePrompt: "Enter complete message, <clear>, <cancel>"
|
||||
stageEditorPasswordDisplayPrompt: "Enter password display, <cancel>"
|
||||
stageEditorPasswordDisplayHint: "(This is the text that will be displayed to the player as their objective)"
|
||||
stageEditorPasswordPhrasePrompt: "Enter password phrases, <semicolon>, <cancel>"
|
||||
stageEditorPasswordPhraseHint: "(This is the text that a player must enter to complete the objective)"
|
||||
stageEditorObjectiveOverridePrompt: "Enter objective display override, <clear>, <cancel>"
|
||||
stageEditorObjectiveOverrideHint: "(This override will display your own text as the objective)"
|
||||
stageEditorObjectiveOverrideCleared: "Objective display override cleared."
|
||||
stageEditorPasswordDisplayPrompt: "Enter password hint message, <cancel>"
|
||||
stageEditorPasswordPhrasePrompt: "Enter password phrases to accept, <semicolon>, <cancel>"
|
||||
stageEditorDeliveryAddItem: "Add item"
|
||||
stageEditorDeliveryNPCs: "Set NPC IDs"
|
||||
stageEditorDeliveryMessages: "Set delivery messages"
|
||||
@ -410,7 +404,6 @@ reqSetQuestBlocks: "Set Quest blocks"
|
||||
reqSetMcMMO: "Set mcMMO Classic requirements"
|
||||
reqSetHeroes: "Set Heroes requirements"
|
||||
reqSetCustom: "Set custom requirements"
|
||||
reqSetFail: "Set fail requirements message"
|
||||
reqSetSkills: "Set skills"
|
||||
reqSetSkillAmounts: "Set skill amounts"
|
||||
reqHeroesSetPrimary: "Set Primary Class"
|
||||
@ -426,7 +419,6 @@ reqMcMMOPrompt: "Enter mcMMO Classic skills, <space>, <clear>, <cancel>"
|
||||
reqMcMMOAmountsPrompt: "Enter mcMMO Classic skill amounts, <space>, <clear>, <cancel>"
|
||||
reqHeroesPrimaryPrompt: "Enter a Heroes Primary Class name, <clear>, <cancel>"
|
||||
reqHeroesSecondaryPrompt: "Enter a Heroes Secondary Class name, <clear>, <cancel>"
|
||||
reqFailMessagePrompt: "Enter fail requirements message, <cancel>"
|
||||
reqAddItem: "Add item"
|
||||
reqSetRemoveItems: "Set remove items"
|
||||
reqNoItemsSet: "No items set"
|
||||
@ -471,13 +463,12 @@ rewSetQuestPoints: "Set Quest Points reward"
|
||||
rewSetItems: "Set item rewards"
|
||||
rewSetExperience: "Set experience reward"
|
||||
rewSetCommands: "Set command rewards"
|
||||
rewCommands: "Command rewards"
|
||||
rewSetCommandsOverrides: "Set command display overrides"
|
||||
rewCommandsCleared: "Command rewards cleared."
|
||||
rewCommandsOverridePrompt: "Enter command display override, <clear>, <cancel>"
|
||||
rewCommandsOverrideHint: "(This override will display your own text as the reward)"
|
||||
rewNoCommands: "You must set commands first!"
|
||||
rewPermissions: "Permission rewards"
|
||||
rewSetPermission: "Set permission rewards"
|
||||
rewSetPermissionWorlds: "Set permission worlds"
|
||||
rewPermissionsCleared: "Permission rewards cleared."
|
||||
rewSetMcMMO: "Set mcMMO Classic skill rewards"
|
||||
rewSetHeroes: "Set Heroes experience rewards"
|
||||
rewSetPhat: "Set PhatLoot rewards"
|
||||
@ -486,12 +477,11 @@ rewSetHeroesClasses: "Set classes"
|
||||
rewSetHeroesAmounts: "Set experience amounts"
|
||||
rewMoneyPrompt: "Enter amount of <money>, <clear>, <cancel>"
|
||||
rewExperiencePrompt: "Enter amount of experience, <clear>, <cancel>"
|
||||
rewCommandPrompt: "Enter command rewards, <semicolon>, <clear>, <cancel>"
|
||||
rewCommandPromptHint: 'Note: You may put <player> to specify the player who completed the Quest. e.g. smite <player>'
|
||||
rewCommandPrompt: "Enter command rewards (use '<player>' to represent the player), <semicolon>, <clear>, <cancel>"
|
||||
rewPermissionsPrompt: "Enter permission rewards, <space>, <clear>, <cancel>"
|
||||
rewPermissionsWorldPrompt: "Enter permission worlds, <semicolon>, <clear>, <cancel>"
|
||||
rewQuestPointsPrompt: "Enter amount of Quest Points, <clear>, <cancel>"
|
||||
rewMcMMOPrompt: "Enter mcMMO Classic skills, <space>, <cancel>"
|
||||
rewMcMMOPromptHint: "Note: Typing 'All' will give levels to all skills."
|
||||
rewMcMMOPrompt: "Enter mcMMO Classic skills (or enter 'All' for all skills), <space>, <cancel>"
|
||||
rewHeroesClassesPrompt: "Enter Heroes classes, <space>, <cancel>"
|
||||
rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed), <space>, <cancel>"
|
||||
rewPhatLootsPrompt: "Enter PhatLoots, <space>, <clear>, <cancel>"
|
||||
@ -542,6 +532,8 @@ dateCreateEnterSecond: "Enter a second (max. 59), <cancel>"
|
||||
dateCreateEnterOffset: "Enter a UTC time offset (max. 14), <cancel>"
|
||||
dateCreateEnterZone: "Enter a UTC time zone, <cancel>"
|
||||
dateCreateNoYearAmount: "You must set a year first!"
|
||||
overrideCreateSet: "Set details list override"
|
||||
overrideCreateEnter: "Enter replacement text, <clear>, <cancel>"
|
||||
questObjectivesTitle: "---(<quest>)---"
|
||||
questCompleteTitle: '**QUEST COMPLETE: <quest>**'
|
||||
questRewardsTitle: "Rewards:"
|
||||
@ -569,6 +561,7 @@ plannerTitle: "- <quest> | Planner -"
|
||||
optionsTitle: "- <quest> | Options -"
|
||||
itemRequirementsTitle: "- Item Requirements -"
|
||||
itemRewardsTitle: "- Item Rewards -"
|
||||
permissionRewardsTitle: "- Permission Rewards -"
|
||||
mcMMORequirementsTitle: "- mcMMO Classic Requirements -"
|
||||
mcMMORewardsTitle: "- mcMMO Classic Rewards -"
|
||||
heroesRequirementsTitle: "- Heroes Requirements -"
|
||||
@ -732,6 +725,7 @@ noWord: "No"
|
||||
"true": "true"
|
||||
"false": "false"
|
||||
clear: "Clear"
|
||||
cleared: "Cleared"
|
||||
edit: "Edit"
|
||||
none: "None"
|
||||
done: "Done"
|
||||
@ -765,8 +759,8 @@ blocksWithin: "within <amount> blocks of"
|
||||
valRequired: "Value required"
|
||||
experience: "Experience"
|
||||
timePrompt: "Enter amount of time (in seconds), <clear>, <cancel>"
|
||||
timerMessage: "%green%Time left to finish the quest/stage:%red% <time> seconds"
|
||||
timerStart: "%green%You have%red% <time> seconds%green% to finish this quest/stage"
|
||||
timerMessage: "Time left to finish the quest/stage: <time> seconds"
|
||||
timerStart: "You have <time> seconds to finish this quest/stage"
|
||||
questErrorReadingFile: "Error reading Quests file."
|
||||
questSaveError: "An error occurred while saving."
|
||||
noPermission: "You do not have permission to do that."
|
||||
|
Loading…
Reference in New Issue
Block a user