mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-17 21:11:20 +01:00
Enforce maximum line width of 120, part 2
This commit is contained in:
parent
f54f670e71
commit
5739ce80a9
@ -204,9 +204,11 @@ public abstract class CustomObjective implements Listener {
|
|||||||
if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) {
|
if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) {
|
||||||
if (quester.getQuestData(quest).customObjectiveCounts.containsKey(obj.getName())) {
|
if (quester.getQuestData(quest).customObjectiveCounts.containsKey(obj.getName())) {
|
||||||
int old = quester.getQuestData(quest).customObjectiveCounts.get(obj.getName());
|
int old = quester.getQuestData(quest).customObjectiveCounts.get(obj.getName());
|
||||||
plugin.getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), old + count);
|
plugin.getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts
|
||||||
|
.put(obj.getName(), old + count);
|
||||||
} else {
|
} else {
|
||||||
plugin.getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), count);
|
plugin.getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts
|
||||||
|
.put(obj.getName(), count);
|
||||||
}
|
}
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) {
|
for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) {
|
||||||
@ -218,12 +220,15 @@ public abstract class CustomObjective implements Listener {
|
|||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
int goal = quester.getCurrentStage(quest).customObjectiveCounts.get(index);
|
int goal = quester.getCurrentStage(quest).customObjectiveCounts.get(index);
|
||||||
if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= goal) {
|
if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= goal) {
|
||||||
quester.finishObjective(quest, "customObj", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, goal), null, null, null, null, null, null, null, obj);
|
quester.finishObjective(quest, "customObj", new ItemStack(Material.AIR, 1),
|
||||||
|
new ItemStack(Material.AIR, goal), null, null, null, null, null, null, null, obj);
|
||||||
|
|
||||||
// Multiplayer
|
// Multiplayer
|
||||||
quester.dispatchMultiplayerObjectives(quest, quester.getCurrentStage(quest), (Quester q) -> {
|
quester.dispatchMultiplayerObjectives(quest, quester.getCurrentStage(quest), (Quester q) -> {
|
||||||
q.getQuestData(quest).customObjectiveCounts.put(obj.getName(), quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()));
|
q.getQuestData(quest).customObjectiveCounts.put(obj.getName(),
|
||||||
q.finishObjective(quest, "customObj", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, goal), null, null, null, null, null, null, null, obj);
|
quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()));
|
||||||
|
q.finishObjective(quest, "customObj", new ItemStack(Material.AIR, 1),
|
||||||
|
new ItemStack(Material.AIR, goal), null, null, null, null, null, null, null, obj);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,8 @@ public class Dependencies {
|
|||||||
public boolean isPluginAvailable(String pluginName) {
|
public boolean isPluginAvailable(String pluginName) {
|
||||||
if (plugin.getServer().getPluginManager().getPlugin(pluginName) != null ) {
|
if (plugin.getServer().getPluginManager().getPlugin(pluginName) != null ) {
|
||||||
if (!plugin.getServer().getPluginManager().getPlugin(pluginName).isEnabled()) {
|
if (!plugin.getServer().getPluginManager().getPlugin(pluginName).isEnabled()) {
|
||||||
plugin.getLogger().warning(pluginName + " was detected, but is not enabled! Fix "+ pluginName + " to allow linkage.");
|
plugin.getLogger().warning(pluginName
|
||||||
|
+ " was detected, but is not enabled! Fix "+ pluginName + " to allow linkage.");
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -168,7 +169,8 @@ public class Dependencies {
|
|||||||
placeholder = (PlaceholderAPIPlugin) plugin.getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
placeholder = (PlaceholderAPIPlugin) plugin.getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
||||||
}
|
}
|
||||||
if (isPluginAvailable("CitizensBooks")) {
|
if (isPluginAvailable("CitizensBooks")) {
|
||||||
citizensBooks = ((CitizensBooksPlugin) plugin.getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
|
citizensBooks = ((CitizensBooksPlugin) plugin.getServer().getPluginManager().getPlugin("CitizensBooks"))
|
||||||
|
.getAPI();
|
||||||
}
|
}
|
||||||
if (isPluginAvailable("DungeonsXL")) {
|
if (isPluginAvailable("DungeonsXL")) {
|
||||||
dungeons = DungeonsXL.getInstance();
|
dungeons = DungeonsXL.getInstance();
|
||||||
@ -193,7 +195,8 @@ public class Dependencies {
|
|||||||
|
|
||||||
private boolean setupEconomy() {
|
private boolean setupEconomy() {
|
||||||
try {
|
try {
|
||||||
RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager()
|
||||||
|
.getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||||
if (economyProvider != null) {
|
if (economyProvider != null) {
|
||||||
economy = economyProvider.getProvider();
|
economy = economyProvider.getProvider();
|
||||||
}
|
}
|
||||||
@ -204,7 +207,8 @@ public class Dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupPermissions() {
|
private boolean setupPermissions() {
|
||||||
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
|
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager()
|
||||||
|
.getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||||
if (permissionProvider != null) {
|
if (permissionProvider != null) {
|
||||||
permission = permissionProvider.getProvider();
|
permission = permissionProvider.getProvider();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,8 @@ public class NpcEffectThread implements Runnable {
|
|||||||
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||||
if (nearby.isEmpty() == false) {
|
if (nearby.isEmpty() == false) {
|
||||||
for (Entity e : nearby) {
|
for (Entity e : nearby) {
|
||||||
if (plugin.getDependencies().getCitizens() != null && plugin.getDependencies().getCitizens().getNPCRegistry() != null) {
|
if (plugin.getDependencies().getCitizens() != null
|
||||||
|
&& plugin.getDependencies().getCitizens().getNPCRegistry() != null) {
|
||||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(e)) {
|
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(e)) {
|
||||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(e);
|
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(e);
|
||||||
if (plugin.hasQuest(npc, quester)) {
|
if (plugin.hasQuest(npc, quester)) {
|
||||||
|
@ -184,7 +184,8 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
String stageCompleteMessage = currentStage.completeMessage;
|
String stageCompleteMessage = currentStage.completeMessage;
|
||||||
if (stageCompleteMessage != null) {
|
if (stageCompleteMessage != null) {
|
||||||
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageCompleteMessage, this, quester.getPlayer()));
|
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageCompleteMessage,
|
||||||
|
this, quester.getPlayer()));
|
||||||
}
|
}
|
||||||
if (plugin.getSettings().canUseCompass()) {
|
if (plugin.getSettings().canUseCompass()) {
|
||||||
quester.resetCompass();
|
quester.resetCompass();
|
||||||
@ -249,9 +250,6 @@ public class Quest {
|
|||||||
if (currentStage.script != null) {
|
if (currentStage.script != null) {
|
||||||
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester);
|
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* if (quester.getCurrentStage(this).finishEvent != null) { quester.getCurrentStage(this).finishEvent.fire(quester); }
|
|
||||||
*/
|
|
||||||
if (nextStage.startEvent != null) {
|
if (nextStage.startEvent != null) {
|
||||||
nextStage.startEvent.fire(quester, this);
|
nextStage.startEvent.fire(quester, this);
|
||||||
}
|
}
|
||||||
@ -262,7 +260,8 @@ public class Quest {
|
|||||||
plugin.showObjectives(this, quester, false);
|
plugin.showObjectives(this, quester, false);
|
||||||
String stageStartMessage = quester.getCurrentStage(this).startMessage;
|
String stageStartMessage = quester.getCurrentStage(this).startMessage;
|
||||||
if (stageStartMessage != null) {
|
if (stageStartMessage != null) {
|
||||||
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageStartMessage, this, quester.getPlayer()));
|
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageStartMessage, this,
|
||||||
|
quester.getPlayer()));
|
||||||
}
|
}
|
||||||
quester.updateJournal();
|
quester.updateJournal();
|
||||||
QuesterPostChangeStageEvent postEvent = new QuesterPostChangeStageEvent(quester, this, currentStage, nextStage);
|
QuesterPostChangeStageEvent postEvent = new QuesterPostChangeStageEvent(quester, this, currentStage, nextStage);
|
||||||
@ -296,7 +295,8 @@ public class Quest {
|
|||||||
} else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) {
|
} else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) {
|
||||||
targetLocation = nextStage.locationsToReach.getFirst();
|
targetLocation = nextStage.locationsToReach.getFirst();
|
||||||
} else if (nextStage.itemDeliveryTargets != null && nextStage.itemDeliveryTargets.size() > 0) {
|
} else if (nextStage.itemDeliveryTargets != null && nextStage.itemDeliveryTargets.size() > 0) {
|
||||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(nextStage.itemDeliveryTargets.getFirst());
|
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(nextStage.itemDeliveryTargets
|
||||||
|
.getFirst());
|
||||||
targetLocation = npc.getStoredLocation();
|
targetLocation = npc.getStoredLocation();
|
||||||
}
|
}
|
||||||
if (targetLocation != null && targetLocation.getWorld() != null) {
|
if (targetLocation != null && targetLocation.getWorld() != null) {
|
||||||
@ -326,7 +326,8 @@ public class Quest {
|
|||||||
protected boolean testRequirements(Player player) {
|
protected boolean testRequirements(Player player) {
|
||||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
if (reqs.getMoney() != 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
if (reqs.getMoney() != 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
||||||
if (plugin.getDependencies().getVaultEconomy().getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) < reqs.getMoney()) {
|
if (plugin.getDependencies().getVaultEconomy().getBalance(Bukkit.getOfflinePlayer(player.getUniqueId()))
|
||||||
|
< reqs.getMoney()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,8 +381,8 @@ public class Quest {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
plugin.getLogger().warning("Quester \"" + player.getName() + "\" attempted to take Quest \"" + name + "\", but the Custom Requirement \"" + s
|
plugin.getLogger().warning("Quester \"" + player.getName() + "\" attempted to take Quest \"" + name
|
||||||
+ "\" could not be found. Does it still exist?");
|
+ "\", but the Custom Requirement \"" + s + "\" could not be found. Does it still exist?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (quester.questPoints < reqs.getQuestPoints()) {
|
if (quester.questPoints < reqs.getQuestPoints()) {
|
||||||
@ -481,12 +482,14 @@ public class Quest {
|
|||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
for (String s : rews.getMcmmoSkills()) {
|
for (String s : rews.getMcmmoSkills()) {
|
||||||
UserManager.getPlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s), rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)));
|
UserManager.getPlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s),
|
||||||
|
rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)));
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
for (String s : rews.getHeroesClasses()) {
|
for (String s : rews.getHeroesClasses()) {
|
||||||
Hero hero = plugin.getHero(player.getUniqueId());
|
Hero hero = plugin.getHero(player.getUniqueId());
|
||||||
hero.addExp(rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)), plugin.getDependencies().getHeroes().getClassManager().getClass(s), player.getLocation());
|
hero.addExp(rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)),
|
||||||
|
plugin.getDependencies().getHeroes().getClassManager().getClass(s), player.getLocation());
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
|
LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
|
||||||
@ -500,7 +503,8 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
if (lb.getMoney() > 0) {
|
if (lb.getMoney() > 0) {
|
||||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||||
plugin.getDependencies().getVaultEconomy().depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
plugin.getDependencies().getVaultEconomy()
|
||||||
|
.depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lb.getItemList().isEmpty() == false) {
|
if (lb.getItemList().isEmpty() == false) {
|
||||||
@ -509,8 +513,8 @@ public class Quest {
|
|||||||
try {
|
try {
|
||||||
Quests.addItem(player, is);
|
Quests.addItem(player, is);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of "
|
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " + player.getName()
|
||||||
+ player.getName() + " upon completion of quest " + name);
|
+ " upon completion of quest " + name);
|
||||||
player.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
player.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||||
+ "Please contact an administrator.");
|
+ "Please contact an administrator.");
|
||||||
}
|
}
|
||||||
@ -535,12 +539,14 @@ public class Quest {
|
|||||||
player.sendMessage(ChatColor.GREEN + Lang.get(player, "questRewardsTitle"));
|
player.sendMessage(ChatColor.GREEN + Lang.get(player, "questRewardsTitle"));
|
||||||
if (plugin.getSettings().canShowQuestTitles()) {
|
if (plugin.getSettings().canShowQuestTitles()) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||||
+ " title " + "{\"text\":\"" + Lang.get(player, "quest") + " " + Lang.get(player, "complete") + "\",\"color\":\"gold\"}");
|
+ " title " + "{\"text\":\"" + Lang.get(player, "quest") + " " + Lang.get(player, "complete")
|
||||||
|
+ "\",\"color\":\"gold\"}");
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||||
+ " subtitle " + "{\"text\":\"" + name + "\",\"color\":\"yellow\"}");
|
+ " subtitle " + "{\"text\":\"" + name + "\",\"color\":\"yellow\"}");
|
||||||
}
|
}
|
||||||
if (rews.getQuestPoints() > 0) {
|
if (rews.getQuestPoints() > 0) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " " + Lang.get(player, "questPoints"));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " "
|
||||||
|
+ Lang.get(player, "questPoints"));
|
||||||
q.questPoints += rews.getQuestPoints();
|
q.questPoints += rews.getQuestPoints();
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
@ -548,9 +554,11 @@ public class Quest {
|
|||||||
String text = "error";
|
String text = "error";
|
||||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||||
if (i.getEnchantments().isEmpty()) {
|
if (i.getEnchantments().isEmpty()) {
|
||||||
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount();
|
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||||
|
+ ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount();
|
||||||
} else {
|
} else {
|
||||||
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET;
|
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||||
|
+ ChatColor.RESET;
|
||||||
try {
|
try {
|
||||||
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
|
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
|
||||||
text += ChatColor.GRAY + " " + Lang.get(player, "with") + ChatColor.DARK_PURPLE;
|
text += ChatColor.GRAY + " " + Lang.get(player, "with") + ChatColor.DARK_PURPLE;
|
||||||
@ -565,9 +573,11 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
} else if (i.getDurability() != 0) {
|
} else if (i.getDurability() != 0) {
|
||||||
if (i.getEnchantments().isEmpty()) {
|
if (i.getEnchantments().isEmpty()) {
|
||||||
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount();
|
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY
|
||||||
|
+ " x " + i.getAmount();
|
||||||
} else {
|
} else {
|
||||||
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " " + Lang.get(player, "with");
|
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY
|
||||||
|
+ " " + Lang.get(player, "with");
|
||||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||||
}
|
}
|
||||||
@ -597,44 +607,57 @@ public class Quest {
|
|||||||
for (ItemStack i : phatLootItems) {
|
for (ItemStack i : phatLootItems) {
|
||||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||||
if (i.getEnchantments().isEmpty()) {
|
if (i.getEnchantments().isEmpty()) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||||
|
+ ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
|
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||||
|
+ ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " "
|
||||||
|
+ Lang.get(player, "enchantedItem"));
|
||||||
}
|
}
|
||||||
} else if (i.getDurability() != 0) {
|
} else if (i.getDurability() != 0) {
|
||||||
if (i.getEnchantments().isEmpty()) {
|
if (i.getEnchantments().isEmpty()) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
|
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability()
|
||||||
|
+ ChatColor.GRAY + " x " + i.getAmount());
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability()
|
||||||
|
+ ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " "
|
||||||
|
+ Lang.get(player, "enchantedItem"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (i.getEnchantments().isEmpty()) {
|
if (i.getEnchantments().isEmpty()) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount());
|
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x "
|
||||||
|
+ i.getAmount());
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x "
|
||||||
|
+ i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
if (rews.getMoney() > 1) {
|
if (rews.getMoney() > 1) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE + plugin.getCurrency(true));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||||
|
+ plugin.getCurrency(true));
|
||||||
none = null;
|
none = null;
|
||||||
} else if (rews.getMoney() == 1) {
|
} else if (rews.getMoney() == 1) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE + plugin.getCurrency(false));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||||
|
+ plugin.getCurrency(false));
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
if (rews.getExp() > 0 || phatLootExp > 0) {
|
if (rews.getExp() > 0 || phatLootExp > 0) {
|
||||||
int tot = rews.getExp() + phatLootExp;
|
int tot = rews.getExp() + phatLootExp;
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " " + Lang.get(player, "experience"));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " "
|
||||||
|
+ Lang.get(player, "experience"));
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
if (rews.getCommands().isEmpty() == false) {
|
if (rews.getCommands().isEmpty() == false) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (String s : rews.getCommands()) {
|
for (String s : rews.getCommands()) {
|
||||||
if (rews.getCommandsOverrideDisplay().isEmpty() == false && rews.getCommandsOverrideDisplay().size() >= index) {
|
if (rews.getCommandsOverrideDisplay().isEmpty() == false && rews.getCommandsOverrideDisplay().size()
|
||||||
|
>= index) {
|
||||||
if (rews.getCommandsOverrideDisplay().size() > index) {
|
if (rews.getCommandsOverrideDisplay().size() > index) {
|
||||||
if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) {
|
if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getCommandsOverrideDisplay().get(index));
|
player.sendMessage("- " + ChatColor.DARK_GREEN
|
||||||
|
+ rews.getCommandsOverrideDisplay().get(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -646,13 +669,17 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
if (rews.getMcmmoSkills().isEmpty() == false) {
|
if (rews.getMcmmoSkills().isEmpty() == false) {
|
||||||
for (String s : rews.getMcmmoSkills()) {
|
for (String s : rews.getMcmmoSkills()) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " " + Lang.get(player, "experience"));
|
player.sendMessage("- " + ChatColor.DARK_GREEN
|
||||||
|
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " " + ChatColor.DARK_PURPLE
|
||||||
|
+ s + " " + Lang.get(player, "experience"));
|
||||||
}
|
}
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
if (rews.getHeroesClasses().isEmpty() == false) {
|
if (rews.getHeroesClasses().isEmpty() == false) {
|
||||||
for (String s : rews.getHeroesClasses()) {
|
for (String s : rews.getHeroesClasses()) {
|
||||||
player.sendMessage("- " + ChatColor.AQUA + rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE + s + " " + Lang.get(player, "experience"));
|
player.sendMessage("- " + ChatColor.AQUA
|
||||||
|
+ rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE
|
||||||
|
+ s + " " + Lang.get(player, "experience"));
|
||||||
}
|
}
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
@ -683,7 +710,8 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
found.giveReward(player, rews.getCustomRewards().get(s));
|
found.giveReward(player, rews.getCustomRewards().get(s));
|
||||||
} else {
|
} else {
|
||||||
plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \"" + name + "\", but the Custom Reward \"" + s + "\" could not be found. Does it still exist?");
|
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;
|
none = null;
|
||||||
}
|
}
|
||||||
@ -754,7 +782,8 @@ public class Quest {
|
|||||||
if (region == null) {
|
if (region == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plugin.getDependencies().getWorldGuardApi().getApplicableRegionsIDs(player.getWorld(), player.getLocation()).contains(region)) {
|
if (plugin.getDependencies().getWorldGuardApi()
|
||||||
|
.getApplicableRegionsIDs(player.getWorld(), player.getLocation()).contains(region)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -327,7 +327,8 @@ public class QuestData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public LinkedHashMap<Map<Enchantment, Material>, Integer> itemsEnchanted = new LinkedHashMap<Map<Enchantment, Material>, Integer>() {
|
public LinkedHashMap<Map<Enchantment, Material>, Integer> itemsEnchanted
|
||||||
|
= new LinkedHashMap<Map<Enchantment, Material>, Integer>() {
|
||||||
|
|
||||||
private static final long serialVersionUID = 416869352279205852L;
|
private static final long serialVersionUID = 416869352279205852L;
|
||||||
|
|
||||||
|
@ -79,7 +79,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).withFirstPrompt(new MainMenuPrompt()).withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!").addConversationAbandonedListener(this);
|
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||||
|
.withFirstPrompt(new MainMenuPrompt()).withTimeout(3600)
|
||||||
|
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
||||||
|
.addConversationAbandonedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<UUID, Block> getSelectedBlockStarts() {
|
public Map<UUID, Block> getSelectedBlockStarts() {
|
||||||
@ -182,7 +185,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
String text = ChatColor.GOLD + getTitle() + "\n";
|
String text = ChatColor.GOLD + getTitle() + "\n";
|
||||||
for (int i = 1; i <= size; i++) {
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
@ -290,7 +294,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
return ChatColor.YELLOW + Lang.get("questEditorFinishMessage");
|
return ChatColor.YELLOW + Lang.get("questEditorFinishMessage");
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens() != null) {
|
if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens()
|
||||||
|
!= null) {
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
||||||
} else if (plugin.getDependencies().getCitizens() != null) {
|
} else if (plugin.getDependencies().getCitizens() != null) {
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
||||||
@ -348,19 +353,23 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
|
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
|
||||||
return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")";
|
return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + "(" + context.getSessionData(CK.Q_ASK_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")";
|
return ChatColor.YELLOW + "(" + context.getSessionData(CK.Q_ASK_MESSAGE) + ChatColor.RESET
|
||||||
|
+ ChatColor.YELLOW + ")";
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
|
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
|
||||||
return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")";
|
return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + "(" + context.getSessionData(CK.Q_FINISH_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")";
|
return ChatColor.YELLOW + "(" + context.getSessionData(CK.Q_FINISH_MESSAGE) + ChatColor.RESET
|
||||||
|
+ ChatColor.YELLOW + ")";
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens() != null) {
|
if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens()
|
||||||
|
!= null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else if (plugin.getDependencies().getCitizens() != null) {
|
} else if (plugin.getDependencies().getCitizens() != null) {
|
||||||
return ChatColor.YELLOW + "(" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ChatColor.RESET + ChatColor.YELLOW + ")";
|
return ChatColor.YELLOW + "(" + CitizensAPI.getNPCRegistry().getById((Integer) context
|
||||||
|
.getSessionData(CK.Q_START_NPC)).getName() + ChatColor.RESET + ChatColor.YELLOW + ")";
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
}
|
}
|
||||||
@ -369,14 +378,16 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||||
return ChatColor.YELLOW + "(" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")";
|
return ChatColor.YELLOW + "(" + l.getWorld().getName() + ", " + l.getBlockX() + ", "
|
||||||
|
+ l.getBlockY() + ", " + l.getBlockZ() + ")";
|
||||||
}
|
}
|
||||||
case 6:
|
case 6:
|
||||||
if (plugin.getDependencies().getWorldGuardApi() != null) {
|
if (plugin.getDependencies().getWorldGuardApi() != null) {
|
||||||
if (context.getSessionData(CK.Q_REGION) == null) {
|
if (context.getSessionData(CK.Q_REGION) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + "(" + ChatColor.GREEN + (String) context.getSessionData(CK.Q_REGION) + ChatColor.YELLOW + ")";
|
return ChatColor.YELLOW + "(" + ChatColor.GREEN
|
||||||
|
+ (String) context.getSessionData(CK.Q_REGION) + ChatColor.YELLOW + ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
@ -392,7 +403,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW + "(" + ItemUtil.getDisplayString((ItemStack) context.getSessionData(CK.Q_GUIDISPLAY)) + ChatColor.RESET + ChatColor.YELLOW + ")";
|
return ChatColor.YELLOW + "(" + ItemUtil.getDisplayString((ItemStack) context
|
||||||
|
.getSessionData(CK.Q_GUIDISPLAY)) + ChatColor.RESET + ChatColor.YELLOW + ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
@ -415,9 +427,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
QuestsEditorPostOpenCreatePromptEvent event = new QuestsEditorPostOpenCreatePromptEvent(context);
|
QuestsEditorPostOpenCreatePromptEvent event = new QuestsEditorPostOpenCreatePromptEvent(context);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA) + ChatColor.GOLD + " -\n";
|
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
|
||||||
|
+ ChatColor.GOLD + " -\n";
|
||||||
for (int i = 1; i <= size; i++) {
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
@ -586,7 +600,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
if (input.startsWith("++")) {
|
if (input.startsWith("++")) {
|
||||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
|
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
|
||||||
context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " " + input.substring(2));
|
context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " "
|
||||||
|
+ input.substring(2));
|
||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -608,7 +623,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
if (input.startsWith("++")) {
|
if (input.startsWith("++")) {
|
||||||
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
|
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
|
||||||
context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " " + input.substring(2));
|
context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " "
|
||||||
|
+ input.substring(2));
|
||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -623,12 +639,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
selectingNpcs.add((Player) context.getForWhom());
|
selectingNpcs.add((Player) context.getForWhom());
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorEnterNPCStart") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
return ChatColor.YELLOW + Lang.get("questEditorEnterNPCStart") + "\n"
|
||||||
|
+ ChatColor.GOLD + Lang.get("npcHint");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
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 {
|
try {
|
||||||
int i = Integer.parseInt(input);
|
int i = Integer.parseInt(input);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
@ -641,7 +659,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} 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 NPCStartPrompt();
|
return new NPCStartPrompt();
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
@ -712,7 +731,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
Player player = (Player) context.getForWhom();
|
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) {
|
||||||
String found = null;
|
String found = null;
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
for (World world : plugin.getServer().getWorlds()) {
|
for (World world : plugin.getServer().getWorlds()) {
|
||||||
@ -766,13 +786,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
Player player = (Player) context.getForWhom();
|
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 a = plugin.getAction(input);
|
Action a = plugin.getAction(input);
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
context.setSessionData(CK.Q_INITIAL_EVENT, a.getName());
|
context.setSessionData(CK.Q_INITIAL_EVENT, a.getName());
|
||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " + Lang.get("questEditorInvalidEventName"));
|
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
|
||||||
|
+ Lang.get("questEditorInvalidEventName"));
|
||||||
return new InitialActionPrompt();
|
return new InitialActionPrompt();
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.Q_INITIAL_EVENT, null);
|
context.setSessionData(CK.Q_INITIAL_EVENT, null);
|
||||||
@ -814,17 +836,20 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getQueryText(ConversationContext context) {
|
public String getQueryText(ConversationContext context) {
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA + context.getSessionData(CK.Q_NAME) + ChatColor.YELLOW + "\"?\n";
|
return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA
|
||||||
|
+ context.getSessionData(CK.Q_NAME) + ChatColor.YELLOW + "\"?\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenSavePromptEvent event = new QuestsEditorPostOpenSavePromptEvent(QuestFactory.this, context);
|
QuestsEditorPostOpenSavePromptEvent event
|
||||||
|
= new QuestsEditorPostOpenSavePromptEvent(QuestFactory.this, context);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = getQueryText(context);
|
String text = getQueryText(context);
|
||||||
for (int i = 1; i <= size; i++) {
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
@ -861,7 +886,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
saveQuest(context, newSection);
|
saveQuest(context, newSection);
|
||||||
data.save(new File(plugin.getDataFolder(), "quests.yml"));
|
data.save(new File(plugin.getDataFolder(), "quests.yml"));
|
||||||
context.getForWhom().sendRawMessage(ChatColor.GREEN
|
context.getForWhom().sendRawMessage(ChatColor.GREEN
|
||||||
+ Lang.get("questEditorSaved").replaceAll("<command>", "/questadmin " + Lang.get("COMMAND_QUESTADMIN_RELOAD")));
|
+ Lang.get("questEditorSaved").replaceAll("<command>", "/questadmin "
|
||||||
|
+ Lang.get("COMMAND_QUESTADMIN_RELOAD")));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (InvalidConfigurationException e) {
|
} catch (InvalidConfigurationException e) {
|
||||||
@ -911,12 +937,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenExitPromptEvent event = new QuestsEditorPostOpenExitPromptEvent(QuestFactory.this, context);
|
QuestsEditorPostOpenExitPromptEvent event
|
||||||
|
= new QuestsEditorPostOpenExitPromptEvent(QuestFactory.this, context);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = getQueryText(context);
|
String text = getQueryText(context);
|
||||||
for (int i = 1; i <= size; i++) {
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
@ -1140,7 +1168,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
cs.set("event", initialEvent);
|
cs.set("event", initialEvent);
|
||||||
cs.set("region", region);
|
cs.set("region", region);
|
||||||
cs.set("gui-display", guiDisplay);
|
cs.set("gui-display", guiDisplay);
|
||||||
if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false) || (mcMMOSkillReqs != null && mcMMOSkillReqs.isEmpty() == false) || heroesPrimaryReq != null || heroesSecondaryReq != null || customReqs != null) {
|
if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false
|
||||||
|
|| permReqs != null && permReqs.isEmpty() == false
|
||||||
|
|| (questReqs != null && questReqs.isEmpty() == false)
|
||||||
|
|| (questBlocks != null && questBlocks.isEmpty() == false)
|
||||||
|
|| (mcMMOSkillReqs != null && mcMMOSkillReqs.isEmpty() == false)
|
||||||
|
|| heroesPrimaryReq != null || heroesSecondaryReq != null || customReqs != null) {
|
||||||
ConfigurationSection reqs = cs.createSection("requirements");
|
ConfigurationSection reqs = cs.createSection("requirements");
|
||||||
reqs.set("items", itemReqs);
|
reqs.set("items", itemReqs);
|
||||||
reqs.set("remove-items", removeItemReqs);
|
reqs.set("remove-items", removeItemReqs);
|
||||||
@ -1377,7 +1410,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) {
|
if (cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) {
|
||||||
customObjs = (LinkedList<String>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
customObjs = (LinkedList<String>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
||||||
customObjCounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
|
customObjCounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
|
||||||
customObjsData = (LinkedList<Entry<String, Object>>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
|
customObjsData
|
||||||
|
= (LinkedList<Entry<String, Object>>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(pref + CK.S_START_EVENT) != null) {
|
if (cc.getSessionData(pref + CK.S_START_EVENT) != null) {
|
||||||
startEvent = (String) cc.getSessionData(pref + CK.S_START_EVENT);
|
startEvent = (String) cc.getSessionData(pref + CK.S_START_EVENT);
|
||||||
@ -1538,15 +1572,20 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
stage.set("delay", delay.intValue() / 1000);
|
stage.set("delay", delay.intValue() / 1000);
|
||||||
}
|
}
|
||||||
stage.set("delay-message", delayMessage == null ? delayMessage : delayMessage.replace("\\n", "\n"));
|
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 == null ? overrideDisplay
|
||||||
|
: overrideDisplay.replace("\\n", "\n"));
|
||||||
stage.set("start-message", startMessage == null ? startMessage : startMessage.replace("\\n", "\n"));
|
stage.set("start-message", startMessage == null ? startMessage : startMessage.replace("\\n", "\n"));
|
||||||
stage.set("complete-message", completeMessage == null ? completeMessage : completeMessage.replace("\\n", "\n"));
|
stage.set("complete-message", completeMessage == null ? completeMessage
|
||||||
|
: completeMessage.replace("\\n", "\n"));
|
||||||
}
|
}
|
||||||
if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false
|
if (moneyRew != null || questPointsRew != null || itemRews != null && itemRews.isEmpty() == false
|
||||||
|| permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false
|
|| permRews != null && permRews.isEmpty() == false || expRew != null
|
||||||
|| commandDisplayOverrideRews != null && commandDisplayOverrideRews.isEmpty() == false || mcMMOSkillRews != null
|
|| commandRews != null && commandRews.isEmpty() == false
|
||||||
|| RPGItemRews != null || heroesClassRews != null && heroesClassRews.isEmpty() == false
|
|| commandDisplayOverrideRews != null && commandDisplayOverrideRews.isEmpty() == false
|
||||||
|| phatLootRews != null && phatLootRews.isEmpty() == false || customRews != null && customRews.isEmpty() == false) {
|
|| mcMMOSkillRews != null || RPGItemRews != null
|
||||||
|
|| heroesClassRews != null && heroesClassRews.isEmpty() == false
|
||||||
|
|| phatLootRews != null && phatLootRews.isEmpty() == false
|
||||||
|
|| customRews != null && customRews.isEmpty() == false) {
|
||||||
ConfigurationSection rews = cs.createSection("rewards");
|
ConfigurationSection rews = cs.createSection("rewards");
|
||||||
rews.set("items", (itemRews != null && itemRews.isEmpty() == false) ? itemRews : null);
|
rews.set("items", (itemRews != null && itemRews.isEmpty() == false) ? itemRews : null);
|
||||||
rews.set("money", moneyRew);
|
rews.set("money", moneyRew);
|
||||||
@ -1995,7 +2034,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
Quest found = plugin.getQuest(input);
|
Quest found = plugin.getQuest(input);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
for (Quest q : plugin.getQuests()) {
|
for (Quest q : plugin.getQuests()) {
|
||||||
if (q.getRequirements().getNeededQuests().contains(q.getName()) || q.getRequirements().getBlockQuests().contains(q.getName())) {
|
if (q.getRequirements().getNeededQuests().contains(q.getName())
|
||||||
|
|| q.getRequirements().getBlockQuests().contains(q.getName())) {
|
||||||
used.add(q.getName());
|
used.add(q.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2003,11 +2043,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
context.setSessionData(CK.ED_QUEST_DELETE, found.getName());
|
context.setSessionData(CK.ED_QUEST_DELETE, found.getName());
|
||||||
return new DeletePrompt();
|
return new DeletePrompt();
|
||||||
} else {
|
} else {
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestAsRequirement1") + " \"" + ChatColor.DARK_PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + "\" " + Lang.get("questEditorQuestAsRequirement2"));
|
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||||
|
+ Lang.get("questEditorQuestAsRequirement1") + " \"" + ChatColor.DARK_PURPLE
|
||||||
|
+ context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + "\" "
|
||||||
|
+ Lang.get("questEditorQuestAsRequirement2"));
|
||||||
for (String s : used) {
|
for (String s : used) {
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "- " + ChatColor.DARK_RED + s);
|
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "- " + ChatColor.DARK_RED + s);
|
||||||
}
|
}
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestAsRequirement3"));
|
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||||
|
+ Lang.get("questEditorQuestAsRequirement3"));
|
||||||
return new SelectDeletePrompt();
|
return new SelectDeletePrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2023,9 +2067,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - " + Lang.get("yesWord") + "\n";
|
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - "
|
||||||
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - " + Lang.get("noWord");
|
+ Lang.get("yesWord") + "\n";
|
||||||
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW + (String) context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + ")\n" + text;
|
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_QUEST_DELETE) + ChatColor.RED + ")\n" + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1942,9 +1942,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
if (config.contains("quests." + questKey + ".requirements.mcmmo-skills")) {
|
if (config.contains("quests." + questKey + ".requirements.mcmmo-skills")) {
|
||||||
if (Quests.checkList(config.getList("quests." + questKey + ".requirements.mcmmo-skills"), String.class)) {
|
if (Quests.checkList(config.getList("quests." + questKey + ".requirements.mcmmo-skills"), String.class)) {
|
||||||
if (config.contains("quests." + questKey + ".requirements.mcmmo-amounts")) {
|
if (config.contains("quests." + questKey + ".requirements.mcmmo-amounts")) {
|
||||||
if (Quests.checkList(config.getList("quests." + questKey + ".requirements.mcmmo-amounts"), Integer.class)) {
|
if (Quests.checkList(config.getList("quests." + questKey + ".requirements.mcmmo-amounts"),
|
||||||
|
Integer.class)) {
|
||||||
List<String> skills = config.getStringList("quests." + questKey + ".requirements.mcmmo-skills");
|
List<String> skills = config.getStringList("quests." + questKey + ".requirements.mcmmo-skills");
|
||||||
List<Integer> amounts = config.getIntegerList("quests." + questKey + ".requirements.mcmmo-amounts");
|
List<Integer> amounts = config.getIntegerList("quests." + questKey
|
||||||
|
+ ".requirements.mcmmo-amounts");
|
||||||
if (skills.size() != amounts.size()) {
|
if (skills.size() != amounts.size()) {
|
||||||
skipQuestProcess("mcmmo-skills: and mcmmo-amounts: in requirements: for Quest "
|
skipQuestProcess("mcmmo-skills: and mcmmo-amounts: in requirements: for Quest "
|
||||||
+ quest.getName() + " are not the same size!");
|
+ quest.getName() + " are not the same size!");
|
||||||
@ -2108,7 +2110,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names")) {
|
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names")) {
|
||||||
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names"), String.class)) {
|
if (checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".break-block-names"),
|
||||||
|
String.class)) {
|
||||||
breakNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2
|
breakNames = config.getStringList("quests." + questKey + ".stages.ordered." + s2
|
||||||
+ ".break-block-names");
|
+ ".break-block-names");
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +39,8 @@ public class Stage {
|
|||||||
protected Integer playersToKill;
|
protected Integer playersToKill;
|
||||||
protected LinkedList<ItemStack> itemsToCraft = new LinkedList<ItemStack>();
|
protected LinkedList<ItemStack> itemsToCraft = new LinkedList<ItemStack>();
|
||||||
protected LinkedList<ItemStack> itemsToSmelt = new LinkedList<ItemStack>();
|
protected LinkedList<ItemStack> itemsToSmelt = new LinkedList<ItemStack>();
|
||||||
protected Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
protected Map<Map<Enchantment, Material>, Integer> itemsToEnchant
|
||||||
|
= new HashMap<Map<Enchantment, Material>, Integer>();
|
||||||
protected LinkedList<ItemStack> itemsToBrew = new LinkedList<ItemStack>();
|
protected LinkedList<ItemStack> itemsToBrew = new LinkedList<ItemStack>();
|
||||||
protected LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>();
|
protected LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>();
|
||||||
protected LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
|
protected LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user