Improve code syntax, part 6

This commit is contained in:
PikaMug 2021-09-09 01:01:41 -04:00
parent 3cf7ad2719
commit 3f7e920043
14 changed files with 824 additions and 878 deletions

View File

@ -12,19 +12,19 @@
package me.blackvein.quests; package me.blackvein.quests;
import org.bukkit.entity.Player;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.entity.Player;
public abstract class CustomRequirement { public abstract class CustomRequirement {
private String name = null; private String name = null;
private String author = null; private String author = null;
private String display = null; private String display = null;
private final Map<String, Short> items = new HashMap<String, Short>(); private final Map<String, Short> items = new HashMap<>();
private final Map<String, Object> data = new HashMap<String, Object>(); private final Map<String, Object> data = new HashMap<>();
private final Map<String, String> descriptions = new HashMap<String, String>(); private final Map<String, String> descriptions = new HashMap<>();
public abstract boolean testRequirement(Player p, Map<String, Object> m); public abstract boolean testRequirement(Player p, Map<String, Object> m);

View File

@ -12,19 +12,19 @@
package me.blackvein.quests; package me.blackvein.quests;
import org.bukkit.entity.Player;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.entity.Player;
public abstract class CustomReward { public abstract class CustomReward {
private String name = null; private String name = null;
private String author = null; private String author = null;
private String display = null; private String display = null;
private final Map<String, Short> items = new HashMap<String, Short>(); private final Map<String, Short> items = new HashMap<>();
private final Map<String, Object> data = new HashMap<String, Object>(); private final Map<String, Object> data = new HashMap<>();
private final Map<String, String> descriptions = new HashMap<String, String>(); private final Map<String, String> descriptions = new HashMap<>();
public abstract void giveReward(Player p, Map<String, Object> m); public abstract void giveReward(Player p, Map<String, Object> m);

View File

@ -31,8 +31,8 @@ public class Planner {
} }
final Calendar cal = Calendar.getInstance(); final Calendar cal = Calendar.getInstance();
final String[] s = start.split(":"); final String[] s = start.split(":");
cal.set(Integer.valueOf(s[2]), Integer.valueOf(s[1]), Integer.valueOf(s[0]), cal.set(Integer.parseInt(s[2]), Integer.parseInt(s[1]), Integer.parseInt(s[0]),
Integer.valueOf(s[3]), Integer.valueOf(s[4]), Integer.valueOf(s[5])); Integer.parseInt(s[3]), Integer.parseInt(s[4]), Integer.parseInt(s[5]));
final TimeZone tz = TimeZone.getTimeZone(s[6]); final TimeZone tz = TimeZone.getTimeZone(s[6]);
cal.setTimeZone(tz); cal.setTimeZone(tz);
return cal.getTimeInMillis(); return cal.getTimeInMillis();
@ -52,8 +52,8 @@ public class Planner {
} }
final Calendar cal = Calendar.getInstance(); final Calendar cal = Calendar.getInstance();
final String[] s = end.split(":"); final String[] s = end.split(":");
cal.set(Integer.valueOf(s[2]), Integer.valueOf(s[1]), Integer.valueOf(s[0]), cal.set(Integer.parseInt(s[2]), Integer.parseInt(s[1]), Integer.parseInt(s[0]),
Integer.valueOf(s[3]), Integer.valueOf(s[4]), Integer.valueOf(s[5])); Integer.parseInt(s[3]), Integer.parseInt(s[4]), Integer.parseInt(s[5]));
final TimeZone tz = TimeZone.getTimeZone(s[6]); final TimeZone tz = TimeZone.getTimeZone(s[6]);
cal.setTimeZone(tz); cal.setTimeZone(tz);
return cal.getTimeInMillis(); return cal.getTimeInMillis();

View File

@ -69,10 +69,10 @@ public class Quest implements Comparable<Quest> {
protected Location blockStart; protected Location blockStart;
protected String regionStart = null; protected String regionStart = null;
protected Action initialAction; protected Action initialAction;
private final Requirements reqs = new Requirements(); private final Requirements requirements = new Requirements();
private final Planner pln = new Planner(); private final Planner planner = new Planner();
private final Rewards rews = new Rewards(); private final Rewards rewards = new Rewards();
private final Options opts = new Options(); private final Options options = new Options();
@Override @Override
public int compareTo(final Quest quest) { public int compareTo(final Quest quest) {
@ -160,19 +160,19 @@ public class Quest implements Comparable<Quest> {
} }
public Requirements getRequirements() { public Requirements getRequirements() {
return reqs; return requirements;
} }
public Planner getPlanner() { public Planner getPlanner() {
return pln; return planner;
} }
public Rewards getRewards() { public Rewards getRewards() {
return rews; return rewards;
} }
public Options getOptions() { public Options getOptions() {
return opts; return options;
} }
/** /**
@ -216,7 +216,7 @@ public class Quest implements Comparable<Quest> {
} }
// Multiplayer // Multiplayer
if (allowSharedProgress && opts.getShareProgressLevel() == 3) { if (allowSharedProgress && options.getShareProgressLevel() == 3) {
final List<Quester> mq = quester.getMultiplayerQuesters(this); final List<Quester> mq = quester.getMultiplayerQuesters(this);
for (final Quester qq : mq) { for (final Quester qq : mq) {
if (currentStage.equals(qq.getCurrentStage(this))) { if (currentStage.equals(qq.getCurrentStage(this))) {
@ -441,36 +441,36 @@ public class Quest implements Comparable<Quest> {
*/ */
protected boolean testRequirements(final OfflinePlayer player) { protected boolean testRequirements(final OfflinePlayer player) {
final Quester quester = plugin.getQuester(player.getUniqueId()); final Quester quester = plugin.getQuester(player.getUniqueId());
if (reqs.getMoney() != 0 && plugin.getDependencies().getVaultEconomy() != null) { if (requirements.getMoney() != 0 && plugin.getDependencies().getVaultEconomy() != null) {
if (plugin.getDependencies().getVaultEconomy().getBalance(player) < reqs.getMoney()) { if (plugin.getDependencies().getVaultEconomy().getBalance(player) < requirements.getMoney()) {
return false; return false;
} }
} }
if (quester.questPoints < reqs.getQuestPoints()) { if (quester.questPoints < requirements.getQuestPoints()) {
return false; return false;
} }
if (!quester.completedQuests.containsAll(reqs.getNeededQuests())) { if (!quester.completedQuests.containsAll(requirements.getNeededQuests())) {
return false; return false;
} }
for (final Quest q : reqs.getBlockQuests()) { for (final Quest q : requirements.getBlockQuests()) {
if (quester.completedQuests.contains(q) || quester.currentQuests.containsKey(q)) { if (quester.completedQuests.contains(q) || quester.currentQuests.containsKey(q)) {
return false; return false;
} }
} }
for (final String s : reqs.getMcmmoSkills()) { for (final String s : requirements.getMcmmoSkills()) {
final SkillType st = Quests.getMcMMOSkill(s); final SkillType st = Quests.getMcMMOSkill(s);
final int lvl = reqs.getMcmmoAmounts().get(reqs.getMcmmoSkills().indexOf(s)); final int lvl = requirements.getMcmmoAmounts().get(requirements.getMcmmoSkills().indexOf(s));
if (UserManager.getOfflinePlayer(player).getProfile().getSkillLevel(st) < lvl) { if (UserManager.getOfflinePlayer(player).getProfile().getSkillLevel(st) < lvl) {
return false; return false;
} }
} }
if (reqs.getHeroesPrimaryClass() != null) { if (requirements.getHeroesPrimaryClass() != null) {
if (!plugin.getDependencies().testPrimaryHeroesClass(reqs.getHeroesPrimaryClass(), player.getUniqueId())) { if (!plugin.getDependencies().testPrimaryHeroesClass(requirements.getHeroesPrimaryClass(), player.getUniqueId())) {
return false; return false;
} }
} }
if (reqs.getHeroesSecondaryClass() != null) { if (requirements.getHeroesSecondaryClass() != null) {
if (!plugin.getDependencies().testSecondaryHeroesClass(reqs.getHeroesSecondaryClass(), if (!plugin.getDependencies().testSecondaryHeroesClass(requirements.getHeroesSecondaryClass(),
player.getUniqueId())) { player.getUniqueId())) {
return false; return false;
} }
@ -479,19 +479,19 @@ public class Quest implements Comparable<Quest> {
final Player p = (Player)player; final Player p = (Player)player;
final Inventory fakeInv = Bukkit.createInventory(null, InventoryType.PLAYER); final Inventory fakeInv = Bukkit.createInventory(null, InventoryType.PLAYER);
fakeInv.setContents(p.getInventory().getContents().clone()); fakeInv.setContents(p.getInventory().getContents().clone());
for (final ItemStack is : reqs.getItems()) { for (final ItemStack is : requirements.getItems()) {
if (InventoryUtil.canRemoveItem(fakeInv, is)) { if (InventoryUtil.canRemoveItem(fakeInv, is)) {
InventoryUtil.removeItem(fakeInv, is); InventoryUtil.removeItem(fakeInv, is);
} else { } else {
return false; return false;
} }
} }
for (final String s : reqs.getPermissions()) { for (final String s : requirements.getPermissions()) {
if (!p.hasPermission(s)) { if (!p.hasPermission(s)) {
return false; return false;
} }
} }
for (final String s : reqs.getCustomRequirements().keySet()) { for (final String s : requirements.getCustomRequirements().keySet()) {
CustomRequirement found = null; CustomRequirement found = null;
for (final CustomRequirement cr : plugin.getCustomRequirements()) { for (final CustomRequirement cr : plugin.getCustomRequirements()) {
if (cr.getName().equalsIgnoreCase(s)) { if (cr.getName().equalsIgnoreCase(s)) {
@ -500,7 +500,7 @@ public class Quest implements Comparable<Quest> {
} }
} }
if (found != null) { if (found != null) {
if (!found.testRequirement(p, reqs.getCustomRequirements().get(s))) { if (!found.testRequirement(p, requirements.getCustomRequirements().get(s))) {
return false; return false;
} }
} else { } else {
@ -571,7 +571,7 @@ public class Quest implements Comparable<Quest> {
+ finished, this, p); + finished, this, p);
Bukkit.getScheduler().runTaskLater(plugin, () -> p.sendMessage(ps), 40); Bukkit.getScheduler().runTaskLater(plugin, () -> p.sendMessage(ps), 40);
} }
if (pln.getCooldown() > -1) { if (planner.getCooldown() > -1) {
quester.completedTimes.put(this, System.currentTimeMillis()); quester.completedTimes.put(this, System.currentTimeMillis());
if (quester.amountsCompleted.containsKey(this)) { if (quester.amountsCompleted.containsKey(this)) {
quester.amountsCompleted.put(this, quester.amountsCompleted.get(this) + 1); quester.amountsCompleted.put(this, quester.amountsCompleted.get(this) + 1);
@ -583,16 +583,16 @@ public class Quest implements Comparable<Quest> {
// Issue rewards // Issue rewards
final Dependencies depends = plugin.getDependencies(); final Dependencies depends = plugin.getDependencies();
boolean issuedReward = false; boolean issuedReward = false;
if (rews.getMoney() > 0 && depends.getVaultEconomy() != null) { if (rewards.getMoney() > 0 && depends.getVaultEconomy() != null) {
depends.getVaultEconomy().depositPlayer(player, rews.getMoney()); depends.getVaultEconomy().depositPlayer(player, rewards.getMoney());
issuedReward = true; issuedReward = true;
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded " plugin.getLogger().info(player.getUniqueId() + " was rewarded "
+ depends.getVaultEconomy().format(rews.getMoney())); + depends.getVaultEconomy().format(rewards.getMoney()));
} }
} }
if (player.isOnline()) { if (player.isOnline()) {
for (final ItemStack i : rews.getItems()) { for (final ItemStack i : rewards.getItems()) {
try { try {
InventoryUtil.addItem(player.getPlayer(), i); InventoryUtil.addItem(player.getPlayer(), i);
} catch (final Exception e) { } catch (final Exception e) {
@ -608,7 +608,7 @@ public class Quest implements Comparable<Quest> {
} }
} }
} }
for (final String s : rews.getCommands()) { for (final String s : rewards.getCommands()) {
if (player.getName() == null) { if (player.getName() == null) {
continue; continue;
} }
@ -628,12 +628,12 @@ public class Quest implements Comparable<Quest> {
plugin.getLogger().info(player.getUniqueId() + " was rewarded command " + s); plugin.getLogger().info(player.getUniqueId() + " was rewarded command " + s);
} }
} }
for (int i = 0; i < rews.getPermissions().size(); i++) { for (int i = 0; i < rewards.getPermissions().size(); i++) {
if (depends.getVaultPermission() != null) { if (depends.getVaultPermission() != null) {
final String perm = rews.getPermissions().get(i); final String perm = rewards.getPermissions().get(i);
String world = null; String world = null;
if (i < rews.getPermissionWorlds().size()) { if (i < rewards.getPermissionWorlds().size()) {
world = rews.getPermissionWorlds().get(i); world = rewards.getPermissionWorlds().get(i);
} }
if (world == null || world.equals("null")) { if (world == null || world.equals("null")) {
depends.getVaultPermission().playerAdd(null, player, perm); depends.getVaultPermission().playerAdd(null, player, perm);
@ -646,8 +646,8 @@ public class Quest implements Comparable<Quest> {
issuedReward = true; issuedReward = true;
} }
} }
for (final String s : rews.getMcmmoSkills()) { for (final String s : rewards.getMcmmoSkills()) {
final int levels = rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)); final int levels = rewards.getMcmmoAmounts().get(rewards.getMcmmoSkills().indexOf(s));
UserManager.getOfflinePlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s), levels); UserManager.getOfflinePlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s), levels);
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded " + s + " x " + levels); plugin.getLogger().info(player.getUniqueId() + " was rewarded " + s + " x " + levels);
@ -655,9 +655,9 @@ public class Quest implements Comparable<Quest> {
issuedReward = true; issuedReward = true;
} }
if (player.isOnline()) { if (player.isOnline()) {
for (final String s : rews.getHeroesClasses()) { for (final String s : rewards.getHeroesClasses()) {
final Hero hero = plugin.getDependencies().getHero(player.getUniqueId()); final Hero hero = plugin.getDependencies().getHero(player.getUniqueId());
final double expChange = rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)); final double expChange = rewards.getHeroesAmounts().get(rewards.getHeroesClasses().indexOf(s));
hero.addExp(expChange, plugin.getDependencies().getHeroes().getClassManager().getClass(s), hero.addExp(expChange, plugin.getDependencies().getHeroes().getClassManager().getClass(s),
((Player)player).getLocation()); ((Player)player).getLocation());
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
@ -666,16 +666,16 @@ public class Quest implements Comparable<Quest> {
issuedReward = true; issuedReward = true;
} }
} }
if (rews.getPartiesExperience() > 0 && depends.getPartiesApi() != null) { if (rewards.getPartiesExperience() > 0 && depends.getPartiesApi() != null) {
final PartyPlayer partyPlayer = depends.getPartiesApi().getPartyPlayer(player.getUniqueId()); final PartyPlayer partyPlayer = depends.getPartiesApi().getPartyPlayer(player.getUniqueId());
if (partyPlayer != null && partyPlayer.getPartyId() != null) { if (partyPlayer != null && partyPlayer.getPartyId() != null) {
final Party party = depends.getPartiesApi().getParty(partyPlayer.getPartyId()); final Party party = depends.getPartiesApi().getParty(partyPlayer.getPartyId());
if (party != null) { if (party != null) {
party.giveExperience(rews.getPartiesExperience()); party.giveExperience(rewards.getPartiesExperience());
issuedReward = true; issuedReward = true;
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded " plugin.getLogger().info(player.getUniqueId() + " was rewarded "
+ rews.getPartiesExperience() + " party experience"); + rewards.getPartiesExperience() + " party experience");
} }
} }
} }
@ -683,7 +683,7 @@ public class Quest implements Comparable<Quest> {
final LinkedList<ItemStack> phatLootItems = new LinkedList<>(); final LinkedList<ItemStack> phatLootItems = new LinkedList<>();
int phatLootExp = 0; int phatLootExp = 0;
final LinkedList<String> phatLootMessages = new LinkedList<>(); final LinkedList<String> phatLootMessages = new LinkedList<>();
for (final String s : rews.getPhatLoots()) { for (final String s : rewards.getPhatLoots()) {
final LootBundle lb = PhatLootsAPI.getPhatLoot(s).rollForLoot(); final LootBundle lb = PhatLootsAPI.getPhatLoot(s).rollForLoot();
if (lb.getExp() > 0) { if (lb.getExp() > 0) {
phatLootExp += lb.getExp(); phatLootExp += lb.getExp();
@ -724,25 +724,25 @@ public class Quest implements Comparable<Quest> {
} }
issuedReward = true; issuedReward = true;
} }
if (rews.getExp() > 0 && player.isOnline()) { if (rewards.getExp() > 0 && player.isOnline()) {
((Player)player).giveExp(rews.getExp()); ((Player)player).giveExp(rewards.getExp());
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded exp " + rews.getExp()); plugin.getLogger().info(player.getUniqueId() + " was rewarded exp " + rewards.getExp());
} }
issuedReward = true; issuedReward = true;
} }
if (rews.getQuestPoints() > 0) { if (rewards.getQuestPoints() > 0) {
quester.questPoints += rews.getQuestPoints(); quester.questPoints += rewards.getQuestPoints();
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded " + rews.getQuestPoints() + " " plugin.getLogger().info(player.getUniqueId() + " was rewarded " + rewards.getQuestPoints() + " "
+ Lang.get("questPoints")); + Lang.get("questPoints"));
} }
issuedReward = true; issuedReward = true;
} }
if (!rews.getCustomRewards().isEmpty()) { if (!rewards.getCustomRewards().isEmpty()) {
issuedReward = true; issuedReward = true;
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
for (final String s : rews.getCustomRewards().keySet()) { for (final String s : rewards.getCustomRewards().keySet()) {
plugin.getLogger().info(player.getUniqueId() + " was custom rewarded " + s); plugin.getLogger().info(player.getUniqueId() + " was custom rewarded " + s);
} }
} }
@ -763,8 +763,8 @@ public class Quest implements Comparable<Quest> {
Lang.send(p, ChatColor.GREEN + Lang.get(p, "questRewardsTitle")); Lang.send(p, ChatColor.GREEN + Lang.get(p, "questRewardsTitle"));
if (!issuedReward) { if (!issuedReward) {
p.sendMessage(ChatColor.GRAY + "- (" + Lang.get("none") + ")"); p.sendMessage(ChatColor.GRAY + "- (" + Lang.get("none") + ")");
} else if (!rews.getDetailsOverride().isEmpty()) { } else if (!rewards.getDetailsOverride().isEmpty()) {
for (final String s: rews.getDetailsOverride()) { for (final String s: rewards.getDetailsOverride()) {
String message = ChatColor.DARK_GREEN + ConfigUtil.parseString( String message = ChatColor.DARK_GREEN + ConfigUtil.parseString(
ChatColor.translateAlternateColorCodes('&', s)); ChatColor.translateAlternateColorCodes('&', s));
if (plugin.getDependencies().getPlaceholderApi() != null) { if (plugin.getDependencies().getPlaceholderApi() != null) {
@ -773,11 +773,11 @@ public class Quest implements Comparable<Quest> {
quester.sendMessage("- " + message); quester.sendMessage("- " + message);
} }
} else { } else {
if (rews.getQuestPoints() > 0) { if (rewards.getQuestPoints() > 0) {
quester.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " " quester.sendMessage("- " + ChatColor.DARK_GREEN + rewards.getQuestPoints() + " "
+ Lang.get(p, "questPoints")); + Lang.get(p, "questPoints"));
} }
for (final ItemStack i : rews.getItems()) { for (final ItemStack i : rewards.getItems()) {
StringBuilder text; StringBuilder text;
if (i.getItemMeta() != null && i.getItemMeta().hasDisplayName()) { if (i.getItemMeta() != null && i.getItemMeta().hasDisplayName()) {
if (i.getEnchantments().isEmpty()) { if (i.getEnchantments().isEmpty()) {
@ -873,23 +873,23 @@ public class Quest implements Comparable<Quest> {
} }
} }
} }
if (rews.getMoney() > 0 && depends.getVaultEconomy() != null) { if (rewards.getMoney() > 0 && depends.getVaultEconomy() != null) {
quester.sendMessage("- " + ChatColor.DARK_GREEN quester.sendMessage("- " + ChatColor.DARK_GREEN
+ depends.getVaultEconomy().format(rews.getMoney())); + depends.getVaultEconomy().format(rewards.getMoney()));
} }
if (rews.getExp() > 0 || phatLootExp > 0) { if (rewards.getExp() > 0 || phatLootExp > 0) {
final int tot = rews.getExp() + phatLootExp; final int tot = rewards.getExp() + phatLootExp;
quester.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " " quester.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " "
+ Lang.get(p, "experience")); + Lang.get(p, "experience"));
} }
if (!rews.getCommands().isEmpty()) { if (!rewards.getCommands().isEmpty()) {
int index = 0; int index = 0;
for (final String s : rews.getCommands()) { for (final String s : rewards.getCommands()) {
if (!rews.getCommandsOverrideDisplay().isEmpty() if (!rewards.getCommandsOverrideDisplay().isEmpty()
&& rews.getCommandsOverrideDisplay().size() > index) { && rewards.getCommandsOverrideDisplay().size() > index) {
if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) { if (!rewards.getCommandsOverrideDisplay().get(index).trim().equals("")) {
quester.sendMessage("- " + ChatColor.DARK_GREEN quester.sendMessage("- " + ChatColor.DARK_GREEN
+ rews.getCommandsOverrideDisplay().get(index)); + rewards.getCommandsOverrideDisplay().get(index));
} }
} else { } else {
quester.sendMessage("- " + ChatColor.DARK_GREEN + s); quester.sendMessage("- " + ChatColor.DARK_GREEN + s);
@ -897,12 +897,12 @@ public class Quest implements Comparable<Quest> {
index++; index++;
} }
} }
if (!rews.getPermissions().isEmpty()) { if (!rewards.getPermissions().isEmpty()) {
int index = 0; int index = 0;
for (final String s : rews.getPermissions()) { for (final String s : rewards.getPermissions()) {
if (rews.getPermissionWorlds() != null && rews.getPermissionWorlds().size() > index) { if (rewards.getPermissionWorlds() != null && rewards.getPermissionWorlds().size() > index) {
quester.sendMessage("- " + ChatColor.DARK_GREEN + s + " (" quester.sendMessage("- " + ChatColor.DARK_GREEN + s + " ("
+ rews.getPermissionWorlds().get(index) + ")"); + rewards.getPermissionWorlds().get(index) + ")");
} else { } else {
quester.sendMessage("- " + ChatColor.DARK_GREEN + s); quester.sendMessage("- " + ChatColor.DARK_GREEN + s);
@ -910,22 +910,22 @@ public class Quest implements Comparable<Quest> {
index++; index++;
} }
} }
if (!rews.getMcmmoSkills().isEmpty()) { if (!rewards.getMcmmoSkills().isEmpty()) {
for (final String s : rews.getMcmmoSkills()) { for (final String s : rewards.getMcmmoSkills()) {
quester.sendMessage("- " + ChatColor.DARK_GREEN quester.sendMessage("- " + ChatColor.DARK_GREEN
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " " + rewards.getMcmmoAmounts().get(rewards.getMcmmoSkills().indexOf(s)) + " "
+ ChatColor.DARK_PURPLE + s + " " + Lang.get(p, "experience")); + ChatColor.DARK_PURPLE + s + " " + Lang.get(p, "experience"));
} }
} }
if (!rews.getHeroesClasses().isEmpty()) { if (!rewards.getHeroesClasses().isEmpty()) {
for (final String s : rews.getHeroesClasses()) { for (final String s : rewards.getHeroesClasses()) {
quester.sendMessage("- " + ChatColor.AQUA quester.sendMessage("- " + ChatColor.AQUA
+ rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE + rewards.getHeroesAmounts().get(rewards.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE
+ s + " " + Lang.get(p, "experience")); + s + " " + Lang.get(p, "experience"));
} }
} }
if (rews.getPartiesExperience() > 0) { if (rewards.getPartiesExperience() > 0) {
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getPartiesExperience() + ChatColor.DARK_PURPLE p.sendMessage("- " + ChatColor.DARK_GREEN + rewards.getPartiesExperience() + ChatColor.DARK_PURPLE
+ " " + Lang.get(p, "partiesExperience")); + " " + Lang.get(p, "partiesExperience"));
} }
if (!phatLootMessages.isEmpty()) { if (!phatLootMessages.isEmpty()) {
@ -933,7 +933,7 @@ public class Quest implements Comparable<Quest> {
quester.sendMessage("- " + s); quester.sendMessage("- " + s);
} }
} }
for (final String s : rews.getCustomRewards().keySet()) { for (final String s : rewards.getCustomRewards().keySet()) {
CustomReward found = null; CustomReward found = null;
for (final CustomReward cr : plugin.getCustomRewards()) { for (final CustomReward cr : plugin.getCustomRewards()) {
if (cr.getName().equalsIgnoreCase(s)) { if (cr.getName().equalsIgnoreCase(s)) {
@ -942,18 +942,18 @@ public class Quest implements Comparable<Quest> {
} }
} }
if (found != null) { if (found != null) {
final Map<String, Object> datamap = rews.getCustomRewards().get(found.getName()); final Map<String, Object> dataMap = rewards.getCustomRewards().get(found.getName());
String message = found.getDisplay(); String message = found.getDisplay();
if (message != null) { if (message != null) {
for (final String key : datamap.keySet()) { for (final String key : dataMap.keySet()) {
message = message.replace("%" + key + "%", datamap.get(key).toString()); message = message.replace("%" + key + "%", dataMap.get(key).toString());
} }
quester.sendMessage("- " + ChatColor.GOLD + message); quester.sendMessage("- " + ChatColor.GOLD + message);
} else { } else {
plugin.getLogger().warning("Failed to notify player: " plugin.getLogger().warning("Failed to notify player: "
+ "Custom Reward does not have an assigned name"); + "Custom Reward does not have an assigned name");
} }
found.giveReward(p, rews.getCustomRewards().get(s)); found.giveReward(p, rewards.getCustomRewards().get(s));
} else { } else {
plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \"" plugin.getLogger().warning("Quester \"" + player.getName() + "\" completed the Quest \""
+ name + "\", but the Custom Reward \"" + s + name + "\", but the Custom Reward \"" + s
@ -976,7 +976,7 @@ public class Quest implements Comparable<Quest> {
} }
// Multiplayer // Multiplayer
if (allowMultiplayer && opts.getShareProgressLevel() == 4) { if (allowMultiplayer && options.getShareProgressLevel() == 4) {
final List<Quester> mq = quester.getMultiplayerQuesters(this); final List<Quester> mq = quester.getMultiplayerQuesters(this);
for (final Quester qq : mq) { for (final Quester qq : mq) {
if (qq.getQuestData(this) != null) { if (qq.getQuestData(this) != null) {
@ -999,7 +999,7 @@ public class Quest implements Comparable<Quest> {
* Force player to quit quest and inform them of their failure * Force player to quit quest and inform them of their failure
* *
* @param quester The quester to be ejected * @param quester The quester to be ejected
* @param ignoreFailAction Whether or not to ignore quest fail Action * @param ignoreFailAction Whether to ignore quest fail Action
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void failQuest(final Quester quester, final boolean ignoreFailAction) { public void failQuest(final Quester quester, final boolean ignoreFailAction) {

View File

@ -1403,7 +1403,7 @@ public class QuestData {
return sheepSheared; return sheepSheared;
} }
public void setSheepSheared(LinkedList<Integer> sheepSheared) { public void setSheepSheared(final LinkedList<Integer> sheepSheared) {
this.sheepSheared = sheepSheared; this.sheepSheared = sheepSheared;
if (doJournalUpdate) { if (doJournalUpdate) {
quester.updateJournal(); quester.updateJournal();

View File

@ -176,96 +176,96 @@ public class QuestFactory implements ConversationAbandonedListener {
if (q.getGUIDisplay() != null) { if (q.getGUIDisplay() != null) {
context.setSessionData(CK.Q_GUIDISPLAY, q.getGUIDisplay()); context.setSessionData(CK.Q_GUIDISPLAY, q.getGUIDisplay());
} }
final Requirements reqs = q.getRequirements(); final Requirements requirements = q.getRequirements();
if (reqs.getMoney() != 0) { if (requirements.getMoney() != 0) {
context.setSessionData(CK.REQ_MONEY, reqs.getMoney()); context.setSessionData(CK.REQ_MONEY, requirements.getMoney());
} }
if (reqs.getQuestPoints() != 0) { if (requirements.getQuestPoints() != 0) {
context.setSessionData(CK.REQ_QUEST_POINTS, reqs.getQuestPoints()); context.setSessionData(CK.REQ_QUEST_POINTS, requirements.getQuestPoints());
} }
if (!reqs.getItems().isEmpty()) { if (!requirements.getItems().isEmpty()) {
context.setSessionData(CK.REQ_ITEMS, reqs.getItems()); context.setSessionData(CK.REQ_ITEMS, requirements.getItems());
context.setSessionData(CK.REQ_ITEMS_REMOVE, reqs.getRemoveItems()); context.setSessionData(CK.REQ_ITEMS_REMOVE, requirements.getRemoveItems());
} }
if (!reqs.getNeededQuests().isEmpty()) { if (!requirements.getNeededQuests().isEmpty()) {
final List<String> ids = reqs.getNeededQuests().stream().map(Quest::getId).collect(Collectors.toList()); final List<String> ids = requirements.getNeededQuests().stream().map(Quest::getId).collect(Collectors.toList());
context.setSessionData(CK.REQ_QUEST, ids); context.setSessionData(CK.REQ_QUEST, ids);
} }
if (!reqs.getBlockQuests().isEmpty()) { if (!requirements.getBlockQuests().isEmpty()) {
final List<String> ids = reqs.getBlockQuests().stream().map(Quest::getId).collect(Collectors.toList()); final List<String> ids = requirements.getBlockQuests().stream().map(Quest::getId).collect(Collectors.toList());
context.setSessionData(CK.REQ_QUEST_BLOCK, ids); context.setSessionData(CK.REQ_QUEST_BLOCK, ids);
} }
if (!reqs.getMcmmoSkills().isEmpty()) { if (!requirements.getMcmmoSkills().isEmpty()) {
context.setSessionData(CK.REQ_MCMMO_SKILLS, reqs.getMcmmoAmounts()); context.setSessionData(CK.REQ_MCMMO_SKILLS, requirements.getMcmmoAmounts());
context.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, reqs.getMcmmoAmounts()); context.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, requirements.getMcmmoAmounts());
} }
if (!reqs.getPermissions().isEmpty()) { if (!requirements.getPermissions().isEmpty()) {
context.setSessionData(CK.REQ_PERMISSION, reqs.getPermissions()); context.setSessionData(CK.REQ_PERMISSION, requirements.getPermissions());
} }
if (reqs.getHeroesPrimaryClass() != null) { if (requirements.getHeroesPrimaryClass() != null) {
context.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, reqs.getHeroesPrimaryClass()); context.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, requirements.getHeroesPrimaryClass());
} }
if (reqs.getHeroesSecondaryClass() != null) { if (requirements.getHeroesSecondaryClass() != null) {
context.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, reqs.getHeroesSecondaryClass()); context.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, requirements.getHeroesSecondaryClass());
} }
if (!reqs.getCustomRequirements().isEmpty()) { if (!requirements.getCustomRequirements().isEmpty()) {
final LinkedList<String> list = new LinkedList<>(); final LinkedList<String> list = new LinkedList<>();
final LinkedList<Map<String, Object>> datamapList = new LinkedList<>(); final LinkedList<Map<String, Object>> dataMapList = new LinkedList<>();
for (final Entry<String, Map<String, Object>> entry : reqs.getCustomRequirements().entrySet()) { for (final Entry<String, Map<String, Object>> entry : requirements.getCustomRequirements().entrySet()) {
list.add(entry.getKey()); list.add(entry.getKey());
datamapList.add(entry.getValue()); dataMapList.add(entry.getValue());
} }
context.setSessionData(CK.REQ_CUSTOM, list); context.setSessionData(CK.REQ_CUSTOM, list);
context.setSessionData(CK.REQ_CUSTOM_DATA, datamapList); context.setSessionData(CK.REQ_CUSTOM_DATA, dataMapList);
} }
if (!reqs.getDetailsOverride().isEmpty()) { if (!requirements.getDetailsOverride().isEmpty()) {
context.setSessionData(CK.REQ_FAIL_MESSAGE, reqs.getDetailsOverride()); context.setSessionData(CK.REQ_FAIL_MESSAGE, requirements.getDetailsOverride());
} }
final Rewards rews = q.getRewards(); final Rewards rewards = q.getRewards();
if (rews.getMoney() != 0) { if (rewards.getMoney() != 0) {
context.setSessionData(CK.REW_MONEY, rews.getMoney()); context.setSessionData(CK.REW_MONEY, rewards.getMoney());
} }
if (rews.getQuestPoints() != 0) { if (rewards.getQuestPoints() != 0) {
context.setSessionData(CK.REW_QUEST_POINTS, rews.getQuestPoints()); context.setSessionData(CK.REW_QUEST_POINTS, rewards.getQuestPoints());
} }
if (rews.getExp() != 0) { if (rewards.getExp() != 0) {
context.setSessionData(CK.REW_EXP, rews.getExp()); context.setSessionData(CK.REW_EXP, rewards.getExp());
} }
if (!rews.getItems().isEmpty()) { if (!rewards.getItems().isEmpty()) {
context.setSessionData(CK.REW_ITEMS, rews.getItems()); context.setSessionData(CK.REW_ITEMS, rewards.getItems());
} }
if (!rews.getCommands().isEmpty()) { if (!rewards.getCommands().isEmpty()) {
context.setSessionData(CK.REW_COMMAND, rews.getCommands()); context.setSessionData(CK.REW_COMMAND, rewards.getCommands());
} }
if (!rews.getCommandsOverrideDisplay().isEmpty()) { if (!rewards.getCommandsOverrideDisplay().isEmpty()) {
context.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, rews.getCommandsOverrideDisplay()); context.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, rewards.getCommandsOverrideDisplay());
} }
if (!rews.getPermissions().isEmpty()) { if (!rewards.getPermissions().isEmpty()) {
context.setSessionData(CK.REW_PERMISSION, rews.getPermissions()); context.setSessionData(CK.REW_PERMISSION, rewards.getPermissions());
} }
if (!rews.getPermissions().isEmpty()) { if (!rewards.getPermissions().isEmpty()) {
context.setSessionData(CK.REW_PERMISSION_WORLDS, rews.getPermissionWorlds()); context.setSessionData(CK.REW_PERMISSION_WORLDS, rewards.getPermissionWorlds());
} }
if (!rews.getMcmmoSkills().isEmpty()) { if (!rewards.getMcmmoSkills().isEmpty()) {
context.setSessionData(CK.REW_MCMMO_SKILLS, rews.getMcmmoSkills()); context.setSessionData(CK.REW_MCMMO_SKILLS, rewards.getMcmmoSkills());
context.setSessionData(CK.REW_MCMMO_AMOUNTS, rews.getMcmmoAmounts()); context.setSessionData(CK.REW_MCMMO_AMOUNTS, rewards.getMcmmoAmounts());
} }
if (!rews.getHeroesClasses().isEmpty()) { if (!rewards.getHeroesClasses().isEmpty()) {
context.setSessionData(CK.REW_HEROES_CLASSES, rews.getHeroesClasses()); context.setSessionData(CK.REW_HEROES_CLASSES, rewards.getHeroesClasses());
context.setSessionData(CK.REW_HEROES_AMOUNTS, rews.getHeroesAmounts()); context.setSessionData(CK.REW_HEROES_AMOUNTS, rewards.getHeroesAmounts());
} }
if (rews.getPartiesExperience() != 0) { if (rewards.getPartiesExperience() != 0) {
context.setSessionData(CK.REW_PARTIES_EXPERIENCE, rews.getPartiesExperience()); context.setSessionData(CK.REW_PARTIES_EXPERIENCE, rewards.getPartiesExperience());
} }
if (!rews.getPhatLoots().isEmpty()) { if (!rewards.getPhatLoots().isEmpty()) {
context.setSessionData(CK.REW_PHAT_LOOTS, rews.getPhatLoots()); context.setSessionData(CK.REW_PHAT_LOOTS, rewards.getPhatLoots());
} }
if (!rews.getCustomRewards().isEmpty()) { if (!rewards.getCustomRewards().isEmpty()) {
context.setSessionData(CK.REW_CUSTOM, new LinkedList<>(rews.getCustomRewards().keySet())); context.setSessionData(CK.REW_CUSTOM, new LinkedList<>(rewards.getCustomRewards().keySet()));
context.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList<Object>(rews.getCustomRewards().values())); context.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList<Object>(rewards.getCustomRewards().values()));
} }
if (!rews.getDetailsOverride().isEmpty()) { if (!rewards.getDetailsOverride().isEmpty()) {
context.setSessionData(CK.REW_DETAILS_OVERRIDE, rews.getDetailsOverride()); context.setSessionData(CK.REW_DETAILS_OVERRIDE, rewards.getDetailsOverride());
} }
final Planner pln = q.getPlanner(); final Planner pln = q.getPlanner();
if (pln.getStart() != null) { if (pln.getStart() != null) {
@ -299,68 +299,68 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(pref, Boolean.TRUE); context.setSessionData(pref, Boolean.TRUE);
if (!stage.getBlocksToBreak().isEmpty()) { if (!stage.getBlocksToBreak().isEmpty()) {
final LinkedList<String> names = new LinkedList<>(); final LinkedList<String> names = new LinkedList<>();
final LinkedList<Integer> amnts = new LinkedList<>(); final LinkedList<Integer> amounts = new LinkedList<>();
final LinkedList<Short> durab = new LinkedList<>(); final LinkedList<Short> durability = new LinkedList<>();
for (final ItemStack e : stage.getBlocksToBreak()) { for (final ItemStack e : stage.getBlocksToBreak()) {
names.add(e.getType().name()); names.add(e.getType().name());
amnts.add(e.getAmount()); amounts.add(e.getAmount());
durab.add(e.getDurability()); durability.add(e.getDurability());
} }
context.setSessionData(pref + CK.S_BREAK_NAMES, names); context.setSessionData(pref + CK.S_BREAK_NAMES, names);
context.setSessionData(pref + CK.S_BREAK_AMOUNTS, amnts); context.setSessionData(pref + CK.S_BREAK_AMOUNTS, amounts);
context.setSessionData(pref + CK.S_BREAK_DURABILITY, durab); context.setSessionData(pref + CK.S_BREAK_DURABILITY, durability);
} }
if (!stage.getBlocksToDamage().isEmpty()) { if (!stage.getBlocksToDamage().isEmpty()) {
final LinkedList<String> names = new LinkedList<>(); final LinkedList<String> names = new LinkedList<>();
final LinkedList<Integer> amnts = new LinkedList<>(); final LinkedList<Integer> amounts = new LinkedList<>();
final LinkedList<Short> durab = new LinkedList<>(); final LinkedList<Short> durability = new LinkedList<>();
for (final ItemStack e : stage.getBlocksToDamage()) { for (final ItemStack e : stage.getBlocksToDamage()) {
names.add(e.getType().name()); names.add(e.getType().name());
amnts.add(e.getAmount()); amounts.add(e.getAmount());
durab.add(e.getDurability()); durability.add(e.getDurability());
} }
context.setSessionData(pref + CK.S_DAMAGE_NAMES, names); context.setSessionData(pref + CK.S_DAMAGE_NAMES, names);
context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts); context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amounts);
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durab); context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durability);
} }
if (!stage.getBlocksToPlace().isEmpty()) { if (!stage.getBlocksToPlace().isEmpty()) {
final LinkedList<String> names = new LinkedList<>(); final LinkedList<String> names = new LinkedList<>();
final LinkedList<Integer> amnts = new LinkedList<>(); final LinkedList<Integer> amounts = new LinkedList<>();
final LinkedList<Short> durab = new LinkedList<>(); final LinkedList<Short> durability = new LinkedList<>();
for (final ItemStack e : stage.getBlocksToPlace()) { for (final ItemStack e : stage.getBlocksToPlace()) {
names.add(e.getType().name()); names.add(e.getType().name());
amnts.add(e.getAmount()); amounts.add(e.getAmount());
durab.add(e.getDurability()); durability.add(e.getDurability());
} }
context.setSessionData(pref + CK.S_PLACE_NAMES, names); context.setSessionData(pref + CK.S_PLACE_NAMES, names);
context.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts); context.setSessionData(pref + CK.S_PLACE_AMOUNTS, amounts);
context.setSessionData(pref + CK.S_PLACE_DURABILITY, durab); context.setSessionData(pref + CK.S_PLACE_DURABILITY, durability);
} }
if (!stage.getBlocksToUse().isEmpty()) { if (!stage.getBlocksToUse().isEmpty()) {
final LinkedList<String> names = new LinkedList<>(); final LinkedList<String> names = new LinkedList<>();
final LinkedList<Integer> amnts = new LinkedList<>(); final LinkedList<Integer> amounts = new LinkedList<>();
final LinkedList<Short> durab = new LinkedList<>(); final LinkedList<Short> durability = new LinkedList<>();
for (final ItemStack e : stage.getBlocksToUse()) { for (final ItemStack e : stage.getBlocksToUse()) {
names.add(e.getType().name()); names.add(e.getType().name());
amnts.add(e.getAmount()); amounts.add(e.getAmount());
durab.add(e.getDurability()); durability.add(e.getDurability());
} }
context.setSessionData(pref + CK.S_USE_NAMES, names); context.setSessionData(pref + CK.S_USE_NAMES, names);
context.setSessionData(pref + CK.S_USE_AMOUNTS, amnts); context.setSessionData(pref + CK.S_USE_AMOUNTS, amounts);
context.setSessionData(pref + CK.S_USE_DURABILITY, durab); context.setSessionData(pref + CK.S_USE_DURABILITY, durability);
} }
if (!stage.getBlocksToCut().isEmpty()) { if (!stage.getBlocksToCut().isEmpty()) {
final LinkedList<String> names = new LinkedList<>(); final LinkedList<String> names = new LinkedList<>();
final LinkedList<Integer> amnts = new LinkedList<>(); final LinkedList<Integer> amounts = new LinkedList<>();
final LinkedList<Short> durab = new LinkedList<>(); final LinkedList<Short> durability = new LinkedList<>();
for (final ItemStack e : stage.getBlocksToCut()) { for (final ItemStack e : stage.getBlocksToCut()) {
names.add(e.getType().name()); names.add(e.getType().name());
amnts.add(e.getAmount()); amounts.add(e.getAmount());
durab.add(e.getDurability()); durability.add(e.getDurability());
} }
context.setSessionData(pref + CK.S_CUT_NAMES, names); context.setSessionData(pref + CK.S_CUT_NAMES, names);
context.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts); context.setSessionData(pref + CK.S_CUT_AMOUNTS, amounts);
context.setSessionData(pref + CK.S_CUT_DURABILITY, durab); context.setSessionData(pref + CK.S_CUT_DURABILITY, durability);
} }
if (!stage.getItemsToCraft().isEmpty()) { if (!stage.getItemsToCraft().isEmpty()) {
final LinkedList<ItemStack> items = new LinkedList<>(stage.getItemsToCraft()); final LinkedList<ItemStack> items = new LinkedList<>(stage.getItemsToCraft());
@ -415,21 +415,21 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(pref + CK.S_MOB_TYPES, mobs); context.setSessionData(pref + CK.S_MOB_TYPES, mobs);
context.setSessionData(pref + CK.S_MOB_AMOUNTS, stage.getMobNumToKill()); context.setSessionData(pref + CK.S_MOB_AMOUNTS, stage.getMobNumToKill());
if (!stage.getLocationsToKillWithin().isEmpty()) { if (!stage.getLocationsToKillWithin().isEmpty()) {
final LinkedList<String> locs = new LinkedList<>(); final LinkedList<String> locations = new LinkedList<>();
for (final Location l : stage.getLocationsToKillWithin()) { for (final Location l : stage.getLocationsToKillWithin()) {
locs.add(ConfigUtil.getLocationInfo(l)); locations.add(ConfigUtil.getLocationInfo(l));
} }
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs); context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locations);
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS, stage.getRadiiToKillWithin()); context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS, stage.getRadiiToKillWithin());
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, stage.getKillNames()); context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, stage.getKillNames());
} }
} }
if (!stage.getLocationsToReach().isEmpty()) { if (!stage.getLocationsToReach().isEmpty()) {
final LinkedList<String> locs = new LinkedList<>(); final LinkedList<String> locations = new LinkedList<>();
for (final Location l : stage.getLocationsToReach()) { for (final Location l : stage.getLocationsToReach()) {
locs.add(ConfigUtil.getLocationInfo(l)); locations.add(ConfigUtil.getLocationInfo(l));
} }
context.setSessionData(pref + CK.S_REACH_LOCATIONS, locs); context.setSessionData(pref + CK.S_REACH_LOCATIONS, locations);
context.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, stage.getRadiiToReachWithin()); context.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, stage.getRadiiToReachWithin());
context.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, stage.getLocationNames()); context.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, stage.getLocationNames());
} }
@ -438,9 +438,9 @@ public class QuestFactory implements ConversationAbandonedListener {
for (final EntityType e : stage.getMobsToTame()) { for (final EntityType e : stage.getMobsToTame()) {
mobs.add(MiscUtil.getPrettyMobName(e)); mobs.add(MiscUtil.getPrettyMobName(e));
} }
final LinkedList<Integer> amts = new LinkedList<>(stage.getMobNumToTame()); final LinkedList<Integer> amounts = new LinkedList<>(stage.getMobNumToTame());
context.setSessionData(pref + CK.S_TAME_TYPES, mobs); context.setSessionData(pref + CK.S_TAME_TYPES, mobs);
context.setSessionData(pref + CK.S_TAME_AMOUNTS, amts); context.setSessionData(pref + CK.S_TAME_AMOUNTS, amounts);
} }
if (!stage.getSheepToShear().isEmpty()) { if (!stage.getSheepToShear().isEmpty()) {
final LinkedList<String> colors = new LinkedList<>(); final LinkedList<String> colors = new LinkedList<>();
@ -448,9 +448,9 @@ public class QuestFactory implements ConversationAbandonedListener {
colors.add(MiscUtil.getPrettyDyeColorName(d)); colors.add(MiscUtil.getPrettyDyeColorName(d));
} }
final LinkedList<Integer> amts = new LinkedList<>(stage.sheepNumToShear); final LinkedList<Integer> amounts = new LinkedList<>(stage.sheepNumToShear);
context.setSessionData(pref + CK.S_SHEAR_COLORS, colors); context.setSessionData(pref + CK.S_SHEAR_COLORS, colors);
context.setSessionData(pref + CK.S_SHEAR_AMOUNTS, amts); context.setSessionData(pref + CK.S_SHEAR_AMOUNTS, amounts);
} }
if (!stage.getPasswordDisplays().isEmpty()) { if (!stage.getPasswordDisplays().isEmpty()) {
context.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, stage.getPasswordDisplays()); context.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, stage.getPasswordDisplays());
@ -463,10 +463,10 @@ public class QuestFactory implements ConversationAbandonedListener {
list.add(stage.getCustomObjectives().get(i).getName()); list.add(stage.getCustomObjectives().get(i).getName());
countList.add(stage.getCustomObjectiveCounts().get(i)); countList.add(stage.getCustomObjectiveCounts().get(i));
} }
final LinkedList<Entry<String, Object>> datamapList = new LinkedList<>(stage.getCustomObjectiveData()); final LinkedList<Entry<String, Object>> dataMapList = new LinkedList<>(stage.getCustomObjectiveData());
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, list); context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, list);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, countList); context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, countList);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList); context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, dataMapList);
} }
if (stage.getStartAction() != null) { if (stage.getStartAction() != null) {
context.setSessionData(pref + CK.S_START_EVENT, stage.getStartAction().getName()); context.setSessionData(pref + CK.S_START_EVENT, stage.getStartAction().getName());
@ -619,44 +619,44 @@ public class QuestFactory implements ConversationAbandonedListener {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void saveRequirements(final ConversationContext context, final ConfigurationSection section) { private void saveRequirements(final ConversationContext context, final ConfigurationSection section) {
final ConfigurationSection reqs = section.createSection("requirements"); final ConfigurationSection requirements = section.createSection("requirements");
reqs.set("money", context.getSessionData(CK.REQ_MONEY) != null requirements.set("money", context.getSessionData(CK.REQ_MONEY) != null
? context.getSessionData(CK.REQ_MONEY) : null); ? context.getSessionData(CK.REQ_MONEY) : null);
reqs.set("quest-points", context.getSessionData(CK.REQ_QUEST_POINTS) != null requirements.set("quest-points", context.getSessionData(CK.REQ_QUEST_POINTS) != null
? context.getSessionData(CK.REQ_QUEST_POINTS) : null); ? context.getSessionData(CK.REQ_QUEST_POINTS) : null);
reqs.set("items", context.getSessionData(CK.REQ_ITEMS) != null requirements.set("items", context.getSessionData(CK.REQ_ITEMS) != null
? context.getSessionData(CK.REQ_ITEMS) : null); ? context.getSessionData(CK.REQ_ITEMS) : null);
reqs.set("remove-items", context.getSessionData(CK.REQ_ITEMS_REMOVE) != null requirements.set("remove-items", context.getSessionData(CK.REQ_ITEMS_REMOVE) != null
? context.getSessionData(CK.REQ_ITEMS_REMOVE) : null); ? context.getSessionData(CK.REQ_ITEMS_REMOVE) : null);
reqs.set("permissions", context.getSessionData(CK.REQ_PERMISSION) != null requirements.set("permissions", context.getSessionData(CK.REQ_PERMISSION) != null
? context.getSessionData(CK.REQ_PERMISSION) : null); ? context.getSessionData(CK.REQ_PERMISSION) : null);
reqs.set("quests", context.getSessionData(CK.REQ_QUEST) != null requirements.set("quests", context.getSessionData(CK.REQ_QUEST) != null
? context.getSessionData(CK.REQ_QUEST) : null); ? context.getSessionData(CK.REQ_QUEST) : null);
reqs.set("quest-blocks", context.getSessionData(CK.REQ_QUEST_BLOCK) != null requirements.set("quest-blocks", context.getSessionData(CK.REQ_QUEST_BLOCK) != null
? context.getSessionData(CK.REQ_QUEST_BLOCK) : null); ? context.getSessionData(CK.REQ_QUEST_BLOCK) : null);
reqs.set("mcmmo-skills", context.getSessionData(CK.REQ_MCMMO_SKILLS) != null requirements.set("mcmmo-skills", context.getSessionData(CK.REQ_MCMMO_SKILLS) != null
? context.getSessionData(CK.REQ_MCMMO_SKILLS) : null); ? context.getSessionData(CK.REQ_MCMMO_SKILLS) : null);
reqs.set("mcmmo-amounts", context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) != null requirements.set("mcmmo-amounts", context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) != null
? context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) : null); ? context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) : null);
reqs.set("heroes-primary-class", context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null requirements.set("heroes-primary-class", context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null
? context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) : null); ? context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) : null);
reqs.set("heroes-secondary-class", context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null requirements.set("heroes-secondary-class", context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null
? context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) : null); ? context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) : null);
final LinkedList<String> customReqs = context.getSessionData(CK.REQ_CUSTOM) != null final LinkedList<String> customRequirements = context.getSessionData(CK.REQ_CUSTOM) != null
? (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM) : null; ? (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM) : null;
final LinkedList<Map<String, Object>> customReqsData = context.getSessionData(CK.REQ_CUSTOM_DATA) != null final LinkedList<Map<String, Object>> customRequirementsData = context.getSessionData(CK.REQ_CUSTOM_DATA) != null
? (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA) : null; ? (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA) : null;
if (customReqs != null && customReqsData != null) { if (customRequirements != null && customRequirementsData != null) {
final ConfigurationSection customReqsSec = reqs.createSection("custom-requirements"); final ConfigurationSection customRequirementsSec = requirements.createSection("custom-requirements");
for (int i = 0; i < customReqs.size(); i++) { for (int i = 0; i < customRequirements.size(); i++) {
final ConfigurationSection customReqSec = customReqsSec.createSection("req" + (i + 1)); final ConfigurationSection customReqSec = customRequirementsSec.createSection("req" + (i + 1));
customReqSec.set("name", customReqs.get(i)); customReqSec.set("name", customRequirements.get(i));
customReqSec.set("data", customReqsData.get(i)); customReqSec.set("data", customRequirementsData.get(i));
} }
} }
reqs.set("fail-requirement-message", context.getSessionData(CK.REQ_FAIL_MESSAGE) != null requirements.set("fail-requirement-message", context.getSessionData(CK.REQ_FAIL_MESSAGE) != null
? context.getSessionData(CK.REQ_FAIL_MESSAGE) : null); ? context.getSessionData(CK.REQ_FAIL_MESSAGE) : null);
if (reqs.getKeys(false).isEmpty()) { if (requirements.getKeys(false).isEmpty()) {
section.set("requirements", null); section.set("requirements", null);
} }
} }
@ -755,23 +755,23 @@ public class QuestFactory implements ConversationAbandonedListener {
? context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) : null); ? context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) : null);
stage.set("password-phrases", context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null stage.set("password-phrases", context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null
? context.getSessionData(pref + CK.S_PASSWORD_PHRASES) : null); ? context.getSessionData(pref + CK.S_PASSWORD_PHRASES) : null);
final LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES); final LinkedList<String> customObj = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
final LinkedList<Integer> customObjCounts final LinkedList<Integer> customObjCounts
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT); = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
final LinkedList<Entry<String, Object>> customObjsData final LinkedList<Entry<String, Object>> customObjData
= (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA); = (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) { if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) {
final ConfigurationSection sec = stage.createSection("custom-objectives"); final ConfigurationSection sec = stage.createSection("custom-objectives");
if (customObjs == null || customObjCounts == null || customObjsData == null) { if (customObj == null || customObjCounts == null || customObjData == null) {
continue; continue;
} }
for (int index = 0; index < customObjs.size(); index++) { for (int index = 0; index < customObj.size(); index++) {
final ConfigurationSection sec2 = sec.createSection("custom" + (index + 1)); final ConfigurationSection sec2 = sec.createSection("custom" + (index + 1));
sec2.set("name", customObjs.get(index)); sec2.set("name", customObj.get(index));
sec2.set("count", customObjCounts.get(index)); sec2.set("count", customObjCounts.get(index));
CustomObjective found = null; CustomObjective found = null;
for (final CustomObjective co : plugin.getCustomObjectives()) { for (final CustomObjective co : plugin.getCustomObjectives()) {
if (co.getName().equals(customObjs.get(index))) { if (co.getName().equals(customObj.get(index))) {
found = co; found = co;
break; break;
} }
@ -780,9 +780,9 @@ public class QuestFactory implements ConversationAbandonedListener {
continue; continue;
} }
final ConfigurationSection sec3 = sec2.createSection("data"); final ConfigurationSection sec3 = sec2.createSection("data");
for (final Entry<String, Object> datamap : found.getData()) { for (final Entry<String, Object> dataMap : found.getData()) {
for (final Entry<String, Object> e : customObjsData) { for (final Entry<String, Object> e : customObjData) {
if (e.getKey().equals(datamap.getKey())) { if (e.getKey().equals(dataMap.getKey())) {
sec3.set(e.getKey(), e.getValue()); // if anything goes wrong it's probably here sec3.set(e.getKey(), e.getValue()); // if anything goes wrong it's probably here
} }
} }
@ -834,50 +834,50 @@ public class QuestFactory implements ConversationAbandonedListener {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void saveRewards(final ConversationContext context, final ConfigurationSection section) { private void saveRewards(final ConversationContext context, final ConfigurationSection section) {
final ConfigurationSection rews = section.createSection("rewards"); final ConfigurationSection rewards = section.createSection("rewards");
rews.set("items", context.getSessionData(CK.REW_ITEMS) != null rewards.set("items", context.getSessionData(CK.REW_ITEMS) != null
? context.getSessionData(CK.REW_ITEMS) : null); ? context.getSessionData(CK.REW_ITEMS) : null);
rews.set("money", context.getSessionData(CK.REW_MONEY) != null rewards.set("money", context.getSessionData(CK.REW_MONEY) != null
? context.getSessionData(CK.REW_MONEY) : null); ? context.getSessionData(CK.REW_MONEY) : null);
rews.set("quest-points", context.getSessionData(CK.REW_QUEST_POINTS) != null rewards.set("quest-points", context.getSessionData(CK.REW_QUEST_POINTS) != null
? context.getSessionData(CK.REW_QUEST_POINTS) : null); ? context.getSessionData(CK.REW_QUEST_POINTS) : null);
rews.set("exp", context.getSessionData(CK.REW_EXP) != null rewards.set("exp", context.getSessionData(CK.REW_EXP) != null
? context.getSessionData(CK.REW_EXP) : null); ? context.getSessionData(CK.REW_EXP) : null);
rews.set("commands", context.getSessionData(CK.REW_COMMAND) != null rewards.set("commands", context.getSessionData(CK.REW_COMMAND) != null
? context.getSessionData(CK.REW_COMMAND) : null); ? context.getSessionData(CK.REW_COMMAND) : null);
rews.set("commands-override-display", context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY) != null rewards.set("commands-override-display", context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY) != null
? context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY) : null); ? context.getSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY) : null);
rews.set("permissions", context.getSessionData(CK.REW_PERMISSION) != null rewards.set("permissions", context.getSessionData(CK.REW_PERMISSION) != null
? context.getSessionData(CK.REW_PERMISSION) : null); ? context.getSessionData(CK.REW_PERMISSION) : null);
rews.set("permission-worlds", context.getSessionData(CK.REW_PERMISSION_WORLDS) != null rewards.set("permission-worlds", context.getSessionData(CK.REW_PERMISSION_WORLDS) != null
? context.getSessionData(CK.REW_PERMISSION_WORLDS) : null); ? context.getSessionData(CK.REW_PERMISSION_WORLDS) : null);
rews.set("mcmmo-skills", context.getSessionData(CK.REW_MCMMO_SKILLS) != null rewards.set("mcmmo-skills", context.getSessionData(CK.REW_MCMMO_SKILLS) != null
? context.getSessionData(CK.REW_MCMMO_SKILLS) : null); ? context.getSessionData(CK.REW_MCMMO_SKILLS) : null);
rews.set("mcmmo-levels", context.getSessionData(CK.REW_MCMMO_AMOUNTS) != null rewards.set("mcmmo-levels", context.getSessionData(CK.REW_MCMMO_AMOUNTS) != null
? context.getSessionData(CK.REW_MCMMO_AMOUNTS) : null); ? context.getSessionData(CK.REW_MCMMO_AMOUNTS) : null);
rews.set("heroes-exp-classes", context.getSessionData(CK.REW_HEROES_CLASSES) != null rewards.set("heroes-exp-classes", context.getSessionData(CK.REW_HEROES_CLASSES) != null
? context.getSessionData(CK.REW_HEROES_CLASSES) : null); ? context.getSessionData(CK.REW_HEROES_CLASSES) : null);
rews.set("heroes-exp-amounts", context.getSessionData(CK.REW_HEROES_AMOUNTS) != null rewards.set("heroes-exp-amounts", context.getSessionData(CK.REW_HEROES_AMOUNTS) != null
? context.getSessionData(CK.REW_HEROES_AMOUNTS) : null); ? context.getSessionData(CK.REW_HEROES_AMOUNTS) : null);
rews.set("parties-experience", context.getSessionData(CK.REW_PARTIES_EXPERIENCE) != null rewards.set("parties-experience", context.getSessionData(CK.REW_PARTIES_EXPERIENCE) != null
? context.getSessionData(CK.REW_PARTIES_EXPERIENCE) : null); ? context.getSessionData(CK.REW_PARTIES_EXPERIENCE) : null);
rews.set("phat-loots", context.getSessionData(CK.REW_PHAT_LOOTS) != null rewards.set("phat-loots", context.getSessionData(CK.REW_PHAT_LOOTS) != null
? context.getSessionData(CK.REW_PHAT_LOOTS) : null); ? context.getSessionData(CK.REW_PHAT_LOOTS) : null);
final LinkedList<String> customRews = context.getSessionData(CK.REW_CUSTOM) != null final LinkedList<String> customRewards = context.getSessionData(CK.REW_CUSTOM) != null
? (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM) : null; ? (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM) : null;
final LinkedList<Map<String, Object>> customRewsData = context.getSessionData(CK.REW_CUSTOM_DATA) != null final LinkedList<Map<String, Object>> customRewardsData = context.getSessionData(CK.REW_CUSTOM_DATA) != null
? (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA) : null; ? (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA) : null;
if (customRews != null && customRewsData != null) { if (customRewards != null && customRewardsData != null) {
final ConfigurationSection customRewsSec = rews.createSection("custom-rewards"); final ConfigurationSection customRewardsSec = rewards.createSection("custom-rewards");
for (int i = 0; i < customRews.size(); i++) { for (int i = 0; i < customRewards.size(); i++) {
final ConfigurationSection customRewSec = customRewsSec.createSection("req" + (i + 1)); final ConfigurationSection customRewSec = customRewardsSec.createSection("req" + (i + 1));
customRewSec.set("name", customRews.get(i)); customRewSec.set("name", customRewards.get(i));
customRewSec.set("data", customRewsData.get(i)); customRewSec.set("data", customRewardsData.get(i));
} }
} }
rews.set("details-override", context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null rewards.set("details-override", context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null
? context.getSessionData(CK.REW_DETAILS_OVERRIDE) : null); ? context.getSessionData(CK.REW_DETAILS_OVERRIDE) : null);
if (rews.getKeys(false).isEmpty()) { if (rewards.getKeys(false).isEmpty()) {
section.set("rewards", null); section.set("rewards", null);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -12,27 +12,27 @@
package me.blackvein.quests; package me.blackvein.quests;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.inventory.ItemStack;
public class Requirements { public class Requirements {
private int money = 0; private int money = 0;
private int questPoints = 0; private int questPoints = 0;
private List<ItemStack> items = new LinkedList<ItemStack>(); private List<ItemStack> items = new LinkedList<>();
private List<Boolean> removeItems = new LinkedList<Boolean>(); private List<Boolean> removeItems = new LinkedList<>();
private List<Quest> neededQuests = new LinkedList<Quest>(); private List<Quest> neededQuests = new LinkedList<>();
private List<Quest> blockQuests = new LinkedList<Quest>(); private List<Quest> blockQuests = new LinkedList<>();
private List<String> permissions = new LinkedList<String>(); private List<String> permissions = new LinkedList<>();
private List<String> mcmmoSkills = new LinkedList<String>(); private List<String> mcmmoSkills = new LinkedList<>();
private List<Integer> mcmmoAmounts = new LinkedList<Integer>(); private List<Integer> mcmmoAmounts = new LinkedList<>();
private String heroesPrimaryClass = null; private String heroesPrimaryClass = null;
private String heroesSecondaryClass = null; private String heroesSecondaryClass = null;
private Map<String, Map<String, Object>> customRequirements = new HashMap<String, Map<String, Object>>(); private Map<String, Map<String, Object>> customRequirements = new HashMap<>();
private List<String> detailsOverride = new LinkedList<String>(); private List<String> detailsOverride = new LinkedList<>();
public int getMoney() { public int getMoney() {
return money; return money;

View File

@ -12,30 +12,30 @@
package me.blackvein.quests; package me.blackvein.quests;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.inventory.ItemStack;
public class Rewards { public class Rewards {
private int money = 0; private int money = 0;
private int questPoints = 0; private int questPoints = 0;
private int exp = 0; private int exp = 0;
private List<String> commands = new LinkedList<String>(); private List<String> commands = new LinkedList<>();
private List<String> commandsOverrideDisplay = new LinkedList<String>(); private List<String> commandsOverrideDisplay = new LinkedList<>();
private List<String> permissions = new LinkedList<String>(); private List<String> permissions = new LinkedList<>();
private List<String> permissionWorlds = new LinkedList<String>(); private List<String> permissionWorlds = new LinkedList<>();
private List<ItemStack> items = new LinkedList<ItemStack>(); private List<ItemStack> items = new LinkedList<>();
private List<String> mcmmoSkills = new LinkedList<String>(); private List<String> mcmmoSkills = new LinkedList<>();
private List<Integer> mcmmoAmounts = new LinkedList<Integer>(); private List<Integer> mcmmoAmounts = new LinkedList<>();
private List<String> heroesClasses = new LinkedList<String>(); private List<String> heroesClasses = new LinkedList<>();
private List<Double> heroesAmounts = new LinkedList<Double>(); private List<Double> heroesAmounts = new LinkedList<>();
private int partiesExperience = 0; private int partiesExperience = 0;
private List<String> phatLoots = new LinkedList<String>(); private List<String> phatLoots = new LinkedList<>();
private Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>(); private Map<String, Map<String, Object>> customRewards = new HashMap<>();
private List<String> detailsOverride = new LinkedList<String>(); private List<String> detailsOverride = new LinkedList<>();
public int getMoney() { public int getMoney() {
return money; return money;

View File

@ -17,6 +17,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
public class Settings { public class Settings {
@ -186,7 +187,7 @@ public class Settings {
genFilesOnJoin = config.getBoolean("generate-files-on-join", true); genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false); ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
killDelay = config.getInt("kill-delay", 600); killDelay = config.getInt("kill-delay", 600);
if (config.getString("language").equalsIgnoreCase("en")) { if (Objects.requireNonNull(config.getString("language")).equalsIgnoreCase("en")) {
//Legacy //Legacy
Lang.setISO("en-US"); Lang.setISO("en-US");
} else { } else {

View File

@ -28,17 +28,17 @@ import java.util.Map.Entry;
public class Stage { public class Stage {
protected LinkedList<ItemStack> blocksToBreak = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> blocksToBreak = new LinkedList<>();
protected LinkedList<ItemStack> blocksToDamage = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> blocksToDamage = new LinkedList<>();
protected LinkedList<ItemStack> blocksToPlace = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> blocksToPlace = new LinkedList<>();
protected LinkedList<ItemStack> blocksToUse = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> blocksToUse = new LinkedList<>();
protected LinkedList<ItemStack> blocksToCut = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> blocksToCut = new LinkedList<>();
protected LinkedList<ItemStack> itemsToCraft = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> itemsToCraft = new LinkedList<>();
protected LinkedList<ItemStack> itemsToSmelt = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> itemsToSmelt = new LinkedList<>();
protected LinkedList<ItemStack> itemsToEnchant = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> itemsToEnchant = new LinkedList<>();
protected LinkedList<ItemStack> itemsToBrew = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> itemsToBrew = new LinkedList<>();
protected LinkedList<ItemStack> itemsToConsume = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> itemsToConsume = new LinkedList<>();
protected LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>(); protected LinkedList<ItemStack> itemsToDeliver = new LinkedList<>();
protected LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() { protected LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
private static final long serialVersionUID = -2774443496142382127L; private static final long serialVersionUID = -2774443496142382127L;
@ -59,7 +59,7 @@ public class Stage {
return true; return true;
} }
}; };
protected LinkedList<String> deliverMessages = new LinkedList<String>(); protected LinkedList<String> deliverMessages = new LinkedList<>();
protected LinkedList<Integer> citizensToInteract = new LinkedList<Integer>() { protected LinkedList<Integer> citizensToInteract = new LinkedList<Integer>() {
private static final long serialVersionUID = -4086855121042524435L; private static final long serialVersionUID = -4086855121042524435L;
@ -100,43 +100,43 @@ public class Stage {
return true; return true;
} }
}; };
protected LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>(); protected LinkedList<Integer> citizenNumToKill = new LinkedList<>();
protected LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>(); protected LinkedList<EntityType> mobsToKill = new LinkedList<>();
protected LinkedList<Integer> mobNumToKill = new LinkedList<Integer>(); protected LinkedList<Integer> mobNumToKill = new LinkedList<>();
protected LinkedList<Location> locationsToKillWithin = new LinkedList<Location>(); protected LinkedList<Location> locationsToKillWithin = new LinkedList<>();
protected LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>(); protected LinkedList<Integer> radiiToKillWithin = new LinkedList<>();
protected LinkedList<String> killNames = new LinkedList<String>(); protected LinkedList<String> killNames = new LinkedList<>();
protected LinkedList<EntityType> mobsToTame = new LinkedList<EntityType>(); protected LinkedList<EntityType> mobsToTame = new LinkedList<>();
protected LinkedList<Integer> mobNumToTame = new LinkedList<Integer>(); protected LinkedList<Integer> mobNumToTame = new LinkedList<>();
protected Integer fishToCatch; protected Integer fishToCatch;
protected Integer cowsToMilk; protected Integer cowsToMilk;
protected LinkedList<DyeColor> sheepToShear = new LinkedList<DyeColor>(); protected LinkedList<DyeColor> sheepToShear = new LinkedList<>();
protected LinkedList<Integer> sheepNumToShear = new LinkedList<Integer>(); protected LinkedList<Integer> sheepNumToShear = new LinkedList<>();
protected Integer playersToKill; protected Integer playersToKill;
protected LinkedList<Location> locationsToReach = new LinkedList<Location>(); protected LinkedList<Location> locationsToReach = new LinkedList<>();
protected LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>(); protected LinkedList<Integer> radiiToReachWithin = new LinkedList<>();
protected LinkedList<World> worldsToReachWithin = new LinkedList<World>(); protected LinkedList<World> worldsToReachWithin = new LinkedList<>();
protected LinkedList<String> locationNames = new LinkedList<String>(); protected LinkedList<String> locationNames = new LinkedList<>();
protected LinkedList<String> passwordDisplays = new LinkedList<String>(); protected LinkedList<String> passwordDisplays = new LinkedList<>();
protected LinkedList<String> passwordPhrases = new LinkedList<String>(); protected LinkedList<String> passwordPhrases = new LinkedList<>();
protected String script; protected String script;
protected Action startAction = null; protected Action startAction = null;
protected Action finishAction = null; protected Action finishAction = null;
protected Action failAction = null; protected Action failAction = null;
protected Action deathAction = null; protected Action deathAction = null;
protected Map<String, Action> chatActions = new HashMap<String, Action>(); protected Map<String, Action> chatActions = new HashMap<>();
protected Map<String, Action> commandActions = new HashMap<String, Action>(); protected Map<String, Action> commandActions = new HashMap<>();
protected Action disconnectAction = null; protected Action disconnectAction = null;
protected Condition condition = null; protected Condition condition = null;
protected long delay = -1; protected long delay = -1;
protected String delayMessage = null; protected String delayMessage = null;
protected String completeMessage = null; protected String completeMessage = null;
protected String startMessage = null; protected String startMessage = null;
protected LinkedList<String> objectiveOverrides = new LinkedList<String>(); protected LinkedList<String> objectiveOverrides = new LinkedList<>();
protected LinkedList<CustomObjective> customObjectives = new LinkedList<CustomObjective>(); protected LinkedList<CustomObjective> customObjectives = new LinkedList<>();
protected LinkedList<Integer> customObjectiveCounts = new LinkedList<Integer>(); protected LinkedList<Integer> customObjectiveCounts = new LinkedList<>();
protected LinkedList<String> customObjectiveDisplays = new LinkedList<String>(); protected LinkedList<String> customObjectiveDisplays = new LinkedList<>();
protected LinkedList<Entry<String, Object>> customObjectiveData = new LinkedList<Entry<String, Object>>(); protected LinkedList<Entry<String, Object>> customObjectiveData = new LinkedList<>();
public LinkedList<ItemStack> getBlocksToBreak() { public LinkedList<ItemStack> getBlocksToBreak() {
return blocksToBreak; return blocksToBreak;
@ -566,8 +566,7 @@ public class Stage {
if (!mobsToTame.isEmpty()) { return true; } if (!mobsToTame.isEmpty()) { return true; }
if (!sheepToShear.isEmpty()) { return true; } if (!sheepToShear.isEmpty()) { return true; }
if (!passwordDisplays.isEmpty()) { return true; } if (!passwordDisplays.isEmpty()) { return true; }
if (!customObjectives.isEmpty()) { return true; } return !customObjectives.isEmpty();
return false;
} }
/** /**

View File

@ -23,7 +23,7 @@ import java.util.Map;
public class ParticleProvider_v1_8_R1 extends ParticleProvider { public class ParticleProvider_v1_8_R1 extends ParticleProvider {
private static Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>(); private static final Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>();
static { static {
PARTICLES.put(PreBuiltParticle.ENCHANT, EnumParticle.ENCHANTMENT_TABLE); PARTICLES.put(PreBuiltParticle.ENCHANT, EnumParticle.ENCHANTMENT_TABLE);

View File

@ -12,19 +12,18 @@
package me.blackvein.quests.particle; package me.blackvein.quests.particle;
import java.util.HashMap; import net.minecraft.server.v1_8_R2.EnumParticle;
import java.util.Map; import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R2.EnumParticle; import java.util.HashMap;
import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles; import java.util.Map;
public class ParticleProvider_v1_8_R2 extends ParticleProvider { public class ParticleProvider_v1_8_R2 extends ParticleProvider {
private static Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>(); private static final Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>();
static { static {
PARTICLES.put(PreBuiltParticle.ENCHANT, EnumParticle.ENCHANTMENT_TABLE); PARTICLES.put(PreBuiltParticle.ENCHANT, EnumParticle.ENCHANTMENT_TABLE);

View File

@ -12,19 +12,18 @@
package me.blackvein.quests.particle; package me.blackvein.quests.particle;
import java.util.HashMap; import net.minecraft.server.v1_8_R3.EnumParticle;
import java.util.Map; import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R3.EnumParticle; import java.util.HashMap;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles; import java.util.Map;
public class ParticleProvider_v1_8_R3 extends ParticleProvider { public class ParticleProvider_v1_8_R3 extends ParticleProvider {
private static Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>(); private static final Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>();
static { static {
PARTICLES.put(PreBuiltParticle.ENCHANT, EnumParticle.ENCHANTMENT_TABLE); PARTICLES.put(PreBuiltParticle.ENCHANT, EnumParticle.ENCHANTMENT_TABLE);