Enforce maximum line width of 120, part 2

This commit is contained in:
PikaMug 2019-10-07 16:43:27 -04:00
parent f54f670e71
commit 5739ce80a9
9 changed files with 491 additions and 267 deletions

View File

@ -204,9 +204,11 @@ public abstract class CustomObjective implements Listener {
if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) {
if (quester.getQuestData(quest).customObjectiveCounts.containsKey(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 {
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;
for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) {
@ -218,12 +220,15 @@ public abstract class CustomObjective implements Listener {
if (index > -1) {
int goal = quester.getCurrentStage(quest).customObjectiveCounts.get(index);
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
quester.dispatchMultiplayerObjectives(quest, quester.getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).customObjectiveCounts.put(obj.getName(), 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);
q.getQuestData(quest).customObjectiveCounts.put(obj.getName(),
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;
});
}

View File

@ -124,7 +124,8 @@ public class Dependencies {
public boolean isPluginAvailable(String pluginName) {
if (plugin.getServer().getPluginManager().getPlugin(pluginName) != null ) {
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 {
return true;
}
@ -168,7 +169,8 @@ public class Dependencies {
placeholder = (PlaceholderAPIPlugin) plugin.getServer().getPluginManager().getPlugin("PlaceholderAPI");
}
if (isPluginAvailable("CitizensBooks")) {
citizensBooks = ((CitizensBooksPlugin) plugin.getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
citizensBooks = ((CitizensBooksPlugin) plugin.getServer().getPluginManager().getPlugin("CitizensBooks"))
.getAPI();
}
if (isPluginAvailable("DungeonsXL")) {
dungeons = DungeonsXL.getInstance();
@ -193,7 +195,8 @@ public class Dependencies {
private boolean setupEconomy() {
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) {
economy = economyProvider.getProvider();
}
@ -204,7 +207,8 @@ public class Dependencies {
}
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) {
permission = permissionProvider.getProvider();
}

View File

@ -36,7 +36,8 @@ public class NpcEffectThread implements Runnable {
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
if (nearby.isEmpty() == false) {
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)) {
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(e);
if (plugin.hasQuest(npc, quester)) {

View File

@ -184,7 +184,8 @@ public class Quest {
}
String stageCompleteMessage = currentStage.completeMessage;
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()) {
quester.resetCompass();
@ -249,9 +250,6 @@ public class Quest {
if (currentStage.script != null) {
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester);
}
/*
* if (quester.getCurrentStage(this).finishEvent != null) { quester.getCurrentStage(this).finishEvent.fire(quester); }
*/
if (nextStage.startEvent != null) {
nextStage.startEvent.fire(quester, this);
}
@ -262,7 +260,8 @@ public class Quest {
plugin.showObjectives(this, quester, false);
String stageStartMessage = quester.getCurrentStage(this).startMessage;
if (stageStartMessage != null) {
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageStartMessage, this, quester.getPlayer()));
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageStartMessage, this,
quester.getPlayer()));
}
quester.updateJournal();
QuesterPostChangeStageEvent postEvent = new QuesterPostChangeStageEvent(quester, this, currentStage, nextStage);
@ -296,7 +295,8 @@ public class Quest {
} else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) {
targetLocation = nextStage.locationsToReach.getFirst();
} 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();
}
if (targetLocation != null && targetLocation.getWorld() != null) {
@ -326,7 +326,8 @@ public class Quest {
protected boolean testRequirements(Player player) {
Quester quester = plugin.getQuester(player.getUniqueId());
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;
}
}
@ -380,8 +381,8 @@ public class Quest {
return false;
}
} else {
plugin.getLogger().warning("Quester \"" + player.getName() + "\" attempted to take Quest \"" + name + "\", but the Custom Requirement \"" + s
+ "\" could not be found. Does it still exist?");
plugin.getLogger().warning("Quester \"" + player.getName() + "\" attempted to take Quest \"" + name
+ "\", but the Custom Requirement \"" + s + "\" could not be found. Does it still exist?");
}
}
if (quester.questPoints < reqs.getQuestPoints()) {
@ -481,12 +482,14 @@ public class Quest {
none = null;
}
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;
}
for (String s : rews.getHeroesClasses()) {
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;
}
LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
@ -500,7 +503,8 @@ public class Quest {
}
if (lb.getMoney() > 0) {
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) {
@ -509,8 +513,8 @@ public class Quest {
try {
Quests.addItem(player, is);
} catch (Exception e) {
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of "
+ player.getName() + " upon completion of quest " + name);
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " + player.getName()
+ " upon completion of quest " + name);
player.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
+ "Please contact an administrator.");
}
@ -535,12 +539,14 @@ public class Quest {
player.sendMessage(ChatColor.GREEN + Lang.get(player, "questRewardsTitle"));
if (plugin.getSettings().canShowQuestTitles()) {
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()
+ " subtitle " + "{\"text\":\"" + name + "\",\"color\":\"yellow\"}");
}
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();
none = null;
}
@ -548,9 +554,11 @@ public class Quest {
String text = "error";
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
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 {
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET;
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
+ ChatColor.RESET;
try {
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
text += ChatColor.GRAY + " " + Lang.get(player, "with") + ChatColor.DARK_PURPLE;
@ -565,9 +573,11 @@ public class Quest {
}
} else if (i.getDurability() != 0) {
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 {
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()) {
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
}
@ -597,44 +607,57 @@ public class Quest {
for (ItemStack i : phatLootItems) {
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
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 {
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) {
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 {
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 {
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 {
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;
}
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;
} 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;
}
if (rews.getExp() > 0 || phatLootExp > 0) {
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;
}
if (rews.getCommands().isEmpty() == false) {
int index = 0;
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().get(index).trim().equals("")) {
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getCommandsOverrideDisplay().get(index));
player.sendMessage("- " + ChatColor.DARK_GREEN
+ rews.getCommandsOverrideDisplay().get(index));
}
}
} else {
@ -646,13 +669,17 @@ public class Quest {
}
if (rews.getMcmmoSkills().isEmpty() == false) {
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;
}
if (rews.getHeroesClasses().isEmpty() == false) {
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;
}
@ -683,7 +710,8 @@ public class Quest {
}
found.giveReward(player, rews.getCustomRewards().get(s));
} 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;
}
@ -754,7 +782,8 @@ public class Quest {
if (region == null) {
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 false;

View File

@ -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;

View File

@ -79,7 +79,10 @@ public class QuestFactory implements ConversationAbandonedListener {
this.plugin = plugin;
questsFile = new File(plugin.getDataFolder(), "quests.yml");
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).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() {
@ -182,7 +185,8 @@ public class QuestFactory implements ConversationAbandonedListener {
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + getTitle() + "\n";
for (int i = 1; i <= size; i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
+ getSelectionText(context, i) + "\n";
}
return text;
}
@ -290,7 +294,8 @@ public class QuestFactory implements ConversationAbandonedListener {
return ChatColor.YELLOW + Lang.get("questEditorFinishMessage");
}
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");
} else if (plugin.getDependencies().getCitizens() != null) {
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
@ -348,19 +353,23 @@ public class QuestFactory implements ConversationAbandonedListener {
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")";
} 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:
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")";
} 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:
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") + ")";
} 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 {
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
}
@ -369,14 +378,16 @@ public class QuestFactory implements ConversationAbandonedListener {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
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:
if (plugin.getDependencies().getWorldGuardApi() != null) {
if (context.getSessionData(CK.Q_REGION) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} 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 {
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
@ -392,7 +403,8 @@ public class QuestFactory implements ConversationAbandonedListener {
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} 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 {
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
@ -415,9 +427,11 @@ public class QuestFactory implements ConversationAbandonedListener {
QuestsEditorPostOpenCreatePromptEvent event = new QuestsEditorPostOpenCreatePromptEvent(context);
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++) {
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;
}
@ -586,7 +600,8 @@ public class QuestFactory implements ConversationAbandonedListener {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.startsWith("++")) {
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();
}
}
@ -608,7 +623,8 @@ public class QuestFactory implements ConversationAbandonedListener {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.startsWith("++")) {
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();
}
}
@ -623,12 +639,14 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
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
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > -1) {
@ -641,7 +659,8 @@ public class QuestFactory implements ConversationAbandonedListener {
return new CreateMenuPrompt();
}
} 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();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
@ -712,7 +731,8 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String found = null;
boolean done = false;
for (World world : plugin.getServer().getWorlds()) {
@ -766,13 +786,15 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
Action a = plugin.getAction(input);
if (a != null) {
context.setSessionData(CK.Q_INITIAL_EVENT, a.getName());
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();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.Q_INITIAL_EVENT, null);
@ -814,17 +836,20 @@ public class QuestFactory implements ConversationAbandonedListener {
}
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
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenSavePromptEvent event = new QuestsEditorPostOpenSavePromptEvent(QuestFactory.this, context);
QuestsEditorPostOpenSavePromptEvent event
= new QuestsEditorPostOpenSavePromptEvent(QuestFactory.this, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = getQueryText(context);
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;
}
@ -861,7 +886,8 @@ public class QuestFactory implements ConversationAbandonedListener {
saveQuest(context, newSection);
data.save(new File(plugin.getDataFolder(), "quests.yml"));
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) {
e.printStackTrace();
} catch (InvalidConfigurationException e) {
@ -911,12 +937,14 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenExitPromptEvent event = new QuestsEditorPostOpenExitPromptEvent(QuestFactory.this, context);
QuestsEditorPostOpenExitPromptEvent event
= new QuestsEditorPostOpenExitPromptEvent(QuestFactory.this, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = getQueryText(context);
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;
}
@ -1140,7 +1168,12 @@ public class QuestFactory implements ConversationAbandonedListener {
cs.set("event", initialEvent);
cs.set("region", region);
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");
reqs.set("items", itemReqs);
reqs.set("remove-items", removeItemReqs);
@ -1377,7 +1410,8 @@ public class QuestFactory implements ConversationAbandonedListener {
if (cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) {
customObjs = (LinkedList<String>) cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
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) {
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-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("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
|| permRews != null && permRews.isEmpty() == false || expRew != null || commandRews != null && commandRews.isEmpty() == false
|| commandDisplayOverrideRews != null && commandDisplayOverrideRews.isEmpty() == false || mcMMOSkillRews != null
|| RPGItemRews != null || heroesClassRews != null && heroesClassRews.isEmpty() == false
|| phatLootRews != null && phatLootRews.isEmpty() == false || customRews != null && customRews.isEmpty() == false) {
|| permRews != null && permRews.isEmpty() == false || expRew != null
|| commandRews != null && commandRews.isEmpty() == false
|| commandDisplayOverrideRews != null && commandDisplayOverrideRews.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");
rews.set("items", (itemRews != null && itemRews.isEmpty() == false) ? itemRews : null);
rews.set("money", moneyRew);
@ -1995,7 +2034,8 @@ public class QuestFactory implements ConversationAbandonedListener {
Quest found = plugin.getQuest(input);
if (found != null) {
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());
}
}
@ -2003,11 +2043,15 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(CK.ED_QUEST_DELETE, found.getName());
return new DeletePrompt();
} 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) {
((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();
}
}
@ -2023,9 +2067,12 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - " + Lang.get("yesWord") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - " + Lang.get("noWord");
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW + (String) context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + ")\n" + text;
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + "" + ChatColor.GREEN + " - "
+ Lang.get("yesWord") + "\n";
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - "
+ Lang.get("noWord");
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW
+ (String) context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + ")\n" + text;
}
@Override

File diff suppressed because it is too large Load Diff

View File

@ -1942,9 +1942,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (config.contains("quests." + questKey + ".requirements.mcmmo-skills")) {
if (Quests.checkList(config.getList("quests." + questKey + ".requirements.mcmmo-skills"), String.class)) {
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<Integer> amounts = config.getIntegerList("quests." + questKey + ".requirements.mcmmo-amounts");
List<Integer> amounts = config.getIntegerList("quests." + questKey
+ ".requirements.mcmmo-amounts");
if (skills.size() != amounts.size()) {
skipQuestProcess("mcmmo-skills: and mcmmo-amounts: in requirements: for Quest "
+ 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 (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
+ ".break-block-names");
} else {

View File

@ -39,7 +39,8 @@ public class Stage {
protected Integer playersToKill;
protected LinkedList<ItemStack> itemsToCraft = 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> itemsToDeliver = new LinkedList<ItemStack>();
protected LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {