mirror of https://github.com/PikaMug/Quests.git
Use final liberally
This commit is contained in:
parent
d878d35d37
commit
af65380362
|
@ -25,12 +25,12 @@ import org.bukkit.inventory.ItemStack;
|
|||
|
||||
public abstract class CustomObjective implements Listener {
|
||||
|
||||
private Quests plugin = Quests.getPlugin(Quests.class);
|
||||
private final Quests plugin = Quests.getPlugin(Quests.class);
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
private String display = "Progress: %count%";
|
||||
private LinkedList<Entry<String, Object>> data = new LinkedList<Entry<String, Object>>();
|
||||
private Map<String, String> descriptions = new HashMap<String, String>();
|
||||
private final LinkedList<Entry<String, Object>> data = new LinkedList<Entry<String, Object>>();
|
||||
private final Map<String, String> descriptions = new HashMap<String, String>();
|
||||
private String countPrompt = "Enter number";
|
||||
private boolean showCount = true;
|
||||
private int count = 1;
|
||||
|
@ -39,7 +39,7 @@ public abstract class CustomObjective implements Listener {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public abstract class CustomObjective implements Listener {
|
|||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
public void setAuthor(final String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public abstract class CustomObjective implements Listener {
|
|||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
public void setDisplay(final String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ public abstract class CustomObjective implements Listener {
|
|||
* @param description Description of expected input
|
||||
* @param defaultValue Value to be used if input is not received
|
||||
*/
|
||||
public void addStringPrompt(String title, String description, Object defaultValue) {
|
||||
Entry<String, Object> prompt = new AbstractMap.SimpleEntry<String, Object>(title, defaultValue);
|
||||
public void addStringPrompt(final String title, final String description, final Object defaultValue) {
|
||||
final Entry<String, Object> prompt = new AbstractMap.SimpleEntry<String, Object>(title, defaultValue);
|
||||
data.add(prompt);
|
||||
descriptions.put(title, description);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public abstract class CustomObjective implements Listener {
|
|||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
public void setCount(final int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public abstract class CustomObjective implements Listener {
|
|||
return countPrompt;
|
||||
}
|
||||
|
||||
public void setCountPrompt(String countPrompt) {
|
||||
public void setCountPrompt(final String countPrompt) {
|
||||
this.countPrompt = countPrompt;
|
||||
}
|
||||
|
||||
|
@ -110,28 +110,28 @@ public abstract class CustomObjective implements Listener {
|
|||
*
|
||||
* @param showCount
|
||||
*/
|
||||
public void setShowCount(boolean showCount) {
|
||||
public void setShowCount(final boolean showCount) {
|
||||
this.showCount = showCount;
|
||||
}
|
||||
|
||||
public Map<String, Object> getDataForPlayer(Player player, CustomObjective customObj, Quest quest) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
public Map<String, Object> getDataForPlayer(final Player player, final CustomObjective customObj, final Quest quest) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester != null) {
|
||||
Stage currentStage = quester.getCurrentStage(quest);
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
return null;
|
||||
}
|
||||
CustomObjective found = null;
|
||||
for (me.blackvein.quests.CustomObjective co : currentStage.customObjectives) {
|
||||
for (final me.blackvein.quests.CustomObjective co : currentStage.customObjectives) {
|
||||
if (co.getName().equals(customObj.getName())) {
|
||||
found = co;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found != null) {
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
for (Entry<String, Object> datamap : found.getData()) {
|
||||
for (Entry<String, Object> e : currentStage.customObjectiveData) {
|
||||
final Map<String, Object> m = new HashMap<String, Object>();
|
||||
for (final Entry<String, Object> datamap : found.getData()) {
|
||||
for (final Entry<String, Object> e : currentStage.customObjectiveData) {
|
||||
if (e.getKey().equals(datamap.getKey())) {
|
||||
m.put(e.getKey(), e.getValue());
|
||||
}
|
||||
|
@ -145,12 +145,12 @@ public abstract class CustomObjective implements Listener {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void incrementObjective(Player player, CustomObjective obj, int count, Quest quest) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
public void incrementObjective(final Player player, final CustomObjective obj, final int count, final Quest quest) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester != null) {
|
||||
// Check if the player has Quest with objective
|
||||
boolean hasQuest = false;
|
||||
for (CustomObjective co : quester.getCurrentStage(quest).customObjectives) {
|
||||
for (final CustomObjective co : quester.getCurrentStage(quest).customObjectives) {
|
||||
if (co.getName().equals(obj.getName())) {
|
||||
hasQuest = true;
|
||||
break;
|
||||
|
@ -158,7 +158,7 @@ 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());
|
||||
final int old = quester.getQuestData(quest).customObjectiveCounts.get(obj.getName());
|
||||
plugin.getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts
|
||||
.put(obj.getName(), old + count);
|
||||
} else {
|
||||
|
@ -173,13 +173,13 @@ public abstract class CustomObjective implements Listener {
|
|||
}
|
||||
}
|
||||
if (index > -1) {
|
||||
int goal = quester.getCurrentStage(quest).customObjectiveCounts.get(index);
|
||||
final 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);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerObjectives(quest, quester.getCurrentStage(quest), (Quester q) -> {
|
||||
quester.dispatchMultiplayerObjectives(quest, quester.getCurrentStage(quest), (final 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),
|
||||
|
|
|
@ -22,8 +22,8 @@ public abstract class CustomRequirement {
|
|||
private String name = null;
|
||||
private String author = null;
|
||||
private String display = null;
|
||||
private Map<String, Object> data = new HashMap<String, Object>();
|
||||
private Map<String, String> descriptions = new HashMap<String, String>();
|
||||
private final Map<String, Object> data = new HashMap<String, Object>();
|
||||
private final Map<String, String> descriptions = new HashMap<String, String>();
|
||||
|
||||
public abstract boolean testRequirement(Player p, Map<String, Object> m);
|
||||
|
||||
|
@ -31,7 +31,7 @@ public abstract class CustomRequirement {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public abstract class CustomRequirement {
|
|||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
public void setAuthor(final String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ public abstract class CustomRequirement {
|
|||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
display = name;
|
||||
public void setDisplay(final String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Map<String, Object> getData() {
|
||||
|
@ -64,7 +64,7 @@ public abstract class CustomRequirement {
|
|||
* @param description Description of expected input
|
||||
* @param defaultValue Value to be used if input is not received
|
||||
*/
|
||||
public void addStringPrompt(String title, String description, Object defaultValue) {
|
||||
public void addStringPrompt(final String title, final String description, final Object defaultValue) {
|
||||
data.put(title, defaultValue);
|
||||
descriptions.put(title, description);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public abstract class CustomReward {
|
|||
private String name = null;
|
||||
private String author = null;
|
||||
private String display = null;
|
||||
private Map<String, Object> data = new HashMap<String, Object>();
|
||||
private Map<String, String> descriptions = new HashMap<String, String>();
|
||||
private final Map<String, Object> data = new HashMap<String, Object>();
|
||||
private final Map<String, String> descriptions = new HashMap<String, String>();
|
||||
|
||||
public abstract void giveReward(Player p, Map<String, Object> m);
|
||||
|
||||
|
@ -31,7 +31,7 @@ public abstract class CustomReward {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public abstract class CustomReward {
|
|||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
public void setAuthor(final String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,14 @@ public abstract class CustomReward {
|
|||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
public void setDisplay(final String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getDisplay()}
|
||||
*/
|
||||
@Deprecated
|
||||
public String getRewardName() {
|
||||
return display;
|
||||
}
|
||||
|
@ -61,7 +62,8 @@ public abstract class CustomReward {
|
|||
/**
|
||||
* @deprecated Use {@link #setDisplay(String)}
|
||||
*/
|
||||
public void setRewardName(String name) {
|
||||
@Deprecated
|
||||
public void setRewardName(final String name) {
|
||||
display = name;
|
||||
}
|
||||
|
||||
|
@ -78,7 +80,7 @@ public abstract class CustomReward {
|
|||
* @param description Description of expected input
|
||||
* @param defaultValue Value to be used if input is not received
|
||||
*/
|
||||
public void addStringPrompt(String title, String description, Object defaultValue) {
|
||||
public void addStringPrompt(final String title, final String description, final Object defaultValue) {
|
||||
data.put(title, defaultValue);
|
||||
descriptions.put(title, description);
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
package me.blackvein.quests;
|
||||
|
||||
public class DenizenTrigger {
|
||||
private Quests plugin;
|
||||
private final Quests plugin;
|
||||
|
||||
public DenizenTrigger(Quests plugin) {
|
||||
public DenizenTrigger(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public boolean runDenizenScript(String scriptName, Quester quester) {
|
||||
public boolean runDenizenScript(final String scriptName, final Quester quester) {
|
||||
if (scriptName == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -18,16 +18,6 @@ import org.bukkit.Location;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
||||
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import net.citizensnpcs.api.CitizensPlugin;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import ro.nicuch.citizensbooks.CitizensBooksAPI;
|
||||
import ro.nicuch.citizensbooks.CitizensBooksPlugin;
|
||||
|
||||
import com.alessiodp.parties.api.Parties;
|
||||
import com.alessiodp.parties.api.interfaces.PartiesAPI;
|
||||
import com.codisimus.plugins.phatloots.PhatLoots;
|
||||
|
@ -39,6 +29,15 @@ import com.herocraftonline.heroes.Heroes;
|
|||
import com.herocraftonline.heroes.characters.Hero;
|
||||
|
||||
import de.erethon.dungeonsxl.DungeonsXL;
|
||||
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
||||
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import net.citizensnpcs.api.CitizensPlugin;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import ro.nicuch.citizensbooks.CitizensBooksAPI;
|
||||
import ro.nicuch.citizensbooks.CitizensBooksPlugin;
|
||||
|
||||
public class Dependencies {
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class Dependencies {
|
|||
private static DungeonsXL dungeons = null;
|
||||
private static PartiesAPI parties = null;
|
||||
|
||||
public Dependencies(Quests plugin) {
|
||||
public Dependencies(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -90,7 +89,7 @@ public class Dependencies {
|
|||
try {
|
||||
Class.forName("com.gmail.nossr50.datatypes.skills.SkillType");
|
||||
mcmmo = (mcMMO) plugin.getServer().getPluginManager().getPlugin("mcMMO");
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// Unsupported version
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +109,7 @@ public class Dependencies {
|
|||
phatLoots = (PhatLoots) plugin.getServer().getPluginManager().getPlugin("PhatLoots");
|
||||
plugin.getLogger().info("Sucessfully linked Quests with PhatLoots "
|
||||
+ phatLoots.getDescription().getVersion());
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (final NoClassDefFoundError e) {
|
||||
plugin.getLogger().warning("Unofficial version of PhatLoots found. PhatLoots in Quests not enabled.");
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +129,7 @@ public class Dependencies {
|
|||
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
|
||||
plugin.getLogger().info("Sucessfully linked Quests with Citizens "
|
||||
+ citizens.getDescription().getVersion());
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled.");
|
||||
}
|
||||
}
|
||||
|
@ -168,14 +167,14 @@ public class Dependencies {
|
|||
try {
|
||||
Class.forName("com.alessiodp.parties.api.Parties");
|
||||
parties = Parties.getApi();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// Unsupported version
|
||||
}
|
||||
}
|
||||
return parties;
|
||||
}
|
||||
|
||||
public boolean isPluginAvailable(String pluginName) {
|
||||
public boolean isPluginAvailable(final String pluginName) {
|
||||
if (plugin.getServer().getPluginManager().getPlugin(pluginName) != null ) {
|
||||
if (!plugin.getServer().getPluginManager().getPlugin(pluginName).isEnabled()) {
|
||||
plugin.getLogger().warning(pluginName
|
||||
|
@ -204,19 +203,19 @@ public class Dependencies {
|
|||
|
||||
private boolean setupEconomy() {
|
||||
try {
|
||||
RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager()
|
||||
final RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager()
|
||||
.getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null) {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
return (economy != null);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean setupPermissions() {
|
||||
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager()
|
||||
final RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager()
|
||||
.getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||
if (permissionProvider != null) {
|
||||
permission = permissionProvider.getProvider();
|
||||
|
@ -224,7 +223,7 @@ public class Dependencies {
|
|||
return (permission != null);
|
||||
}
|
||||
|
||||
public String getCurrency(boolean plural) {
|
||||
public String getCurrency(final boolean plural) {
|
||||
if (getVaultEconomy() == null) {
|
||||
return Lang.get("money");
|
||||
}
|
||||
|
@ -243,42 +242,42 @@ public class Dependencies {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean runDenizenScript(String scriptName, Quester quester) {
|
||||
public boolean runDenizenScript(final String scriptName, final Quester quester) {
|
||||
return plugin.getDenizenTrigger().runDenizenScript(scriptName, quester);
|
||||
}
|
||||
|
||||
public Location getNPCLocation(int id) {
|
||||
public Location getNPCLocation(final int id) {
|
||||
return citizens.getNPCRegistry().getById(id).getStoredLocation();
|
||||
}
|
||||
|
||||
public String getNPCName(int id) {
|
||||
public String getNPCName(final int id) {
|
||||
return citizens.getNPCRegistry().getById(id).getName();
|
||||
}
|
||||
|
||||
public int getMcmmoSkillLevel(SkillType st, String player) {
|
||||
McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
||||
public int getMcmmoSkillLevel(final SkillType st, final String player) {
|
||||
final McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
||||
if (mPlayer == null) {
|
||||
return -1;
|
||||
}
|
||||
return mPlayer.getProfile().getSkillLevel(st);
|
||||
}
|
||||
|
||||
public Hero getHero(UUID uuid) {
|
||||
Player p = plugin.getServer().getPlayer(uuid);
|
||||
public Hero getHero(final UUID uuid) {
|
||||
final Player p = plugin.getServer().getPlayer(uuid);
|
||||
if (p == null) {
|
||||
return null;
|
||||
}
|
||||
return heroes.getCharacterManager().getHero(p);
|
||||
}
|
||||
|
||||
public boolean testPrimaryHeroesClass(String primaryClass, UUID uuid) {
|
||||
Hero hero = getHero(uuid);
|
||||
public boolean testPrimaryHeroesClass(final String primaryClass, final UUID uuid) {
|
||||
final Hero hero = getHero(uuid);
|
||||
return hero.getHeroClass().getName().equalsIgnoreCase(primaryClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean testSecondaryHeroesClass(String secondaryClass, UUID uuid) {
|
||||
Hero hero = getHero(uuid);
|
||||
public boolean testSecondaryHeroesClass(final String secondaryClass, final UUID uuid) {
|
||||
final Hero hero = getHero(uuid);
|
||||
return hero.getSecondClass().getName().equalsIgnoreCase(secondaryClass);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class Options {
|
|||
return allowCommands;
|
||||
}
|
||||
|
||||
public void setAllowCommands(boolean allowCommands) {
|
||||
public void setAllowCommands(final boolean allowCommands) {
|
||||
this.allowCommands = allowCommands;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class Options {
|
|||
return allowQuitting;
|
||||
}
|
||||
|
||||
public void setAllowQuitting(boolean allowQuitting) {
|
||||
public void setAllowQuitting(final boolean allowQuitting) {
|
||||
this.allowQuitting = allowQuitting;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class Options {
|
|||
return useDungeonsXLPlugin;
|
||||
}
|
||||
|
||||
public void setUseDungeonsXLPlugin(boolean useDungeonsXLPlugin) {
|
||||
public void setUseDungeonsXLPlugin(final boolean useDungeonsXLPlugin) {
|
||||
this.useDungeonsXLPlugin = useDungeonsXLPlugin;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class Options {
|
|||
return usePartiesPlugin;
|
||||
}
|
||||
|
||||
public void setUsePartiesPlugin(boolean usePartiesPlugin) {
|
||||
public void setUsePartiesPlugin(final boolean usePartiesPlugin) {
|
||||
this.usePartiesPlugin = usePartiesPlugin;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class Options {
|
|||
return shareProgressLevel;
|
||||
}
|
||||
|
||||
public void setShareProgressLevel(int shareProgressLevel) {
|
||||
public void setShareProgressLevel(final int shareProgressLevel) {
|
||||
this.shareProgressLevel = shareProgressLevel;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class Options {
|
|||
return requireSameQuest;
|
||||
}
|
||||
|
||||
public void setRequireSameQuest(boolean requireSameQuest) {
|
||||
public void setRequireSameQuest(final boolean requireSameQuest) {
|
||||
this.requireSameQuest = requireSameQuest;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,18 +29,18 @@ public class Planner {
|
|||
if (start == null) {
|
||||
return -1;
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String[] s = start.split(":");
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
final String[] s = start.split(":");
|
||||
cal.set(Integer.valueOf(s[2]), Integer.valueOf(s[1]), Integer.valueOf(s[0]),
|
||||
Integer.valueOf(s[3]), Integer.valueOf(s[4]), Integer.valueOf(s[5]));
|
||||
TimeZone tz = TimeZone.getTimeZone(s[6]);
|
||||
final TimeZone tz = TimeZone.getTimeZone(s[6]);
|
||||
cal.setTimeZone(tz);
|
||||
return cal.getTimeInMillis();
|
||||
}
|
||||
public boolean hasStart() {
|
||||
return start != null;
|
||||
}
|
||||
public void setStart(String start) {
|
||||
public void setStart(final String start) {
|
||||
this.start = start;
|
||||
}
|
||||
public String getEnd() {
|
||||
|
@ -50,18 +50,18 @@ public class Planner {
|
|||
if (end == null) {
|
||||
return -1;
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String[] s = end.split(":");
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
final String[] s = end.split(":");
|
||||
cal.set(Integer.valueOf(s[2]), Integer.valueOf(s[1]), Integer.valueOf(s[0]),
|
||||
Integer.valueOf(s[3]), Integer.valueOf(s[4]), Integer.valueOf(s[5]));
|
||||
TimeZone tz = TimeZone.getTimeZone(s[6]);
|
||||
final TimeZone tz = TimeZone.getTimeZone(s[6]);
|
||||
cal.setTimeZone(tz);
|
||||
return cal.getTimeInMillis();
|
||||
}
|
||||
public boolean hasEnd() {
|
||||
return end != null;
|
||||
}
|
||||
public void setEnd(String end) {
|
||||
public void setEnd(final String end) {
|
||||
this.end = end;
|
||||
}
|
||||
public long getRepeat() {
|
||||
|
@ -70,7 +70,7 @@ public class Planner {
|
|||
public boolean hasRepeat() {
|
||||
return repeat != -1;
|
||||
}
|
||||
public void setRepeat(long repeat) {
|
||||
public void setRepeat(final long repeat) {
|
||||
this.repeat = repeat;
|
||||
}
|
||||
public long getCooldown() {
|
||||
|
@ -79,13 +79,13 @@ public class Planner {
|
|||
public boolean hasCooldown() {
|
||||
return cooldown != -1;
|
||||
}
|
||||
public void setCooldown(long cooldown) {
|
||||
public void setCooldown(final long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
public boolean getOverride() {
|
||||
return override;
|
||||
}
|
||||
public void setOverride(boolean override) {
|
||||
public void setOverride(final boolean override) {
|
||||
this.override = override;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,15 +56,15 @@ public class Quest {
|
|||
protected String description;
|
||||
protected String finished;
|
||||
protected ItemStack guiDisplay = null;
|
||||
private LinkedList<Stage> orderedStages = new LinkedList<Stage>();
|
||||
private final LinkedList<Stage> orderedStages = new LinkedList<Stage>();
|
||||
protected NPC npcStart;
|
||||
protected Location blockStart;
|
||||
protected String regionStart = null;
|
||||
protected Action initialAction;
|
||||
private Requirements reqs = new Requirements();
|
||||
private Planner pln = new Planner();
|
||||
private Rewards rews = new Rewards();
|
||||
private Options opts = new Options();
|
||||
private final Requirements reqs = new Requirements();
|
||||
private final Planner pln = new Planner();
|
||||
private final Rewards rews = new Rewards();
|
||||
private final Options opts = new Options();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -74,7 +74,7 @@ public class Quest {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class Quest {
|
|||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
public void setDescription(final String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class Quest {
|
|||
return finished;
|
||||
}
|
||||
|
||||
public void setFinished(String finished) {
|
||||
public void setFinished(final String finished) {
|
||||
this.finished = finished;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class Quest {
|
|||
return regionStart;
|
||||
}
|
||||
|
||||
public void setRegionStart(String regionStart) {
|
||||
public void setRegionStart(final String regionStart) {
|
||||
this.regionStart = regionStart;
|
||||
}
|
||||
|
||||
|
@ -106,14 +106,14 @@ public class Quest {
|
|||
return guiDisplay;
|
||||
}
|
||||
|
||||
public void setGUIDisplay(ItemStack guiDisplay) {
|
||||
public void setGUIDisplay(final ItemStack guiDisplay) {
|
||||
this.guiDisplay = guiDisplay;
|
||||
}
|
||||
|
||||
public Stage getStage(int index) {
|
||||
public Stage getStage(final int index) {
|
||||
try {
|
||||
return orderedStages.get(index);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class Quest {
|
|||
return npcStart;
|
||||
}
|
||||
|
||||
public void setNpcStart(NPC npcStart) {
|
||||
public void setNpcStart(final NPC npcStart) {
|
||||
this.npcStart = npcStart;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class Quest {
|
|||
return blockStart;
|
||||
}
|
||||
|
||||
public void setBlockStart(Location blockStart) {
|
||||
public void setBlockStart(final Location blockStart) {
|
||||
this.blockStart = blockStart;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class Quest {
|
|||
return initialAction;
|
||||
}
|
||||
|
||||
public void setInitialAction(Action initialAction) {
|
||||
public void setInitialAction(final Action initialAction) {
|
||||
this.initialAction = initialAction;
|
||||
}
|
||||
|
||||
|
@ -168,13 +168,13 @@ public class Quest {
|
|||
* @param quester Player to force
|
||||
* @param allowSharedProgress Whether to distribute progress to fellow questers
|
||||
*/
|
||||
public void nextStage(Quester quester, boolean allowSharedProgress) {
|
||||
Stage currentStage = quester.getCurrentStage(this);
|
||||
public void nextStage(final Quester quester, final boolean allowSharedProgress) {
|
||||
final Stage currentStage = quester.getCurrentStage(this);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("Current stage was null for quester " + quester.getPlayer().getUniqueId());
|
||||
return;
|
||||
}
|
||||
String stageCompleteMessage = currentStage.completeMessage;
|
||||
final String stageCompleteMessage = currentStage.completeMessage;
|
||||
if (stageCompleteMessage != null) {
|
||||
if (quester.getOfflinePlayer().isOnline()) {
|
||||
quester.getPlayer().sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(stageCompleteMessage,
|
||||
|
@ -204,8 +204,8 @@ public class Quest {
|
|||
|
||||
// Multiplayer
|
||||
if (opts.getShareProgressLevel() == 3) {
|
||||
List<Quester> mq = quester.getMultiplayerQuesters(this);
|
||||
for (Quester qq : mq) {
|
||||
final List<Quester> mq = quester.getMultiplayerQuesters(this);
|
||||
for (final Quester qq : mq) {
|
||||
if (currentStage.equals(qq.getCurrentStage(this))) {
|
||||
nextStage(qq, allowSharedProgress);
|
||||
}
|
||||
|
@ -224,17 +224,17 @@ public class Quest {
|
|||
* @param stage Stage number to specify
|
||||
* @throws IndexOutOfBoundsException if stage does not exist
|
||||
*/
|
||||
public void setStage(Quester quester, int stage) throws IndexOutOfBoundsException {
|
||||
OfflinePlayer player = quester.getOfflinePlayer();
|
||||
public void setStage(final Quester quester, final int stage) throws IndexOutOfBoundsException {
|
||||
final OfflinePlayer player = quester.getOfflinePlayer();
|
||||
if (orderedStages.size() - 1 < stage) {
|
||||
String msg = "Tried to set invalid stage number of " + stage + " for quest " + getName() + " on "
|
||||
final String msg = "Tried to set invalid stage number of " + stage + " for quest " + getName() + " on "
|
||||
+ player.getName();
|
||||
throw new IndexOutOfBoundsException(msg);
|
||||
}
|
||||
Stage currentStage = quester.getCurrentStage(this);
|
||||
Stage nextStage = getStage(stage);
|
||||
final Stage currentStage = quester.getCurrentStage(this);
|
||||
final Stage nextStage = getStage(stage);
|
||||
if (player.isOnline()) {
|
||||
QuesterPreChangeStageEvent preEvent = new QuesterPreChangeStageEvent(quester, this, currentStage, nextStage);
|
||||
final QuesterPreChangeStageEvent preEvent = new QuesterPreChangeStageEvent(quester, this, currentStage, nextStage);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
|
@ -251,19 +251,19 @@ public class Quest {
|
|||
}
|
||||
updateCompass(quester, nextStage);
|
||||
if (player.isOnline()) {
|
||||
Player p = quester.getPlayer();
|
||||
final Player p = quester.getPlayer();
|
||||
String msg = Lang.get(p, "questObjectivesTitle");
|
||||
msg = msg.replace("<quest>", name);
|
||||
p.sendMessage(ChatColor.GOLD + msg);
|
||||
plugin.showObjectives(this, quester, false);
|
||||
String stageStartMessage = quester.getCurrentStage(this).startMessage;
|
||||
final String stageStartMessage = quester.getCurrentStage(this).startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
p.sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(stageStartMessage, this, p));
|
||||
}
|
||||
}
|
||||
quester.updateJournal();
|
||||
if (player.isOnline()) {
|
||||
QuesterPostChangeStageEvent postEvent = new QuesterPostChangeStageEvent(quester, this, currentStage, nextStage);
|
||||
final QuesterPostChangeStageEvent postEvent = new QuesterPostChangeStageEvent(quester, this, currentStage, nextStage);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public class Quest {
|
|||
* @param stage The stage to process for targets
|
||||
* @return true if successful
|
||||
*/
|
||||
public boolean updateCompass(Quester quester, Stage stage) {
|
||||
public boolean updateCompass(final Quester quester, final Stage stage) {
|
||||
if (quester == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public class Quest {
|
|||
} else if (stage.locationsToReach != null && stage.locationsToReach.size() > 0) {
|
||||
targetLocation = stage.locationsToReach.getFirst();
|
||||
} else if (stage.itemDeliveryTargets != null && stage.itemDeliveryTargets.size() > 0) {
|
||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(stage.itemDeliveryTargets
|
||||
final NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(stage.itemDeliveryTargets
|
||||
.getFirst());
|
||||
targetLocation = npc.getStoredLocation();
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class Quest {
|
|||
* @param quester The quester to check
|
||||
* @return true if all Requirements have been met
|
||||
*/
|
||||
public boolean testRequirements(Quester quester) {
|
||||
public boolean testRequirements(final Quester quester) {
|
||||
return testRequirements(quester.getOfflinePlayer());
|
||||
}
|
||||
|
||||
|
@ -330,8 +330,8 @@ public class Quest {
|
|||
* @param player The player to check
|
||||
* @return true if all Requirements have been met
|
||||
*/
|
||||
protected boolean testRequirements(OfflinePlayer player) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
protected boolean testRequirements(final OfflinePlayer player) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (reqs.getMoney() != 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
||||
if (plugin.getDependencies().getVaultEconomy().getBalance(player) < reqs.getMoney()) {
|
||||
return false;
|
||||
|
@ -343,14 +343,14 @@ public class Quest {
|
|||
if (quester.completedQuests.containsAll(reqs.getNeededQuests()) == false) {
|
||||
return false;
|
||||
}
|
||||
for (String q : reqs.getBlockQuests()) {
|
||||
Quest questObject = new Quest();
|
||||
for (final String q : reqs.getBlockQuests()) {
|
||||
final Quest questObject = new Quest();
|
||||
questObject.name = q;
|
||||
if (quester.completedQuests.contains(q) || quester.currentQuests.containsKey(questObject)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (String s : reqs.getMcmmoSkills()) {
|
||||
for (final String s : reqs.getMcmmoSkills()) {
|
||||
final SkillType st = Quests.getMcMMOSkill(s);
|
||||
final int lvl = reqs.getMcmmoAmounts().get(reqs.getMcmmoSkills().indexOf(s));
|
||||
if (UserManager.getOfflinePlayer(player).getProfile().getSkillLevel(st) < lvl) {
|
||||
|
@ -370,11 +370,11 @@ public class Quest {
|
|||
}
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
PlayerInventory inventory = p.getInventory();
|
||||
final Player p = (Player)player;
|
||||
final PlayerInventory inventory = p.getInventory();
|
||||
int num = 0;
|
||||
for (ItemStack is : reqs.getItems()) {
|
||||
for (ItemStack stack : inventory.getContents()) {
|
||||
for (final ItemStack is : reqs.getItems()) {
|
||||
for (final ItemStack stack : inventory.getContents()) {
|
||||
if (stack != null) {
|
||||
if (ItemUtil.compareItems(is, stack, true) == 0) {
|
||||
num += stack.getAmount();
|
||||
|
@ -386,14 +386,14 @@ public class Quest {
|
|||
}
|
||||
num = 0;
|
||||
}
|
||||
for (String s : reqs.getPermissions()) {
|
||||
for (final String s : reqs.getPermissions()) {
|
||||
if (p.hasPermission(s) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (String s : reqs.getCustomRequirements().keySet()) {
|
||||
for (final String s : reqs.getCustomRequirements().keySet()) {
|
||||
CustomRequirement found = null;
|
||||
for (CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||
for (final CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||
if (cr.getName().equalsIgnoreCase(s)) {
|
||||
found = cr;
|
||||
break;
|
||||
|
@ -418,10 +418,10 @@ public class Quest {
|
|||
* @param q The quester finishing this quest
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void completeQuest(Quester q) {
|
||||
OfflinePlayer player = q.getOfflinePlayer();
|
||||
public void completeQuest(final Quester q) {
|
||||
final OfflinePlayer player = q.getOfflinePlayer();
|
||||
if (player.isOnline()) {
|
||||
QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this);
|
||||
final QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
|
@ -431,14 +431,14 @@ public class Quest {
|
|||
if (!q.completedQuests.contains(name)) {
|
||||
q.completedQuests.add(name);
|
||||
}
|
||||
for (Map.Entry<Integer, Quest> entry : q.timers.entrySet()) {
|
||||
for (final Map.Entry<Integer, Quest> entry : q.timers.entrySet()) {
|
||||
if (entry.getValue().getName().equals(getName())) {
|
||||
plugin.getServer().getScheduler().cancelTask(entry.getKey());
|
||||
q.timers.remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
final Player p = (Player)player;
|
||||
final String[] ps = ConfigUtil.parseStringWithPossibleLineBreaks(ChatColor.AQUA + finished, this, p);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
|
@ -464,11 +464,11 @@ public class Quest {
|
|||
issuedReward = true;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
for (ItemStack i : rews.getItems()) {
|
||||
final Player p = (Player)player;
|
||||
for (final ItemStack i : rews.getItems()) {
|
||||
try {
|
||||
InventoryUtil.addItem(p, i);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().severe("Unable to add null reward item to inventory of "
|
||||
+ player.getName() + " upon completion of quest " + name);
|
||||
p.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
|
@ -477,7 +477,7 @@ public class Quest {
|
|||
issuedReward = true;
|
||||
}
|
||||
}
|
||||
for (String s : rews.getCommands()) {
|
||||
for (final String s : rews.getCommands()) {
|
||||
String temp = s.replace("<player>", player.getName());
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null && player.isOnline()) {
|
||||
temp = PlaceholderAPI.setPlaceholders((Player)player, temp);
|
||||
|
@ -498,7 +498,7 @@ public class Quest {
|
|||
}
|
||||
for (int i = 0; i < rews.getPermissions().size(); i++) {
|
||||
if (plugin.getDependencies().getVaultPermission() != null) {
|
||||
String perm = rews.getPermissions().get(i);
|
||||
final String perm = rews.getPermissions().get(i);
|
||||
String world = null;
|
||||
if (i < rews.getPermissionWorlds().size()) {
|
||||
world = rews.getPermissionWorlds().get(i);
|
||||
|
@ -511,25 +511,25 @@ public class Quest {
|
|||
}
|
||||
issuedReward = true;
|
||||
}
|
||||
for (String s : rews.getMcmmoSkills()) {
|
||||
for (final String s : rews.getMcmmoSkills()) {
|
||||
UserManager.getOfflinePlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s),
|
||||
rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)));
|
||||
issuedReward = true;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
for (String s : rews.getHeroesClasses()) {
|
||||
Hero hero = plugin.getDependencies().getHero(player.getUniqueId());
|
||||
for (final String s : rews.getHeroesClasses()) {
|
||||
final Hero hero = plugin.getDependencies().getHero(player.getUniqueId());
|
||||
hero.addExp(rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)),
|
||||
plugin.getDependencies().getHeroes().getClassManager().getClass(s),
|
||||
((Player)player).getLocation());
|
||||
issuedReward = true;
|
||||
}
|
||||
}
|
||||
LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
|
||||
int phatLootExp = 0;
|
||||
LinkedList<String> phatLootMessages = new LinkedList<String>();
|
||||
for (String s : rews.getPhatLoots()) {
|
||||
LootBundle lb = PhatLootsAPI.getPhatLoot(s).rollForLoot();
|
||||
final LinkedList<String> phatLootMessages = new LinkedList<String>();
|
||||
for (final String s : rews.getPhatLoots()) {
|
||||
final LootBundle lb = PhatLootsAPI.getPhatLoot(s).rollForLoot();
|
||||
if (lb.getExp() > 0) {
|
||||
phatLootExp += lb.getExp();
|
||||
if (player.isOnline()) {
|
||||
|
@ -545,11 +545,11 @@ public class Quest {
|
|||
if (lb.getItemList().isEmpty() == false) {
|
||||
phatLootItems.addAll(lb.getItemList());
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
for (ItemStack is : lb.getItemList()) {
|
||||
final Player p = (Player)player;
|
||||
for (final ItemStack is : lb.getItemList()) {
|
||||
try {
|
||||
InventoryUtil.addItem(p, is);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " + p.getName()
|
||||
+ " upon completion of quest " + name);
|
||||
p.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
|
@ -559,7 +559,7 @@ public class Quest {
|
|||
}
|
||||
}
|
||||
if (lb.getCommandList().isEmpty() == false && player.isOnline()) {
|
||||
for (CommandLoot cl : lb.getCommandList()) {
|
||||
for (final CommandLoot cl : lb.getCommandList()) {
|
||||
cl.execute((Player)player);
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ public class Quest {
|
|||
|
||||
// Inform player
|
||||
if (player.isOnline()) {
|
||||
Player p = (Player)player;
|
||||
final Player p = (Player)player;
|
||||
p.sendMessage(ChatColor.GOLD + Lang.get(p, "questCompleteTitle").replace("<quest>", ChatColor.YELLOW + name
|
||||
+ ChatColor.GOLD));
|
||||
if (plugin.getSettings().canShowQuestTitles()) {
|
||||
|
@ -596,7 +596,7 @@ public class Quest {
|
|||
if (!issuedReward) {
|
||||
p.sendMessage(ChatColor.GRAY + "- (" + Lang.get("none") + ")");
|
||||
} else if (!rews.getDetailsOverride().isEmpty()) {
|
||||
for (String s: rews.getDetailsOverride()) {
|
||||
for (final String s: rews.getDetailsOverride()) {
|
||||
String message = ChatColor.DARK_GREEN + ConfigUtil.parseString(
|
||||
ChatColor.translateAlternateColorCodes('&', s));
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
|
@ -609,7 +609,7 @@ public class Quest {
|
|||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " "
|
||||
+ Lang.get(p, "questPoints"));
|
||||
}
|
||||
for (ItemStack i : rews.getItems()) {
|
||||
for (final ItemStack i : rews.getItems()) {
|
||||
String text = "error";
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
|
@ -621,11 +621,11 @@ public class Quest {
|
|||
try {
|
||||
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
|
||||
text += ChatColor.GRAY + " " + Lang.get(p, "with") + ChatColor.DARK_PURPLE;
|
||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
for (final Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
}
|
||||
} catch (Throwable tr) {
|
||||
} catch (final Throwable tr) {
|
||||
// Do nothing, hasItemFlag() not introduced until 1.8.6
|
||||
}
|
||||
text += ChatColor.GRAY + " x " + i.getAmount();
|
||||
|
@ -637,7 +637,7 @@ public class Quest {
|
|||
} else {
|
||||
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY
|
||||
+ " " + Lang.get(p, "with");
|
||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
for (final Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
text += ChatColor.GRAY + " x " + i.getAmount();
|
||||
|
@ -650,11 +650,11 @@ public class Quest {
|
|||
try {
|
||||
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
|
||||
text += ChatColor.GRAY + " " + Lang.get(p, "with");
|
||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
for (final Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
}
|
||||
} catch (Throwable tr) {
|
||||
} catch (final Throwable tr) {
|
||||
// Do nothing, hasItemFlag() not introduced until 1.8.6
|
||||
}
|
||||
text += ChatColor.GRAY + " x " + i.getAmount();
|
||||
|
@ -662,7 +662,7 @@ public class Quest {
|
|||
}
|
||||
p.sendMessage(text);
|
||||
}
|
||||
for (ItemStack i : phatLootItems) {
|
||||
for (final ItemStack i : phatLootItems) {
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||
|
@ -699,13 +699,13 @@ public class Quest {
|
|||
+ plugin.getDependencies().getCurrency(false));
|
||||
}
|
||||
if (rews.getExp() > 0 || phatLootExp > 0) {
|
||||
int tot = rews.getExp() + phatLootExp;
|
||||
final int tot = rews.getExp() + phatLootExp;
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " "
|
||||
+ Lang.get(p, "experience"));
|
||||
}
|
||||
if (rews.getCommands().isEmpty() == false) {
|
||||
int index = 0;
|
||||
for (String s : rews.getCommands()) {
|
||||
for (final String s : rews.getCommands()) {
|
||||
if (rews.getCommandsOverrideDisplay().isEmpty() == false && rews.getCommandsOverrideDisplay().size()
|
||||
> index) {
|
||||
if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) {
|
||||
|
@ -720,7 +720,7 @@ public class Quest {
|
|||
}
|
||||
if (rews.getPermissions().isEmpty() == false) {
|
||||
int index = 0;
|
||||
for (String s : rews.getPermissions()) {
|
||||
for (final String s : rews.getPermissions()) {
|
||||
if (rews.getPermissionWorlds() != null && rews.getPermissionWorlds().size() > index) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + s + " (" + rews.getPermissionWorlds().get(index)
|
||||
+ ")");
|
||||
|
@ -732,37 +732,37 @@ public class Quest {
|
|||
}
|
||||
}
|
||||
if (rews.getMcmmoSkills().isEmpty() == false) {
|
||||
for (String s : rews.getMcmmoSkills()) {
|
||||
for (final String s : rews.getMcmmoSkills()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN
|
||||
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " "
|
||||
+ ChatColor.DARK_PURPLE + s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
}
|
||||
if (rews.getHeroesClasses().isEmpty() == false) {
|
||||
for (String s : rews.getHeroesClasses()) {
|
||||
for (final String s : rews.getHeroesClasses()) {
|
||||
p.sendMessage("- " + ChatColor.AQUA
|
||||
+ rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE
|
||||
+ s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
}
|
||||
if (phatLootMessages.isEmpty() == false) {
|
||||
for (String s : phatLootMessages) {
|
||||
for (final String s : phatLootMessages) {
|
||||
p.sendMessage("- " + s);
|
||||
}
|
||||
}
|
||||
for (String s : rews.getCustomRewards().keySet()) {
|
||||
for (final String s : rews.getCustomRewards().keySet()) {
|
||||
CustomReward found = null;
|
||||
for (CustomReward cr : plugin.getCustomRewards()) {
|
||||
for (final CustomReward cr : plugin.getCustomRewards()) {
|
||||
if (cr.getName().equalsIgnoreCase(s)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found != null) {
|
||||
Map<String, Object> datamap = rews.getCustomRewards().get(found.getName());
|
||||
final Map<String, Object> datamap = rews.getCustomRewards().get(found.getName());
|
||||
String message = found.getDisplay();
|
||||
if (message != null) {
|
||||
for (String key : datamap.keySet()) {
|
||||
for (final String key : datamap.keySet()) {
|
||||
message = message.replace("%" + key + "%", datamap.get(key).toString());
|
||||
}
|
||||
p.sendMessage("- " + ChatColor.GOLD + message);
|
||||
|
@ -785,14 +785,14 @@ public class Quest {
|
|||
q.updateJournal();
|
||||
q.findCompassTarget();
|
||||
if (player.isOnline()) {
|
||||
QuesterPostCompleteQuestEvent postEvent = new QuesterPostCompleteQuestEvent(q, this);
|
||||
final QuesterPostCompleteQuestEvent postEvent = new QuesterPostCompleteQuestEvent(q, this);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
if (opts.getShareProgressLevel() == 4) {
|
||||
List<Quester> mq = q.getMultiplayerQuesters(this);
|
||||
for (Quester qq : mq) {
|
||||
final List<Quester> mq = q.getMultiplayerQuesters(this);
|
||||
for (final Quester qq : mq) {
|
||||
if (qq.getQuestData(this) != null) {
|
||||
completeQuest(qq);
|
||||
}
|
||||
|
@ -806,14 +806,14 @@ public class Quest {
|
|||
* @param quester The quester to be ejected
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void failQuest(Quester quester) {
|
||||
QuesterPreFailQuestEvent preEvent = new QuesterPreFailQuestEvent(quester, this);
|
||||
public void failQuest(final Quester quester) {
|
||||
final QuesterPreFailQuestEvent preEvent = new QuesterPreFailQuestEvent(quester, this);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
Player player = quester.getPlayer();
|
||||
String[] messages = {
|
||||
final Player player = quester.getPlayer();
|
||||
final String[] messages = {
|
||||
ChatColor.GOLD + Lang.get(player, "questObjectivesTitle").replace("<quest>", name),
|
||||
ChatColor.RED + Lang.get(player, "questFailed")
|
||||
};
|
||||
|
@ -821,7 +821,7 @@ public class Quest {
|
|||
if (player.isOnline()) {
|
||||
player.updateInventory();
|
||||
}
|
||||
QuesterPostFailQuestEvent postEvent = new QuesterPostFailQuestEvent(quester, this);
|
||||
final QuesterPostFailQuestEvent postEvent = new QuesterPostFailQuestEvent(quester, this);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
|
||||
|
@ -831,7 +831,7 @@ public class Quest {
|
|||
* @param quester The quester to check
|
||||
* @return true if quester is in region
|
||||
*/
|
||||
public boolean isInRegion(Quester quester) {
|
||||
public boolean isInRegion(final Quester quester) {
|
||||
return isInRegion(quester.getPlayer());
|
||||
}
|
||||
|
||||
|
@ -841,7 +841,7 @@ public class Quest {
|
|||
* @param player The player to check
|
||||
* @return true if player is in region
|
||||
*/
|
||||
private boolean isInRegion(Player player) {
|
||||
private boolean isInRegion(final Player player) {
|
||||
if (regionStart == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -62,7 +62,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
private Set<UUID> selectingNpcs = new HashSet<UUID>();
|
||||
private List<String> editingQuestNames = new LinkedList<String>();
|
||||
|
||||
public QuestFactory(Quests plugin) {
|
||||
public QuestFactory(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||
|
@ -75,7 +75,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
return selectedBlockStarts;
|
||||
}
|
||||
|
||||
public void setSelectedBlockStarts(Map<UUID, Block> selectedBlockStarts) {
|
||||
public void setSelectedBlockStarts(final Map<UUID, Block> selectedBlockStarts) {
|
||||
this.selectedBlockStarts = selectedBlockStarts;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
return selectedKillLocations;
|
||||
}
|
||||
|
||||
public void setSelectedKillLocations(Map<UUID, Block> selectedKillLocations) {
|
||||
public void setSelectedKillLocations(final Map<UUID, Block> selectedKillLocations) {
|
||||
this.selectedKillLocations = selectedKillLocations;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
return selectedReachLocations;
|
||||
}
|
||||
|
||||
public void setSelectedReachLocations(Map<UUID, Block> selectedReachLocations) {
|
||||
public void setSelectedReachLocations(final Map<UUID, Block> selectedReachLocations) {
|
||||
this.selectedReachLocations = selectedReachLocations;
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
return selectingNpcs;
|
||||
}
|
||||
|
||||
public void setSelectingNpcs(Set<UUID> selectingNpcs) {
|
||||
public void setSelectingNpcs(final Set<UUID> selectingNpcs) {
|
||||
this.selectingNpcs = selectingNpcs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link#getNamesOfQuestsBeingEdited}
|
||||
*/
|
||||
@Deprecated
|
||||
public List<String> getNames() {
|
||||
return editingQuestNames;
|
||||
}
|
||||
|
@ -113,7 +114,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
/**
|
||||
* @deprecated Use {@link#setNamesOfQuestsBeingEdited}
|
||||
*/
|
||||
public void setNames(List<String> names) {
|
||||
@Deprecated
|
||||
public void setNames(final List<String> names) {
|
||||
this.editingQuestNames = names;
|
||||
}
|
||||
|
||||
|
@ -121,7 +123,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
return editingQuestNames;
|
||||
}
|
||||
|
||||
public void setNamesOfQuestsBeingEdited(List<String> questNames) {
|
||||
public void setNamesOfQuestsBeingEdited(final List<String> questNames) {
|
||||
this.editingQuestNames = questNames;
|
||||
}
|
||||
|
||||
|
@ -130,22 +132,22 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||
public void conversationAbandoned(final ConversationAbandonedEvent abandonedEvent) {
|
||||
if (abandonedEvent.getContext().getSessionData(CK.Q_NAME) != null) {
|
||||
editingQuestNames.remove((String) abandonedEvent.getContext().getSessionData(CK.Q_NAME));
|
||||
editingQuestNames.remove(abandonedEvent.getContext().getSessionData(CK.Q_NAME));
|
||||
}
|
||||
Player player = (Player) abandonedEvent.getContext().getForWhom();
|
||||
final Player player = (Player) abandonedEvent.getContext().getForWhom();
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
selectedKillLocations.remove(player.getUniqueId());
|
||||
selectedReachLocations.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public Prompt returnToMenu(ConversationContext context) {
|
||||
public Prompt returnToMenu(final ConversationContext context) {
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void loadQuest(ConversationContext context, Quest q) {
|
||||
public void loadQuest(final ConversationContext context, final Quest q) {
|
||||
context.setSessionData(CK.ED_QUEST_EDIT, q.getName());
|
||||
context.setSessionData(CK.Q_ID, q.getId());
|
||||
context.setSessionData(CK.Q_NAME, q.getName());
|
||||
|
@ -164,7 +166,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
if (q.getGUIDisplay() != null) {
|
||||
context.setSessionData(CK.Q_GUIDISPLAY, q.getGUIDisplay());
|
||||
}
|
||||
Requirements reqs = q.getRequirements();
|
||||
final Requirements reqs = q.getRequirements();
|
||||
if (reqs.getMoney() != 0) {
|
||||
context.setSessionData(CK.REQ_MONEY, reqs.getMoney());
|
||||
}
|
||||
|
@ -195,9 +197,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, reqs.getHeroesSecondaryClass());
|
||||
}
|
||||
if (reqs.getCustomRequirements().isEmpty() == false) {
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
LinkedList<Map<String, Object>> datamapList = new LinkedList<Map<String, Object>>();
|
||||
for (Entry<String, Map<String, Object>> entry : reqs.getCustomRequirements().entrySet()) {
|
||||
final LinkedList<String> list = new LinkedList<String>();
|
||||
final LinkedList<Map<String, Object>> datamapList = new LinkedList<Map<String, Object>>();
|
||||
for (final Entry<String, Map<String, Object>> entry : reqs.getCustomRequirements().entrySet()) {
|
||||
list.add(entry.getKey());
|
||||
datamapList.add(entry.getValue());
|
||||
}
|
||||
|
@ -207,7 +209,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
if (reqs.getDetailsOverride().isEmpty() == false) {
|
||||
context.setSessionData(CK.REQ_FAIL_MESSAGE, reqs.getDetailsOverride());
|
||||
}
|
||||
Rewards rews = q.getRewards();
|
||||
final Rewards rews = q.getRewards();
|
||||
if (rews.getMoney() != 0) {
|
||||
context.setSessionData(CK.REW_MONEY, rews.getMoney());
|
||||
}
|
||||
|
@ -250,7 +252,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
if (rews.getDetailsOverride().isEmpty() == false) {
|
||||
context.setSessionData(CK.REW_DETAILS_OVERRIDE, rews.getDetailsOverride());
|
||||
}
|
||||
Planner pln = q.getPlanner();
|
||||
final Planner pln = q.getPlanner();
|
||||
if (pln.getStart() != null) {
|
||||
context.setSessionData(CK.PLN_START_DATE, pln.getStart());
|
||||
}
|
||||
|
@ -264,7 +266,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.PLN_COOLDOWN, pln.getCooldown());
|
||||
}
|
||||
context.setSessionData(CK.PLN_OVERRIDE, pln.getOverride());
|
||||
Options opt = q.getOptions();
|
||||
final Options opt = q.getOptions();
|
||||
context.setSessionData(CK.OPT_ALLOW_COMMANDS, opt.getAllowCommands());
|
||||
context.setSessionData(CK.OPT_ALLOW_QUITTING, opt.getAllowQuitting());
|
||||
context.setSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN, opt.getUseDungeonsXLPlugin());
|
||||
|
@ -273,15 +275,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.OPT_REQUIRE_SAME_QUEST, opt.getRequireSameQuest());
|
||||
// Stages (Objectives)
|
||||
int index = 1;
|
||||
for (Stage stage : q.getStages()) {
|
||||
for (final Stage stage : q.getStages()) {
|
||||
final String pref = "stage" + index;
|
||||
index++;
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
if (!stage.getBlocksToBreak().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (ItemStack e : stage.getBlocksToBreak()) {
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
final LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (final ItemStack e : stage.getBlocksToBreak()) {
|
||||
names.add(e.getType().name());
|
||||
amnts.add(e.getAmount());
|
||||
durab.add(e.getDurability());
|
||||
|
@ -291,10 +293,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, durab);
|
||||
}
|
||||
if (!stage.getBlocksToDamage().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (ItemStack e : stage.getBlocksToDamage()) {
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
final LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (final ItemStack e : stage.getBlocksToDamage()) {
|
||||
names.add(e.getType().name());
|
||||
amnts.add(e.getAmount());
|
||||
durab.add(e.getDurability());
|
||||
|
@ -304,10 +306,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durab);
|
||||
}
|
||||
if (!stage.getBlocksToPlace().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (ItemStack e : stage.getBlocksToPlace()) {
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
final LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (final ItemStack e : stage.getBlocksToPlace()) {
|
||||
names.add(e.getType().name());
|
||||
amnts.add(e.getAmount());
|
||||
durab.add(e.getDurability());
|
||||
|
@ -317,10 +319,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, durab);
|
||||
}
|
||||
if (!stage.getBlocksToUse().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (ItemStack e : stage.getBlocksToUse()) {
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
final LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (final ItemStack e : stage.getBlocksToUse()) {
|
||||
names.add(e.getType().name());
|
||||
amnts.add(e.getAmount());
|
||||
durab.add(e.getDurability());
|
||||
|
@ -330,10 +332,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_USE_DURABILITY, durab);
|
||||
}
|
||||
if (!stage.getBlocksToCut().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (ItemStack e : stage.getBlocksToCut()) {
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
final LinkedList<Short> durab = new LinkedList<Short>();
|
||||
for (final ItemStack e : stage.getBlocksToCut()) {
|
||||
names.add(e.getType().name());
|
||||
amnts.add(e.getAmount());
|
||||
durab.add(e.getDurability());
|
||||
|
@ -343,26 +345,26 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_CUT_DURABILITY, durab);
|
||||
}
|
||||
if (!stage.getItemsToCraft().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToCraft()) {
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (final ItemStack is : stage.getItemsToCraft()) {
|
||||
items.add(is);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
}
|
||||
if (!stage.getItemsToSmelt().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToSmelt()) {
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (final ItemStack is : stage.getItemsToSmelt()) {
|
||||
items.add(is);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
}
|
||||
if (!stage.getItemsToEnchant().isEmpty()) {
|
||||
LinkedList<String> enchants = new LinkedList<String>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (Entry<Map<Enchantment, Material>, Integer> e : stage.getItemsToEnchant().entrySet()) {
|
||||
final LinkedList<String> enchants = new LinkedList<String>();
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
final LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (final Entry<Map<Enchantment, Material>, Integer> e : stage.getItemsToEnchant().entrySet()) {
|
||||
amounts.add(e.getValue());
|
||||
for (Entry<Enchantment, Material> e2 : e.getKey().entrySet()) {
|
||||
for (final Entry<Enchantment, Material> e2 : e.getKey().entrySet()) {
|
||||
names.add(e2.getValue().name());
|
||||
enchants.add(ItemUtil.getPrettyEnchantmentName(e2.getKey()));
|
||||
}
|
||||
|
@ -372,15 +374,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, amounts);
|
||||
}
|
||||
if (!stage.getItemsToBrew().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToBrew()) {
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (final ItemStack is : stage.getItemsToBrew()) {
|
||||
items.add(is);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_BREW_ITEMS, items);
|
||||
}
|
||||
if (!stage.getItemsToConsume().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToConsume()) {
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (final ItemStack is : stage.getItemsToConsume()) {
|
||||
items.add(is);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_CONSUME_ITEMS, items);
|
||||
|
@ -395,12 +397,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_PLAYER_KILL, stage.getPlayersToKill());
|
||||
}
|
||||
if (!stage.getItemsToDeliver().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (ItemStack is : stage.getItemsToDeliver()) {
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (final ItemStack is : stage.getItemsToDeliver()) {
|
||||
items.add(is);
|
||||
}
|
||||
for (Integer n : stage.getItemDeliveryTargets()) {
|
||||
for (final Integer n : stage.getItemDeliveryTargets()) {
|
||||
npcs.add(n);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_DELIVERY_ITEMS, items);
|
||||
|
@ -408,30 +410,30 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_DELIVERY_MESSAGES, stage.getDeliverMessages());
|
||||
}
|
||||
if (!stage.getCitizensToInteract().isEmpty()) {
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (Integer n : stage.getCitizensToInteract()) {
|
||||
final LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (final Integer n : stage.getCitizensToInteract()) {
|
||||
npcs.add(n);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
||||
}
|
||||
if (!stage.getCitizensToKill().isEmpty()) {
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (Integer n : stage.getCitizensToKill()) {
|
||||
final LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (final Integer n : stage.getCitizensToKill()) {
|
||||
npcs.add(n);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs);
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS, stage.getCitizenNumToKill());
|
||||
}
|
||||
if (!stage.getMobsToKill().isEmpty()) {
|
||||
LinkedList<String> mobs = new LinkedList<String>();
|
||||
for (EntityType et : stage.getMobsToKill()) {
|
||||
final LinkedList<String> mobs = new LinkedList<String>();
|
||||
for (final EntityType et : stage.getMobsToKill()) {
|
||||
mobs.add(MiscUtil.getPrettyMobName(et));
|
||||
}
|
||||
context.setSessionData(pref + CK.S_MOB_TYPES, mobs);
|
||||
context.setSessionData(pref + CK.S_MOB_AMOUNTS, stage.getMobNumToKill());
|
||||
if (!stage.getLocationsToKillWithin().isEmpty()) {
|
||||
LinkedList<String> locs = new LinkedList<String>();
|
||||
for (Location l : stage.getLocationsToKillWithin()) {
|
||||
final LinkedList<String> locs = new LinkedList<String>();
|
||||
for (final Location l : stage.getLocationsToKillWithin()) {
|
||||
locs.add(ConfigUtil.getLocationInfo(l));
|
||||
}
|
||||
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs);
|
||||
|
@ -440,8 +442,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
}
|
||||
if (!stage.getLocationsToReach().isEmpty()) {
|
||||
LinkedList<String> locs = new LinkedList<String>();
|
||||
for (Location l : stage.getLocationsToReach()) {
|
||||
final LinkedList<String> locs = new LinkedList<String>();
|
||||
for (final Location l : stage.getLocationsToReach()) {
|
||||
locs.add(ConfigUtil.getLocationInfo(l));
|
||||
}
|
||||
context.setSessionData(pref + CK.S_REACH_LOCATIONS, locs);
|
||||
|
@ -449,9 +451,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, stage.getLocationNames());
|
||||
}
|
||||
if (!stage.getMobsToTame().isEmpty()) {
|
||||
LinkedList<String> mobs = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<EntityType, Integer> e : stage.getMobsToTame().entrySet()) {
|
||||
final LinkedList<String> mobs = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (final Entry<EntityType, Integer> e : stage.getMobsToTame().entrySet()) {
|
||||
mobs.add(MiscUtil.getPrettyMobName(e.getKey()));
|
||||
amnts.add(e.getValue());
|
||||
}
|
||||
|
@ -459,9 +461,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_TAME_AMOUNTS, amnts);
|
||||
}
|
||||
if (!stage.getSheepToShear().isEmpty()) {
|
||||
LinkedList<String> colors = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<DyeColor, Integer> e : stage.getSheepToShear().entrySet()) {
|
||||
final LinkedList<String> colors = new LinkedList<String>();
|
||||
final LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (final Entry<DyeColor, Integer> e : stage.getSheepToShear().entrySet()) {
|
||||
colors.add(MiscUtil.getPrettyDyeColorName(e.getKey()));
|
||||
amnts.add(e.getValue());
|
||||
}
|
||||
|
@ -473,9 +475,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_PASSWORD_PHRASES, stage.getPasswordPhrases());
|
||||
}
|
||||
if (!stage.getCustomObjectives().isEmpty()) {
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
LinkedList<Integer> countList = new LinkedList<Integer>();
|
||||
LinkedList<Entry<String, Object>> datamapList = new LinkedList<Entry<String, Object>>();
|
||||
final LinkedList<String> list = new LinkedList<String>();
|
||||
final LinkedList<Integer> countList = new LinkedList<Integer>();
|
||||
final LinkedList<Entry<String, Object>> datamapList = new LinkedList<Entry<String, Object>>();
|
||||
for (int i = 0; i < stage.getCustomObjectives().size(); i++) {
|
||||
list.add(stage.getCustomObjectives().get(i).getName());
|
||||
countList.add(stage.getCustomObjectiveCounts().get(i));
|
||||
|
@ -498,9 +500,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.getDisconnectAction().getName());
|
||||
}
|
||||
if (!stage.getChatActions().isEmpty()) {
|
||||
LinkedList<String> chatEvents = new LinkedList<String>();
|
||||
LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
||||
for (String s : stage.getChatActions().keySet()) {
|
||||
final LinkedList<String> chatEvents = new LinkedList<String>();
|
||||
final LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
||||
for (final String s : stage.getChatActions().keySet()) {
|
||||
chatEventTriggers.add(s);
|
||||
chatEvents.add(stage.getChatActions().get(s).getName());
|
||||
}
|
||||
|
@ -508,9 +510,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
|
||||
}
|
||||
if (!stage.getCommandActions().isEmpty()) {
|
||||
LinkedList<String> commandEvents = new LinkedList<String>();
|
||||
LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
||||
for (String s : stage.getCommandActions().keySet()) {
|
||||
final LinkedList<String> commandEvents = new LinkedList<String>();
|
||||
final LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
||||
for (final String s : stage.getCommandActions().keySet()) {
|
||||
commandEventTriggers.add(s);
|
||||
commandEvents.add(stage.getCommandActions().get(s).getName());
|
||||
}
|
||||
|
@ -541,25 +543,25 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void deleteQuest(ConversationContext context) {
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
File questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||
public void deleteQuest(final ConversationContext context) {
|
||||
final FileConfiguration data = new YamlConfiguration();
|
||||
final File questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||
try {
|
||||
data.load(questsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<quest>", questsFile.getName()));
|
||||
return;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<quest>", questsFile.getName()));
|
||||
return;
|
||||
}
|
||||
String quest = (String) context.getSessionData(CK.ED_QUEST_DELETE);
|
||||
ConfigurationSection sec = data.getConfigurationSection("quests");
|
||||
for (String key : sec.getKeys(false)) {
|
||||
final String quest = (String) context.getSessionData(CK.ED_QUEST_DELETE);
|
||||
final ConfigurationSection sec = data.getConfigurationSection("quests");
|
||||
for (final String key : sec.getKeys(false)) {
|
||||
if (sec.getString(key + ".name").equalsIgnoreCase(quest)) {
|
||||
sec.set(key, null);
|
||||
break;
|
||||
|
@ -567,12 +569,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
try {
|
||||
data.save(questsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
public void execute(Boolean response) {
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@Override
|
||||
public void execute(final Boolean response) {
|
||||
if (!response) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("unknownError"));
|
||||
}
|
||||
|
@ -582,15 +585,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
context.getForWhom().sendRawMessage(ChatColor.GREEN + Lang.get("questDeleted"));
|
||||
}
|
||||
|
||||
public void saveQuest(ConversationContext context, ConfigurationSection section) {
|
||||
public void saveQuest(final ConversationContext context, final ConfigurationSection section) {
|
||||
String edit = null;
|
||||
if (context.getSessionData(CK.ED_QUEST_EDIT) != null) {
|
||||
edit = (String) context.getSessionData(CK.ED_QUEST_EDIT);
|
||||
}
|
||||
if (edit != null) {
|
||||
ConfigurationSection questList = section.getParent();
|
||||
for (String key : questList.getKeys(false)) {
|
||||
String name = questList.getString(key + ".name");
|
||||
final ConfigurationSection questList = section.getParent();
|
||||
for (final String key : questList.getKeys(false)) {
|
||||
final String name = questList.getString(key + ".name");
|
||||
if (name != null) {
|
||||
if (name.equalsIgnoreCase(edit)) {
|
||||
questList.set(key, null);
|
||||
|
@ -623,8 +626,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void saveRequirements(ConversationContext context, ConfigurationSection section) {
|
||||
ConfigurationSection reqs = section.createSection("requirements");
|
||||
private void saveRequirements(final ConversationContext context, final ConfigurationSection section) {
|
||||
final ConfigurationSection reqs = section.createSection("requirements");
|
||||
reqs.set("money", context.getSessionData(CK.REQ_MONEY) != null
|
||||
? (Integer) context.getSessionData(CK.REQ_MONEY) : null);
|
||||
reqs.set("quest-points", context.getSessionData(CK.REQ_QUEST_POINTS) != null
|
||||
|
@ -647,14 +650,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
? (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) : null);
|
||||
reqs.set("heroes-secondary-class", context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null
|
||||
? (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) : null);
|
||||
LinkedList<String> customReqs = context.getSessionData(CK.REQ_CUSTOM) != null
|
||||
final LinkedList<String> customReqs = context.getSessionData(CK.REQ_CUSTOM) != null
|
||||
? (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM) : null;
|
||||
LinkedList<Map<String, Object>> customReqsData = context.getSessionData(CK.REQ_CUSTOM_DATA) != null
|
||||
final LinkedList<Map<String, Object>> customReqsData = context.getSessionData(CK.REQ_CUSTOM_DATA) != null
|
||||
? (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA) : null;
|
||||
if (customReqs != null) {
|
||||
ConfigurationSection customReqsSec = reqs.createSection("custom-requirements");
|
||||
final ConfigurationSection customReqsSec = reqs.createSection("custom-requirements");
|
||||
for (int i = 0; i < customReqs.size(); i++) {
|
||||
ConfigurationSection customReqSec = customReqsSec.createSection("req" + (i + 1));
|
||||
final ConfigurationSection customReqSec = customReqsSec.createSection("req" + (i + 1));
|
||||
customReqSec.set("name", customReqs.get(i));
|
||||
customReqSec.set("data", customReqsData.get(i));
|
||||
}
|
||||
|
@ -667,13 +670,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void saveStages(ConversationContext context, ConfigurationSection section) {
|
||||
ConfigurationSection stages = section.createSection("stages");
|
||||
ConfigurationSection ordered = stages.createSection("ordered");
|
||||
private void saveStages(final ConversationContext context, final ConfigurationSection section) {
|
||||
final ConfigurationSection stages = section.createSection("stages");
|
||||
final ConfigurationSection ordered = stages.createSection("ordered");
|
||||
String pref;
|
||||
for (int i = 1; i <= new StageMenuPrompt(context).getStages(context); i++) {
|
||||
pref = "stage" + i;
|
||||
ConfigurationSection stage = ordered.createSection("" + i);
|
||||
final ConfigurationSection stage = ordered.createSection("" + i);
|
||||
stage.set("break-block-names", context.getSessionData(pref + CK.S_BREAK_NAMES) != null
|
||||
? (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_NAMES) : null);
|
||||
stage.set("break-block-amounts", context.getSessionData(pref + CK.S_BREAK_AMOUNTS) != null
|
||||
|
@ -762,13 +765,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
? (LinkedList<Integer>) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS) : null);
|
||||
stage.set("password-displays", context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) != null
|
||||
? (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) : null);
|
||||
LinkedList<LinkedList<String>> passPhrases
|
||||
final LinkedList<LinkedList<String>> passPhrases
|
||||
= (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
|
||||
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) {
|
||||
LinkedList<String> toPut = new LinkedList<String>();
|
||||
for (LinkedList<String> list : passPhrases) {
|
||||
final LinkedList<String> toPut = new LinkedList<String>();
|
||||
for (final LinkedList<String> list : passPhrases) {
|
||||
String combine = "";
|
||||
for (String s : list) {
|
||||
for (final String s : list) {
|
||||
if (list.getLast().equals(s) == false) {
|
||||
combine += s + "|";
|
||||
} else {
|
||||
|
@ -779,27 +782,27 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
stage.set("password-phrases", toPut);
|
||||
}
|
||||
LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
||||
LinkedList<Integer> customObjCounts
|
||||
final LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
||||
final LinkedList<Integer> customObjCounts
|
||||
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT);
|
||||
LinkedList<Entry<String, Object>> customObjsData
|
||||
final LinkedList<Entry<String, Object>> customObjsData
|
||||
= (LinkedList<Entry<String, Object>>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA);
|
||||
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) != null) {
|
||||
ConfigurationSection sec = stage.createSection("custom-objectives");
|
||||
final ConfigurationSection sec = stage.createSection("custom-objectives");
|
||||
for (int index = 0; index < customObjs.size(); index++) {
|
||||
ConfigurationSection sec2 = sec.createSection("custom" + (index + 1));
|
||||
final ConfigurationSection sec2 = sec.createSection("custom" + (index + 1));
|
||||
sec2.set("name", customObjs.get(index));
|
||||
sec2.set("count", customObjCounts.get(index));
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : plugin.getCustomObjectives()) {
|
||||
for (final CustomObjective co : plugin.getCustomObjectives()) {
|
||||
if (co.getName().equals(customObjs.get(index))) {
|
||||
found = co;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ConfigurationSection sec3 = sec2.createSection("data");
|
||||
for (Entry<String, Object> datamap : found.getData()) {
|
||||
for (Entry<String, Object> e : customObjsData) {
|
||||
final ConfigurationSection sec3 = sec2.createSection("data");
|
||||
for (final Entry<String, Object> datamap : found.getData()) {
|
||||
for (final Entry<String, Object> e : customObjsData) {
|
||||
if (e.getKey().equals(datamap.getKey())) {
|
||||
sec3.set(e.getKey(), e.getValue()); // if anything goes wrong it's probably here
|
||||
}
|
||||
|
@ -827,19 +830,19 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
? context.getSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS) : null);
|
||||
stage.set("condition", context.getSessionData(pref + CK.S_CONDITION) != null
|
||||
? context.getSessionData(pref + CK.S_CONDITION) : null);
|
||||
Long delay = (Long) context.getSessionData(pref + CK.S_DELAY);
|
||||
final Long delay = (Long) context.getSessionData(pref + CK.S_DELAY);
|
||||
if (context.getSessionData(pref + CK.S_DELAY) != null) {
|
||||
stage.set("delay", delay.intValue() / 1000);
|
||||
}
|
||||
String delayMessage = (String) context.getSessionData(pref + CK.S_DELAY_MESSAGE);
|
||||
final String delayMessage = (String) context.getSessionData(pref + CK.S_DELAY_MESSAGE);
|
||||
if (context.getSessionData(pref + CK.S_DELAY_MESSAGE) != null) {
|
||||
stage.set("delay-message", delayMessage == null ? delayMessage : delayMessage.replace("\\n", "\n"));
|
||||
}
|
||||
String startMessage = (String) context.getSessionData(pref + CK.S_START_MESSAGE);
|
||||
final String startMessage = (String) context.getSessionData(pref + CK.S_START_MESSAGE);
|
||||
if (context.getSessionData(pref + CK.S_START_MESSAGE) != null) {
|
||||
stage.set("start-message", startMessage == null ? startMessage : startMessage.replace("\\n", "\n"));
|
||||
}
|
||||
String completeMessage = (String) context.getSessionData(pref + CK.S_COMPLETE_MESSAGE);
|
||||
final String completeMessage = (String) context.getSessionData(pref + CK.S_COMPLETE_MESSAGE);
|
||||
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) != null) {
|
||||
stage.set("complete-message", completeMessage == null ? completeMessage
|
||||
: completeMessage.replace("\\n", "\n"));
|
||||
|
@ -850,8 +853,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void saveRewards(ConversationContext context, ConfigurationSection section) {
|
||||
ConfigurationSection rews = section.createSection("rewards");
|
||||
private void saveRewards(final ConversationContext context, final ConfigurationSection section) {
|
||||
final ConfigurationSection rews = section.createSection("rewards");
|
||||
rews.set("items", context.getSessionData(CK.REW_ITEMS) != null
|
||||
? (List<ItemStack>) context.getSessionData(CK.REW_ITEMS) : null);
|
||||
rews.set("money", context.getSessionData(CK.REW_MONEY) != null
|
||||
|
@ -878,14 +881,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
? (List<Double>) context.getSessionData(CK.REW_HEROES_AMOUNTS) : null);
|
||||
rews.set("phat-loots", context.getSessionData(CK.REW_PHAT_LOOTS) != null
|
||||
? (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS) : null);
|
||||
LinkedList<String> customRews = context.getSessionData(CK.REW_CUSTOM) != null
|
||||
final LinkedList<String> customRews = context.getSessionData(CK.REW_CUSTOM) != null
|
||||
? (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM) : null;
|
||||
LinkedList<Map<String, Object>> customRewsData = context.getSessionData(CK.REW_CUSTOM_DATA) != null
|
||||
final LinkedList<Map<String, Object>> customRewsData = context.getSessionData(CK.REW_CUSTOM_DATA) != null
|
||||
? (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA) : null;
|
||||
if (customRews != null) {
|
||||
ConfigurationSection customRewsSec = rews.createSection("custom-rewards");
|
||||
final ConfigurationSection customRewsSec = rews.createSection("custom-rewards");
|
||||
for (int i = 0; i < customRews.size(); i++) {
|
||||
ConfigurationSection customRewSec = customRewsSec.createSection("req" + (i + 1));
|
||||
final ConfigurationSection customRewSec = customRewsSec.createSection("req" + (i + 1));
|
||||
customRewSec.set("name", customRews.get(i));
|
||||
customRewSec.set("data", customRewsData.get(i));
|
||||
}
|
||||
|
@ -897,8 +900,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
}
|
||||
|
||||
private void savePlanner(ConversationContext context, ConfigurationSection section) {
|
||||
ConfigurationSection pln = section.createSection("planner");
|
||||
private void savePlanner(final ConversationContext context, final ConfigurationSection section) {
|
||||
final ConfigurationSection pln = section.createSection("planner");
|
||||
pln.set("start", context.getSessionData(CK.PLN_START_DATE) != null
|
||||
? (String) context.getSessionData(CK.PLN_START_DATE) : null);
|
||||
pln.set("end", context.getSessionData(CK.PLN_END_DATE) != null
|
||||
|
@ -914,8 +917,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
}
|
||||
|
||||
private void saveOptions(ConversationContext context, ConfigurationSection section) {
|
||||
ConfigurationSection opts = section.createSection("options");
|
||||
private void saveOptions(final ConversationContext context, final ConfigurationSection section) {
|
||||
final ConfigurationSection opts = section.createSection("options");
|
||||
opts.set("allow-commands", context.getSessionData(CK.OPT_ALLOW_COMMANDS) != null
|
||||
? (Boolean) context.getSessionData(CK.OPT_ALLOW_COMMANDS) : null);
|
||||
opts.set("allow-quitting", context.getSessionData(CK.OPT_ALLOW_QUITTING) != null
|
||||
|
|
|
@ -36,7 +36,7 @@ public class QuestMob {
|
|||
public QuestMob(){
|
||||
}
|
||||
|
||||
public QuestMob(EntityType entityType, Location spawnLocation, int spawnAmounts) {
|
||||
public QuestMob(final EntityType entityType, final Location spawnLocation, final int spawnAmounts) {
|
||||
this.entityType = entityType;
|
||||
this.spawnLocation = spawnLocation;
|
||||
this.spawnAmounts = spawnAmounts;
|
||||
|
@ -46,7 +46,7 @@ public class QuestMob {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class QuestMob {
|
|||
return entityType;
|
||||
}
|
||||
|
||||
public void setType(EntityType entityType) {
|
||||
public void setType(final EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class QuestMob {
|
|||
return spawnLocation;
|
||||
}
|
||||
|
||||
public void setSpawnLocation(Location spawnLocation) {
|
||||
public void setSpawnLocation(final Location spawnLocation) {
|
||||
this.spawnLocation = spawnLocation;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class QuestMob {
|
|||
return spawnAmounts;
|
||||
}
|
||||
|
||||
public void setSpawnAmounts(int spawnAmounts) {
|
||||
public void setSpawnAmounts(final int spawnAmounts) {
|
||||
this.spawnAmounts = spawnAmounts;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class QuestMob {
|
|||
return inventory;
|
||||
}
|
||||
|
||||
public void setInventory(ItemStack[] inventory) {
|
||||
public void setInventory(final ItemStack[] inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
|
@ -86,45 +86,45 @@ public class QuestMob {
|
|||
return dropChances;
|
||||
}
|
||||
|
||||
public void setDropChances(Float[] dropChances) {
|
||||
public void setDropChances(final Float[] dropChances) {
|
||||
this.dropChances = dropChances;
|
||||
}
|
||||
|
||||
public void setHelmet(ItemStack helmet, float dropChance) {
|
||||
public void setHelmet(final ItemStack helmet, final float dropChance) {
|
||||
inventory[4] = helmet;
|
||||
dropChances[4] = dropChance;
|
||||
}
|
||||
|
||||
public void setChest(ItemStack chest, float dropChance) {
|
||||
public void setChest(final ItemStack chest, final float dropChance) {
|
||||
inventory[3] = chest;
|
||||
dropChances[3] = dropChance;
|
||||
}
|
||||
|
||||
public void setLeggings(ItemStack leggings, float dropChance) {
|
||||
public void setLeggings(final ItemStack leggings, final float dropChance) {
|
||||
inventory[2] = leggings;
|
||||
dropChances[2] = dropChance;
|
||||
}
|
||||
|
||||
public void setBoots(ItemStack boots, float dropChance) {
|
||||
public void setBoots(final ItemStack boots, final float dropChance) {
|
||||
inventory[1] = boots;
|
||||
dropChances[1] = dropChance;
|
||||
}
|
||||
|
||||
public void setHeldItem(ItemStack heldItem, float dropChance) {
|
||||
public void setHeldItem(final ItemStack heldItem, final float dropChance) {
|
||||
inventory[0] = heldItem;
|
||||
dropChances[0] = dropChance;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void spawn() {
|
||||
World world = spawnLocation.getWorld();
|
||||
final World world = spawnLocation.getWorld();
|
||||
for (int i = 0; i < spawnAmounts; i++) {
|
||||
LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLocation, entityType);
|
||||
final LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLocation, entityType);
|
||||
if (name != null) {
|
||||
entity.setCustomName(name);
|
||||
entity.setCustomNameVisible(true);
|
||||
}
|
||||
EntityEquipment eq = entity.getEquipment();
|
||||
final EntityEquipment eq = entity.getEquipment();
|
||||
eq.setItemInHand(inventory[0]);
|
||||
eq.setBoots(inventory[1]);
|
||||
eq.setLeggings(inventory[2]);
|
||||
|
@ -183,15 +183,15 @@ public class QuestMob {
|
|||
return string;
|
||||
}
|
||||
|
||||
public static QuestMob fromString(String str) {
|
||||
public static QuestMob fromString(final String str) {
|
||||
String name = null;
|
||||
EntityType entityType = null;
|
||||
Location loc = null;
|
||||
Integer amounts = null;
|
||||
ItemStack[] inventory = new ItemStack[5];
|
||||
Float[] dropChances = new Float[5];
|
||||
String[] args = str.split("::");
|
||||
for (String string : args) {
|
||||
final ItemStack[] inventory = new ItemStack[5];
|
||||
final Float[] dropChances = new Float[5];
|
||||
final String[] args = str.split("::");
|
||||
for (final String string : args) {
|
||||
if (string.startsWith("type-")) {
|
||||
entityType = MiscUtil.getProperMobType(string.substring(5));
|
||||
} else if (string.startsWith("name-")) {
|
||||
|
@ -205,7 +205,7 @@ public class QuestMob {
|
|||
} else if (string.startsWith("hand_drop-")) {
|
||||
try {
|
||||
dropChances[0] = Float.parseFloat(string.substring(10));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for hand was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[0] = 1.0f;
|
||||
|
@ -215,7 +215,7 @@ public class QuestMob {
|
|||
} else if (string.startsWith("boots_drop-")) {
|
||||
try {
|
||||
dropChances[1] = Float.parseFloat(string.substring(11));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for boots was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[1] = 1.0f;
|
||||
|
@ -225,7 +225,7 @@ public class QuestMob {
|
|||
} else if (string.startsWith("leggings_drop-")) {
|
||||
try {
|
||||
dropChances[2] = Float.parseFloat(string.substring(14));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for leggings was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[2] = 1.0f;
|
||||
|
@ -235,7 +235,7 @@ public class QuestMob {
|
|||
} else if (string.startsWith("chest_drop-")) {
|
||||
try {
|
||||
dropChances[3] = Float.parseFloat(string.substring(11));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for chest was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[3] = 1.0f;
|
||||
|
@ -245,14 +245,14 @@ public class QuestMob {
|
|||
} else if (string.startsWith("helmet_drop-")) {
|
||||
try {
|
||||
dropChances[4] = Float.parseFloat(string.substring(12));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
Bukkit.getLogger().info("Drop chance for helmet was required, but left empty."
|
||||
+ " Setting to 1.0");
|
||||
dropChances[4] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
QuestMob qm = new QuestMob(entityType, loc, amounts);
|
||||
final QuestMob qm = new QuestMob(entityType, loc, amounts);
|
||||
qm.setName(name);
|
||||
qm.inventory = inventory;
|
||||
qm.dropChances = dropChances;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -37,79 +37,79 @@ public class Requirements {
|
|||
public int getMoney() {
|
||||
return money;
|
||||
}
|
||||
public void setMoney(int money) {
|
||||
public void setMoney(final int money) {
|
||||
this.money = money;
|
||||
}
|
||||
public int getQuestPoints() {
|
||||
return questPoints;
|
||||
}
|
||||
public void setQuestPoints(int questPoints) {
|
||||
public void setQuestPoints(final int questPoints) {
|
||||
this.questPoints = questPoints;
|
||||
}
|
||||
public List<ItemStack> getItems() {
|
||||
return items;
|
||||
}
|
||||
public void setItems(List<ItemStack> items) {
|
||||
public void setItems(final List<ItemStack> items) {
|
||||
this.items = items;
|
||||
}
|
||||
public List<Boolean> getRemoveItems() {
|
||||
return removeItems;
|
||||
}
|
||||
public void setRemoveItems(List<Boolean> removeItems) {
|
||||
public void setRemoveItems(final List<Boolean> removeItems) {
|
||||
this.removeItems = removeItems;
|
||||
}
|
||||
public List<String> getNeededQuests() {
|
||||
return neededQuests;
|
||||
}
|
||||
public void setNeededQuests(List<String> neededQuests) {
|
||||
public void setNeededQuests(final List<String> neededQuests) {
|
||||
this.neededQuests = neededQuests;
|
||||
}
|
||||
public List<String> getBlockQuests() {
|
||||
return blockQuests;
|
||||
}
|
||||
public void setBlockQuests(List<String> blockQuests) {
|
||||
public void setBlockQuests(final List<String> blockQuests) {
|
||||
this.blockQuests = blockQuests;
|
||||
}
|
||||
public List<String> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void setPermissions(List<String> permissions) {
|
||||
public void setPermissions(final List<String> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
public List<String> getMcmmoSkills() {
|
||||
return mcmmoSkills;
|
||||
}
|
||||
public void setMcmmoSkills(List<String> mcmmoSkills) {
|
||||
public void setMcmmoSkills(final List<String> mcmmoSkills) {
|
||||
this.mcmmoSkills = mcmmoSkills;
|
||||
}
|
||||
public List<Integer> getMcmmoAmounts() {
|
||||
return mcmmoAmounts;
|
||||
}
|
||||
public void setMcmmoAmounts(List<Integer> mcmmoAmounts) {
|
||||
public void setMcmmoAmounts(final List<Integer> mcmmoAmounts) {
|
||||
this.mcmmoAmounts = mcmmoAmounts;
|
||||
}
|
||||
public String getHeroesPrimaryClass() {
|
||||
return heroesPrimaryClass;
|
||||
}
|
||||
public void setHeroesPrimaryClass(String heroesPrimaryClass) {
|
||||
public void setHeroesPrimaryClass(final String heroesPrimaryClass) {
|
||||
this.heroesPrimaryClass = heroesPrimaryClass;
|
||||
}
|
||||
public String getHeroesSecondaryClass() {
|
||||
return heroesSecondaryClass;
|
||||
}
|
||||
public void setHeroesSecondaryClass(String heroesSecondaryClass) {
|
||||
public void setHeroesSecondaryClass(final String heroesSecondaryClass) {
|
||||
this.heroesSecondaryClass = heroesSecondaryClass;
|
||||
}
|
||||
public Map<String, Map<String, Object>> getCustomRequirements() {
|
||||
return customRequirements;
|
||||
}
|
||||
protected void setCustomRequirements(Map<String, Map<String, Object>> customRequirements) {
|
||||
protected void setCustomRequirements(final Map<String, Map<String, Object>> customRequirements) {
|
||||
this.customRequirements = customRequirements;
|
||||
}
|
||||
public List<String> getDetailsOverride() {
|
||||
return detailsOverride;
|
||||
}
|
||||
public void setDetailsOverride(List<String> detailsOverride) {
|
||||
public void setDetailsOverride(final List<String> detailsOverride) {
|
||||
this.detailsOverride = detailsOverride;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,91 +39,91 @@ public class Rewards {
|
|||
public int getMoney() {
|
||||
return money;
|
||||
}
|
||||
public void setMoney(int money) {
|
||||
public void setMoney(final int money) {
|
||||
this.money = money;
|
||||
}
|
||||
public int getQuestPoints() {
|
||||
return questPoints;
|
||||
}
|
||||
public void setQuestPoints(int questPoints) {
|
||||
public void setQuestPoints(final int questPoints) {
|
||||
this.questPoints = questPoints;
|
||||
}
|
||||
public int getExp() {
|
||||
return exp;
|
||||
}
|
||||
public void setExp(int exp) {
|
||||
public void setExp(final int exp) {
|
||||
this.exp = exp;
|
||||
}
|
||||
public List<String> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
public void setCommands(List<String> commands) {
|
||||
public void setCommands(final List<String> commands) {
|
||||
this.commands = commands;
|
||||
}
|
||||
public List<String> getCommandsOverrideDisplay() {
|
||||
return commandsOverrideDisplay;
|
||||
}
|
||||
public void setCommandsOverrideDisplay(List<String> commandsOverrideDisplay) {
|
||||
public void setCommandsOverrideDisplay(final List<String> commandsOverrideDisplay) {
|
||||
this.commandsOverrideDisplay = commandsOverrideDisplay;
|
||||
}
|
||||
public List<String> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void setPermissions(List<String> permissions) {
|
||||
public void setPermissions(final List<String> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
public List<String> getPermissionWorlds() {
|
||||
return permissionWorlds;
|
||||
}
|
||||
public void setPermissionWorlds(List<String> worldNames) {
|
||||
public void setPermissionWorlds(final List<String> worldNames) {
|
||||
this.permissionWorlds = worldNames;
|
||||
}
|
||||
public List<ItemStack> getItems() {
|
||||
return items;
|
||||
}
|
||||
public void setItems(List<ItemStack> items) {
|
||||
public void setItems(final List<ItemStack> items) {
|
||||
this.items = items;
|
||||
}
|
||||
public List<String> getMcmmoSkills() {
|
||||
return mcmmoSkills;
|
||||
}
|
||||
public void setMcmmoSkills(List<String> mcmmoSkills) {
|
||||
public void setMcmmoSkills(final List<String> mcmmoSkills) {
|
||||
this.mcmmoSkills = mcmmoSkills;
|
||||
}
|
||||
public List<Integer> getMcmmoAmounts() {
|
||||
return mcmmoAmounts;
|
||||
}
|
||||
public void setMcmmoAmounts(List<Integer> mcmmoAmounts) {
|
||||
public void setMcmmoAmounts(final List<Integer> mcmmoAmounts) {
|
||||
this.mcmmoAmounts = mcmmoAmounts;
|
||||
}
|
||||
public List<String> getHeroesClasses() {
|
||||
return heroesClasses;
|
||||
}
|
||||
public void setHeroesClasses(List<String> heroesClasses) {
|
||||
public void setHeroesClasses(final List<String> heroesClasses) {
|
||||
this.heroesClasses = heroesClasses;
|
||||
}
|
||||
public List<Double> getHeroesAmounts() {
|
||||
return heroesAmounts;
|
||||
}
|
||||
public void setHeroesAmounts(List<Double> heroesAmounts) {
|
||||
public void setHeroesAmounts(final List<Double> heroesAmounts) {
|
||||
this.heroesAmounts = heroesAmounts;
|
||||
}
|
||||
public List<String> getPhatLoots() {
|
||||
return phatLoots;
|
||||
}
|
||||
public void setPhatLoots(List<String> phatLoots) {
|
||||
public void setPhatLoots(final List<String> phatLoots) {
|
||||
this.phatLoots = phatLoots;
|
||||
}
|
||||
public Map<String, Map<String, Object>> getCustomRewards() {
|
||||
return customRewards;
|
||||
}
|
||||
protected void setCustomRewards(Map<String, Map<String, Object>> customRewards) {
|
||||
protected void setCustomRewards(final Map<String, Map<String, Object>> customRewards) {
|
||||
this.customRewards = customRewards;
|
||||
}
|
||||
public List<String> getDetailsOverride() {
|
||||
return detailsOverride;
|
||||
}
|
||||
public void setDetailsOverride(List<String> detailsOverride) {
|
||||
public void setDetailsOverride(final List<String> detailsOverride) {
|
||||
this.detailsOverride = detailsOverride;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,121 +41,121 @@ public class Settings {
|
|||
private boolean translateNames = false;
|
||||
private boolean translateSubCommands = false;
|
||||
|
||||
public Settings(Quests plugin) {
|
||||
public Settings(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public int getAcceptTimeout() {
|
||||
return acceptTimeout;
|
||||
}
|
||||
public void setAcceptTimeout(int acceptTimeout) {
|
||||
public void setAcceptTimeout(final int acceptTimeout) {
|
||||
this.acceptTimeout = acceptTimeout;
|
||||
}
|
||||
public boolean canAllowCommands() {
|
||||
return allowCommands;
|
||||
}
|
||||
public void setAllowCommands(boolean allowCommands) {
|
||||
public void setAllowCommands(final boolean allowCommands) {
|
||||
this.allowCommands = allowCommands;
|
||||
}
|
||||
public boolean canAllowCommandsForNpcQuests() {
|
||||
return allowCommandsForNpcQuests;
|
||||
}
|
||||
public void setAllowCommandsForNpcQuests(boolean allowCommandsForNpcQuests) {
|
||||
public void setAllowCommandsForNpcQuests(final boolean allowCommandsForNpcQuests) {
|
||||
this.allowCommandsForNpcQuests = allowCommandsForNpcQuests;
|
||||
}
|
||||
public boolean canAllowPranks() {
|
||||
return allowPranks;
|
||||
}
|
||||
public void setAllowPranks(boolean allowPranks) {
|
||||
public void setAllowPranks(final boolean allowPranks) {
|
||||
this.allowPranks = allowPranks;
|
||||
}
|
||||
public boolean canAskConfirmation() {
|
||||
return askConfirmation;
|
||||
}
|
||||
public void setAskConfirmation(boolean askConfirmation) {
|
||||
public void setAskConfirmation(final boolean askConfirmation) {
|
||||
this.askConfirmation = askConfirmation;
|
||||
}
|
||||
public boolean canGenFilesOnJoin() {
|
||||
return genFilesOnJoin;
|
||||
}
|
||||
public void setGenFilesOnJoin(boolean genFilesOnJoin) {
|
||||
public void setGenFilesOnJoin(final boolean genFilesOnJoin) {
|
||||
this.genFilesOnJoin = genFilesOnJoin;
|
||||
}
|
||||
public boolean canIgnoreLockedQuests() {
|
||||
return ignoreLockedQuests;
|
||||
}
|
||||
public void setIgnoreLockedQuests(boolean ignoreLockedQuests) {
|
||||
public void setIgnoreLockedQuests(final boolean ignoreLockedQuests) {
|
||||
this.ignoreLockedQuests = ignoreLockedQuests;
|
||||
}
|
||||
public int getKillDelay() {
|
||||
return killDelay;
|
||||
}
|
||||
public void setKillDelay(int killDelay) {
|
||||
public void setKillDelay(final int killDelay) {
|
||||
this.killDelay = killDelay;
|
||||
}
|
||||
public int getMaxQuests() {
|
||||
return maxQuests;
|
||||
}
|
||||
public void setMaxQuests(int maxQuests) {
|
||||
public void setMaxQuests(final int maxQuests) {
|
||||
this.maxQuests = maxQuests;
|
||||
}
|
||||
public boolean canNpcEffects() {
|
||||
return npcEffects;
|
||||
}
|
||||
public void setNpcEffects(boolean npcEffects) {
|
||||
public void setNpcEffects(final boolean npcEffects) {
|
||||
this.npcEffects = npcEffects;
|
||||
}
|
||||
public String getEffect() {
|
||||
return effect;
|
||||
}
|
||||
public void setEffect(String effect) {
|
||||
public void setEffect(final String effect) {
|
||||
this.effect = effect;
|
||||
}
|
||||
public String getRedoEffect() {
|
||||
return redoEffect;
|
||||
}
|
||||
public void setRedoEffect(String redoEffect) {
|
||||
public void setRedoEffect(final String redoEffect) {
|
||||
this.redoEffect = redoEffect;
|
||||
}
|
||||
public boolean canShowQuestReqs() {
|
||||
return showQuestReqs;
|
||||
}
|
||||
public void setShowQuestReqs(boolean showQuestReqs) {
|
||||
public void setShowQuestReqs(final boolean showQuestReqs) {
|
||||
this.showQuestReqs = showQuestReqs;
|
||||
}
|
||||
public boolean canShowQuestTitles() {
|
||||
return showQuestTitles;
|
||||
}
|
||||
public void setShowQuestTitles(boolean showQuestTitles) {
|
||||
public void setShowQuestTitles(final boolean showQuestTitles) {
|
||||
this.showQuestTitles = showQuestTitles;
|
||||
}
|
||||
public int getStrictPlayerMovement() {
|
||||
return strictPlayerMovement;
|
||||
}
|
||||
public void setStrictPlayerMovement(int strictPlayerMovement) {
|
||||
public void setStrictPlayerMovement(final int strictPlayerMovement) {
|
||||
this.strictPlayerMovement = strictPlayerMovement;
|
||||
}
|
||||
public int getTopLimit() {
|
||||
return topLimit;
|
||||
}
|
||||
public void setTopLimit(int topLimit) {
|
||||
public void setTopLimit(final int topLimit) {
|
||||
this.topLimit = topLimit;
|
||||
}
|
||||
public boolean canTranslateNames() {
|
||||
return translateNames;
|
||||
}
|
||||
public void setTranslateNames(boolean translateItems) {
|
||||
public void setTranslateNames(final boolean translateItems) {
|
||||
this.translateNames = translateItems;
|
||||
}
|
||||
public boolean canTranslateSubCommands() {
|
||||
return translateSubCommands;
|
||||
}
|
||||
public void setTranslateSubCommands(boolean translateSubCommands) {
|
||||
public void setTranslateSubCommands(final boolean translateSubCommands) {
|
||||
this.translateSubCommands = translateSubCommands;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
FileConfiguration config = plugin.getConfig();
|
||||
final FileConfiguration config = plugin.getConfig();
|
||||
acceptTimeout = config.getInt("accept-timeout", 20);
|
||||
allowCommands = config.getBoolean("allow-command-questing", true);
|
||||
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false);
|
||||
|
@ -182,7 +182,7 @@ public class Settings {
|
|||
translateSubCommands = config.getBoolean("translate-subcommands", false);
|
||||
try {
|
||||
config.save(new File(plugin.getDataFolder(), "config.yml"));
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,12 +51,13 @@ public class Stage {
|
|||
private static final long serialVersionUID = -2774443496142382127L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(final Object o) {
|
||||
if (o instanceof LinkedList) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
|
||||
for (Integer i : this) {
|
||||
Integer other = otherList.get(this.indexOf(i));
|
||||
for (final Integer i : this) {
|
||||
final Integer other = otherList.get(this.indexOf(i));
|
||||
if (!other.equals(i)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -71,12 +72,13 @@ public class Stage {
|
|||
private static final long serialVersionUID = -4086855121042524435L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(final Object o) {
|
||||
if (o instanceof LinkedList) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
|
||||
for (Integer i : this) {
|
||||
Integer other = otherList.get(this.indexOf(i));
|
||||
for (final Integer i : this) {
|
||||
final Integer other = otherList.get(this.indexOf(i));
|
||||
if (!other.equals(i)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -90,12 +92,13 @@ public class Stage {
|
|||
private static final long serialVersionUID = 7705964814014176415L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(final Object o) {
|
||||
if (o instanceof LinkedList) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
LinkedList<Integer> otherList = (LinkedList<Integer>) o;
|
||||
for (Integer i : this) {
|
||||
Integer other = otherList.get(this.indexOf(i));
|
||||
for (final Integer i : this) {
|
||||
final Integer other = otherList.get(this.indexOf(i));
|
||||
if (!other.equals(i)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -140,7 +143,7 @@ public class Stage {
|
|||
return blocksToBreak;
|
||||
}
|
||||
|
||||
public void setBlocksToBreak(LinkedList<ItemStack> blocksToBreak) {
|
||||
public void setBlocksToBreak(final LinkedList<ItemStack> blocksToBreak) {
|
||||
this.blocksToBreak = blocksToBreak;
|
||||
}
|
||||
|
||||
|
@ -148,7 +151,7 @@ public class Stage {
|
|||
return blocksToDamage;
|
||||
}
|
||||
|
||||
public void setBlocksToDamage(LinkedList<ItemStack> blocksToDamage) {
|
||||
public void setBlocksToDamage(final LinkedList<ItemStack> blocksToDamage) {
|
||||
this.blocksToDamage = blocksToDamage;
|
||||
}
|
||||
|
||||
|
@ -156,7 +159,7 @@ public class Stage {
|
|||
return blocksToPlace;
|
||||
}
|
||||
|
||||
public void setBlocksToPlace(LinkedList<ItemStack> blocksToPlace) {
|
||||
public void setBlocksToPlace(final LinkedList<ItemStack> blocksToPlace) {
|
||||
this.blocksToPlace = blocksToPlace;
|
||||
}
|
||||
|
||||
|
@ -164,7 +167,7 @@ public class Stage {
|
|||
return blocksToUse;
|
||||
}
|
||||
|
||||
public void setBlocksToUse(LinkedList<ItemStack> blocksToUse) {
|
||||
public void setBlocksToUse(final LinkedList<ItemStack> blocksToUse) {
|
||||
this.blocksToUse = blocksToUse;
|
||||
}
|
||||
|
||||
|
@ -172,7 +175,7 @@ public class Stage {
|
|||
return blocksToCut;
|
||||
}
|
||||
|
||||
public void setBlocksToCut(LinkedList<ItemStack> blocksToCut) {
|
||||
public void setBlocksToCut(final LinkedList<ItemStack> blocksToCut) {
|
||||
this.blocksToCut = blocksToCut;
|
||||
}
|
||||
|
||||
|
@ -180,7 +183,7 @@ public class Stage {
|
|||
return cowsToMilk;
|
||||
}
|
||||
|
||||
public void setCowsToMilk(Integer cowsToMilk) {
|
||||
public void setCowsToMilk(final Integer cowsToMilk) {
|
||||
this.cowsToMilk = cowsToMilk;
|
||||
}
|
||||
|
||||
|
@ -188,7 +191,7 @@ public class Stage {
|
|||
return fishToCatch;
|
||||
}
|
||||
|
||||
public void setFishToCatch(Integer fishToCatch) {
|
||||
public void setFishToCatch(final Integer fishToCatch) {
|
||||
this.fishToCatch = fishToCatch;
|
||||
}
|
||||
|
||||
|
@ -196,7 +199,7 @@ public class Stage {
|
|||
return playersToKill;
|
||||
}
|
||||
|
||||
public void setPlayersToKill(Integer playersToKill) {
|
||||
public void setPlayersToKill(final Integer playersToKill) {
|
||||
this.playersToKill = playersToKill;
|
||||
}
|
||||
|
||||
|
@ -204,7 +207,7 @@ public class Stage {
|
|||
return itemsToCraft;
|
||||
}
|
||||
|
||||
public void setItemsToCraft(LinkedList<ItemStack> itemsToCraft) {
|
||||
public void setItemsToCraft(final LinkedList<ItemStack> itemsToCraft) {
|
||||
this.itemsToCraft = itemsToCraft;
|
||||
}
|
||||
|
||||
|
@ -212,7 +215,7 @@ public class Stage {
|
|||
return itemsToSmelt;
|
||||
}
|
||||
|
||||
public void setItemsToSmelt(LinkedList<ItemStack> itemsToSmelt) {
|
||||
public void setItemsToSmelt(final LinkedList<ItemStack> itemsToSmelt) {
|
||||
this.itemsToSmelt = itemsToSmelt;
|
||||
}
|
||||
|
||||
|
@ -221,7 +224,7 @@ public class Stage {
|
|||
}
|
||||
|
||||
public void setItemsToEnchant(
|
||||
Map<Map<Enchantment, Material>, Integer> itemsToEnchant) {
|
||||
final Map<Map<Enchantment, Material>, Integer> itemsToEnchant) {
|
||||
this.itemsToEnchant = itemsToEnchant;
|
||||
}
|
||||
|
||||
|
@ -229,7 +232,7 @@ public class Stage {
|
|||
return itemsToBrew;
|
||||
}
|
||||
|
||||
public void setItemsToBrew(LinkedList<ItemStack> itemsToBrew) {
|
||||
public void setItemsToBrew(final LinkedList<ItemStack> itemsToBrew) {
|
||||
this.itemsToBrew = itemsToBrew;
|
||||
}
|
||||
|
||||
|
@ -237,7 +240,7 @@ public class Stage {
|
|||
return itemsToBrew;
|
||||
}
|
||||
|
||||
public void setItemsToConsume(LinkedList<ItemStack> itemsToBrew) {
|
||||
public void setItemsToConsume(final LinkedList<ItemStack> itemsToBrew) {
|
||||
this.itemsToBrew = itemsToBrew;
|
||||
}
|
||||
|
||||
|
@ -245,7 +248,7 @@ public class Stage {
|
|||
return itemsToDeliver;
|
||||
}
|
||||
|
||||
public void setItemsToDeliver(LinkedList<ItemStack> itemsToDeliver) {
|
||||
public void setItemsToDeliver(final LinkedList<ItemStack> itemsToDeliver) {
|
||||
this.itemsToDeliver = itemsToDeliver;
|
||||
}
|
||||
|
||||
|
@ -253,7 +256,7 @@ public class Stage {
|
|||
return itemDeliveryTargets;
|
||||
}
|
||||
|
||||
public void setItemDeliveryTargets(LinkedList<Integer> itemDeliveryTargets) {
|
||||
public void setItemDeliveryTargets(final LinkedList<Integer> itemDeliveryTargets) {
|
||||
this.itemDeliveryTargets = itemDeliveryTargets;
|
||||
}
|
||||
|
||||
|
@ -261,7 +264,7 @@ public class Stage {
|
|||
return deliverMessages;
|
||||
}
|
||||
|
||||
public void setDeliverMessages(LinkedList<String> deliverMessages) {
|
||||
public void setDeliverMessages(final LinkedList<String> deliverMessages) {
|
||||
this.deliverMessages = deliverMessages;
|
||||
}
|
||||
|
||||
|
@ -269,7 +272,7 @@ public class Stage {
|
|||
return citizensToInteract;
|
||||
}
|
||||
|
||||
public void setCitizensToInteract(LinkedList<Integer> citizensToInteract) {
|
||||
public void setCitizensToInteract(final LinkedList<Integer> citizensToInteract) {
|
||||
this.citizensToInteract = citizensToInteract;
|
||||
}
|
||||
|
||||
|
@ -277,7 +280,7 @@ public class Stage {
|
|||
return citizensToKill;
|
||||
}
|
||||
|
||||
public void setCitizensToKill(LinkedList<Integer> citizensToKill) {
|
||||
public void setCitizensToKill(final LinkedList<Integer> citizensToKill) {
|
||||
this.citizensToKill = citizensToKill;
|
||||
}
|
||||
|
||||
|
@ -285,7 +288,7 @@ public class Stage {
|
|||
return citizenNumToKill;
|
||||
}
|
||||
|
||||
public void setCitizenNumToKill(LinkedList<Integer> citizenNumToKill) {
|
||||
public void setCitizenNumToKill(final LinkedList<Integer> citizenNumToKill) {
|
||||
this.citizenNumToKill = citizenNumToKill;
|
||||
}
|
||||
|
||||
|
@ -293,7 +296,7 @@ public class Stage {
|
|||
return mobsToKill;
|
||||
}
|
||||
|
||||
public void setMobsToKill(LinkedList<EntityType> mobsToKill) {
|
||||
public void setMobsToKill(final LinkedList<EntityType> mobsToKill) {
|
||||
this.mobsToKill = mobsToKill;
|
||||
}
|
||||
|
||||
|
@ -301,7 +304,7 @@ public class Stage {
|
|||
return mobNumToKill;
|
||||
}
|
||||
|
||||
public void setMobNumToKill(LinkedList<Integer> mobNumToKill) {
|
||||
public void setMobNumToKill(final LinkedList<Integer> mobNumToKill) {
|
||||
this.mobNumToKill = mobNumToKill;
|
||||
}
|
||||
|
||||
|
@ -309,7 +312,7 @@ public class Stage {
|
|||
return locationsToKillWithin;
|
||||
}
|
||||
|
||||
public void setLocationsToKillWithin(LinkedList<Location> locationsToKillWithin) {
|
||||
public void setLocationsToKillWithin(final LinkedList<Location> locationsToKillWithin) {
|
||||
this.locationsToKillWithin = locationsToKillWithin;
|
||||
}
|
||||
|
||||
|
@ -317,7 +320,7 @@ public class Stage {
|
|||
return radiiToKillWithin;
|
||||
}
|
||||
|
||||
public void setRadiiToKillWithin(LinkedList<Integer> radiiToKillWithin) {
|
||||
public void setRadiiToKillWithin(final LinkedList<Integer> radiiToKillWithin) {
|
||||
this.radiiToKillWithin = radiiToKillWithin;
|
||||
}
|
||||
|
||||
|
@ -325,7 +328,7 @@ public class Stage {
|
|||
return killNames;
|
||||
}
|
||||
|
||||
public void setKillNames(LinkedList<String> killNames) {
|
||||
public void setKillNames(final LinkedList<String> killNames) {
|
||||
this.killNames = killNames;
|
||||
}
|
||||
|
||||
|
@ -333,7 +336,7 @@ public class Stage {
|
|||
return locationsToReach;
|
||||
}
|
||||
|
||||
public void setLocationsToReach(LinkedList<Location> locationsToReach) {
|
||||
public void setLocationsToReach(final LinkedList<Location> locationsToReach) {
|
||||
this.locationsToReach = locationsToReach;
|
||||
}
|
||||
|
||||
|
@ -341,7 +344,7 @@ public class Stage {
|
|||
return radiiToReachWithin;
|
||||
}
|
||||
|
||||
public void setRadiiToReachWithin(LinkedList<Integer> radiiToReachWithin) {
|
||||
public void setRadiiToReachWithin(final LinkedList<Integer> radiiToReachWithin) {
|
||||
this.radiiToReachWithin = radiiToReachWithin;
|
||||
}
|
||||
|
||||
|
@ -349,7 +352,7 @@ public class Stage {
|
|||
return worldsToReachWithin;
|
||||
}
|
||||
|
||||
public void setWorldsToReachWithin(LinkedList<World> worldsToReachWithin) {
|
||||
public void setWorldsToReachWithin(final LinkedList<World> worldsToReachWithin) {
|
||||
this.worldsToReachWithin = worldsToReachWithin;
|
||||
}
|
||||
|
||||
|
@ -357,7 +360,7 @@ public class Stage {
|
|||
return locationNames;
|
||||
}
|
||||
|
||||
public void setLocationNames(LinkedList<String> locationNames) {
|
||||
public void setLocationNames(final LinkedList<String> locationNames) {
|
||||
this.locationNames = locationNames;
|
||||
}
|
||||
|
||||
|
@ -365,7 +368,7 @@ public class Stage {
|
|||
return mobsToTame;
|
||||
}
|
||||
|
||||
public void setMobsToTame(Map<EntityType, Integer> mobsToTame) {
|
||||
public void setMobsToTame(final Map<EntityType, Integer> mobsToTame) {
|
||||
this.mobsToTame = mobsToTame;
|
||||
}
|
||||
|
||||
|
@ -373,7 +376,7 @@ public class Stage {
|
|||
return sheepToShear;
|
||||
}
|
||||
|
||||
public void setSheepToShear(Map<DyeColor, Integer> sheepToShear) {
|
||||
public void setSheepToShear(final Map<DyeColor, Integer> sheepToShear) {
|
||||
this.sheepToShear = sheepToShear;
|
||||
}
|
||||
|
||||
|
@ -381,7 +384,7 @@ public class Stage {
|
|||
return passwordDisplays;
|
||||
}
|
||||
|
||||
public void setPasswordDisplays(LinkedList<String> passwordDisplays) {
|
||||
public void setPasswordDisplays(final LinkedList<String> passwordDisplays) {
|
||||
this.passwordDisplays = passwordDisplays;
|
||||
}
|
||||
|
||||
|
@ -389,7 +392,7 @@ public class Stage {
|
|||
return passwordPhrases;
|
||||
}
|
||||
|
||||
public void setPasswordPhrases(LinkedList<LinkedList<String>> passwordPhrases) {
|
||||
public void setPasswordPhrases(final LinkedList<LinkedList<String>> passwordPhrases) {
|
||||
this.passwordPhrases = passwordPhrases;
|
||||
}
|
||||
|
||||
|
@ -397,7 +400,7 @@ public class Stage {
|
|||
return script;
|
||||
}
|
||||
|
||||
public void setScript(String script) {
|
||||
public void setScript(final String script) {
|
||||
this.script = script;
|
||||
}
|
||||
|
||||
|
@ -405,7 +408,7 @@ public class Stage {
|
|||
return startAction;
|
||||
}
|
||||
|
||||
public void setStartAction(Action startAction) {
|
||||
public void setStartAction(final Action startAction) {
|
||||
this.startAction = startAction;
|
||||
}
|
||||
|
||||
|
@ -413,7 +416,7 @@ public class Stage {
|
|||
return deathAction;
|
||||
}
|
||||
|
||||
public void setDeathAction(Action deathAction) {
|
||||
public void setDeathAction(final Action deathAction) {
|
||||
this.deathAction = deathAction;
|
||||
}
|
||||
|
||||
|
@ -421,7 +424,7 @@ public class Stage {
|
|||
return chatActions;
|
||||
}
|
||||
|
||||
public void setChatActions(Map<String, Action> chatActions) {
|
||||
public void setChatActions(final Map<String, Action> chatActions) {
|
||||
this.chatActions = chatActions;
|
||||
}
|
||||
|
||||
|
@ -429,7 +432,7 @@ public class Stage {
|
|||
return commandActions;
|
||||
}
|
||||
|
||||
public void setCommandActions(Map<String, Action> commandActions) {
|
||||
public void setCommandActions(final Map<String, Action> commandActions) {
|
||||
this.commandActions = commandActions;
|
||||
}
|
||||
|
||||
|
@ -437,7 +440,7 @@ public class Stage {
|
|||
return disconnectAction;
|
||||
}
|
||||
|
||||
public void setDisconnectAction(Action disconnectAction) {
|
||||
public void setDisconnectAction(final Action disconnectAction) {
|
||||
this.disconnectAction = disconnectAction;
|
||||
}
|
||||
|
||||
|
@ -445,7 +448,7 @@ public class Stage {
|
|||
return finishAction;
|
||||
}
|
||||
|
||||
public void setFinishAction(Action finishAction) {
|
||||
public void setFinishAction(final Action finishAction) {
|
||||
this.finishAction = finishAction;
|
||||
}
|
||||
|
||||
|
@ -453,7 +456,7 @@ public class Stage {
|
|||
return condition;
|
||||
}
|
||||
|
||||
public void setCondition(Condition condition) {
|
||||
public void setCondition(final Condition condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
|
@ -461,7 +464,7 @@ public class Stage {
|
|||
return delay;
|
||||
}
|
||||
|
||||
public void setDelay(long delay) {
|
||||
public void setDelay(final long delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
|
@ -469,7 +472,7 @@ public class Stage {
|
|||
return delayMessage;
|
||||
}
|
||||
|
||||
public void setDelayMessage(String delayMessage) {
|
||||
public void setDelayMessage(final String delayMessage) {
|
||||
this.delayMessage = delayMessage;
|
||||
}
|
||||
|
||||
|
@ -477,7 +480,7 @@ public class Stage {
|
|||
return completeMessage;
|
||||
}
|
||||
|
||||
public void setCompleteMessage(String completeMessage) {
|
||||
public void setCompleteMessage(final String completeMessage) {
|
||||
this.completeMessage = completeMessage;
|
||||
}
|
||||
|
||||
|
@ -485,7 +488,7 @@ public class Stage {
|
|||
return startMessage;
|
||||
}
|
||||
|
||||
public void setStartMessage(String startMessage) {
|
||||
public void setStartMessage(final String startMessage) {
|
||||
this.startMessage = startMessage;
|
||||
}
|
||||
|
||||
|
@ -493,7 +496,7 @@ public class Stage {
|
|||
return objectiveOverrides;
|
||||
}
|
||||
|
||||
public void setObjectiveOverrides(LinkedList<String> objectiveOverrides) {
|
||||
public void setObjectiveOverrides(final LinkedList<String> objectiveOverrides) {
|
||||
this.objectiveOverrides = objectiveOverrides;
|
||||
}
|
||||
|
||||
|
@ -556,7 +559,7 @@ public class Stage {
|
|||
* @param type The type of objective to check for
|
||||
* @return true if stage contains specified objective
|
||||
*/
|
||||
public boolean containsObjective(String type) {
|
||||
public boolean containsObjective(final String type) {
|
||||
if (type.equalsIgnoreCase("breakBlock")) {
|
||||
return !blocksToBreak.isEmpty();
|
||||
} else if (type.equalsIgnoreCase("damageBlock")) {
|
||||
|
|
|
@ -35,7 +35,7 @@ import me.blackvein.quests.util.Lang;
|
|||
|
||||
public class Action {
|
||||
|
||||
private Quests plugin;
|
||||
private final Quests plugin;
|
||||
private String name = "";
|
||||
protected String message = null;
|
||||
protected boolean clearInv = false;
|
||||
|
@ -54,9 +54,10 @@ public class Action {
|
|||
private static final long serialVersionUID = -761974607799449780L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(final Object o) {
|
||||
if (o instanceof LinkedList) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
LinkedList<QuestMob> other = (LinkedList<QuestMob>) o;
|
||||
if (size() != other.size()) {
|
||||
return false;
|
||||
|
@ -88,7 +89,7 @@ public class Action {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,7 @@ public class Action {
|
|||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
public void setMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@ public class Action {
|
|||
return clearInv;
|
||||
}
|
||||
|
||||
public void setClearInv(boolean clearInv) {
|
||||
public void setClearInv(final boolean clearInv) {
|
||||
this.clearInv = clearInv;
|
||||
}
|
||||
|
||||
|
@ -112,7 +113,7 @@ public class Action {
|
|||
return failQuest;
|
||||
}
|
||||
|
||||
public void setFailQuest(boolean failQuest) {
|
||||
public void setFailQuest(final boolean failQuest) {
|
||||
this.failQuest = failQuest;
|
||||
}
|
||||
|
||||
|
@ -120,7 +121,7 @@ public class Action {
|
|||
return explosions;
|
||||
}
|
||||
|
||||
public void setExplosions(LinkedList<Location> explosions) {
|
||||
public void setExplosions(final LinkedList<Location> explosions) {
|
||||
this.explosions = explosions;
|
||||
}
|
||||
|
||||
|
@ -128,7 +129,7 @@ public class Action {
|
|||
return effects;
|
||||
}
|
||||
|
||||
public void setEffects(Map<Location, Effect> effects) {
|
||||
public void setEffects(final Map<Location, Effect> effects) {
|
||||
this.effects = effects;
|
||||
}
|
||||
|
||||
|
@ -136,7 +137,7 @@ public class Action {
|
|||
return items;
|
||||
}
|
||||
|
||||
public void setItems(LinkedList<ItemStack> items) {
|
||||
public void setItems(final LinkedList<ItemStack> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
|
@ -144,7 +145,7 @@ public class Action {
|
|||
return stormWorld;
|
||||
}
|
||||
|
||||
public void setStormWorld(World stormWorld) {
|
||||
public void setStormWorld(final World stormWorld) {
|
||||
this.stormWorld = stormWorld;
|
||||
}
|
||||
|
||||
|
@ -152,7 +153,7 @@ public class Action {
|
|||
return stormDuration;
|
||||
}
|
||||
|
||||
public void setStormDuration(int stormDuration) {
|
||||
public void setStormDuration(final int stormDuration) {
|
||||
this.stormDuration = stormDuration;
|
||||
}
|
||||
|
||||
|
@ -160,7 +161,7 @@ public class Action {
|
|||
return thunderWorld;
|
||||
}
|
||||
|
||||
public void setThunderWorld(World thunderWorld) {
|
||||
public void setThunderWorld(final World thunderWorld) {
|
||||
this.thunderWorld = thunderWorld;
|
||||
}
|
||||
|
||||
|
@ -168,7 +169,7 @@ public class Action {
|
|||
return thunderDuration;
|
||||
}
|
||||
|
||||
public void setThunderDuration(int thunderDuration) {
|
||||
public void setThunderDuration(final int thunderDuration) {
|
||||
this.thunderDuration = thunderDuration;
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ public class Action {
|
|||
return timer;
|
||||
}
|
||||
|
||||
public void setTimer(int timer) {
|
||||
public void setTimer(final int timer) {
|
||||
this.timer = timer;
|
||||
}
|
||||
|
||||
|
@ -184,7 +185,7 @@ public class Action {
|
|||
return cancelTimer;
|
||||
}
|
||||
|
||||
public void setCancelTimer(boolean cancelTimer) {
|
||||
public void setCancelTimer(final boolean cancelTimer) {
|
||||
this.cancelTimer = cancelTimer;
|
||||
}
|
||||
|
||||
|
@ -192,7 +193,7 @@ public class Action {
|
|||
return mobSpawns;
|
||||
}
|
||||
|
||||
public void setMobSpawns(LinkedList<QuestMob> mobSpawns) {
|
||||
public void setMobSpawns(final LinkedList<QuestMob> mobSpawns) {
|
||||
this.mobSpawns = mobSpawns;
|
||||
}
|
||||
|
||||
|
@ -200,7 +201,7 @@ public class Action {
|
|||
return lightningStrikes;
|
||||
}
|
||||
|
||||
public void setLightningStrikes(LinkedList<Location> lightningStrikes) {
|
||||
public void setLightningStrikes(final LinkedList<Location> lightningStrikes) {
|
||||
this.lightningStrikes = lightningStrikes;
|
||||
}
|
||||
|
||||
|
@ -208,7 +209,7 @@ public class Action {
|
|||
return commands;
|
||||
}
|
||||
|
||||
public void setCommands(LinkedList<String> commands) {
|
||||
public void setCommands(final LinkedList<String> commands) {
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
|
@ -216,7 +217,7 @@ public class Action {
|
|||
return potionEffects;
|
||||
}
|
||||
|
||||
public void setPotionEffects(LinkedList<PotionEffect> potionEffects) {
|
||||
public void setPotionEffects(final LinkedList<PotionEffect> potionEffects) {
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,7 @@ public class Action {
|
|||
return hunger;
|
||||
}
|
||||
|
||||
public void setHunger(int hunger) {
|
||||
public void setHunger(final int hunger) {
|
||||
this.hunger = hunger;
|
||||
}
|
||||
|
||||
|
@ -232,7 +233,7 @@ public class Action {
|
|||
return saturation;
|
||||
}
|
||||
|
||||
public void setSaturation(int saturation) {
|
||||
public void setSaturation(final int saturation) {
|
||||
this.saturation = saturation;
|
||||
}
|
||||
|
||||
|
@ -240,7 +241,7 @@ public class Action {
|
|||
return health;
|
||||
}
|
||||
|
||||
public void setHealth(float health) {
|
||||
public void setHealth(final float health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
|
@ -248,7 +249,7 @@ public class Action {
|
|||
return teleport;
|
||||
}
|
||||
|
||||
public void setTeleport(Location teleport) {
|
||||
public void setTeleport(final Location teleport) {
|
||||
this.teleport = teleport;
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,7 @@ public class Action {
|
|||
return book;
|
||||
}
|
||||
|
||||
public void setBook(String book) {
|
||||
public void setBook(final String book) {
|
||||
this.book = book;
|
||||
}
|
||||
|
||||
|
@ -264,12 +265,12 @@ public class Action {
|
|||
return book;
|
||||
}
|
||||
|
||||
public void setDenizenScript(String scriptName) {
|
||||
public void setDenizenScript(final String scriptName) {
|
||||
this.denizenScript = scriptName;
|
||||
}
|
||||
|
||||
public void fire(Quester quester, Quest quest) {
|
||||
Player player = quester.getPlayer();
|
||||
public void fire(final Quester quester, final Quest quest) {
|
||||
final Player player = quester.getPlayer();
|
||||
if (message != null) {
|
||||
player.sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(message, quest, player));
|
||||
}
|
||||
|
@ -277,20 +278,20 @@ public class Action {
|
|||
player.getInventory().clear();
|
||||
}
|
||||
if (explosions.isEmpty() == false) {
|
||||
for (Location l : explosions) {
|
||||
for (final Location l : explosions) {
|
||||
l.getWorld().createExplosion(l, 4F, false);
|
||||
}
|
||||
}
|
||||
if (effects.isEmpty() == false) {
|
||||
for (Location l : effects.keySet()) {
|
||||
for (final Location l : effects.keySet()) {
|
||||
l.getWorld().playEffect(l, effects.get(l), 1);
|
||||
}
|
||||
}
|
||||
if (items.isEmpty() == false) {
|
||||
for (ItemStack is : items) {
|
||||
for (final ItemStack is : items) {
|
||||
try {
|
||||
InventoryUtil.addItem(player, is);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().severe("Unable to add null item to inventory of "
|
||||
+ player.getName() + " during quest " + quest.getName() + " event " + name);
|
||||
player.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
|
@ -307,23 +308,23 @@ public class Action {
|
|||
thunderWorld.setThunderDuration(thunderDuration);
|
||||
}
|
||||
if (mobSpawns.isEmpty() == false) {
|
||||
for (QuestMob questMob : mobSpawns) {
|
||||
for (final QuestMob questMob : mobSpawns) {
|
||||
questMob.spawn();
|
||||
}
|
||||
}
|
||||
if (lightningStrikes.isEmpty() == false) {
|
||||
for (Location l : lightningStrikes) {
|
||||
for (final Location l : lightningStrikes) {
|
||||
l.getWorld().strikeLightning(l);
|
||||
}
|
||||
}
|
||||
if (commands.isEmpty() == false) {
|
||||
for (String s : commands) {
|
||||
for (final String s : commands) {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
|
||||
s.replace("<player>", quester.getPlayer().getName()));
|
||||
}
|
||||
}
|
||||
if (potionEffects.isEmpty() == false) {
|
||||
for (PotionEffect p : potionEffects) {
|
||||
for (final PotionEffect p : potionEffects) {
|
||||
player.addPotionEffect(p);
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +392,7 @@ public class Action {
|
|||
.runTaskLater(plugin, timer*20).getTaskId(), quest);
|
||||
}
|
||||
if (cancelTimer) {
|
||||
for (Map.Entry<Integer, Quest> entry : quester.getTimers().entrySet()) {
|
||||
for (final Map.Entry<Integer, Quest> entry : quester.getTimers().entrySet()) {
|
||||
if (entry.getValue().getName().equals(quest.getName())) {
|
||||
plugin.getServer().getScheduler().cancelTask(entry.getKey());
|
||||
quester.getTimers().remove(entry.getKey());
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
private Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
||||
private List<String> editingActionNames = new LinkedList<String>();
|
||||
|
||||
public ActionFactory(Quests plugin) {
|
||||
public ActionFactory(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||
|
@ -74,7 +74,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
public void setSelectedExplosionLocations(
|
||||
Map<UUID, Block> selectedExplosionLocations) {
|
||||
final Map<UUID, Block> selectedExplosionLocations) {
|
||||
this.selectedExplosionLocations = selectedExplosionLocations;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
return selectedEffectLocations;
|
||||
}
|
||||
|
||||
public void setSelectedEffectLocations(Map<UUID, Block> selectedEffectLocations) {
|
||||
public void setSelectedEffectLocations(final Map<UUID, Block> selectedEffectLocations) {
|
||||
this.selectedEffectLocations = selectedEffectLocations;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
return selectedMobLocations;
|
||||
}
|
||||
|
||||
public void setSelectedMobLocations(Map<UUID, Block> selectedMobLocations) {
|
||||
public void setSelectedMobLocations(final Map<UUID, Block> selectedMobLocations) {
|
||||
this.selectedMobLocations = selectedMobLocations;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
public void setSelectedLightningLocations(
|
||||
Map<UUID, Block> selectedLightningLocations) {
|
||||
final Map<UUID, Block> selectedLightningLocations) {
|
||||
this.selectedLightningLocations = selectedLightningLocations;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
public void setSelectedTeleportLocations(
|
||||
Map<UUID, Block> selectedTeleportLocations) {
|
||||
final Map<UUID, Block> selectedTeleportLocations) {
|
||||
this.selectedTeleportLocations = selectedTeleportLocations;
|
||||
}
|
||||
|
||||
|
@ -120,13 +120,13 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
return editingActionNames;
|
||||
}
|
||||
|
||||
public void setNamesOfActionsBeingEdited(List<String> actionNames) {
|
||||
public void setNamesOfActionsBeingEdited(final List<String> actionNames) {
|
||||
this.editingActionNames = actionNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||
Player player = (Player) abandonedEvent.getContext().getForWhom();
|
||||
public void conversationAbandoned(final ConversationAbandonedEvent abandonedEvent) {
|
||||
final Player player = (Player) abandonedEvent.getContext().getForWhom();
|
||||
selectedExplosionLocations.remove(player.getUniqueId());
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
selectedMobLocations.remove(player.getUniqueId());
|
||||
|
@ -134,11 +134,11 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public Prompt returnToMenu(ConversationContext context) {
|
||||
public Prompt returnToMenu(final ConversationContext context) {
|
||||
return new ActionMainPrompt(context);
|
||||
}
|
||||
|
||||
public void loadData(Action event, ConversationContext context) {
|
||||
public void loadData(final Action event, final ConversationContext context) {
|
||||
if (event.message != null) {
|
||||
context.setSessionData(CK.E_MESSAGE, event.message);
|
||||
}
|
||||
|
@ -153,54 +153,54 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||
}
|
||||
if (event.items != null && event.items.isEmpty() == false) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.addAll(event.items);
|
||||
context.setSessionData(CK.E_ITEMS, items);
|
||||
}
|
||||
if (event.explosions != null && event.explosions.isEmpty() == false) {
|
||||
LinkedList<String> locs = new LinkedList<String>();
|
||||
for (Location loc : event.explosions) {
|
||||
final LinkedList<String> locs = new LinkedList<String>();
|
||||
for (final Location loc : event.explosions) {
|
||||
locs.add(ConfigUtil.getLocationInfo(loc));
|
||||
}
|
||||
context.setSessionData(CK.E_EXPLOSIONS, locs);
|
||||
}
|
||||
if (event.effects != null && event.effects.isEmpty() == false) {
|
||||
LinkedList<String> locs = new LinkedList<String>();
|
||||
LinkedList<String> effs = new LinkedList<String>();
|
||||
for (Entry<Location, Effect> e : event.effects.entrySet()) {
|
||||
locs.add(ConfigUtil.getLocationInfo((Location) e.getKey()));
|
||||
effs.add(((Effect) e.getValue()).toString());
|
||||
final LinkedList<String> locs = new LinkedList<String>();
|
||||
final LinkedList<String> effs = new LinkedList<String>();
|
||||
for (final Entry<Location, Effect> e : event.effects.entrySet()) {
|
||||
locs.add(ConfigUtil.getLocationInfo(e.getKey()));
|
||||
effs.add(e.getValue().toString());
|
||||
}
|
||||
context.setSessionData(CK.E_EFFECTS, effs);
|
||||
context.setSessionData(CK.E_EFFECTS_LOCATIONS, locs);
|
||||
}
|
||||
if (event.stormWorld != null) {
|
||||
context.setSessionData(CK.E_WORLD_STORM, event.stormWorld.getName());
|
||||
context.setSessionData(CK.E_WORLD_STORM_DURATION, (int) event.stormDuration);
|
||||
context.setSessionData(CK.E_WORLD_STORM_DURATION, event.stormDuration);
|
||||
}
|
||||
if (event.thunderWorld != null) {
|
||||
context.setSessionData(CK.E_WORLD_THUNDER, event.thunderWorld.getName());
|
||||
context.setSessionData(CK.E_WORLD_THUNDER_DURATION, (int) event.thunderDuration);
|
||||
context.setSessionData(CK.E_WORLD_THUNDER_DURATION, event.thunderDuration);
|
||||
}
|
||||
if (event.mobSpawns != null && event.mobSpawns.isEmpty() == false) {
|
||||
LinkedList<String> questMobs = new LinkedList<String>();
|
||||
for (QuestMob questMob : event.mobSpawns) {
|
||||
final LinkedList<String> questMobs = new LinkedList<String>();
|
||||
for (final QuestMob questMob : event.mobSpawns) {
|
||||
questMobs.add(questMob.serialize());
|
||||
}
|
||||
context.setSessionData(CK.E_MOB_TYPES, questMobs);
|
||||
}
|
||||
if (event.lightningStrikes != null && event.lightningStrikes.isEmpty() == false) {
|
||||
LinkedList<String> locs = new LinkedList<String>();
|
||||
for (Location loc : event.lightningStrikes) {
|
||||
final LinkedList<String> locs = new LinkedList<String>();
|
||||
for (final Location loc : event.lightningStrikes) {
|
||||
locs.add(ConfigUtil.getLocationInfo(loc));
|
||||
}
|
||||
context.setSessionData(CK.E_LIGHTNING, locs);
|
||||
}
|
||||
if (event.potionEffects != null && event.potionEffects.isEmpty() == false) {
|
||||
LinkedList<String> types = new LinkedList<String>();
|
||||
LinkedList<Long> durations = new LinkedList<Long>();
|
||||
LinkedList<Integer> mags = new LinkedList<Integer>();
|
||||
for (PotionEffect pe : event.potionEffects) {
|
||||
final LinkedList<String> types = new LinkedList<String>();
|
||||
final LinkedList<Long> durations = new LinkedList<Long>();
|
||||
final LinkedList<Integer> mags = new LinkedList<Integer>();
|
||||
for (final PotionEffect pe : event.potionEffects) {
|
||||
types.add(pe.getType().getName());
|
||||
durations.add((long) pe.getDuration());
|
||||
mags.add(pe.getAmplifier());
|
||||
|
@ -210,13 +210,13 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.E_POTION_STRENGHT, mags);
|
||||
}
|
||||
if (event.hunger > -1) {
|
||||
context.setSessionData(CK.E_HUNGER, (Integer) event.hunger);
|
||||
context.setSessionData(CK.E_HUNGER, event.hunger);
|
||||
}
|
||||
if (event.saturation > -1) {
|
||||
context.setSessionData(CK.E_SATURATION, (Integer) event.saturation);
|
||||
context.setSessionData(CK.E_SATURATION, event.saturation);
|
||||
}
|
||||
if (event.health > -1) {
|
||||
context.setSessionData(CK.E_HEALTH, (Float) event.health);
|
||||
context.setSessionData(CK.E_HEALTH, event.health);
|
||||
}
|
||||
if (event.teleport != null) {
|
||||
context.setSessionData(CK.E_TELEPORT, ConfigUtil.getLocationInfo(event.teleport));
|
||||
|
@ -232,7 +232,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void clearData(ConversationContext context) {
|
||||
public void clearData(final ConversationContext context) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, null);
|
||||
context.setSessionData(CK.E_NAME, null);
|
||||
context.setSessionData(CK.E_MESSAGE, null);
|
||||
|
@ -261,23 +261,23 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.E_CANCEL_TIMER, null);
|
||||
}
|
||||
|
||||
public void deleteAction(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
public void deleteAction(final ConversationContext context) {
|
||||
final YamlConfiguration data = new YamlConfiguration();
|
||||
final File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
try {
|
||||
data.load(actionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
}
|
||||
String action = (String) context.getSessionData(CK.ED_EVENT_DELETE);
|
||||
final String action = (String) context.getSessionData(CK.ED_EVENT_DELETE);
|
||||
String key = "actions";
|
||||
ConfigurationSection sec = data.getConfigurationSection(key);
|
||||
if (sec == null) {
|
||||
|
@ -287,12 +287,13 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
sec.set(action, null);
|
||||
try {
|
||||
data.save(actionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
public void execute(Boolean response) {
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@Override
|
||||
public void execute(final Boolean response) {
|
||||
if (!response) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("unknownError"));
|
||||
}
|
||||
|
@ -300,8 +301,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("eventEditorDeleted"));
|
||||
for (Quester q : plugin.getQuesters()) {
|
||||
for (Quest quest : q.getCurrentQuests().keySet()) {
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
}
|
||||
}
|
||||
|
@ -309,17 +310,17 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void saveAction(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
public void saveAction(final ConversationContext context) {
|
||||
final YamlConfiguration data = new YamlConfiguration();
|
||||
final File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
try {
|
||||
data.load(actionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
|
@ -333,54 +334,54 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
if (((String) context.getSessionData(CK.E_OLD_EVENT)).isEmpty() == false) {
|
||||
data.set(key + "." + (String) context.getSessionData(CK.E_OLD_EVENT), null);
|
||||
LinkedList<Action> temp = plugin.getActions();
|
||||
final LinkedList<Action> temp = plugin.getActions();
|
||||
temp.remove(plugin.getAction((String) context.getSessionData(CK.E_OLD_EVENT)));
|
||||
plugin.setActions(temp);
|
||||
}
|
||||
ConfigurationSection section = data.createSection(key + "." + (String) context.getSessionData(CK.E_NAME));
|
||||
editingActionNames.remove((String) context.getSessionData(CK.E_NAME));
|
||||
final ConfigurationSection section = data.createSection(key + "." + (String) context.getSessionData(CK.E_NAME));
|
||||
editingActionNames.remove(context.getSessionData(CK.E_NAME));
|
||||
if (context.getSessionData(CK.E_MESSAGE) != null) {
|
||||
section.set("message", (String) context.getSessionData(CK.E_MESSAGE));
|
||||
section.set("message", context.getSessionData(CK.E_MESSAGE));
|
||||
}
|
||||
if (context.getSessionData(CK.E_CLEAR_INVENTORY) != null) {
|
||||
String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
|
||||
final String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
section.set("clear-inventory", true);
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(CK.E_FAIL_QUEST) != null) {
|
||||
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
final String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
section.set("fail-quest", true);
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(CK.E_ITEMS) != null) {
|
||||
section.set("items", (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS));
|
||||
section.set("items", context.getSessionData(CK.E_ITEMS));
|
||||
}
|
||||
if (context.getSessionData(CK.E_EXPLOSIONS) != null) {
|
||||
section.set("explosions", (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS));
|
||||
section.set("explosions", context.getSessionData(CK.E_EXPLOSIONS));
|
||||
}
|
||||
if (context.getSessionData(CK.E_EFFECTS) != null) {
|
||||
section.set("effects", (LinkedList<String>) context.getSessionData(CK.E_EFFECTS));
|
||||
section.set("effect-locations", (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS));
|
||||
section.set("effects", context.getSessionData(CK.E_EFFECTS));
|
||||
section.set("effect-locations", context.getSessionData(CK.E_EFFECTS_LOCATIONS));
|
||||
}
|
||||
if (context.getSessionData(CK.E_WORLD_STORM) != null) {
|
||||
section.set("storm-world", (String) context.getSessionData(CK.E_WORLD_STORM));
|
||||
section.set("storm-duration", (Integer) context.getSessionData(CK.E_WORLD_STORM_DURATION));
|
||||
section.set("storm-world", context.getSessionData(CK.E_WORLD_STORM));
|
||||
section.set("storm-duration", context.getSessionData(CK.E_WORLD_STORM_DURATION));
|
||||
}
|
||||
if (context.getSessionData(CK.E_WORLD_THUNDER) != null) {
|
||||
section.set("thunder-world", (String) context.getSessionData(CK.E_WORLD_THUNDER));
|
||||
section.set("thunder-duration", (Integer) context.getSessionData(CK.E_WORLD_THUNDER_DURATION));
|
||||
section.set("thunder-world", context.getSessionData(CK.E_WORLD_THUNDER));
|
||||
section.set("thunder-duration", context.getSessionData(CK.E_WORLD_THUNDER_DURATION));
|
||||
}
|
||||
try {
|
||||
if (context.getSessionData(CK.E_MOB_TYPES) != null) {
|
||||
int count = 0;
|
||||
for (String s : (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)) {
|
||||
for (final String s : (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)) {
|
||||
ConfigurationSection ss = section.getConfigurationSection("mob-spawns." + count);
|
||||
if (ss == null) {
|
||||
ss = section.createSection("mob-spawns." + count);
|
||||
}
|
||||
QuestMob questMob = QuestMob.fromString(s);
|
||||
final QuestMob questMob = QuestMob.fromString(s);
|
||||
if (questMob == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -401,55 +402,56 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
count++;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (context.getSessionData(CK.E_LIGHTNING) != null) {
|
||||
section.set("lightning-strikes", (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING));
|
||||
section.set("lightning-strikes", context.getSessionData(CK.E_LIGHTNING));
|
||||
}
|
||||
if (context.getSessionData(CK.E_COMMANDS) != null) {
|
||||
LinkedList<String> commands = (LinkedList<String>) context.getSessionData(CK.E_COMMANDS);
|
||||
final LinkedList<String> commands = (LinkedList<String>) context.getSessionData(CK.E_COMMANDS);
|
||||
if (commands.isEmpty() == false) {
|
||||
section.set("commands", commands);
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(CK.E_POTION_TYPES) != null) {
|
||||
section.set("potion-effect-types", (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES));
|
||||
section.set("potion-effect-durations", (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS));
|
||||
section.set("potion-effect-amplifiers", (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT));
|
||||
section.set("potion-effect-types", context.getSessionData(CK.E_POTION_TYPES));
|
||||
section.set("potion-effect-durations", context.getSessionData(CK.E_POTION_DURATIONS));
|
||||
section.set("potion-effect-amplifiers", context.getSessionData(CK.E_POTION_STRENGHT));
|
||||
}
|
||||
if (context.getSessionData(CK.E_HUNGER) != null) {
|
||||
section.set("hunger", (Integer) context.getSessionData(CK.E_HUNGER));
|
||||
section.set("hunger", context.getSessionData(CK.E_HUNGER));
|
||||
}
|
||||
if (context.getSessionData(CK.E_SATURATION) != null) {
|
||||
section.set("saturation", (Integer) context.getSessionData(CK.E_SATURATION));
|
||||
section.set("saturation", context.getSessionData(CK.E_SATURATION));
|
||||
}
|
||||
if (context.getSessionData(CK.E_HEALTH) != null) {
|
||||
section.set("health", (Integer) context.getSessionData(CK.E_HEALTH));
|
||||
section.set("health", context.getSessionData(CK.E_HEALTH));
|
||||
}
|
||||
if (context.getSessionData(CK.E_TELEPORT) != null) {
|
||||
section.set("teleport-location", (String) context.getSessionData(CK.E_TELEPORT));
|
||||
section.set("teleport-location", context.getSessionData(CK.E_TELEPORT));
|
||||
}
|
||||
if (context.getSessionData(CK.E_TIMER) != null && (int) context.getSessionData(CK.E_TIMER) > 0) {
|
||||
section.set("timer", (Integer) context.getSessionData(CK.E_TIMER));
|
||||
section.set("timer", context.getSessionData(CK.E_TIMER));
|
||||
}
|
||||
if (context.getSessionData(CK.E_CANCEL_TIMER) != null) {
|
||||
String s = (String) context.getSessionData(CK.E_CANCEL_TIMER);
|
||||
final String s = (String) context.getSessionData(CK.E_CANCEL_TIMER);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
section.set("cancel-timer", true);
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(CK.E_DENIZEN) != null) {
|
||||
section.set("denizen-script", (String) context.getSessionData(CK.E_DENIZEN));
|
||||
section.set("denizen-script", context.getSessionData(CK.E_DENIZEN));
|
||||
}
|
||||
try {
|
||||
data.save(actionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
public void execute(Boolean response) {
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@Override
|
||||
public void execute(final Boolean response) {
|
||||
if (!response) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("unknownError"));
|
||||
}
|
||||
|
@ -457,8 +459,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("eventEditorSaved"));
|
||||
for (Quester q : plugin.getQuesters()) {
|
||||
for (Quest quest : q.getCurrentQuests().keySet()) {
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import me.blackvein.quests.util.MiscUtil;
|
|||
public class Condition {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Quests plugin;
|
||||
private final Quests plugin;
|
||||
private String name = "";
|
||||
private boolean failQuest = false;
|
||||
private LinkedList<ItemStack> itemsWhileHoldingMainHand = new LinkedList<ItemStack>();
|
||||
|
@ -41,7 +41,7 @@ public class Condition {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class Condition {
|
|||
return failQuest;
|
||||
}
|
||||
|
||||
public void setFailQuest(boolean failQuest) {
|
||||
public void setFailQuest(final boolean failQuest) {
|
||||
this.failQuest = failQuest;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class Condition {
|
|||
return itemsWhileHoldingMainHand;
|
||||
}
|
||||
|
||||
public void setItemsWhileHoldingMainHand(LinkedList<ItemStack> itemsWhileHoldingMainHand) {
|
||||
public void setItemsWhileHoldingMainHand(final LinkedList<ItemStack> itemsWhileHoldingMainHand) {
|
||||
this.itemsWhileHoldingMainHand = itemsWhileHoldingMainHand;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class Condition {
|
|||
return worldsWhileStayingWithin;
|
||||
}
|
||||
|
||||
public void setWorldsWhileStayingWithin(LinkedList<String> worldsWhileStayingWithin) {
|
||||
public void setWorldsWhileStayingWithin(final LinkedList<String> worldsWhileStayingWithin) {
|
||||
this.worldsWhileStayingWithin = worldsWhileStayingWithin;
|
||||
}
|
||||
|
||||
|
@ -73,15 +73,15 @@ public class Condition {
|
|||
return biomesWhileStayingWithin;
|
||||
}
|
||||
|
||||
public void setBiomesWhileStayingWithin(LinkedList<String> biomesWhileStayingWithin) {
|
||||
public void setBiomesWhileStayingWithin(final LinkedList<String> biomesWhileStayingWithin) {
|
||||
this.biomesWhileStayingWithin = biomesWhileStayingWithin;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean check(Quester quester, Quest quest) {
|
||||
public boolean check(final Quester quester, final Quest quest) {
|
||||
final Player player = quester.getPlayer();
|
||||
if (itemsWhileHoldingMainHand.isEmpty() == false) {
|
||||
for (ItemStack is : itemsWhileHoldingMainHand) {
|
||||
for (final ItemStack is : itemsWhileHoldingMainHand) {
|
||||
if (ItemUtil.compareItems(player.getItemInHand(), is, true, true) == 0) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -90,7 +90,7 @@ public class Condition {
|
|||
}
|
||||
}
|
||||
} else if (worldsWhileStayingWithin.isEmpty() == false) {
|
||||
for (String w : worldsWhileStayingWithin) {
|
||||
for (final String w : worldsWhileStayingWithin) {
|
||||
if (player.getWorld().getName().equalsIgnoreCase(w)) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -98,7 +98,7 @@ public class Condition {
|
|||
}
|
||||
}
|
||||
} else if (biomesWhileStayingWithin.isEmpty() == false) {
|
||||
for (String b : biomesWhileStayingWithin) {
|
||||
for (final String b : biomesWhileStayingWithin) {
|
||||
if (player.getWorld().getBiome(player.getLocation().getBlockX(), player.getLocation().getBlockZ())
|
||||
.name().equalsIgnoreCase(MiscUtil.getProperBiome(b).name())) {
|
||||
return true;
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
private final ConversationFactory convoCreator;
|
||||
private List<String> editingConditionNames = new LinkedList<String>();
|
||||
|
||||
public ConditionFactory(Quests plugin) {
|
||||
public ConditionFactory(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||
|
@ -61,19 +61,19 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
return editingConditionNames;
|
||||
}
|
||||
|
||||
public void setNamesOfConditionsBeingEdited(List<String> conditionNames) {
|
||||
public void setNamesOfConditionsBeingEdited(final List<String> conditionNames) {
|
||||
this.editingConditionNames = conditionNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||
public void conversationAbandoned(final ConversationAbandonedEvent abandonedEvent) {
|
||||
}
|
||||
|
||||
public Prompt returnToMenu(ConversationContext context) {
|
||||
public Prompt returnToMenu(final ConversationContext context) {
|
||||
return new ConditionMainPrompt(context);
|
||||
}
|
||||
|
||||
public void loadData(Condition condition, ConversationContext context) {
|
||||
public void loadData(final Condition condition, final ConversationContext context) {
|
||||
if (condition.isFailQuest() == true) {
|
||||
context.setSessionData(CK.C_FAIL_QUEST, Lang.get("yesWord"));
|
||||
} else {
|
||||
|
@ -81,25 +81,25 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
if (condition.getItemsWhileHoldingMainHand() != null
|
||||
&& condition.getItemsWhileHoldingMainHand().isEmpty() == false) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.addAll(condition.getItemsWhileHoldingMainHand());
|
||||
context.setSessionData(CK.C_WHILE_HOLDING_MAIN_HAND, items);
|
||||
}
|
||||
if (condition.getWorldsWhileStayingWithin() != null
|
||||
&& condition.getWorldsWhileStayingWithin().isEmpty() == false) {
|
||||
LinkedList<String> worlds = new LinkedList<String>();
|
||||
final LinkedList<String> worlds = new LinkedList<String>();
|
||||
worlds.addAll(condition.getBiomesWhileStayingWithin());
|
||||
context.setSessionData(CK.C_WHILE_WITHIN_WORLD, worlds);
|
||||
}
|
||||
if (condition.getBiomesWhileStayingWithin() != null
|
||||
&& condition.getBiomesWhileStayingWithin().isEmpty() == false) {
|
||||
LinkedList<String> biomes = new LinkedList<String>();
|
||||
final LinkedList<String> biomes = new LinkedList<String>();
|
||||
biomes.addAll(condition.getBiomesWhileStayingWithin());
|
||||
context.setSessionData(CK.C_WHILE_WITHIN_BIOME, biomes);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearData(ConversationContext context) {
|
||||
public void clearData(final ConversationContext context) {
|
||||
context.setSessionData(CK.C_OLD_CONDITION, null);
|
||||
context.setSessionData(CK.C_NAME, null);
|
||||
context.setSessionData(CK.C_FAIL_QUEST, null);
|
||||
|
@ -108,33 +108,34 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
context.setSessionData(CK.C_WHILE_WITHIN_BIOME, null);
|
||||
}
|
||||
|
||||
public void deleteCondition(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File conditionsFile = new File(plugin.getDataFolder(), "conditions.yml");
|
||||
public void deleteCondition(final ConversationContext context) {
|
||||
final YamlConfiguration data = new YamlConfiguration();
|
||||
final File conditionsFile = new File(plugin.getDataFolder(), "conditions.yml");
|
||||
try {
|
||||
data.load(conditionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
}
|
||||
String condition = (String) context.getSessionData(CK.ED_CONDITION_DELETE);
|
||||
ConfigurationSection sec = data.getConfigurationSection("conditions");
|
||||
final String condition = (String) context.getSessionData(CK.ED_CONDITION_DELETE);
|
||||
final ConfigurationSection sec = data.getConfigurationSection("conditions");
|
||||
sec.set(condition, null);
|
||||
try {
|
||||
data.save(conditionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
public void execute(Boolean response) {
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@Override
|
||||
public void execute(final Boolean response) {
|
||||
if (!response) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("unknownError"));
|
||||
}
|
||||
|
@ -142,26 +143,25 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("conditionEditorDeleted"));
|
||||
for (Quester q : plugin.getQuesters()) {
|
||||
for (Quest quest : q.getCurrentQuests().keySet()) {
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
}
|
||||
}
|
||||
clearData(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void saveCondition(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File conditionsFile = new File(plugin.getDataFolder(), "conditions.yml");
|
||||
public void saveCondition(final ConversationContext context) {
|
||||
final YamlConfiguration data = new YamlConfiguration();
|
||||
final File conditionsFile = new File(plugin.getDataFolder(), "conditions.yml");
|
||||
try {
|
||||
data.load(conditionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
|
@ -169,38 +169,39 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
}
|
||||
if (((String) context.getSessionData(CK.C_OLD_CONDITION)).isEmpty() == false) {
|
||||
data.set("conditions." + (String) context.getSessionData(CK.C_OLD_CONDITION), null);
|
||||
LinkedList<Condition> temp = plugin.getConditions();
|
||||
final LinkedList<Condition> temp = plugin.getConditions();
|
||||
temp.remove(plugin.getCondition((String) context.getSessionData(CK.C_OLD_CONDITION)));
|
||||
plugin.setConditions(temp);
|
||||
}
|
||||
ConfigurationSection section = data.createSection("conditions." + (String) context.getSessionData(CK.C_NAME));
|
||||
editingConditionNames.remove((String) context.getSessionData(CK.C_NAME));
|
||||
final ConfigurationSection section = data.createSection("conditions." + (String) context.getSessionData(CK.C_NAME));
|
||||
editingConditionNames.remove(context.getSessionData(CK.C_NAME));
|
||||
if (context.getSessionData(CK.C_FAIL_QUEST) != null) {
|
||||
String s = (String) context.getSessionData(CK.C_FAIL_QUEST);
|
||||
final String s = (String) context.getSessionData(CK.C_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
section.set("fail-quest", true);
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) != null) {
|
||||
section.set("hold-main-hand",
|
||||
(LinkedList<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND));
|
||||
context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND));
|
||||
}
|
||||
if (context.getSessionData(CK.C_WHILE_WITHIN_WORLD) != null) {
|
||||
section.set("stay-within-world",
|
||||
(LinkedList<ItemStack>) context.getSessionData(CK.C_WHILE_WITHIN_WORLD));
|
||||
context.getSessionData(CK.C_WHILE_WITHIN_WORLD));
|
||||
}
|
||||
if (context.getSessionData(CK.C_WHILE_WITHIN_BIOME) != null) {
|
||||
section.set("stay-within-biome",
|
||||
(LinkedList<ItemStack>) context.getSessionData(CK.C_WHILE_WITHIN_BIOME));
|
||||
context.getSessionData(CK.C_WHILE_WITHIN_BIOME));
|
||||
}
|
||||
try {
|
||||
data.save(conditionsFile);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
public void execute(Boolean response) {
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@Override
|
||||
public void execute(final Boolean response) {
|
||||
if (!response) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("unknownError"));
|
||||
}
|
||||
|
@ -208,8 +209,8 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
|||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("conditionEditorSaved"));
|
||||
for (Quester q : plugin.getQuesters()) {
|
||||
for (Quest quest : q.getCurrentQuests().keySet()) {
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import me.blackvein.quests.actions.ActionFactory;
|
|||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
|
||||
public abstract class ActionsEditorNumericPrompt extends QuestsNumericPrompt {
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
private ActionFactory factory;
|
||||
|
||||
public ActionsEditorNumericPrompt(final ConversationContext context) {
|
||||
|
@ -36,6 +36,7 @@ public abstract class ActionsEditorNumericPrompt extends QuestsNumericPrompt {
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import me.blackvein.quests.actions.ActionFactory;
|
|||
import me.blackvein.quests.convo.QuestsStringPrompt;
|
||||
|
||||
public abstract class ActionsEditorStringPrompt extends QuestsStringPrompt {
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
private ActionFactory factory;
|
||||
|
||||
public ActionsEditorStringPrompt(final ConversationContext context) {
|
||||
|
@ -35,6 +35,7 @@ public abstract class ActionsEditorStringPrompt extends QuestsStringPrompt {
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
|
|
@ -51,22 +51,25 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public ActionMainPrompt(ConversationContext context) {
|
||||
public ActionMainPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 10;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("event") + ": " + context.getSessionData(CK.E_NAME);
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -91,7 +94,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetName");
|
||||
|
@ -122,8 +126,9 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -135,10 +140,10 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
final LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
String text = "\n";
|
||||
for (String s : types) {
|
||||
QuestMob qm = QuestMob.fromString(s);
|
||||
for (final String s : types) {
|
||||
final QuestMob qm = QuestMob.fromString(s);
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + qm.getType().name()
|
||||
+ ((qm.getName() != null) ? " (" + qm.getName() + ")" : "") + ChatColor.GRAY + " x "
|
||||
+ ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> "
|
||||
|
@ -171,8 +176,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenNumericPromptEvent event = new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenNumericPromptEvent event = new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
|
||||
|
@ -185,7 +190,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
public Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new ActionNamePrompt(context);
|
||||
|
@ -202,7 +207,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
case 7:
|
||||
return new ActionDenizenPrompt(context);
|
||||
case 8:
|
||||
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
final String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||
} else {
|
||||
|
@ -224,38 +229,38 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
public class ActionNamePrompt extends ActionsEditorStringPrompt {
|
||||
|
||||
public ActionNamePrompt(ConversationContext context) {
|
||||
public ActionNamePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorEnterEventName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Action a : plugin.getActions()) {
|
||||
for (final Action a : plugin.getActions()) {
|
||||
if (a.getName().equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorExists"));
|
||||
return new ActionNamePrompt(context);
|
||||
}
|
||||
}
|
||||
List<String> actionNames = plugin.getActionFactory().getNamesOfActionsBeingEdited();
|
||||
final List<String> actionNames = plugin.getActionFactory().getNamesOfActionsBeingEdited();
|
||||
if (actionNames.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||
return new ActionNamePrompt(context);
|
||||
|
@ -264,7 +269,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
||||
return new ActionNamePrompt(context);
|
||||
}
|
||||
actionNames.remove((String) context.getSessionData(CK.E_NAME));
|
||||
actionNames.remove(context.getSessionData(CK.E_NAME));
|
||||
context.setSessionData(CK.E_NAME, input);
|
||||
actionNames.add(input);
|
||||
plugin.getActionFactory().setNamesOfActionsBeingEdited(actionNames);
|
||||
|
@ -275,22 +280,24 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
public class ActionMobListPrompt extends ActionsEditorNumericPrompt {
|
||||
|
||||
public ActionMobListPrompt(ConversationContext context) {
|
||||
public ActionMobListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorMobSpawnsTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -303,7 +310,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorAddMobTypes");
|
||||
|
@ -316,15 +324,17 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.E_MOB_TYPES) != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
String text = "\n";
|
||||
for (int i = 0; i < types.size(); i++) {
|
||||
QuestMob qm = QuestMob.fromString(types.get(i));
|
||||
final QuestMob qm = QuestMob.fromString(types.get(i));
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + qm.getType().name()
|
||||
+ ((qm.getName() != null) ? " (" + qm.getName() + ")" : "") + " x "
|
||||
+ qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN
|
||||
|
@ -341,8 +351,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenNumericPromptEvent event
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenNumericPromptEvent event
|
||||
= new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
|
@ -355,7 +365,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
public Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new ActionMobPrompt(context, 0, null);
|
||||
|
@ -377,7 +387,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
private Integer itemIndex = -1;
|
||||
private final Integer mobIndex;
|
||||
|
||||
public ActionMobPrompt(ConversationContext context, int mobIndex, QuestMob questMob) {
|
||||
public ActionMobPrompt(final ConversationContext context, final int mobIndex, final QuestMob questMob) {
|
||||
super(context);
|
||||
this.questMob = questMob;
|
||||
this.mobIndex = mobIndex;
|
||||
|
@ -385,15 +395,18 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
private final int size = 16;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorAddMobTypesTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -419,7 +432,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetMobName");
|
||||
|
@ -458,7 +472,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return "(" + (questMob.getName() == null ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getName())
|
||||
|
@ -511,7 +526,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
if (questMob == null) {
|
||||
questMob = new QuestMob();
|
||||
}
|
||||
|
@ -525,7 +540,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
ActionsEditorPostOpenNumericPromptEvent event
|
||||
final ActionsEditorPostOpenNumericPromptEvent event
|
||||
= new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
|
@ -539,14 +554,14 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
public Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new ActionMobNamePrompt(context, mobIndex, questMob);
|
||||
case 2:
|
||||
return new ActionMobTypePrompt(context, mobIndex, questMob);
|
||||
case 3:
|
||||
Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
selectedMobLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
||||
return new ActionMobLocationPrompt(context, mobIndex, questMob);
|
||||
|
@ -590,11 +605,11 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
if (context.getSessionData(CK.E_MOB_TYPES) == null
|
||||
|| ((LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)).isEmpty()) {
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
final LinkedList<String> list = new LinkedList<String>();
|
||||
list.add(questMob.serialize());
|
||||
context.setSessionData(CK.E_MOB_TYPES, list);
|
||||
} else {
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
final LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
if (mobIndex < list.size()) {
|
||||
list.set(mobIndex, questMob.serialize());
|
||||
} else {
|
||||
|
@ -616,32 +631,32 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
private final QuestMob questMob;
|
||||
private final Integer mobIndex;
|
||||
|
||||
public ActionMobNamePrompt(ConversationContext context, int mobIndex, QuestMob questMob) {
|
||||
public ActionMobNamePrompt(final ConversationContext context, final int mobIndex, final QuestMob questMob) {
|
||||
super(context);
|
||||
this.questMob = questMob;
|
||||
this.mobIndex = mobIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorSetMobNamePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
|
@ -660,25 +675,25 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
private final QuestMob questMob;
|
||||
private final Integer mobIndex;
|
||||
|
||||
public ActionMobTypePrompt(ConversationContext context, int mobIndex, QuestMob questMob) {
|
||||
public ActionMobTypePrompt(final ConversationContext context, final int mobIndex, final QuestMob questMob) {
|
||||
super(context);
|
||||
this.questMob = questMob;
|
||||
this.mobIndex = mobIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorMobsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorSetMobTypesPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String mobs = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
|
@ -698,8 +713,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (MiscUtil.getProperMobType(input) != null) {
|
||||
questMob.setType(MiscUtil.getProperMobType(input));
|
||||
|
@ -718,43 +733,43 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
private final QuestMob questMob;
|
||||
private final Integer mobIndex;
|
||||
|
||||
public ActionMobAmountPrompt(ConversationContext context, int mobIndex, QuestMob questMob) {
|
||||
public ActionMobAmountPrompt(final ConversationContext context, final int mobIndex, final QuestMob questMob) {
|
||||
super(context);
|
||||
this.questMob = questMob;
|
||||
this.mobIndex = mobIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorSetMobAmountsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i < 1) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
|
||||
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
||||
}
|
||||
questMob.setSpawnAmounts(i);
|
||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
||||
}
|
||||
|
@ -768,38 +783,38 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
private final QuestMob questMob;
|
||||
private final Integer mobIndex;
|
||||
|
||||
public ActionMobLocationPrompt(ConversationContext context, int mobIndex, QuestMob questMob) {
|
||||
public ActionMobLocationPrompt(final ConversationContext context, final int mobIndex, final QuestMob questMob) {
|
||||
super(context);
|
||||
this.questMob = questMob;
|
||||
this.mobIndex = mobIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorSetMobLocationPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
Block block = selectedMobLocations.get(player.getUniqueId());
|
||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final Block block = selectedMobLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
questMob.setSpawnLocation(loc);
|
||||
selectedMobLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
||||
|
@ -809,7 +824,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
selectedMobLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||
|
@ -825,7 +840,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
private final Integer mobIndex;
|
||||
private final Integer invIndex;
|
||||
|
||||
public ActionMobDropPrompt(ConversationContext context, int invIndex, int mobIndex, QuestMob questMob) {
|
||||
public ActionMobDropPrompt(final ConversationContext context, final int invIndex, final int mobIndex, final QuestMob questMob) {
|
||||
super(context);
|
||||
this.questMob = questMob;
|
||||
this.mobIndex = mobIndex;
|
||||
|
@ -833,32 +848,32 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorSetDropChance");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
float chance;
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||
}
|
||||
try {
|
||||
chance = Float.parseFloat(input);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0.0").replace("<greatest>", "1.0"));
|
||||
return new ActionMobDropPrompt(context, invIndex, mobIndex, questMob);
|
||||
|
@ -868,7 +883,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
.replace("<least>", "0.0").replace("<greatest>", "1.0"));
|
||||
return new ActionMobDropPrompt(context, invIndex, mobIndex, questMob);
|
||||
}
|
||||
Float[] temp = questMob.getDropChances();
|
||||
final Float[] temp = questMob.getDropChances();
|
||||
temp[invIndex] = chance;
|
||||
questMob.setDropChances(temp);
|
||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||
|
@ -877,35 +892,35 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
public class ActionDenizenPrompt extends ActionsEditorStringPrompt {
|
||||
|
||||
public ActionDenizenPrompt(ConversationContext context) {
|
||||
public ActionDenizenPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorDenizenScript");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorScriptPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_AQUA + "- " + getTitle(context) + " -\n";
|
||||
for (String s : plugin.getDependencies().getDenizenApi().getScriptNames()) {
|
||||
for (final String s : plugin.getDependencies().getDenizenApi().getScriptNames()) {
|
||||
text += ChatColor.AQUA + "- " + s + "\n";
|
||||
}
|
||||
return text + ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
if (plugin.getDependencies().getDenizenApi().containsScript(input)) {
|
||||
|
@ -930,12 +945,12 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
String modName = null;
|
||||
LinkedList<String> modified = new LinkedList<String>();
|
||||
|
||||
public ActionSavePrompt(ConversationContext context, String modifiedName) {
|
||||
public ActionSavePrompt(final ConversationContext context, final String modifiedName) {
|
||||
super(context);
|
||||
if (modifiedName != null) {
|
||||
modName = modifiedName;
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
for (Stage s : q.getStages()) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
for (final Stage s : q.getStages()) {
|
||||
if (s.getFinishAction() != null && s.getFinishAction().getName() != null) {
|
||||
if (s.getFinishAction().getName().equalsIgnoreCase(modifiedName)) {
|
||||
modified.add(q.getName());
|
||||
|
@ -948,25 +963,25 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorSave");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.YELLOW + getQueryText(context) + " \"" + ChatColor.AQUA
|
||||
+ context.getSessionData(CK.E_NAME) + ChatColor.YELLOW + "\"?\n";
|
||||
if (modified.isEmpty() == false) {
|
||||
text += ChatColor.RED + Lang.get("eventEditorModifiedNote") + "\n";
|
||||
for (String s : modified) {
|
||||
for (final String s : modified) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.DARK_RED + s + "\n";
|
||||
}
|
||||
text += ChatColor.RED + Lang.get("eventEditorForcedToQuit") + "\n";
|
||||
|
@ -975,7 +990,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
plugin.getActionFactory().saveAction(context);
|
||||
return new ActionMenuPrompt(context);
|
||||
|
@ -989,33 +1004,33 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
public class ActionExitPrompt extends ActionsEditorStringPrompt {
|
||||
|
||||
public ActionExitPrompt(ConversationContext context) {
|
||||
public ActionExitPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("confirmDelete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
final String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("yesWord") + "\n" + ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET
|
||||
+ ChatColor.RED + " - " + Lang.get("noWord");
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.BOLD + "" + ChatColor.YELLOW + Lang.get("exited"));
|
||||
plugin.getActionFactory().clearData(context);
|
||||
|
|
|
@ -37,22 +37,25 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public ActionMenuPrompt(ConversationContext context) {
|
||||
public ActionMenuPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -65,7 +68,8 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorCreate");
|
||||
|
@ -80,13 +84,14 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenNumericPromptEvent event = new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenNumericPromptEvent event = new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
|
@ -97,7 +102,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
|
@ -146,42 +151,44 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class ActionSelectCreatePrompt extends ActionsEditorStringPrompt {
|
||||
public ActionSelectCreatePrompt(ConversationContext context) {
|
||||
public ActionSelectCreatePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorCreate");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("eventEditorEnterEventName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
final String text = ChatColor.GOLD + getTitle(context) + "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, String input) {
|
||||
if (input == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new ActionSelectCreatePrompt(context);
|
||||
}
|
||||
input = input.trim();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Action a : plugin.getActions()) {
|
||||
for (final Action a : plugin.getActions()) {
|
||||
if (a.getName().equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorExists"));
|
||||
return new ActionSelectCreatePrompt(context);
|
||||
}
|
||||
}
|
||||
List<String> actionNames = plugin.getActionFactory().getNamesOfActionsBeingEdited();
|
||||
final List<String> actionNames = plugin.getActionFactory().getNamesOfActionsBeingEdited();
|
||||
if (actionNames.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||
return new ActionSelectCreatePrompt(context);
|
||||
|
@ -207,9 +214,9 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
private class ActionSelectEditPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEdit") + " -\n";
|
||||
for (Action a : plugin.getActions()) {
|
||||
for (final Action a : plugin.getActions()) {
|
||||
text += ChatColor.AQUA + a.getName() + ChatColor.GRAY + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2) + "\n";
|
||||
|
@ -218,9 +225,9 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Action a = plugin.getAction(input);
|
||||
final Action a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, a.getName());
|
||||
context.setSessionData(CK.E_NAME, a.getName());
|
||||
|
@ -238,9 +245,9 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
private class ActionSelectDeletePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorDelete") + " -\n";
|
||||
for (Action a : plugin.getActions()) {
|
||||
for (final Action a : plugin.getActions()) {
|
||||
text += ChatColor.AQUA + a.getName() + ChatColor.GRAY + ",";
|
||||
}
|
||||
text = text.substring(0, text.length() - 1) + "\n";
|
||||
|
@ -249,13 +256,13 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> used = new LinkedList<String>();
|
||||
Action a = plugin.getAction(input);
|
||||
final LinkedList<String> used = new LinkedList<String>();
|
||||
final Action a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (Stage stage : quest.getStages()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
for (final Stage stage : quest.getStages()) {
|
||||
if (stage.getFinishAction() != null
|
||||
&& stage.getFinishAction().getName().equalsIgnoreCase(a.getName())) {
|
||||
used.add(quest.getName());
|
||||
|
@ -269,7 +276,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
} else {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorEventInUse")
|
||||
+ " \"" + ChatColor.DARK_PURPLE + a.getName() + ChatColor.RED + "\":");
|
||||
for (String s : used) {
|
||||
for (final String s : used) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "- " + ChatColor.DARK_RED + s);
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
|
@ -288,7 +295,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
private class ActionConfirmDeletePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final 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 + " - "
|
||||
|
@ -298,7 +305,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
plugin.getActionFactory().deleteAction(context);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
|
|
@ -38,14 +38,14 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public EffectPrompt(ConversationContext context) {
|
||||
public EffectPrompt(final ConversationContext context) {
|
||||
super("1", "2", "3");
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEffect") + " -\n";
|
||||
if (context.getSessionData(CK.E_EFFECTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -53,9 +53,9 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetEffects") + "\n";
|
||||
LinkedList<String> effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
|
||||
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
|
||||
for (String effect : effects) {
|
||||
final LinkedList<String> effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
|
||||
final LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
|
||||
for (final String effect : effects) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + effect + ChatColor.GRAY + " at "
|
||||
+ ChatColor.DARK_AQUA + locations.get(effects.indexOf(effect)) + "\n";
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetExplosions") + "\n";
|
||||
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS);
|
||||
for (String loc : locations) {
|
||||
final LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS);
|
||||
for (final String loc : locations) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + loc + "\n";
|
||||
}
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new SoundEffectListPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
selectedExplosionLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
|
||||
return new ExplosionPrompt();
|
||||
|
@ -96,7 +96,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEffects") + " -\n";
|
||||
if (context.getSessionData(CK.E_EFFECTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -110,7 +110,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorAddEffect") + "\n";
|
||||
for (String s : getEffects(context)) {
|
||||
for (final String s : getEffects(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
if (context.getSessionData(CK.E_EFFECTS_LOCATIONS) == null) {
|
||||
|
@ -119,7 +119,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorAddEffectLocation") + "\n";
|
||||
for (String s : getEffectLocations(context)) {
|
||||
for (final String s : getEffectLocations(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new SoundEffectPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
@ -140,7 +140,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustAddEffects"));
|
||||
return new SoundEffectListPrompt();
|
||||
} else {
|
||||
Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
return new SoundEffectLocationPrompt();
|
||||
|
@ -174,12 +174,12 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> getEffects(ConversationContext context) {
|
||||
private List<String> getEffects(final ConversationContext context) {
|
||||
return (List<String>) context.getSessionData(CK.E_EFFECTS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> getEffectLocations(ConversationContext context) {
|
||||
private List<String> getEffectLocations(final ConversationContext context) {
|
||||
return (List<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
|
||||
}
|
||||
}
|
||||
|
@ -187,11 +187,11 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
private class SoundEffectPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String effects = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorEffectsTitle") + "\n";
|
||||
Effect[] vals = Effect.values();
|
||||
final Effect[] vals = Effect.values();
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
Effect eff = vals[i];
|
||||
final Effect eff = vals[i];
|
||||
if (i < (vals.length - 1)) {
|
||||
effects += MiscUtil.snakeCaseToUpperCamelCase(eff.name()) + ", ";
|
||||
} else {
|
||||
|
@ -204,8 +204,8 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (MiscUtil.getProperEffect(input) != null) {
|
||||
LinkedList<String> effects;
|
||||
|
@ -216,7 +216,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
}
|
||||
effects.add(input.toUpperCase());
|
||||
context.setSessionData(CK.E_EFFECTS, effects);
|
||||
Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
return new SoundEffectListPrompt();
|
||||
|
@ -226,7 +226,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
return new SoundEffectPrompt();
|
||||
}
|
||||
} else {
|
||||
Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
return new SoundEffectListPrompt();
|
||||
|
@ -237,19 +237,19 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
private class SoundEffectLocationPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorEffectLocationPrompt");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
Block block = selectedEffectLocations.get(player.getUniqueId());
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final Block block = selectedEffectLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
LinkedList<String> locs;
|
||||
if (context.getSessionData(CK.E_EFFECTS_LOCATIONS) != null) {
|
||||
locs = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
|
||||
|
@ -265,7 +265,7 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
}
|
||||
return new SoundEffectListPrompt();
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
return new SoundEffectListPrompt();
|
||||
|
@ -278,19 +278,19 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
public class ExplosionPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorExplosionPrompt");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
Block block = selectedExplosionLocations.get(player.getUniqueId());
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final Block block = selectedExplosionLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
LinkedList<String> locs;
|
||||
if (context.getSessionData(CK.E_EXPLOSIONS) != null) {
|
||||
locs = (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS);
|
||||
|
@ -308,12 +308,12 @@ public class EffectPrompt extends FixedSetPrompt {
|
|||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.E_EXPLOSIONS, null);
|
||||
Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
selectedExplosionLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
selectedExplosionLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
|
|
|
@ -43,14 +43,14 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public PlayerPrompt(ConversationContext context) {
|
||||
public PlayerPrompt(final ConversationContext context) {
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorPlayer") + " -\n";
|
||||
if (context.getSessionData(CK.E_MESSAGE) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -72,8 +72,8 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetItems") + "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
||||
for (ItemStack is : items) {
|
||||
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
||||
for (final ItemStack is : items) {
|
||||
if (is != null) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getString(is) + "\n";
|
||||
}
|
||||
|
@ -85,11 +85,11 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetPotionEffects") + "\n";
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES);
|
||||
LinkedList<Long> durations = (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS);
|
||||
LinkedList<Integer> mags = (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT);
|
||||
final LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES);
|
||||
final LinkedList<Long> durations = (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS);
|
||||
final LinkedList<Integer> mags = (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT);
|
||||
int index = -1;
|
||||
for (String type : types) {
|
||||
for (final String type : types) {
|
||||
index++;
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + type + ChatColor.DARK_PURPLE + " "
|
||||
+ RomanNumeral.getNumeral(mags.get(index)) + ChatColor.GRAY + " -> " + ChatColor.DARK_AQUA
|
||||
|
@ -102,7 +102,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetHunger") + ChatColor.AQUA + " ("
|
||||
+ (Integer) context.getSessionData(CK.E_HUNGER) + ")\n";
|
||||
+ context.getSessionData(CK.E_HUNGER) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.E_SATURATION) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -110,7 +110,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetSaturation") + ChatColor.AQUA + " ("
|
||||
+ (Integer) context.getSessionData(CK.E_SATURATION) + ")\n";
|
||||
+ context.getSessionData(CK.E_SATURATION) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.E_HEALTH) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -118,7 +118,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetHealth") + ChatColor.AQUA + " ("
|
||||
+ (Integer) context.getSessionData(CK.E_HEALTH) + ")\n";
|
||||
+ context.getSessionData(CK.E_HEALTH) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.E_TELEPORT) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -134,7 +134,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetCommands") + "\n";
|
||||
for (String s : (LinkedList<String>) context.getSessionData(CK.E_COMMANDS)) {
|
||||
for (final String s : (LinkedList<String>) context.getSessionData(CK.E_COMMANDS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
}
|
||||
|
@ -144,11 +144,11 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new MessagePrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
|
||||
final String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord"));
|
||||
} else {
|
||||
|
@ -166,7 +166,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else if (input.equalsIgnoreCase("7")) {
|
||||
return new HealthPrompt();
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
selectedTeleportLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
return new TeleportPrompt();
|
||||
|
@ -179,12 +179,12 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
public class MessagePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetMessagePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
context.setSessionData(CK.E_MESSAGE, input);
|
||||
|
@ -202,15 +202,15 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(CK.E_ITEMS) != null) {
|
||||
List<ItemStack> items = getItems(context);
|
||||
final List<ItemStack> items = getItems(context);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.E_ITEMS, items);
|
||||
} else {
|
||||
LinkedList<ItemStack> itemRews = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> itemRews = new LinkedList<ItemStack>();
|
||||
itemRews.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.E_ITEMS, itemRews);
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("done");
|
||||
} else {
|
||||
for (ItemStack is : getItems(context)) {
|
||||
for (final ItemStack is : getItems(context)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -240,7 +240,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new ItemStackPrompt(context, ItemListPrompt.this);
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
@ -254,7 +254,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<ItemStack> getItems(ConversationContext context) {
|
||||
private List<ItemStack> getItems(final ConversationContext context) {
|
||||
return (List<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + Lang.get("eventEditorPotionEffectsTitle") + "\n";
|
||||
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -283,7 +283,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetPotionEffectTypes") + "\n";
|
||||
for (String s : (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES)) {
|
||||
for (final String s : (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
if (context.getSessionData(CK.E_POTION_DURATIONS) == null) {
|
||||
|
@ -294,7 +294,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("noneSet") + "\n";
|
||||
for (Long l : (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS)) {
|
||||
for (final Long l : (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.DARK_AQUA + MiscUtil.getTime(l * 50L) + "\n";
|
||||
}
|
||||
if (context.getSessionData(CK.E_POTION_STRENGHT) == null) {
|
||||
|
@ -303,7 +303,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetPotionMagnitudes") + "\n";
|
||||
for (int i : (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT)) {
|
||||
for (final int i : (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.DARK_PURPLE + i + "\n";
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new PotionTypesPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
@ -379,20 +379,20 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
private class PotionTypesPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String effs = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorPotionTypesTitle") + "\n";
|
||||
for (PotionEffectType pet : PotionEffectType.values()) {
|
||||
for (final PotionEffectType pet : PotionEffectType.values()) {
|
||||
effs += (pet != null && pet.getName() != null) ? (ChatColor.DARK_PURPLE + pet.getName() + "\n") : "";
|
||||
}
|
||||
return effs + ChatColor.YELLOW + Lang.get("eventEditorSetPotionEffectsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> effTypes = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> effTypes = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (PotionEffectType.getByName(s.toUpperCase()) != null) {
|
||||
effTypes.add(PotionEffectType.getByName(s.toUpperCase()).getName());
|
||||
context.setSessionData(CK.E_POTION_TYPES, effTypes);
|
||||
|
@ -410,25 +410,25 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
private class PotionDurationsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetPotionDurationsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<Long> effDurations = new LinkedList<Long>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<Long> effDurations = new LinkedList<Long>();
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
int i = Integer.parseInt(s);
|
||||
long l = i * 1000;
|
||||
final int i = Integer.parseInt(s);
|
||||
final long l = i * 1000;
|
||||
if (l < 1000) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
|
||||
return new PotionDurationsPrompt();
|
||||
}
|
||||
effDurations.add(l / 50L);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", s));
|
||||
return new PotionDurationsPrompt();
|
||||
}
|
||||
|
@ -442,24 +442,24 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
private class PotionMagnitudesPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetPotionMagnitudesPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<Integer> magAmounts = new LinkedList<Integer>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<Integer> magAmounts = new LinkedList<Integer>();
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
int i = Integer.parseInt(s);
|
||||
final int i = Integer.parseInt(s);
|
||||
if (i < 1) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
|
||||
return new PotionMagnitudesPrompt();
|
||||
}
|
||||
magAmounts.add(i);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", s));
|
||||
return new PotionMagnitudesPrompt();
|
||||
}
|
||||
|
@ -473,23 +473,23 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
public class HungerPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetHungerPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i < 0) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
||||
return new HungerPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.E_HUNGER, (Integer) i);
|
||||
context.setSessionData(CK.E_HUNGER, i);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new HungerPrompt();
|
||||
|
@ -504,23 +504,23 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
public class SaturationPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetSaturationPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i < 0) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
||||
return new SaturationPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.E_SATURATION, (Integer) i);
|
||||
context.setSessionData(CK.E_SATURATION, i);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new SaturationPrompt();
|
||||
|
@ -535,23 +535,23 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
public class HealthPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetHealthPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i < 0) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
||||
return new HealthPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.E_HEALTH, (Integer) i);
|
||||
context.setSessionData(CK.E_HEALTH, i);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new HealthPrompt();
|
||||
|
@ -566,18 +566,18 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
public class TeleportPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetTeleportPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdDone"))) {
|
||||
Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
Block block = selectedTeleportLocations.get(player.getUniqueId());
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final Block block = selectedTeleportLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
context.setSessionData(CK.E_TELEPORT, ConfigUtil.getLocationInfo(loc));
|
||||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
|
@ -588,12 +588,12 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.E_TELEPORT, null);
|
||||
Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
|
@ -606,17 +606,17 @@ public class PlayerPrompt extends FixedSetPrompt {
|
|||
public class CommandsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "" + ChatColor.ITALIC + Lang.get("eventEditorCommandsNote");
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final String text = ChatColor.GOLD + "" + ChatColor.ITALIC + Lang.get("eventEditorCommandsNote");
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetCommandsPrompt") + "\n" + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
String[] commands = input.split(Lang.get("charSemi"));
|
||||
LinkedList<String> cmdList = new LinkedList<String>();
|
||||
final String[] commands = input.split(Lang.get("charSemi"));
|
||||
final LinkedList<String> cmdList = new LinkedList<String>();
|
||||
cmdList.addAll(Arrays.asList(commands));
|
||||
context.setSessionData(CK.E_COMMANDS, cmdList);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TimerPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorTimer") + " -\n";
|
||||
if (context.getSessionData(CK.E_TIMER) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -51,11 +51,11 @@ public class TimerPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new FailTimerPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
String s = (String) context.getSessionData(CK.E_CANCEL_TIMER);
|
||||
final String s = (String) context.getSessionData(CK.E_CANCEL_TIMER);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.setSessionData(CK.E_CANCEL_TIMER, Lang.get("noWord"));
|
||||
} else {
|
||||
|
|
|
@ -38,14 +38,14 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public WeatherPrompt(ConversationContext context) {
|
||||
public WeatherPrompt(final ConversationContext context) {
|
||||
super("1", "2", "3", "4");
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorWeather") + " -\n";
|
||||
if (context.getSessionData(CK.E_WORLD_STORM) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -74,8 +74,8 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetLightning") + "\n";
|
||||
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING);
|
||||
for (String loc : locations) {
|
||||
final LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING);
|
||||
for (final String loc : locations) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + loc + "\n";
|
||||
}
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new StormPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new ThunderPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||
return new LightningPrompt();
|
||||
|
@ -106,7 +106,7 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + Lang.get("eventEditorStormTitle") + "\n";
|
||||
if (context.getSessionData(CK.E_WORLD_STORM) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -125,7 +125,7 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetDuration") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
int dur = (int) context.getSessionData(CK.E_WORLD_STORM_DURATION);
|
||||
final int dur = (int) context.getSessionData(CK.E_WORLD_STORM_DURATION);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetDuration") + " (" + ChatColor.AQUA + MiscUtil.getTime(dur * 1000)
|
||||
+ ChatColor.YELLOW + ")\n";
|
||||
|
@ -139,7 +139,7 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new StormWorldPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
@ -170,9 +170,9 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
private class StormWorldPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String effects = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorWorldsTitle") + "\n" + ChatColor.DARK_PURPLE;
|
||||
for (World w : plugin.getServer().getWorlds()) {
|
||||
for (final World w : plugin.getServer().getWorlds()) {
|
||||
effects += w.getName() + ", ";
|
||||
}
|
||||
effects = effects.substring(0, effects.length());
|
||||
|
@ -180,8 +180,8 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (plugin.getServer().getWorld(input) != null) {
|
||||
context.setSessionData(CK.E_WORLD_STORM, plugin.getServer().getWorld(input).getName());
|
||||
|
@ -198,12 +198,12 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
private class StormDurationPrompt extends NumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorEnterDuration");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
if (input.intValue() < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ Lang.get("invalidMinimum").replace("<number>", "1"));
|
||||
|
@ -222,7 +222,7 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + Lang.get("eventEditorThunderTitle") + "\n";
|
||||
if (context.getSessionData(CK.E_WORLD_THUNDER) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
|
@ -241,7 +241,7 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetDuration") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
int dur = (int) context.getSessionData(CK.E_WORLD_THUNDER_DURATION);
|
||||
final int dur = (int) context.getSessionData(CK.E_WORLD_THUNDER_DURATION);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetDuration") + " (" + ChatColor.AQUA + MiscUtil.getTime(dur * 1000)
|
||||
+ ChatColor.YELLOW + ")\n";
|
||||
|
@ -255,7 +255,7 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new ThunderWorldPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
@ -286,9 +286,9 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
private class ThunderWorldPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String effects = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorWorldsTitle") + "\n" + ChatColor.DARK_PURPLE;
|
||||
for (World w : plugin.getServer().getWorlds()) {
|
||||
for (final World w : plugin.getServer().getWorlds()) {
|
||||
effects += w.getName() + ", ";
|
||||
}
|
||||
effects = effects.substring(0, effects.length());
|
||||
|
@ -296,8 +296,8 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (plugin.getServer().getWorld(input) != null) {
|
||||
context.setSessionData(CK.E_WORLD_THUNDER, plugin.getServer().getWorld(input).getName());
|
||||
|
@ -314,12 +314,12 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
private class ThunderDurationPrompt extends NumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorEnterDuration");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
if (input.intValue() < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ Lang.get("invalidMinimum").replace("<number>", "1"));
|
||||
|
@ -334,19 +334,19 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
public class LightningPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorLightningPrompt");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
Block block = selectedLightningLocations.get(player.getUniqueId());
|
||||
final Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final Block block = selectedLightningLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
LinkedList<String> locs;
|
||||
if (context.getSessionData(CK.E_LIGHTNING) != null) {
|
||||
locs = (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING);
|
||||
|
@ -364,12 +364,12 @@ public class WeatherPrompt extends FixedSetPrompt {
|
|||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.E_LIGHTNING, null);
|
||||
Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
selectedLightningLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final Map<UUID, Block> selectedLightningLocations = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
selectedLightningLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
|
|
|
@ -20,7 +20,7 @@ import me.blackvein.quests.conditions.ConditionFactory;
|
|||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
|
||||
public abstract class ConditionsEditorNumericPrompt extends QuestsNumericPrompt {
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
private ConditionFactory factory;
|
||||
|
||||
public ConditionsEditorNumericPrompt(final ConversationContext context) {
|
||||
|
@ -36,6 +36,7 @@ public abstract class ConditionsEditorNumericPrompt extends QuestsNumericPrompt
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import me.blackvein.quests.conditions.ConditionFactory;
|
|||
import me.blackvein.quests.convo.QuestsStringPrompt;
|
||||
|
||||
public abstract class ConditionsEditorStringPrompt extends QuestsStringPrompt {
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
private ConditionFactory factory;
|
||||
|
||||
public ConditionsEditorStringPrompt(final ConversationContext context) {
|
||||
|
@ -35,6 +35,7 @@ public abstract class ConditionsEditorStringPrompt extends QuestsStringPrompt {
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
|
|
@ -36,22 +36,25 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public ConditionMainPrompt(ConversationContext context) {
|
||||
public ConditionMainPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 6;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("condition") + ": " + context.getSessionData(CK.C_NAME);
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -67,7 +70,8 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("conditionEditorSetName");
|
||||
|
@ -86,7 +90,8 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -106,8 +111,8 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ConditionsEditorPostOpenNumericPromptEvent event = new ConditionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ConditionsEditorPostOpenNumericPromptEvent event = new ConditionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
|
||||
|
@ -120,7 +125,7 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
public Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new ConditionNamePrompt();
|
||||
|
@ -129,7 +134,7 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
case 3:
|
||||
return new WorldPrompt(context);
|
||||
case 4:
|
||||
String s = (String) context.getSessionData(CK.C_FAIL_QUEST);
|
||||
final String s = (String) context.getSessionData(CK.C_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.setSessionData(CK.C_FAIL_QUEST, Lang.get("noWord"));
|
||||
} else {
|
||||
|
@ -152,20 +157,20 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
private class ConditionNamePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("conditionEditorEnterName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Condition c : plugin.getConditions()) {
|
||||
for (final Condition c : plugin.getConditions()) {
|
||||
if (c.getName().equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("conditionEditorExists"));
|
||||
return new ConditionNamePrompt();
|
||||
}
|
||||
}
|
||||
List<String> actionNames = plugin.getConditionFactory().getNamesOfConditionsBeingEdited();
|
||||
final List<String> actionNames = plugin.getConditionFactory().getNamesOfConditionsBeingEdited();
|
||||
if (actionNames.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||
return new ConditionNamePrompt();
|
||||
|
@ -174,7 +179,7 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
||||
return new ConditionNamePrompt();
|
||||
}
|
||||
actionNames.remove((String) context.getSessionData(CK.C_NAME));
|
||||
actionNames.remove(context.getSessionData(CK.C_NAME));
|
||||
context.setSessionData(CK.C_NAME, input);
|
||||
actionNames.add(input);
|
||||
plugin.getConditionFactory().setNamesOfConditionsBeingEdited(actionNames);
|
||||
|
@ -188,11 +193,11 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
String modName = null;
|
||||
LinkedList<String> modified = new LinkedList<String>();
|
||||
|
||||
public ConditionSavePrompt(String modifiedName) {
|
||||
public ConditionSavePrompt(final String modifiedName) {
|
||||
if (modifiedName != null) {
|
||||
modName = modifiedName;
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
for (Stage s : q.getStages()) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
for (final Stage s : q.getStages()) {
|
||||
if (s.getCondition() != null && s.getCondition().getName() != null) {
|
||||
if (s.getCondition().getName().equalsIgnoreCase(modifiedName)) {
|
||||
modified.add(q.getName());
|
||||
|
@ -205,12 +210,12 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA
|
||||
+ context.getSessionData(CK.C_NAME) + ChatColor.YELLOW + "\"?\n";
|
||||
if (modified.isEmpty() == false) {
|
||||
text += ChatColor.RED + Lang.get("conditionEditorModifiedNote") + "\n";
|
||||
for (String s : modified) {
|
||||
for (final String s : modified) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.DARK_RED + s + "\n";
|
||||
}
|
||||
text += ChatColor.RED + Lang.get("conditionEditorForcedToQuit") + "\n";
|
||||
|
@ -219,7 +224,7 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
plugin.getConditionFactory().saveCondition(context);
|
||||
return new ConditionMenuPrompt(context);
|
||||
|
@ -234,15 +239,15 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
|||
private class ConditionExitPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final String text = ChatColor.GREEN + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("yesWord") + "\n" + ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET
|
||||
+ ChatColor.RED + " - " + Lang.get("noWord");
|
||||
return ChatColor.YELLOW + Lang.get("confirmDelete") + "\n" + text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.BOLD + "" + ChatColor.YELLOW + Lang.get("exited"));
|
||||
plugin.getConditionFactory().clearData(context);
|
||||
|
|
|
@ -37,22 +37,25 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public ConditionMenuPrompt(ConversationContext context) {
|
||||
public ConditionMenuPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -65,7 +68,8 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("conditionEditorCreate");
|
||||
|
@ -80,13 +84,14 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ConditionsEditorPostOpenNumericPromptEvent event = new ConditionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ConditionsEditorPostOpenNumericPromptEvent event = new ConditionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
|
@ -97,7 +102,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
|
@ -143,42 +148,44 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class ConditionSelectCreatePrompt extends ConditionsEditorStringPrompt {
|
||||
public ConditionSelectCreatePrompt(ConversationContext context) {
|
||||
public ConditionSelectCreatePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorCreate");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorEnterName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ConditionsEditorPostOpenStringPromptEvent event = new ConditionsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final ConditionsEditorPostOpenStringPromptEvent event = new ConditionsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
final String text = ChatColor.GOLD + getTitle(context) + "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, String input) {
|
||||
if (input == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new ConditionSelectCreatePrompt(context);
|
||||
}
|
||||
input = input.trim();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Condition c : plugin.getConditions()) {
|
||||
for (final Condition c : plugin.getConditions()) {
|
||||
if (c.getName().equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("conditionEditorExists"));
|
||||
return new ConditionSelectCreatePrompt(context);
|
||||
}
|
||||
}
|
||||
List<String> actionNames = plugin.getConditionFactory().getNamesOfConditionsBeingEdited();
|
||||
final List<String> actionNames = plugin.getConditionFactory().getNamesOfConditionsBeingEdited();
|
||||
if (actionNames.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||
return new ConditionSelectCreatePrompt(context);
|
||||
|
@ -204,9 +211,9 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
private class ConditionSelectEditPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("conditionEditorEdit") + " -\n";
|
||||
for (Condition a : plugin.getConditions()) {
|
||||
for (final Condition a : plugin.getConditions()) {
|
||||
text += ChatColor.AQUA + a.getName() + ChatColor.GRAY + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2) + "\n";
|
||||
|
@ -215,9 +222,9 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Condition c = plugin.getCondition(input);
|
||||
final Condition c = plugin.getCondition(input);
|
||||
if (c != null) {
|
||||
context.setSessionData(CK.C_OLD_CONDITION, c.getName());
|
||||
context.setSessionData(CK.C_NAME, c.getName());
|
||||
|
@ -235,9 +242,9 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
private class ConditionSelectDeletePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("conditionEditorDelete") + " -\n";
|
||||
for (Condition c : plugin.getConditions()) {
|
||||
for (final Condition c : plugin.getConditions()) {
|
||||
text += ChatColor.AQUA + c.getName() + ChatColor.GRAY + ",";
|
||||
}
|
||||
text = text.substring(0, text.length() - 1) + "\n";
|
||||
|
@ -246,13 +253,13 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> used = new LinkedList<String>();
|
||||
Condition c = plugin.getCondition(input);
|
||||
final LinkedList<String> used = new LinkedList<String>();
|
||||
final Condition c = plugin.getCondition(input);
|
||||
if (c != null) {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (Stage stage : quest.getStages()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
for (final Stage stage : quest.getStages()) {
|
||||
if (stage.getCondition() != null
|
||||
&& stage.getCondition().getName().equalsIgnoreCase(c.getName())) {
|
||||
used.add(quest.getName());
|
||||
|
@ -266,7 +273,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
} else {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("conditionEditorInUse")
|
||||
+ " \"" + ChatColor.DARK_PURPLE + c.getName() + ChatColor.RED + "\":");
|
||||
for (String s : used) {
|
||||
for (final String s : used) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "- " + ChatColor.DARK_RED + s);
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
|
@ -285,7 +292,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
private class ConditionConfirmDeletePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final 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 + " - "
|
||||
|
@ -295,7 +302,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
plugin.getConditionFactory().deleteCondition(context);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
|
|
@ -30,21 +30,24 @@ import me.blackvein.quests.util.Lang;
|
|||
|
||||
public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public PlayerPrompt(ConversationContext context) {
|
||||
public PlayerPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 2;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorPlayer");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -55,7 +58,8 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("conditionEditorItemsInMainHand");
|
||||
|
@ -66,15 +70,16 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
|
||||
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
|
||||
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
|
||||
|
@ -90,11 +95,11 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.C_WHILE_HOLDING_MAIN_HAND, items);
|
||||
}
|
||||
|
@ -102,7 +107,7 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -114,14 +119,14 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemsInMainHandListPrompt(context);
|
||||
case 2:
|
||||
try {
|
||||
return new ConditionMainPrompt(context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -132,21 +137,24 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemsInMainHandListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public ItemsInMainHandListPrompt(ConversationContext context) {
|
||||
public ItemsInMainHandListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorItemsInMainHand");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -159,7 +167,8 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -172,15 +181,16 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (ItemStack is : (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND)) {
|
||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -195,15 +205,15 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.C_WHILE_HOLDING_MAIN_HAND, items);
|
||||
} else {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(CK.C_WHILE_HOLDING_MAIN_HAND, items);
|
||||
}
|
||||
|
@ -211,7 +221,7 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context) + " -\n";
|
||||
|
@ -223,7 +233,7 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, ItemsInMainHandListPrompt.this);
|
||||
|
|
|
@ -35,21 +35,24 @@ import me.blackvein.quests.util.MiscUtil;
|
|||
|
||||
public class WorldPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public WorldPrompt(ConversationContext context) {
|
||||
public WorldPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorWorld");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -61,7 +64,8 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("conditionEditorStayWithinWorld");
|
||||
|
@ -74,15 +78,16 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.C_WHILE_WITHIN_WORLD) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s: (List<String>) context.getSessionData(CK.C_WHILE_WITHIN_WORLD)) {
|
||||
for (final String s: (List<String>) context.getSessionData(CK.C_WHILE_WITHIN_WORLD)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -92,7 +97,7 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s: (List<String>) context.getSessionData(CK.C_WHILE_WITHIN_BIOME)) {
|
||||
for (final String s: (List<String>) context.getSessionData(CK.C_WHILE_WITHIN_BIOME)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -105,8 +110,8 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -118,7 +123,7 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new WorldsPrompt(context);
|
||||
|
@ -127,7 +132,7 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
case 3:
|
||||
try {
|
||||
return new ConditionMainPrompt(context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -138,27 +143,27 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class WorldsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public WorldsPrompt(ConversationContext context) {
|
||||
public WorldsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorWorldsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorWorldsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String worlds = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
List<World> worldArr = Bukkit.getWorlds();
|
||||
final List<World> worldArr = Bukkit.getWorlds();
|
||||
for (int i = 0; i < worldArr.size(); i++) {
|
||||
if (i < (worldArr.size() - 1)) {
|
||||
worlds += MiscUtil.snakeCaseToUpperCamelCase(worldArr.get(i).getName()) + ", ";
|
||||
|
@ -170,11 +175,11 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> worlds = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> worlds = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (Bukkit.getWorld(s) != null) {
|
||||
worlds.add(s);
|
||||
} else {
|
||||
|
@ -191,27 +196,27 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class BiomesPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public BiomesPrompt(ConversationContext context) {
|
||||
public BiomesPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorBiomesTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("conditionEditorBiomesPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String biomes = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
LinkedList<Biome> biomeArr = new LinkedList<Biome>(Arrays.asList(Biome.values()));
|
||||
final LinkedList<Biome> biomeArr = new LinkedList<Biome>(Arrays.asList(Biome.values()));
|
||||
for (int i = 0; i < biomeArr.size(); i++) {
|
||||
if (i < (biomeArr.size() - 1)) {
|
||||
biomes += MiscUtil.snakeCaseToUpperCamelCase(biomeArr.get(i).name()) + ", ";
|
||||
|
@ -223,11 +228,11 @@ public class WorldPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> biomes = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> biomes = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (MiscUtil.getProperBiome(s) != null) {
|
||||
biomes.add(s);
|
||||
} else {
|
||||
|
|
|
@ -54,23 +54,26 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final Prompt oldPrompt;
|
||||
|
||||
public ItemStackPrompt(ConversationContext context, Prompt old) {
|
||||
public ItemStackPrompt(final ConversationContext context, final Prompt old) {
|
||||
super(context);
|
||||
oldPrompt = old;
|
||||
}
|
||||
|
||||
private final int size = 10;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("createItemTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
@ -78,15 +81,14 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return ChatColor.YELLOW;
|
||||
case 6:
|
||||
return ChatColor.BLUE;
|
||||
case 7:
|
||||
if ((LinkedHashMap<String, Object>) context.getSessionData("tempMeta") != null) {
|
||||
return ChatColor.YELLOW;
|
||||
return ChatColor.BLUE;
|
||||
} else {
|
||||
return ChatColor.GRAY;
|
||||
}
|
||||
case 7:
|
||||
return ChatColor.BLUE;
|
||||
case 8:
|
||||
return ChatColor.RED;
|
||||
case 9:
|
||||
|
@ -96,8 +98,9 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 0:
|
||||
return ChatColor.YELLOW + Lang.get("itemCreateLoadHand");
|
||||
|
@ -128,7 +131,8 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
@ -148,21 +152,21 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.YELLOW + getTitle(context) + "\n";
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
if (context.getSessionData("tempName") != null) {
|
||||
String stackData = getItemData(context);
|
||||
final String stackData = getItemData(context);
|
||||
if (stackData != null) {
|
||||
text += stackData;
|
||||
if (context.getSessionData("tempMeta") != null) {
|
||||
LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) context.getSessionData("tempMeta");
|
||||
final LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) context.getSessionData("tempMeta");
|
||||
if (!map.isEmpty()) {
|
||||
for (String key : map.keySet()) {
|
||||
for (final String key : map.keySet()) {
|
||||
if (key.equals("pages")) {
|
||||
List<String> pages = (List<String>) map.get(key);
|
||||
final List<String> pages = (List<String>) map.get(key);
|
||||
text += ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN + key + "=" + pages.size()
|
||||
+ "\n";
|
||||
} else {
|
||||
|
@ -176,7 +180,7 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
} else {
|
||||
text += "\n";
|
||||
}
|
||||
for (int i = 0; i <= size; i++) {
|
||||
for (int i = 0; i <= size-1; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
|
||||
}
|
||||
|
@ -185,13 +189,13 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 0:
|
||||
context.setSessionData("tempMeta", null);
|
||||
context.setSessionData("tempMeta", null);
|
||||
|
||||
Player player = (Player) context.getForWhom();
|
||||
ItemStack is = player.getItemInHand();
|
||||
final Player player = (Player) context.getForWhom();
|
||||
final ItemStack is = player.getItemInHand();
|
||||
if (is == null || is.getType().equals(Material.AIR)) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("itemCreateNoItem"));
|
||||
return new ItemStackPrompt(context, oldPrompt);
|
||||
|
@ -209,17 +213,17 @@ context.setSessionData("tempMeta", null);
|
|||
context.setSessionData("tempEnchantments", new HashMap<Enchantment, Integer>(is.getEnchantments()));
|
||||
}
|
||||
if (is.hasItemMeta()) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
final ItemMeta meta = is.getItemMeta();
|
||||
if (meta.hasDisplayName()) {
|
||||
String display = meta.getDisplayName().replace(ChatColor.COLOR_CHAR, '&');
|
||||
final String display = meta.getDisplayName().replace(ChatColor.COLOR_CHAR, '&');
|
||||
context.setSessionData("tempDisplay", display);
|
||||
}
|
||||
if (meta.hasLore()) {
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
final LinkedList<String> lore = new LinkedList<String>();
|
||||
lore.addAll(meta.getLore());
|
||||
context.setSessionData("tempLore", lore);
|
||||
}
|
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
final LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
map.putAll(meta.serialize());
|
||||
if (map.containsKey("lore")) {
|
||||
map.remove("lore");
|
||||
|
@ -288,10 +292,11 @@ context.setSessionData("tempMeta", null);
|
|||
context.setSessionData("tempDisplay", null);
|
||||
context.setSessionData("tempLore", null);
|
||||
context.setSessionData("tempMeta", null);
|
||||
return oldPrompt;
|
||||
case 9:
|
||||
if (context.getSessionData("tempName") != null && context.getSessionData("tempAmount") != null) {
|
||||
String name = (String) context.getSessionData("tempName");
|
||||
int amount = (Integer) context.getSessionData("tempAmount");
|
||||
final String name = (String) context.getSessionData("tempName");
|
||||
final int amount = (Integer) context.getSessionData("tempAmount");
|
||||
short data = -1;
|
||||
Map<Enchantment, Integer> enchs = null;
|
||||
String display = null;
|
||||
|
@ -307,16 +312,16 @@ context.setSessionData("tempMeta", null);
|
|||
}
|
||||
if (context.getSessionData("tempLore") != null) {
|
||||
lore = new ArrayList<String>();
|
||||
LinkedList<String> loadedLore = (LinkedList<String>) context.getSessionData("tempLore");
|
||||
for (String line : loadedLore) {
|
||||
final LinkedList<String> loadedLore = (LinkedList<String>) context.getSessionData("tempLore");
|
||||
for (final String line : loadedLore) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(Material.matchMaterial(name), amount);
|
||||
final ItemStack stack = new ItemStack(Material.matchMaterial(name), amount);
|
||||
|
||||
if (data != -1) {
|
||||
stack.setDurability((short) data);
|
||||
stack.setDurability(data);
|
||||
}
|
||||
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
|
@ -326,7 +331,7 @@ context.setSessionData("tempMeta", null);
|
|||
}
|
||||
|
||||
if (enchs != null) {
|
||||
for (Entry<Enchantment, Integer> e : enchs.entrySet()) {
|
||||
for (final Entry<Enchantment, Integer> e : enchs.entrySet()) {
|
||||
meta.addEnchant(e.getKey(), e.getValue(), true);
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +352,7 @@ context.setSessionData("tempMeta", null);
|
|||
default:
|
||||
try {
|
||||
return oldPrompt;
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -356,30 +361,30 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
public class ItemNamePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemNamePrompt(ConversationContext context) {
|
||||
public ItemNamePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String s = input.replace(":", "");
|
||||
Material mat = Material.matchMaterial(s.toUpperCase().replace(" ", "_"));
|
||||
final String s = input.replace(":", "");
|
||||
final Material mat = Material.matchMaterial(s.toUpperCase().replace(" ", "_"));
|
||||
if (mat == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidName"));
|
||||
return new ItemNamePrompt(context);
|
||||
|
@ -396,30 +401,30 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
public class ItemAmountPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemAmountPrompt(ConversationContext context) {
|
||||
public ItemAmountPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterAmount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 1 || amt > 64) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1").replace("<greatest>", "64"));
|
||||
|
@ -428,7 +433,7 @@ context.setSessionData("tempMeta", null);
|
|||
context.setSessionData("tempAmount", Integer.parseInt(input));
|
||||
return new ItemStackPrompt(context, oldPrompt);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new ItemAmountPrompt(context);
|
||||
}
|
||||
|
@ -440,31 +445,31 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
public class ItemDataPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemDataPrompt(ConversationContext context) {
|
||||
public ItemDataPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterDurab");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidDurab"));
|
||||
return new ItemDataPrompt(context);
|
||||
|
@ -472,7 +477,7 @@ context.setSessionData("tempMeta", null);
|
|||
context.setSessionData("tempData", Short.parseShort(input));
|
||||
return new ItemStackPrompt(context, oldPrompt);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
if (input.equals("*")) {
|
||||
context.setSessionData("tempData", Short.parseShort("999")); // wildcard value
|
||||
return new ItemStackPrompt(context, oldPrompt);
|
||||
|
@ -489,24 +494,24 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
public class ItemEnchantmentPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemEnchantmentPrompt(ConversationContext context) {
|
||||
public ItemEnchantmentPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("enchantmentsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterEnch");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
for (Enchantment e : Enchantment.values()) {
|
||||
for (final Enchantment e : Enchantment.values()) {
|
||||
text += ChatColor.GREEN + ItemUtil.getPrettyEnchantmentName(e) + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2);
|
||||
|
@ -514,11 +519,11 @@ context.setSessionData("tempMeta", null);
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
String s = input.replace(":", "");
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final String s = input.replace(":", "");
|
||||
if (s.equalsIgnoreCase(Lang.get("cmdClear")) == false
|
||||
&& s.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Enchantment e = ItemUtil.getEnchantmentFromPrettyName(MiscUtil.getCapitalized(s));
|
||||
final Enchantment e = ItemUtil.getEnchantmentFromPrettyName(MiscUtil.getCapitalized(s));
|
||||
if (e != null) {
|
||||
context.setSessionData("tempEnchant", e);
|
||||
return new ItemEnchantmentLevelPrompt(context, ItemUtil.getPrettyEnchantmentName(e));
|
||||
|
@ -537,30 +542,30 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
final String enchantment;
|
||||
|
||||
protected ItemEnchantmentLevelPrompt(ConversationContext context, String ench) {
|
||||
protected ItemEnchantmentLevelPrompt(final ConversationContext context, final String ench) {
|
||||
super(context);
|
||||
enchantment = ench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterLevel").replace("<enchantment>", enchantment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.AQUA + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
try {
|
||||
int num = Integer.parseInt(input);
|
||||
final int num = Integer.parseInt(input);
|
||||
if (num < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||
.replace("<number>", "1"));
|
||||
|
@ -568,18 +573,19 @@ context.setSessionData("tempMeta", null);
|
|||
} else {
|
||||
if (context.getSessionData("tempEnchantments") != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
Map<Enchantment, Integer> enchs
|
||||
= (Map<Enchantment, Integer>) context.getSessionData("tempEnchantments");
|
||||
enchs.put((Enchantment) context.getSessionData("tempEnchant"), num);
|
||||
context.setSessionData("tempEnchantments", enchs);
|
||||
} else {
|
||||
Map<Enchantment, Integer> enchs = new HashMap<Enchantment, Integer>();
|
||||
final Map<Enchantment, Integer> enchs = new HashMap<Enchantment, Integer>();
|
||||
enchs.put((Enchantment) context.getSessionData("tempEnchant"), num);
|
||||
context.setSessionData("tempEnchantments", enchs);
|
||||
}
|
||||
return new ItemStackPrompt(context, oldPrompt);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new ItemEnchantmentLevelPrompt(context, enchantment);
|
||||
}
|
||||
|
@ -588,27 +594,27 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
public class ItemDisplayPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemDisplayPrompt(ConversationContext context) {
|
||||
public ItemDisplayPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterDisplay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
String s = input.replace(":", "");
|
||||
if (s.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& s.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
|
@ -623,32 +629,32 @@ context.setSessionData("tempMeta", null);
|
|||
|
||||
public class ItemLorePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemLorePrompt(ConversationContext context) {
|
||||
public ItemLorePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("itemCreateEnterLore");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
String s = input.replace(":", "");
|
||||
if (s.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& s.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
s = ConfigUtil.parseString(s);
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
final LinkedList<String> lore = new LinkedList<String>();
|
||||
lore.addAll(Arrays.asList(s.split(Lang.get("charSemi"))));
|
||||
context.setSessionData("tempLore", lore);
|
||||
} else if (s.equalsIgnoreCase("clear")) {
|
||||
|
@ -658,45 +664,47 @@ context.setSessionData("tempMeta", null);
|
|||
}
|
||||
}
|
||||
|
||||
private String getItemData(ConversationContext context) {
|
||||
private String getItemData(final ConversationContext context) {
|
||||
if (context.getSessionData("tempName") != null) {
|
||||
String item;
|
||||
if (context.getSessionData("tempDisplay") == null) {
|
||||
String name = (String) context.getSessionData("tempName");
|
||||
final String name = (String) context.getSessionData("tempName");
|
||||
item = ChatColor.AQUA + ItemUtil.getPrettyItemName(name);
|
||||
if (context.getSessionData("tempData") != null) {
|
||||
item += ":" + ChatColor.BLUE + (Short) context.getSessionData("tempData");
|
||||
item += ":" + ChatColor.BLUE + context.getSessionData("tempData");
|
||||
}
|
||||
} else {
|
||||
item = ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC + (String) context.getSessionData("tempDisplay")
|
||||
+ ChatColor.RESET + "" + ChatColor.GRAY + " (";
|
||||
String name = (String) context.getSessionData("tempName");
|
||||
final String name = (String) context.getSessionData("tempName");
|
||||
item += ChatColor.AQUA + ItemUtil.getPrettyItemName(name);
|
||||
if (context.getSessionData("tempData") != null) {
|
||||
item += ":" + ChatColor.BLUE + (Short) context.getSessionData("tempData");
|
||||
item += ":" + ChatColor.BLUE + context.getSessionData("tempData");
|
||||
}
|
||||
item += ChatColor.GRAY + ")";
|
||||
}
|
||||
if (context.getSessionData("tempAmount") != null) {
|
||||
item += ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + (Integer) context.getSessionData("tempAmount");
|
||||
item += ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + context.getSessionData("tempAmount");
|
||||
} else {
|
||||
item += ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + "1";
|
||||
}
|
||||
item += "\n";
|
||||
if (context.getSessionData("tempEnchantments") != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
Map<Enchantment, Integer> enchantments
|
||||
= (Map<Enchantment, Integer>) context.getSessionData("tempEnchantments");
|
||||
for (Entry<Enchantment, Integer> e : enchantments.entrySet()) {
|
||||
for (final Entry<Enchantment, Integer> e : enchantments.entrySet()) {
|
||||
item += ChatColor.GRAY + " - " + ChatColor.RED + ItemUtil.getPrettyEnchantmentName(e.getKey())
|
||||
+ " " + RomanNumeral.getNumeral(e.getValue()) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData("tempLore") != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
List<String> lore = (List<String>) context.getSessionData("tempLore");
|
||||
item += ChatColor.DARK_GREEN + "(Lore)\n\"";
|
||||
for (String s : lore) {
|
||||
for (final String s : lore) {
|
||||
if (lore.indexOf(s) != (lore.size() - 1)) {
|
||||
item += ChatColor.DARK_GREEN + "" + ChatColor.ITALIC + s + "\n";
|
||||
} else {
|
||||
|
|
|
@ -21,10 +21,10 @@ import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPrompt
|
|||
|
||||
public class OverridePrompt extends QuestsEditorStringPrompt {
|
||||
private final Prompt oldPrompt;
|
||||
private String promptText;
|
||||
private String classPrefix;
|
||||
private final String promptText;
|
||||
private final String classPrefix;
|
||||
|
||||
public OverridePrompt(ConversationContext context, Prompt old, String promptText) {
|
||||
public OverridePrompt(final ConversationContext context, final Prompt old, final String promptText) {
|
||||
super(context);
|
||||
oldPrompt = old;
|
||||
classPrefix = old.getClass().getSimpleName();
|
||||
|
@ -38,26 +38,26 @@ public class OverridePrompt extends QuestsEditorStringPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return promptText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.YELLOW + getQueryText(context) + "\n";
|
||||
final String text = ChatColor.YELLOW + getQueryText(context) + "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
context.setSessionData(classPrefix + "-override", input);
|
||||
return oldPrompt;
|
||||
}
|
||||
|
@ -67,17 +67,17 @@ public class OverridePrompt extends QuestsEditorStringPrompt {
|
|||
private Prompt oldPrompt;
|
||||
private String promptText = "Enter input";
|
||||
|
||||
public Builder context(ConversationContext context) {
|
||||
public Builder context(final ConversationContext context) {
|
||||
this.context = context;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder source(Prompt prompt) {
|
||||
public Builder source(final Prompt prompt) {
|
||||
this.oldPrompt = prompt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder promptText(String text) {
|
||||
public Builder promptText(final String text) {
|
||||
this.promptText = text;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.text.MessageFormat;
|
|||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
@ -31,15 +30,15 @@ public class NpcOfferQuestPrompt extends StringPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
Quests plugin = (Quests)context.getPlugin();
|
||||
Quester quester = plugin.getQuester(((Player) context.getForWhom()).getUniqueId());
|
||||
LinkedList<Quest> quests = (LinkedList<Quest>) context.getSessionData("npcQuests");
|
||||
String npc = (String) context.getSessionData("npc");
|
||||
String text = Lang.get("questNPCListTitle").replace("<npc>", npc);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final Quests plugin = (Quests)context.getPlugin();
|
||||
final Quester quester = plugin.getQuester(((Player) context.getForWhom()).getUniqueId());
|
||||
final LinkedList<Quest> quests = (LinkedList<Quest>) context.getSessionData("npcQuests");
|
||||
final String npc = (String) context.getSessionData("npc");
|
||||
final String text = Lang.get("questNPCListTitle").replace("<npc>", npc);
|
||||
String menu = text + "\n";
|
||||
for (int i = 1; i <= quests.size(); i++) {
|
||||
Quest quest = quests.get(i - 1);
|
||||
final Quest quest = quests.get(i - 1);
|
||||
if (quester.getCompletedQuests().contains(quest.getName())) {
|
||||
menu += ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "" + i + ". " + ChatColor.RESET + ""
|
||||
+ ChatColor.GREEN + "" + ChatColor.ITALIC + quest.getName() + ChatColor.RESET + ""
|
||||
|
@ -57,14 +56,14 @@ public class NpcOfferQuestPrompt extends StringPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Quests plugin = (Quests)context.getPlugin();
|
||||
Quester quester = plugin.getQuester(((Player) context.getForWhom()).getUniqueId());
|
||||
LinkedList<Quest> quests = (LinkedList<Quest>) context.getSessionData("npcQuests");
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Quests plugin = (Quests)context.getPlugin();
|
||||
final Quester quester = plugin.getQuester(((Player) context.getForWhom()).getUniqueId());
|
||||
final LinkedList<Quest> quests = (LinkedList<Quest>) context.getSessionData("npcQuests");
|
||||
int numInput = -1;
|
||||
try {
|
||||
numInput = Integer.parseInt(input);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
// Continue
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cancel")) || numInput == (quests.size() + 1)) {
|
||||
|
@ -72,14 +71,14 @@ public class NpcOfferQuestPrompt extends StringPrompt {
|
|||
return Prompt.END_OF_CONVERSATION;
|
||||
} else {
|
||||
Quest q = null;
|
||||
for (Quest quest : quests) {
|
||||
for (final Quest quest : quests) {
|
||||
if (quest.getName().equalsIgnoreCase(input)) {
|
||||
q = quest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (q == null) {
|
||||
for (Quest quest : quests) {
|
||||
for (final Quest quest : quests) {
|
||||
if (numInput == (quests.indexOf(quest) + 1)) {
|
||||
q = quest;
|
||||
break;
|
||||
|
@ -87,7 +86,7 @@ public class NpcOfferQuestPrompt extends StringPrompt {
|
|||
}
|
||||
}
|
||||
if (q == null) {
|
||||
for (Quest quest : quests) {
|
||||
for (final Quest quest : quests) {
|
||||
if (quest.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
q = quest;
|
||||
break;
|
||||
|
@ -98,16 +97,16 @@ public class NpcOfferQuestPrompt extends StringPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new NpcOfferQuestPrompt();
|
||||
} else {
|
||||
Player player = quester.getPlayer();
|
||||
final Player player = quester.getPlayer();
|
||||
if (quester.canAcceptOffer(q, true)) {
|
||||
quester.setQuestToTake(q.getName());
|
||||
for (String msg : extracted(plugin, quester).split("<br>")) {
|
||||
for (final String msg : extracted(plugin, quester).split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
if (!plugin.getSettings().canAskConfirmation()) {
|
||||
quester.takeQuest(q, false);
|
||||
} else {
|
||||
plugin.getConversationFactory().buildConversation((Conversable) player).begin();
|
||||
plugin.getConversationFactory().buildConversation(player).begin();
|
||||
}
|
||||
}
|
||||
/*Player player = quester.getPlayer();
|
||||
|
|
|
@ -20,7 +20,7 @@ import me.blackvein.quests.Quests;
|
|||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
|
||||
public abstract class QuestsEditorNumericPrompt extends QuestsNumericPrompt {
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
private QuestFactory factory;
|
||||
|
||||
public QuestsEditorNumericPrompt(final ConversationContext context) {
|
||||
|
@ -36,6 +36,7 @@ public abstract class QuestsEditorNumericPrompt extends QuestsNumericPrompt {
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import me.blackvein.quests.Quests;
|
|||
import me.blackvein.quests.convo.QuestsStringPrompt;
|
||||
|
||||
public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
private QuestFactory factory;
|
||||
|
||||
public QuestsEditorStringPrompt(final ConversationContext context) {
|
||||
|
@ -35,6 +35,7 @@ public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
|
|
@ -57,24 +57,27 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public QuestMainPrompt(ConversationContext context) {
|
||||
public QuestMainPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 15;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("quest") + ": " + context.getSessionData(CK.Q_NAME) + "" + ChatColor.GRAY
|
||||
+ (context.getSessionData(CK.Q_ID) != null ? " (" + Lang.get("id") + ":"
|
||||
+ context.getSessionData(CK.Q_ID) + ")": "");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -111,7 +114,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("questEditorName");
|
||||
|
@ -170,7 +174,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return "";
|
||||
|
@ -194,7 +199,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
if (context.getSessionData(CK.Q_START_BLOCK) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
final Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + l.getWorld().getName() + ", " + l.getBlockX() + ", "
|
||||
+ l.getBlockY() + ", " + l.getBlockZ() + ChatColor.RESET + ChatColor.GRAY + ")";
|
||||
}
|
||||
|
@ -241,8 +246,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
|
||||
|
@ -255,7 +260,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new QuestNamePrompt(context);
|
||||
|
@ -270,7 +275,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
return new QuestMainPrompt(context);
|
||||
}
|
||||
case 5:
|
||||
Map<UUID, Block> blockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final Map<UUID, Block> blockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
blockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(blockStarts);
|
||||
return new QuestBlockStartPrompt(context);
|
||||
|
@ -309,32 +314,32 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestNamePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestNamePrompt(ConversationContext context) {
|
||||
public QuestNamePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterQuestName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
if (q.getName().equalsIgnoreCase(input)) {
|
||||
String s = null;
|
||||
if (context.getSessionData(CK.ED_QUEST_EDIT) != null) {
|
||||
|
@ -346,7 +351,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
}
|
||||
List<String> questNames = plugin.getQuestFactory().getNamesOfQuestsBeingEdited();
|
||||
final List<String> questNames = plugin.getQuestFactory().getNamesOfQuestsBeingEdited();
|
||||
if (questNames.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||
return new QuestNamePrompt(context);
|
||||
|
@ -355,7 +360,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
||||
return new QuestNamePrompt(context);
|
||||
}
|
||||
questNames.remove((String) context.getSessionData(CK.Q_NAME));
|
||||
questNames.remove(context.getSessionData(CK.Q_NAME));
|
||||
context.setSessionData(CK.Q_NAME, input);
|
||||
questNames.add(input);
|
||||
plugin.getQuestFactory().setNamesOfQuestsBeingEdited(questNames);
|
||||
|
@ -366,30 +371,30 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestAskMessagePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestAskMessagePrompt(ConversationContext context) {
|
||||
public QuestAskMessagePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterAskMessage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (input.startsWith("++")) {
|
||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
|
||||
|
@ -406,30 +411,30 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestFinishMessagePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestFinishMessagePrompt(ConversationContext context) {
|
||||
public QuestFinishMessagePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterFinishMessage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (input.startsWith("++")) {
|
||||
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
|
||||
|
@ -446,26 +451,26 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestNPCStartPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestNPCStartPrompt(ConversationContext context) {
|
||||
public QuestNPCStartPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterNPCStart");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n"
|
||||
|
@ -473,23 +478,23 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i > -1) {
|
||||
if (CitizensAPI.getNPCRegistry().getById(i) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
||||
return new QuestNPCStartPrompt(context);
|
||||
}
|
||||
context.setSessionData(CK.Q_START_NPC, i);
|
||||
Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new QuestNPCStartPrompt(context);
|
||||
|
@ -497,7 +502,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.Q_START_NPC, null);
|
||||
}
|
||||
Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return new QuestMainPrompt(context);
|
||||
|
@ -506,37 +511,37 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestBlockStartPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestBlockStartPrompt(ConversationContext context) {
|
||||
public QuestBlockStartPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterBlockStart");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdDone")) || input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdDone"))) {
|
||||
Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
Block block = selectedBlockStarts.get(player.getUniqueId());
|
||||
final Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final Block block = selectedBlockStarts.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
context.setSessionData(CK.Q_START_BLOCK, loc);
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
} else {
|
||||
|
@ -544,13 +549,13 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
return new QuestBlockStartPrompt(context);
|
||||
}
|
||||
} else {
|
||||
Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(selectedBlockStarts);
|
||||
}
|
||||
return new QuestMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(selectedBlockStarts);
|
||||
context.setSessionData(CK.Q_START_BLOCK, null);
|
||||
|
@ -562,31 +567,31 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestRegionPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestRegionPrompt(ConversationContext context) {
|
||||
public QuestRegionPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("questRegionTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questWGPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + getTitle(context) + "\n";
|
||||
boolean any = false;
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
WorldGuardAPI api = plugin.getDependencies().getWorldGuardApi();
|
||||
RegionManager rm = api.getRegionManager(world);
|
||||
for (String region : rm.getRegions().keySet()) {
|
||||
for (final World world : plugin.getServer().getWorlds()) {
|
||||
final WorldGuardAPI api = plugin.getDependencies().getWorldGuardApi();
|
||||
final RegionManager rm = api.getRegionManager(world);
|
||||
for (final String region : rm.getRegions().keySet()) {
|
||||
any = true;
|
||||
text += ChatColor.GREEN + region + ", ";
|
||||
}
|
||||
|
@ -601,16 +606,16 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
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()) {
|
||||
WorldGuardAPI api = plugin.getDependencies().getWorldGuardApi();
|
||||
RegionManager rm = api.getRegionManager(world);
|
||||
for (String region : rm.getRegions().keySet()) {
|
||||
for (final World world : plugin.getServer().getWorlds()) {
|
||||
final WorldGuardAPI api = plugin.getDependencies().getWorldGuardApi();
|
||||
final RegionManager rm = api.getRegionManager(world);
|
||||
for (final String region : rm.getRegions().keySet()) {
|
||||
if (region.equalsIgnoreCase(input)) {
|
||||
found = region;
|
||||
done = true;
|
||||
|
@ -642,27 +647,27 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestInitialActionPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestInitialActionPrompt(ConversationContext context) {
|
||||
public QuestInitialActionPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterInitialEvent");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.AQUA + getTitle(context) + "\n";
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
text += ChatColor.RED + "- " + Lang.get("none");
|
||||
} else {
|
||||
for (Action e : plugin.getActions()) {
|
||||
for (final Action e : plugin.getActions()) {
|
||||
text += ChatColor.GREEN + "- " + e.getName() + "\n";
|
||||
}
|
||||
}
|
||||
|
@ -670,11 +675,11 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
Action a = plugin.getAction(input);
|
||||
final Action a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
context.setSessionData(CK.Q_INITIAL_EVENT, a.getName());
|
||||
return new QuestMainPrompt(context);
|
||||
|
@ -696,22 +701,25 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public QuestGuiDisplayPrompt(ConversationContext context) {
|
||||
public QuestGuiDisplayPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("questGUITitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -724,7 +732,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -737,19 +746,20 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getSessionData("tempStack") != null) {
|
||||
ItemStack stack = (ItemStack) context.getSessionData("tempStack");
|
||||
final ItemStack stack = (ItemStack) context.getSessionData("tempStack");
|
||||
boolean failed = false;
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (quest.getGUIDisplay() != null) {
|
||||
if (ItemUtil.compareItems(stack, quest.getGUIDisplay(), false) == 0) {
|
||||
String error = Lang.get("questGUIError");
|
||||
|
@ -767,7 +777,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) != null) {
|
||||
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
final ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
text += " " + ChatColor.RESET + ItemUtil.getDisplayString(stack) + "\n";
|
||||
} else {
|
||||
text += " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
|
@ -780,7 +790,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, QuestGuiDisplayPrompt.this);
|
||||
|
@ -798,7 +808,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestSavePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestSavePrompt(ConversationContext context) {
|
||||
public QuestSavePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -808,11 +818,12 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GREEN;
|
||||
|
@ -823,7 +834,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GREEN + Lang.get("yesWord");
|
||||
|
@ -834,14 +845,15 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + ChatColor.AQUA
|
||||
+ context.getSessionData(CK.Q_NAME) + ChatColor.YELLOW + "\"?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = getQueryText(context) + "\n";
|
||||
|
@ -853,7 +865,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedAskMessage"));
|
||||
|
@ -865,7 +877,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages"));
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
final FileConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
data.load(new File(plugin.getDataFolder(), "quests.yml"));
|
||||
ConfigurationSection questSection = data.getConfigurationSection("quests");
|
||||
|
@ -893,9 +905,9 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
context.getForWhom().sendRawMessage(ChatColor.GREEN
|
||||
+ Lang.get("questEditorSaved").replace("<command>", "/questadmin "
|
||||
+ Lang.get("COMMAND_QUESTADMIN_RELOAD")));
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
@ -909,7 +921,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestExitPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestExitPrompt(ConversationContext context) {
|
||||
public QuestExitPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -919,11 +931,12 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GREEN;
|
||||
|
@ -934,7 +947,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GREEN + Lang.get("yesWord");
|
||||
|
@ -945,13 +958,14 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("confirmDelete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.YELLOW + getQueryText(context) + "\n";
|
||||
|
@ -963,7 +977,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.BOLD + "" + ChatColor.YELLOW + Lang.get("exited"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
|
|
@ -34,22 +34,25 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public QuestMenuPrompt(ConversationContext context) {
|
||||
public QuestMenuPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("questEditorTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -62,7 +65,8 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("questEditorCreate");
|
||||
|
@ -77,13 +81,14 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
|
@ -94,7 +99,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
|
@ -128,42 +133,44 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestSelectCreatePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestSelectCreatePrompt(ConversationContext context) {
|
||||
public QuestSelectCreatePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("questCreateTitle");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterQuestName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + getTitle(context)+ "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
final String text = ChatColor.GOLD + getTitle(context)+ "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, String input) {
|
||||
if (input == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new QuestSelectCreatePrompt(context);
|
||||
}
|
||||
input = input.trim();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
if (q.getName().equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
|
||||
return new QuestSelectCreatePrompt(context);
|
||||
}
|
||||
}
|
||||
List<String> questNames = plugin.getQuestFactory().getNamesOfQuestsBeingEdited();
|
||||
final List<String> questNames = plugin.getQuestFactory().getNamesOfQuestsBeingEdited();
|
||||
if (questNames.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||
return new QuestSelectCreatePrompt(context);
|
||||
|
@ -190,31 +197,33 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestSelectEditPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestSelectEditPrompt(ConversationContext context) {
|
||||
public QuestSelectEditPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("questEditTitle");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterQuestName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String s = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
s += ChatColor.GRAY + "- " + ChatColor.AQUA + q.getName() + "\n";
|
||||
}
|
||||
return s + ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Quest q = plugin.getQuest(input);
|
||||
final Quest q = plugin.getQuest(input);
|
||||
if (q != null) {
|
||||
plugin.getQuestFactory().loadQuest(context, q);
|
||||
return new QuestMainPrompt(context);
|
||||
|
@ -228,22 +237,24 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestSelectDeletePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestSelectDeletePrompt(ConversationContext context) {
|
||||
public QuestSelectDeletePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("questDeleteTitle");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("questEditorEnterQuestName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
text += ChatColor.AQUA + quest.getName() + ChatColor.GRAY + ",";
|
||||
}
|
||||
text = text.substring(0, text.length() - 1) + "\n";
|
||||
|
@ -252,12 +263,12 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> used = new LinkedList<String>();
|
||||
Quest found = plugin.getQuest(input);
|
||||
final LinkedList<String> used = new LinkedList<String>();
|
||||
final Quest found = plugin.getQuest(input);
|
||||
if (found != null) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
if (q.getRequirements().getNeededQuests().contains(q.getName())
|
||||
|| q.getRequirements().getBlockQuests().contains(q.getName())) {
|
||||
used.add(q.getName());
|
||||
|
@ -271,7 +282,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
+ Lang.get("questEditorQuestAsRequirement1") + " \"" + ChatColor.DARK_PURPLE
|
||||
+ context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + "\" "
|
||||
+ Lang.get("questEditorQuestAsRequirement2"));
|
||||
for (String s : used) {
|
||||
for (final String s : used) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "- " + ChatColor.DARK_RED + s);
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
|
@ -289,20 +300,22 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class QuestConfirmDeletePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestConfirmDeletePrompt(ConversationContext context) {
|
||||
public QuestConfirmDeletePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
@Override
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("confirmDelete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final 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 + " - "
|
||||
|
@ -312,7 +325,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
plugin.getQuestFactory().deleteQuest(context);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,6 +15,13 @@ package me.blackvein.quests.convo.quests.objectives;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.blackvein.quests.convo.generic.ItemStackPrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
|
@ -26,18 +33,11 @@ import me.blackvein.quests.util.ItemUtil;
|
|||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
||||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public ItemsPrompt(int stageNum, ConversationContext context) {
|
||||
public ItemsPrompt(final int stageNum, final ConversationContext context) {
|
||||
super(context);
|
||||
this.stageNum = stageNum;
|
||||
this.pref = "stage" + stageNum;
|
||||
|
@ -45,15 +45,18 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final int size = 6;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorItems");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -68,7 +71,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorCraftItems");
|
||||
|
@ -87,15 +91,16 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
|
||||
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
|
||||
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
|
||||
|
@ -107,7 +112,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
|
||||
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
|
||||
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
|
||||
|
@ -119,9 +124,9 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<String> enchants = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_TYPES);
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS);
|
||||
final LinkedList<String> enchants = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_TYPES);
|
||||
final LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES);
|
||||
final LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS);
|
||||
for (int i = 0; i < enchants.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i))
|
||||
+ ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA
|
||||
|
@ -135,7 +140,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS);
|
||||
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
|
||||
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
|
||||
|
@ -147,7 +152,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_CONSUME_ITEMS);
|
||||
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_CONSUME_ITEMS);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
|
||||
+ ChatColor.GRAY + " x " + ChatColor.AQUA + items.get(i).getAmount() + "\n";
|
||||
|
@ -163,15 +168,15 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
} else if (context.getSessionData(pref + CK.S_SMELT_ITEMS) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
}
|
||||
|
@ -180,7 +185,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -192,7 +197,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemsCraftListPrompt(context);
|
||||
|
@ -207,7 +212,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
case 6:
|
||||
try {
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -218,21 +223,24 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemsCraftListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public ItemsCraftListPrompt(ConversationContext context) {
|
||||
public ItemsCraftListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorCraftItems");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -245,7 +253,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -258,15 +267,16 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS)) {
|
||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -281,15 +291,15 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_CRAFT_ITEMS);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
} else {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
}
|
||||
|
@ -297,7 +307,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context) + " -\n";
|
||||
|
@ -309,7 +319,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, ItemsCraftListPrompt.this);
|
||||
|
@ -327,21 +337,24 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemsSmeltListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public ItemsSmeltListPrompt(ConversationContext context) {
|
||||
public ItemsSmeltListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorSmeltItems");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -354,7 +367,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -367,15 +381,16 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_SMELT_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS)) {
|
||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -390,15 +405,15 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(pref + CK.S_SMELT_ITEMS) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_SMELT_ITEMS);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
} else {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
}
|
||||
|
@ -406,7 +421,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context) + " -\n";
|
||||
|
@ -418,7 +433,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, ItemsSmeltListPrompt.this);
|
||||
|
@ -436,21 +451,24 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemsEnchantListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public ItemsEnchantListPrompt(ConversationContext context) {
|
||||
public ItemsEnchantListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 5;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorEnchantItems");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -465,7 +483,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorSetEnchantments");
|
||||
|
@ -482,15 +501,16 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_ENCHANT_TYPES)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_ENCHANT_TYPES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -500,7 +520,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -510,7 +530,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (int i : (List<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS)) {
|
||||
for (final int i : (List<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -524,8 +544,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context) + " -\n";
|
||||
|
@ -538,7 +558,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemEnchantTypesPrompt(context);
|
||||
|
@ -585,24 +605,24 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemEnchantTypesPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemEnchantTypesPrompt(ConversationContext context) {
|
||||
public ItemEnchantTypesPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorEnchantments");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorEnchantTypePrompt");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.DARK_PURPLE + getTitle(context)
|
||||
|
@ -619,10 +639,10 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> enchTypes = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> enchTypes = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (ItemUtil.getEnchantmentFromProperName(s) != null) {
|
||||
if (enchTypes.contains(s) == false) {
|
||||
enchTypes.add(s);
|
||||
|
@ -644,34 +664,34 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemEnchantItemsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemEnchantItemsPrompt(ConversationContext context) {
|
||||
public ItemEnchantItemsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorItemNamesPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
for (String s : args) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<String> names = new LinkedList<String>();
|
||||
for (final String s : args) {
|
||||
try {
|
||||
if (Material.matchMaterial(s) != null) {
|
||||
names.add(s);
|
||||
|
@ -680,7 +700,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
+ Lang.get("stageEditorInvalidItemName"));
|
||||
return new ItemEnchantItemsPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorNotListofNumbers"));
|
||||
return new ItemEnchantItemsPrompt(context);
|
||||
|
@ -694,34 +714,34 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemEnchantAmountsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public ItemEnchantAmountsPrompt(ConversationContext context) {
|
||||
public ItemEnchantAmountsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorEnchantAmountsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (String s : args) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (final String s : args) {
|
||||
try {
|
||||
if (Integer.parseInt(s) > 0) {
|
||||
amounts.add(Integer.parseInt(s));
|
||||
|
@ -730,7 +750,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
.replace("<number>", "1"));
|
||||
return new ItemEnchantAmountsPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorNotListofNumbers"));
|
||||
return new ItemEnchantAmountsPrompt(context);
|
||||
|
@ -744,21 +764,24 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemsBrewListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public ItemsBrewListPrompt(ConversationContext context) {
|
||||
public ItemsBrewListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorBrewPotions");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -771,7 +794,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -784,15 +808,16 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_BREW_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS)) {
|
||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -807,15 +832,15 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(pref + CK.S_BREW_ITEMS) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_BREW_ITEMS);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_BREW_ITEMS, items);
|
||||
} else {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_BREW_ITEMS, items);
|
||||
}
|
||||
|
@ -823,7 +848,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context) + " -\n";
|
||||
|
@ -835,7 +860,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, ItemsBrewListPrompt.this);
|
||||
|
@ -853,21 +878,24 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class ItemsConsumeListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public ItemsConsumeListPrompt(ConversationContext context) {
|
||||
public ItemsConsumeListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorConsumeItems");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -880,7 +908,8 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -893,15 +922,16 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_CONSUME_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_CONSUME_ITEMS)) {
|
||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_CONSUME_ITEMS)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -916,15 +946,15 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(pref + CK.S_CONSUME_ITEMS) != null) {
|
||||
List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_CONSUME_ITEMS);
|
||||
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(pref + CK.S_CONSUME_ITEMS);
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_CONSUME_ITEMS, items);
|
||||
} else {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
items.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_CONSUME_ITEMS, items);
|
||||
}
|
||||
|
@ -932,7 +962,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context) + " -\n";
|
||||
|
@ -944,7 +974,7 @@ public class ItemsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, ItemsConsumeListPrompt.this);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public MobsPrompt(int stageNum, ConversationContext context) {
|
||||
public MobsPrompt(final int stageNum, final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.stageNum = stageNum;
|
||||
|
@ -53,15 +53,18 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final int size = 6;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobs");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -76,7 +79,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorKillMobs");
|
||||
|
@ -95,16 +99,17 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<String> mobs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_TYPES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS);
|
||||
final LinkedList<String> mobs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_TYPES);
|
||||
final LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS);
|
||||
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) {
|
||||
for (int i = 0; i < mobs.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA
|
||||
|
@ -112,11 +117,11 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
+ " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
} else {
|
||||
LinkedList<String> locs
|
||||
final LinkedList<String> locs
|
||||
= (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS);
|
||||
LinkedList<Integer> radii
|
||||
final LinkedList<Integer> radii
|
||||
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS);
|
||||
LinkedList<String> names
|
||||
final LinkedList<String> names
|
||||
= (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES);
|
||||
for (int i = 0; i < mobs.size(); i++) {
|
||||
String msg = Lang.get("blocksWithin");
|
||||
|
@ -134,8 +139,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<String> mobs = (LinkedList<String>) context.getSessionData(pref + CK.S_TAME_TYPES);
|
||||
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_TAME_AMOUNTS);
|
||||
final LinkedList<String> mobs = (LinkedList<String>) context.getSessionData(pref + CK.S_TAME_TYPES);
|
||||
final LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_TAME_AMOUNTS);
|
||||
for (int i = 0; i < mobs.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + mobs.get(i) + ChatColor.GRAY + " x "
|
||||
+ ChatColor.AQUA + amounts.get(i) + "\n";
|
||||
|
@ -146,7 +151,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
if (context.getSessionData(pref + CK.S_FISH) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Integer fish = (Integer) context.getSessionData(pref + CK.S_FISH);
|
||||
final Integer fish = (Integer) context.getSessionData(pref + CK.S_FISH);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + fish + " " + Lang.get("stageEditorFish")
|
||||
+ ChatColor.GRAY + ")\n";
|
||||
}
|
||||
|
@ -154,7 +159,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
if (context.getSessionData(pref + CK.S_COW_MILK) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Integer cows = (Integer) context.getSessionData(pref + CK.S_COW_MILK);
|
||||
final Integer cows = (Integer) context.getSessionData(pref + CK.S_COW_MILK);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + cows + " " + Lang.get("stageEditorCows")
|
||||
+ ChatColor.GRAY + ")\n";
|
||||
}
|
||||
|
@ -163,8 +168,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<String> colors = (LinkedList<String>) context.getSessionData(pref + CK.S_SHEAR_COLORS);
|
||||
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS);
|
||||
final LinkedList<String> colors = (LinkedList<String>) context.getSessionData(pref + CK.S_SHEAR_COLORS);
|
||||
final LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS);
|
||||
for (int i = 0; i < colors.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + colors.get(i) + ChatColor.GRAY + " x "
|
||||
+ ChatColor.AQUA + amounts.get(i) + "\n";
|
||||
|
@ -179,10 +184,10 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -194,7 +199,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new MobsKillListPrompt(context);
|
||||
|
@ -209,7 +214,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
case 6:
|
||||
try {
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -220,21 +225,24 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsKillListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public MobsKillListPrompt(ConversationContext context) {
|
||||
public MobsKillListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 7;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorKillMobs");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -251,7 +259,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorSetMobTypes");
|
||||
|
@ -272,15 +281,16 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_MOB_TYPES)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_MOB_TYPES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -290,7 +300,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS)) {
|
||||
for (final Integer i : (List<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -300,7 +310,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -310,7 +320,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (int i : (List<Integer>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS)) {
|
||||
for (final int i : (List<Integer>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -320,7 +330,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -334,8 +344,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -348,14 +358,14 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new MobsTypesPrompt(context);
|
||||
case 2:
|
||||
return new MobsAmountsPrompt(context);
|
||||
case 3:
|
||||
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
return new MobsLocationPrompt(context);
|
||||
|
@ -425,28 +435,28 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsTypesPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsTypesPrompt(ConversationContext context) {
|
||||
public MobsTypesPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorMobsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String mobs = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
LinkedList<EntityType> mobArr = new LinkedList<EntityType>(Arrays.asList(EntityType.values()));
|
||||
LinkedList<EntityType> toRemove = new LinkedList<EntityType>();
|
||||
final LinkedList<EntityType> mobArr = new LinkedList<EntityType>(Arrays.asList(EntityType.values()));
|
||||
final LinkedList<EntityType> toRemove = new LinkedList<EntityType>();
|
||||
for (int i = 0; i < mobArr.size(); i++) {
|
||||
final EntityType type = mobArr.get(i);
|
||||
if (type.isAlive() == false || type.name().equals("PLAYER")) {
|
||||
|
@ -465,11 +475,11 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> mobTypes = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> mobTypes = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (MiscUtil.getProperMobType(s) != null) {
|
||||
mobTypes.add(s);
|
||||
} else {
|
||||
|
@ -486,43 +496,43 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsAmountsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsAmountsPrompt(ConversationContext context) {
|
||||
public MobsAmountsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobAmountsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<Integer> mobAmounts = new LinkedList<Integer>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<Integer> mobAmounts = new LinkedList<Integer>();
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
int i = Integer.parseInt(s);
|
||||
final int i = Integer.parseInt(s);
|
||||
if (i < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||
.replace("<number>", "1"));
|
||||
return new MobsAmountsPrompt(context);
|
||||
}
|
||||
mobAmounts.add(i);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new MobsAmountsPrompt(context);
|
||||
}
|
||||
|
@ -535,23 +545,23 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsLocationPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsLocationPrompt(ConversationContext context) {
|
||||
public MobsLocationPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobLocationPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
|
@ -559,12 +569,12 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Block block = plugin.getQuestFactory().getSelectedKillLocations().get(player.getUniqueId());
|
||||
final Block block = plugin.getQuestFactory().getSelectedKillLocations().get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
final Location loc = block.getLocation();
|
||||
LinkedList<String> locs;
|
||||
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) != null) {
|
||||
locs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS);
|
||||
|
@ -573,7 +583,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
locs.add(ConfigUtil.getLocationInfo(loc));
|
||||
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs);
|
||||
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
} else {
|
||||
|
@ -582,7 +592,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
return new MobsKillListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
return new MobsKillListPrompt(context);
|
||||
|
@ -594,43 +604,43 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsRadiiPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsRadiiPrompt(ConversationContext context) {
|
||||
public MobsRadiiPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobLocationRadiiPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<Integer> radii = new LinkedList<Integer>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<Integer> radii = new LinkedList<Integer>();
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
int i = Integer.parseInt(s);
|
||||
final int i = Integer.parseInt(s);
|
||||
if (i < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||
.replace("<number>", "1"));
|
||||
return new MobsRadiiPrompt(context);
|
||||
}
|
||||
radii.add(i);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorInvalidItemName"));
|
||||
return new MobsRadiiPrompt(context);
|
||||
|
@ -644,32 +654,32 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsLocationNamesPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsLocationNamesPrompt(ConversationContext context) {
|
||||
public MobsLocationNamesPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobLocationNamesPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> locNames = new LinkedList<String>();
|
||||
final LinkedList<String> locNames = new LinkedList<String>();
|
||||
locNames.addAll(Arrays.asList(input.split(Lang.get("charSemi"))));
|
||||
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, locNames);
|
||||
}
|
||||
|
@ -679,41 +689,41 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsFishPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsFishPrompt(ConversationContext context) {
|
||||
public MobsFishPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorCatchFishPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i < 0) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorPositiveAmount"));
|
||||
return new MobsFishPrompt(context);
|
||||
} else if (i > 0) {
|
||||
context.setSessionData(pref + CK.S_FISH, i);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new MobsFishPrompt(context);
|
||||
|
@ -727,41 +737,41 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsCowsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsCowsPrompt(ConversationContext context) {
|
||||
public MobsCowsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMilkCowsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
if (i < 0) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorPositiveAmount"));
|
||||
return new MobsCowsPrompt(context);
|
||||
} else if (i > 0) {
|
||||
context.setSessionData(pref + CK.S_COW_MILK, i);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new MobsCowsPrompt(context);
|
||||
|
@ -775,21 +785,24 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsTameListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public MobsTameListPrompt(ConversationContext context) {
|
||||
public MobsTameListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorTameMobs");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -803,7 +816,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorSetMobTypes");
|
||||
|
@ -818,15 +832,16 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_TAME_TYPES)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_TAME_TYPES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -836,7 +851,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(pref + CK.S_TAME_AMOUNTS)) {
|
||||
for (final Integer i : (List<Integer>) context.getSessionData(pref + CK.S_TAME_AMOUNTS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -850,8 +865,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -864,7 +879,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new MobsTameTypesPrompt(context);
|
||||
|
@ -902,23 +917,23 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsTameTypesPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsTameTypesPrompt(ConversationContext context) {
|
||||
public MobsTameTypesPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("eventEditorMobsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorMobsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String mobs = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
|
@ -935,11 +950,11 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> mobTypes = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> mobTypes = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (MiscUtil.getProperMobType(s) != null) {
|
||||
final EntityType type = MiscUtil.getProperMobType(s);
|
||||
if (type.isAlive() || Tameable.class.isAssignableFrom(type.getEntityClass())) {
|
||||
|
@ -963,43 +978,43 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsTameAmountsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsTameAmountsPrompt(ConversationContext context) {
|
||||
public MobsTameAmountsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorTameAmountsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<Integer> mobAmounts = new LinkedList<Integer>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<Integer> mobAmounts = new LinkedList<Integer>();
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
int i = Integer.parseInt(s);
|
||||
final int i = Integer.parseInt(s);
|
||||
if (i < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||
.replace("<number>", "1"));
|
||||
return new MobsTameAmountsPrompt(context);
|
||||
}
|
||||
mobAmounts.add(i);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new MobsTameAmountsPrompt(context);
|
||||
|
@ -1013,21 +1028,24 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsShearListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public MobsShearListPrompt(ConversationContext context) {
|
||||
public MobsShearListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorShearSheep");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -1041,7 +1059,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorSetShearColors");
|
||||
|
@ -1056,15 +1075,16 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_SHEAR_COLORS)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_SHEAR_COLORS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -1074,7 +1094,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS)) {
|
||||
for (final Integer i : (List<Integer>) context.getSessionData(pref + CK.S_SHEAR_AMOUNTS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -1088,8 +1108,8 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -1102,7 +1122,7 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new MobsShearColorsPrompt(context);
|
||||
|
@ -1140,23 +1160,23 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsShearColorsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsShearColorsPrompt(ConversationContext context) {
|
||||
public MobsShearColorsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorColors");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorShearColorsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String cols = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " - \n";
|
||||
|
@ -1172,11 +1192,11 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> colors = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<String> colors = new LinkedList<String>();
|
||||
for (final String s : input.split(" ")) {
|
||||
if (MiscUtil.getProperDyeColor(s) != null) {
|
||||
colors.add(s);
|
||||
context.setSessionData(pref + CK.S_SHEAR_COLORS, colors);
|
||||
|
@ -1193,43 +1213,43 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MobsShearAmountsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MobsShearAmountsPrompt(ConversationContext context) {
|
||||
public MobsShearAmountsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorShearAmountsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<Integer> shearAmounts = new LinkedList<Integer>();
|
||||
for (String s : input.split(" ")) {
|
||||
final LinkedList<Integer> shearAmounts = new LinkedList<Integer>();
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
int i = Integer.parseInt(s);
|
||||
final int i = Integer.parseInt(s);
|
||||
if (i < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||
.replace("<number>", "1"));
|
||||
return new MobsShearAmountsPrompt(context);
|
||||
}
|
||||
shearAmounts.add(i);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
|
||||
return new MobsShearAmountsPrompt(context);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public NpcsPrompt(int stageNum, ConversationContext context) {
|
||||
public NpcsPrompt(final int stageNum, final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.stageNum = stageNum;
|
||||
|
@ -48,15 +48,18 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorNPCs");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -69,7 +72,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliverItems");
|
||||
|
@ -84,8 +88,9 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
|
@ -93,8 +98,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DELIVERY_NPCS);
|
||||
LinkedList<ItemStack> items
|
||||
final LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DELIVERY_NPCS);
|
||||
final LinkedList<ItemStack> items
|
||||
= (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS);
|
||||
for (int i = 0; i < npcs.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getName(items.get(i))
|
||||
|
@ -114,7 +119,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<Integer> npcs
|
||||
final LinkedList<Integer> npcs
|
||||
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO);
|
||||
for (int i = 0; i < npcs.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE
|
||||
|
@ -132,8 +137,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL);
|
||||
LinkedList<Integer> amounts
|
||||
final LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL);
|
||||
final LinkedList<Integer> amounts
|
||||
= (LinkedList<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS);
|
||||
for (int i = 0; i < npcs.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE
|
||||
|
@ -153,10 +158,10 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -168,7 +173,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
|
@ -194,7 +199,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
case 4:
|
||||
try {
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -205,21 +210,24 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcsDeliveryListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public NpcsDeliveryListPrompt(ConversationContext context) {
|
||||
public NpcsDeliveryListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 5;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorDeliverItems");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -234,7 +242,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorDeliveryAddItem");
|
||||
|
@ -251,15 +260,16 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS)) {
|
||||
for (final ItemStack is : (List<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS)) {
|
||||
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -269,7 +279,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (int i : (List<Integer>) context.getSessionData(pref + CK.S_DELIVERY_NPCS)) {
|
||||
for (final int i : (List<Integer>) context.getSessionData(pref + CK.S_DELIVERY_NPCS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + " ("
|
||||
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName() + ")\n";
|
||||
}
|
||||
|
@ -280,7 +290,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String s : (List<String>) context.getSessionData(pref + CK.S_DELIVERY_MESSAGES)) {
|
||||
for (final String s : (List<String>) context.getSessionData(pref + CK.S_DELIVERY_MESSAGES)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + "\"" + s + "\"\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -295,15 +305,15 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
// Check/add newly made item
|
||||
if (context.getSessionData("newItem") != null) {
|
||||
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) != null) {
|
||||
List<ItemStack> itemRews = (List<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS);
|
||||
final List<ItemStack> itemRews = (List<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS);
|
||||
itemRews.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_DELIVERY_ITEMS, itemRews);
|
||||
} else {
|
||||
LinkedList<ItemStack> itemRews = new LinkedList<ItemStack>();
|
||||
final LinkedList<ItemStack> itemRews = new LinkedList<ItemStack>();
|
||||
itemRews.add((ItemStack) context.getSessionData("tempStack"));
|
||||
context.setSessionData(pref + CK.S_DELIVERY_ITEMS, itemRews);
|
||||
}
|
||||
|
@ -311,7 +321,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempStack", null);
|
||||
}
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -324,7 +334,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(context, NpcsDeliveryListPrompt.this);
|
||||
|
@ -370,36 +380,36 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcDeliveryNpcsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public NpcDeliveryNpcsPrompt(ConversationContext context) {
|
||||
public NpcDeliveryNpcsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorNPCPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (String s : args) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (final String s : args) {
|
||||
try {
|
||||
Integer i = Integer.parseInt(s);
|
||||
final Integer i = Integer.parseInt(s);
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) != null) {
|
||||
npcs.add(i);
|
||||
} else {
|
||||
|
@ -407,7 +417,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
+ Lang.get("stageEditorInvalidNPC"));
|
||||
return new NpcDeliveryNpcsPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorNotListofNumbers"));
|
||||
return new NpcDeliveryNpcsPrompt(context);
|
||||
|
@ -415,7 +425,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
context.setSessionData(pref + CK.S_DELIVERY_NPCS, npcs);
|
||||
}
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
return new NpcsDeliveryListPrompt(context);
|
||||
|
@ -424,29 +434,29 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcDeliveryMessagesPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public NpcDeliveryMessagesPrompt(ConversationContext context) {
|
||||
public NpcDeliveryMessagesPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorDeliveryMessagesPrompt");
|
||||
}
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD + Lang.get("stageEditorNPCNote");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String[] args = input.split(Lang.get("charSemi"));
|
||||
LinkedList<String> messages = new LinkedList<String>();
|
||||
final String[] args = input.split(Lang.get("charSemi"));
|
||||
final LinkedList<String> messages = new LinkedList<String>();
|
||||
messages.addAll(Arrays.asList(args));
|
||||
context.setSessionData(pref + CK.S_DELIVERY_MESSAGES, messages);
|
||||
}
|
||||
|
@ -456,23 +466,23 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcsIdsToTalkToPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public NpcsIdsToTalkToPrompt(ConversationContext context) {
|
||||
public NpcsIdsToTalkToPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorNPCToTalkToPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD
|
||||
|
@ -480,14 +490,14 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (String s : args) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (final String s : args) {
|
||||
try {
|
||||
Integer i = Integer.parseInt(s);
|
||||
final Integer i = Integer.parseInt(s);
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) != null) {
|
||||
npcs.add(i);
|
||||
} else {
|
||||
|
@ -495,13 +505,13 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
+ Lang.get("stageEditorInvalidNPC"));
|
||||
return new NpcsIdsToTalkToPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorNotListofNumbers"));
|
||||
return new NpcsIdsToTalkToPrompt(context);
|
||||
}
|
||||
}
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
||||
|
@ -514,21 +524,24 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcsKillListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public NpcsKillListPrompt(ConversationContext context) {
|
||||
public NpcsKillListPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 4;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorNPCs");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -542,7 +555,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorSetKillIds");
|
||||
|
@ -557,8 +571,9 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
|
@ -566,7 +581,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL)) {
|
||||
for (final Integer i : (List<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA
|
||||
+ plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName()
|
||||
+ ChatColor.DARK_AQUA + " (" + i + ")\n";
|
||||
|
@ -581,7 +596,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS)) {
|
||||
for (final Integer i : (List<Integer>) context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + i + "\n";
|
||||
}
|
||||
return text;
|
||||
|
@ -595,8 +610,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
|
@ -609,7 +624,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new NpcIdsToKillPrompt(context);
|
||||
|
@ -647,36 +662,36 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcIdsToKillPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public NpcIdsToKillPrompt(ConversationContext context) {
|
||||
public NpcIdsToKillPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorNPCPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (String s : args) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
for (final String s : args) {
|
||||
try {
|
||||
Integer i = Integer.parseInt(s);
|
||||
final Integer i = Integer.parseInt(s);
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) != null) {
|
||||
npcs.add(i);
|
||||
} else {
|
||||
|
@ -684,7 +699,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
+ Lang.get("stageEditorInvalidNPC"));
|
||||
return new NpcIdsToKillPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorNotListofNumbers"));
|
||||
return new NpcIdsToKillPrompt(context);
|
||||
|
@ -692,7 +707,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs);
|
||||
}
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
return new NpcsKillListPrompt(context);
|
||||
|
@ -701,31 +716,31 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class NpcAmountsToKillPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public NpcAmountsToKillPrompt(ConversationContext context) {
|
||||
public NpcAmountsToKillPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("stageEditorKillNPCsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (String s : args) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (final String s : args) {
|
||||
try {
|
||||
if (Integer.parseInt(s) > 0) {
|
||||
amounts.add(Integer.parseInt(s));
|
||||
|
@ -734,7 +749,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||
.replace("<number>", "1"));
|
||||
return new NpcAmountsToKillPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||
+ Lang.get("stageEditorNotListofNumbers"));
|
||||
return new NpcAmountsToKillPrompt(context);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
private String tempKey;
|
||||
private Prompt tempPrompt;
|
||||
|
||||
public OptionsPrompt(ConversationContext context) {
|
||||
public OptionsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("optionsTitle").replace("<quest>", (String) context.getSessionData(CK.Q_NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -63,7 +63,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GOLD + Lang.get("optGeneral");
|
||||
|
@ -77,13 +77,13 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_GREEN + getTitle(context)
|
||||
|
@ -97,7 +97,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new OptionsGeneralPrompt(context);
|
||||
|
@ -111,7 +111,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class OptionsTrueFalsePrompt extends QuestsEditorStringPrompt {
|
||||
public OptionsTrueFalsePrompt(ConversationContext context) {
|
||||
public OptionsTrueFalsePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -122,19 +122,19 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
String text = "Select '<true>' or '<false>'";
|
||||
text = text.replace("<true>", Lang.get("true"));
|
||||
text = text.replace("<false>", Lang.get("false"));
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("true");
|
||||
|
@ -150,8 +150,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = Lang.get("optBooleanPrompt");
|
||||
|
@ -161,7 +161,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
if (input.startsWith("t") || input.equalsIgnoreCase(Lang.get("true"))
|
||||
|
@ -183,7 +183,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class OptionsLevelPrompt extends QuestsEditorStringPrompt {
|
||||
public OptionsLevelPrompt(ConversationContext context) {
|
||||
public OptionsLevelPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -194,16 +194,16 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return "Pick level of progress sharing";
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GOLD + "1";
|
||||
|
@ -222,7 +222,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.GRAY + Lang.get("everything");
|
||||
|
@ -242,8 +242,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = Lang.get("optNumberPrompt");
|
||||
|
@ -259,13 +259,13 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
context.setSessionData(tempKey, i);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class OptionsGeneralPrompt extends QuestsEditorNumericPrompt {
|
||||
public OptionsGeneralPrompt(ConversationContext context) {
|
||||
public OptionsGeneralPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -290,12 +290,12 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return ChatColor.DARK_GREEN + Lang.get("optGeneral");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -309,7 +309,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("optAllowCommands");
|
||||
|
@ -323,28 +323,28 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.OPT_ALLOW_COMMANDS) == null) {
|
||||
boolean defaultOpt = new Options().getAllowCommands();
|
||||
final boolean defaultOpt = new Options().getAllowCommands();
|
||||
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
boolean commandsOpt = (Boolean) context.getSessionData(CK.OPT_ALLOW_COMMANDS);
|
||||
final boolean commandsOpt = (Boolean) context.getSessionData(CK.OPT_ALLOW_COMMANDS);
|
||||
return ChatColor.GRAY + "(" + (commandsOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(commandsOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(commandsOpt))) + ChatColor.GRAY + ")";
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(CK.OPT_ALLOW_QUITTING) == null) {
|
||||
boolean defaultOpt = new Options().getAllowQuitting();
|
||||
final boolean defaultOpt = new Options().getAllowQuitting();
|
||||
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
boolean quittingOpt = (Boolean) context.getSessionData(CK.OPT_ALLOW_QUITTING);
|
||||
final boolean quittingOpt = (Boolean) context.getSessionData(CK.OPT_ALLOW_QUITTING);
|
||||
return ChatColor.GRAY + "(" + (quittingOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(quittingOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(quittingOpt))) + ChatColor.GRAY + ")";
|
||||
|
@ -357,8 +357,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
||||
|
@ -370,7 +370,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
public Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
tempKey = CK.OPT_ALLOW_COMMANDS;
|
||||
|
@ -385,7 +385,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
tempPrompt = null;
|
||||
try {
|
||||
return new OptionsPrompt(context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class OptionsMultiplayerPrompt extends QuestsEditorNumericPrompt {
|
||||
public OptionsMultiplayerPrompt(ConversationContext context) {
|
||||
public OptionsMultiplayerPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -408,12 +408,12 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return ChatColor.DARK_GREEN + Lang.get("optMultiplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.BLUE;
|
||||
|
@ -431,7 +431,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("optUseDungeonsXLPlugin");
|
||||
|
@ -449,48 +449,48 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN) == null) {
|
||||
boolean defaultOpt = new Options().getUseDungeonsXLPlugin();
|
||||
final boolean defaultOpt = new Options().getUseDungeonsXLPlugin();
|
||||
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
boolean dungeonsOpt = (Boolean) context.getSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN);
|
||||
final boolean dungeonsOpt = (Boolean) context.getSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN);
|
||||
return ChatColor.GRAY + "(" + (dungeonsOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(dungeonsOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(dungeonsOpt))) + ChatColor.GRAY + ")";
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) == null) {
|
||||
boolean defaultOpt = new Options().getUsePartiesPlugin();
|
||||
final boolean defaultOpt = new Options().getUsePartiesPlugin();
|
||||
return ChatColor.GRAY + "("+ (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
boolean partiesOpt = (Boolean) context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN);
|
||||
final boolean partiesOpt = (Boolean) context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN);
|
||||
return ChatColor.GRAY + "(" + (partiesOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(partiesOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(partiesOpt))) + ChatColor.GRAY + ")";
|
||||
}
|
||||
case 3:
|
||||
if (context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) == null) {
|
||||
int defaultOpt = new Options().getShareProgressLevel();
|
||||
final int defaultOpt = new Options().getShareProgressLevel();
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(defaultOpt) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
int shareOpt = (Integer) context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL);
|
||||
final int shareOpt = (Integer) context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")";
|
||||
}
|
||||
case 4:
|
||||
if (context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) == null) {
|
||||
boolean defaultOpt = new Options().getRequireSameQuest();
|
||||
final boolean defaultOpt = new Options().getRequireSameQuest();
|
||||
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST);
|
||||
final boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST);
|
||||
return ChatColor.GRAY + "(" + (requireOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(requireOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(requireOpt))) + ChatColor.GRAY + ")";
|
||||
|
@ -503,8 +503,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
||||
|
@ -516,7 +516,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
public Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
tempKey = CK.OPT_USE_DUNGEONSXL_PLUGIN;
|
||||
|
@ -539,7 +539,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||
tempPrompt = null;
|
||||
try {
|
||||
return new OptionsPrompt(context);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@ import java.util.Calendar;
|
|||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
|
@ -25,15 +29,11 @@ import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPrompt
|
|||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
private final Prompt oldPrompt;
|
||||
private String source = "";
|
||||
|
||||
public DateTimePrompt(ConversationContext context, Prompt old, String origin) {
|
||||
public DateTimePrompt(final ConversationContext context, final Prompt old, final String origin) {
|
||||
super(context);
|
||||
oldPrompt = old;
|
||||
source = origin;
|
||||
|
@ -41,19 +41,21 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
private final int size = 10;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("dateTimeTitle");
|
||||
}
|
||||
|
||||
public String getDataText(ConversationContext context) {
|
||||
public String getDataText(final ConversationContext context) {
|
||||
String dateData = "";
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
final SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||
final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
cal.set((Integer) context.getSessionData("tempYear"), (Integer) context.getSessionData("tempMonth"),
|
||||
(Integer) context.getSessionData("tempDay"), (Integer) context.getSessionData("tempHour"),
|
||||
|
@ -62,18 +64,19 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
dateData += ChatColor.AQUA + timeFormat.format(cal.getTime()) + " ";
|
||||
|
||||
cal.setTimeZone(TimeZone.getTimeZone((String) context.getSessionData("tempZone")));
|
||||
String[] iso = Lang.getISO().split("-");
|
||||
Locale loc = new Locale(iso[0], iso[1]);
|
||||
Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||
String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
|
||||
DecimalFormat zoneFormat = new DecimalFormat("00");
|
||||
final String[] iso = Lang.getISO().split("-");
|
||||
final Locale loc = new Locale(iso[0], iso[1]);
|
||||
final Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||
final String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
|
||||
final DecimalFormat zoneFormat = new DecimalFormat("00");
|
||||
dateData += ChatColor.LIGHT_PURPLE + "UTC" + (hour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0]))
|
||||
+ ":" + zoneFormat.format(Integer.valueOf(sep[1])) + ChatColor.GREEN + " ("
|
||||
+ cal.getTimeZone().getDisplayName(loc) + ")";
|
||||
return dateData;
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 0:
|
||||
return ChatColor.YELLOW;
|
||||
|
@ -94,7 +97,8 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 0:
|
||||
return ChatColor.GOLD + Lang.get("dateCreateLoadTime");
|
||||
|
@ -121,7 +125,8 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 0:
|
||||
return "";
|
||||
|
@ -157,7 +162,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
case 7:
|
||||
if (context.getSessionData("tempZone") != null) {
|
||||
TimeZone tz = TimeZone.getTimeZone((String) context.getSessionData("tempZone"));
|
||||
final TimeZone tz = TimeZone.getTimeZone((String) context.getSessionData("tempZone"));
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + tz.getDisplayName(false, TimeZone.SHORT)
|
||||
+ ChatColor.GRAY + ")";
|
||||
}
|
||||
|
@ -170,8 +175,8 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + getTitle(context) + "\n";
|
||||
|
@ -189,10 +194,10 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 0:
|
||||
Calendar cal = Calendar.getInstance();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
context.setSessionData("tempDay", cal.get(Calendar.DAY_OF_MONTH));
|
||||
context.setSessionData("tempMonth", cal.get(Calendar.MONTH));
|
||||
context.setSessionData("tempYear", cal.get(Calendar.YEAR));
|
||||
|
@ -229,14 +234,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
&& context.getSessionData("tempYear") != null && context.getSessionData("tempHour") != null
|
||||
&& context.getSessionData("tempMinute") != null && context.getSessionData("tempSecond") != null
|
||||
&& context.getSessionData("tempZone") != null) {
|
||||
int day = (Integer) context.getSessionData("tempDay");
|
||||
int month = (Integer) context.getSessionData("tempMonth");
|
||||
int year = (Integer) context.getSessionData("tempYear");
|
||||
int hour = (Integer) context.getSessionData("tempHour");
|
||||
int minute = (Integer) context.getSessionData("tempMinute");
|
||||
int second = (Integer) context.getSessionData("tempSecond");
|
||||
String zone = (String) context.getSessionData("tempZone");
|
||||
String date = day + ":" + month + ":" + year + ":"
|
||||
final int day = (Integer) context.getSessionData("tempDay");
|
||||
final int month = (Integer) context.getSessionData("tempMonth");
|
||||
final int year = (Integer) context.getSessionData("tempYear");
|
||||
final int hour = (Integer) context.getSessionData("tempHour");
|
||||
final int minute = (Integer) context.getSessionData("tempMinute");
|
||||
final int second = (Integer) context.getSessionData("tempSecond");
|
||||
final String zone = (String) context.getSessionData("tempZone");
|
||||
final String date = day + ":" + month + ":" + year + ":"
|
||||
+ hour + ":" + minute + ":" + second + ":" + zone;
|
||||
if (source != null) {
|
||||
if (source.equals("start")) {
|
||||
|
@ -269,33 +274,33 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class DayPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public DayPrompt(ConversationContext context) {
|
||||
public DayPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterDay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 1 || amt > 31) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1").replace("<greatest>", "31"));
|
||||
|
@ -304,7 +309,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempDay", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new DayPrompt(context);
|
||||
}
|
||||
|
@ -316,33 +321,33 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MonthPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MonthPrompt(ConversationContext context) {
|
||||
public MonthPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterYear");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 1 || amt > 12) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1").replace("<greatest>", "12"));
|
||||
|
@ -351,7 +356,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempMonth", Integer.parseInt(input) - 1);
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new MonthPrompt(context);
|
||||
}
|
||||
|
@ -363,33 +368,33 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class YearPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public YearPrompt(ConversationContext context) {
|
||||
public YearPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterYear");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 1000 || amt > 9999) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1000").replace("<greatest>", "9999"));
|
||||
|
@ -398,7 +403,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempYear", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new YearPrompt(context);
|
||||
}
|
||||
|
@ -410,33 +415,33 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class HourPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public HourPrompt(ConversationContext context) {
|
||||
public HourPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterHour");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 0 || amt > 23) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0").replace("<greatest>", "23"));
|
||||
|
@ -445,7 +450,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempHour", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new HourPrompt(context);
|
||||
}
|
||||
|
@ -457,33 +462,33 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class MinutePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MinutePrompt(ConversationContext context) {
|
||||
public MinutePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterMinute");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 0 || amt > 59) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0").replace("<greatest>", "59"));
|
||||
|
@ -492,7 +497,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempMinute", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new MinutePrompt(context);
|
||||
}
|
||||
|
@ -504,33 +509,33 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class SecondPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public SecondPrompt(ConversationContext context) {
|
||||
public SecondPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterSecond");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
int amt = Integer.parseInt(input);
|
||||
final int amt = Integer.parseInt(input);
|
||||
if (amt < 0 || amt > 59) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0").replace("<greatest>", "59"));
|
||||
|
@ -539,7 +544,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
context.setSessionData("tempSecond", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new SecondPrompt(context);
|
||||
}
|
||||
|
@ -551,39 +556,39 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class OffsetPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public OffsetPrompt(ConversationContext context) {
|
||||
public OffsetPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterOffset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
try {
|
||||
double amt = Double.parseDouble(input.replace("UTC", "").replace(":", "."));
|
||||
final double amt = Double.parseDouble(input.replace("UTC", "").replace(":", "."));
|
||||
if (amt < -12.0 || amt > 14.0) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "-12:00").replace("<greatest>", "14:00"));
|
||||
return new OffsetPrompt(context);
|
||||
} else {
|
||||
String[] t = TimeZone.getAvailableIDs((int) Math.round(amt * 60.0 * 60.0 * 1000.0));
|
||||
final String[] t = TimeZone.getAvailableIDs((int) Math.round(amt * 60.0 * 60.0 * 1000.0));
|
||||
if (t.length > 1) {
|
||||
return new ZonePrompt(context, t);
|
||||
} else if (t.length > 0) {
|
||||
|
@ -593,7 +598,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new OffsetPrompt(context);
|
||||
}
|
||||
|
@ -607,28 +612,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
String[] zones;
|
||||
|
||||
public ZonePrompt(ConversationContext context, String[] timezones) {
|
||||
public ZonePrompt(final ConversationContext context, final String[] timezones) {
|
||||
super(context);
|
||||
zones = timezones;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("timeZoneTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterZone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
for (String z : zones) {
|
||||
for (final String z : zones) {
|
||||
text += ChatColor.GREEN + z + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2);
|
||||
|
@ -636,9 +641,9 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
for (String z : zones) {
|
||||
for (final String z : zones) {
|
||||
if (z.toLowerCase().startsWith(input.toLowerCase())) {
|
||||
context.setSessionData("tempZone", z);
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
|
|
|
@ -18,6 +18,10 @@ import java.util.Calendar;
|
|||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
import me.blackvein.quests.Planner;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
|
@ -28,30 +32,29 @@ import me.blackvein.quests.util.CK;
|
|||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final Quests plugin;
|
||||
|
||||
public PlannerPrompt(ConversationContext context) {
|
||||
public PlannerPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 6;
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("plannerTitle").replace("<quest>", (String) context.getSessionData(CK.Q_NAME));
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -72,7 +75,8 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("plnStart");
|
||||
|
@ -95,7 +99,8 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.PLN_START_DATE) == null) {
|
||||
|
@ -131,12 +136,12 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
case 5:
|
||||
if (context.getSessionData(CK.PLN_OVERRIDE) == null) {
|
||||
boolean defaultOpt = new Planner().getOverride();
|
||||
final boolean defaultOpt = new Planner().getOverride();
|
||||
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
boolean quittingOpt = (Boolean) context.getSessionData(CK.PLN_OVERRIDE);
|
||||
final boolean quittingOpt = (Boolean) context.getSessionData(CK.PLN_OVERRIDE);
|
||||
return ChatColor.GRAY + "(" + (quittingOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(quittingOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(quittingOpt))) + ChatColor.GRAY + ")";
|
||||
|
@ -149,8 +154,8 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
||||
|
@ -164,7 +169,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new DateTimePrompt(context, PlannerPrompt.this, "start");
|
||||
|
@ -190,30 +195,30 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class PlannerRepeatPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public PlannerRepeatPrompt(ConversationContext context) {
|
||||
public PlannerRepeatPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("timePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
|
@ -223,14 +228,14 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
if (delay < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else {
|
||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, delay);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new PlannerRepeatPrompt(context);
|
||||
|
@ -241,30 +246,30 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
|
||||
public class PlannerCooldownPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public PlannerCooldownPrompt(ConversationContext context) {
|
||||
public PlannerCooldownPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
return Lang.get("timePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
|
@ -274,14 +279,14 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
long delay;
|
||||
try {
|
||||
int i = Integer.parseInt(input);
|
||||
final int i = Integer.parseInt(input);
|
||||
delay = i * 1000;
|
||||
if (delay < 1) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
|
||||
} else {
|
||||
context.setSessionData(CK.PLN_COOLDOWN, delay);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new PlannerCooldownPrompt(context);
|
||||
|
@ -291,7 +296,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
public class PlannerOverridePrompt extends QuestsEditorStringPrompt {
|
||||
public PlannerOverridePrompt(ConversationContext context) {
|
||||
public PlannerOverridePrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -302,19 +307,19 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
public String getQueryText(final ConversationContext context) {
|
||||
String text = "Select '<true>' or '<false>'";
|
||||
text = text.replace("<true>", Lang.get("true"));
|
||||
text = text.replace("<false>", Lang.get("false"));
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("true");
|
||||
|
@ -330,8 +335,8 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = Lang.get("optBooleanPrompt");
|
||||
|
@ -341,7 +346,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
if (input.startsWith("t") || input.equalsIgnoreCase(Lang.get("true"))
|
||||
|
@ -362,29 +367,29 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
}
|
||||
|
||||
private String getPrettyDate(String formattedDate) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm:ss");
|
||||
String[] date = formattedDate.split(":");
|
||||
int day = Integer.valueOf(date[0]);
|
||||
int month = Integer.valueOf(date[1]);
|
||||
int year = Integer.valueOf(date[2]);
|
||||
int hour = Integer.valueOf(date[3]);
|
||||
int minute = Integer.valueOf(date[4]);
|
||||
int second = Integer.valueOf(date[5]);
|
||||
private String getPrettyDate(final String formattedDate) {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
final SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||
final SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm:ss");
|
||||
final String[] date = formattedDate.split(":");
|
||||
final int day = Integer.valueOf(date[0]);
|
||||
final int month = Integer.valueOf(date[1]);
|
||||
final int year = Integer.valueOf(date[2]);
|
||||
final int hour = Integer.valueOf(date[3]);
|
||||
final int minute = Integer.valueOf(date[4]);
|
||||
final int second = Integer.valueOf(date[5]);
|
||||
|
||||
cal.set(year, month, day, hour, minute, second);
|
||||
String output = ChatColor.DARK_AQUA + dateFormat.format(cal.getTime());
|
||||
output += ChatColor.AQUA + " " + timeFormat.format(cal.getTime());
|
||||
|
||||
TimeZone tz = TimeZone.getTimeZone(date[6]);
|
||||
final TimeZone tz = TimeZone.getTimeZone(date[6]);
|
||||
cal.setTimeZone(tz);
|
||||
String[] iso = Lang.getISO().split("-");
|
||||
Locale loc = new Locale(iso[0], iso[1]);
|
||||
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
|
||||
DecimalFormat zoneFormat = new DecimalFormat("00");
|
||||
final String[] iso = Lang.getISO().split("-");
|
||||
final Locale loc = new Locale(iso[0], iso[1]);
|
||||
final Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||
final String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
|
||||
final DecimalFormat zoneFormat = new DecimalFormat("00");
|
||||
output += ChatColor.LIGHT_PURPLE + " UTC" + (zhour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0]))
|
||||
+ ":" + zoneFormat.format(Integer.valueOf(sep[1])) + ChatColor.GREEN + " ("
|
||||
+ cal.getTimeZone().getDisplayName(loc) + ")";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -25,23 +25,26 @@ import me.blackvein.quests.util.Lang;
|
|||
public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final Quests plugin;
|
||||
private int size = 2;
|
||||
private final int size = 2;
|
||||
|
||||
public StageMenuPrompt(ConversationContext context) {
|
||||
public StageMenuPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
@Override
|
||||
public String getTitle(final ConversationContext context) {
|
||||
return Lang.get("stageEditorStages");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
int stages = getStages(context);
|
||||
@Override
|
||||
public ChatColor getNumberColor(final ConversationContext context, final int number) {
|
||||
final int stages = getStages(context);
|
||||
if (number > 0) {
|
||||
if (number < (stages + 1) && number > 0) {
|
||||
return ChatColor.BLUE;
|
||||
|
@ -54,8 +57,9 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
return null;
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
int stages = getStages(context);
|
||||
@Override
|
||||
public String getSelectionText(final ConversationContext context, final int number) {
|
||||
final int stages = getStages(context);
|
||||
if (number > 0) {
|
||||
if (number < (stages + 1) && number > 0) {
|
||||
return ChatColor.GOLD + Lang.get("stageEditorEditStage") + " " + number;
|
||||
|
@ -68,13 +72,14 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
return null;
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
@Override
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
public String getPromptText(final ConversationContext context) {
|
||||
final QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -\n";
|
||||
|
@ -86,9 +91,9 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
int i = input.intValue();
|
||||
int stages = getStages(context);
|
||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||
final int i = input.intValue();
|
||||
final int stages = getStages(context);
|
||||
if (i > 0) {
|
||||
if (i < (stages + 1) && i > 0) {
|
||||
return new StageMainPrompt((i), context);
|
||||
|
@ -101,7 +106,7 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
return new StageMenuPrompt(context);
|
||||
}
|
||||
|
||||
public int getStages(ConversationContext context) {
|
||||
public int getStages(final ConversationContext context) {
|
||||
int num = 1;
|
||||
while (true) {
|
||||
if (context.getSessionData("stage" + num) != null) {
|
||||
|
@ -113,8 +118,8 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||
return (num - 1);
|
||||
}
|
||||
|
||||
public void deleteStage(ConversationContext context, int stageNum) {
|
||||
int stages = getStages(context);
|
||||
public void deleteStage(final ConversationContext context, final int stageNum) {
|
||||
final int stages = getStages(context);
|
||||
int current = stageNum;
|
||||
String pref = "stage" + current;
|
||||
String newPref;
|
||||
|
|
|
@ -21,10 +21,11 @@ public abstract class QuestsEvent extends Event {
|
|||
public QuestsEvent() {
|
||||
}
|
||||
|
||||
public QuestsEvent(boolean async) {
|
||||
public QuestsEvent(final boolean async) {
|
||||
super(async);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ import me.blackvein.quests.events.QuestsEvent;
|
|||
*/
|
||||
public abstract class QuestsCommandEvent extends QuestsEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
protected Quester quester;
|
||||
private final Quester quester;
|
||||
|
||||
public QuestsCommandEvent(final Quester quester) {
|
||||
this.quester = quester;
|
||||
}
|
||||
|
||||
public QuestsCommandEvent(final Quester quester, boolean async) {
|
||||
public QuestsCommandEvent(final Quester quester, final boolean async) {
|
||||
super(async);
|
||||
this.quester = quester;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public abstract class QuestsCommandEvent extends QuestsEvent {
|
|||
return quester;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ import me.blackvein.quests.Quester;
|
|||
public class QuestsCommandPreQuestsEditorEvent extends QuestsCommandEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private ConversationContext context;
|
||||
private final ConversationContext context;
|
||||
|
||||
public QuestsCommandPreQuestsEditorEvent(Quester quester, ConversationContext context) {
|
||||
public QuestsCommandPreQuestsEditorEvent(final Quester quester, final ConversationContext context) {
|
||||
super(quester);
|
||||
this.context = context;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class QuestsCommandPreQuestsEditorEvent extends QuestsCommandEvent implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class QuestsCommandPreQuestsJournalEvent extends QuestsCommandEvent imple
|
|||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuestsCommandPreQuestsJournalEvent(Quester quester) {
|
||||
public QuestsCommandPreQuestsJournalEvent(final Quester quester) {
|
||||
super(quester);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class QuestsCommandPreQuestsJournalEvent extends QuestsCommandEvent imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class QuestsCommandPreQuestsListEvent extends QuestsCommandEvent implemen
|
|||
private final int page;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuestsCommandPreQuestsListEvent(Quester quester, int page) {
|
||||
public QuestsCommandPreQuestsListEvent(final Quester quester, final int page) {
|
||||
super(quester);
|
||||
this.page = page;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class QuestsCommandPreQuestsListEvent extends QuestsCommandEvent implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import me.blackvein.quests.events.QuestsEvent;
|
|||
public abstract class ActionsEditorEvent extends QuestsEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
protected ConversationContext context;
|
||||
protected ActionFactory factory;
|
||||
protected Prompt prompt;
|
||||
private final ActionFactory factory;
|
||||
private final Prompt prompt;
|
||||
|
||||
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt) {
|
||||
this.context = context;
|
||||
|
@ -35,29 +35,13 @@ public abstract class ActionsEditorEvent extends QuestsEvent {
|
|||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt, boolean async) {
|
||||
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
|
||||
super(async);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ActionsEditorEvent(final ConversationContext context, ActionFactory factory, final Prompt prompt) {
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ActionsEditorEvent(final ConversationContext context, ActionFactory factory, final Prompt prompt,
|
||||
boolean async) {
|
||||
super(async);
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
|
|
|
@ -15,54 +15,24 @@ package me.blackvein.quests.events.editor.actions;
|
|||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.actions.ActionFactory;
|
||||
import me.blackvein.quests.convo.actions.ActionsEditorNumericPrompt;
|
||||
|
||||
public class ActionsEditorPostOpenNumericPromptEvent extends ActionsEditorEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private ActionFactory factory;
|
||||
private ActionsEditorNumericPrompt prompt;
|
||||
private final ActionsEditorNumericPrompt prompt;
|
||||
|
||||
public ActionsEditorPostOpenNumericPromptEvent(ConversationContext context, ActionsEditorNumericPrompt prompt) {
|
||||
public ActionsEditorPostOpenNumericPromptEvent(final ConversationContext context, final ActionsEditorNumericPrompt prompt) {
|
||||
super(context, prompt);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ActionsEditorPostOpenNumericPromptEvent(ConversationContext context, ActionFactory factory,
|
||||
ActionsEditorNumericPrompt prompt) {
|
||||
super(context, factory, prompt);
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory involved in this event
|
||||
*
|
||||
* @return ActionFactory which is involved in this event
|
||||
*/
|
||||
public ActionFactory getActionFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric prompt involved in this event
|
||||
*
|
||||
* @return Prompt which is involved in this event
|
||||
*/
|
||||
@Override
|
||||
public ActionsEditorNumericPrompt getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
@ -15,54 +15,24 @@ package me.blackvein.quests.events.editor.actions;
|
|||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.actions.ActionFactory;
|
||||
import me.blackvein.quests.convo.actions.ActionsEditorStringPrompt;
|
||||
|
||||
public class ActionsEditorPostOpenStringPromptEvent extends ActionsEditorEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private ActionFactory factory;
|
||||
private ActionsEditorStringPrompt prompt;
|
||||
private final ActionsEditorStringPrompt prompt;
|
||||
|
||||
public ActionsEditorPostOpenStringPromptEvent(ConversationContext context, ActionsEditorStringPrompt prompt) {
|
||||
public ActionsEditorPostOpenStringPromptEvent(final ConversationContext context, final ActionsEditorStringPrompt prompt) {
|
||||
super(context, prompt);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ActionsEditorPostOpenStringPromptEvent(ConversationContext context, ActionFactory factory,
|
||||
ActionsEditorStringPrompt prompt) {
|
||||
super(context, factory, prompt);
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory involved in this event
|
||||
*
|
||||
* @return ActionFactory which is involved in this event
|
||||
*/
|
||||
public ActionFactory getActionFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string prompt involved in this event
|
||||
*
|
||||
* @return Prompt which is involved in this event
|
||||
*/
|
||||
@Override
|
||||
public ActionsEditorStringPrompt getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import me.blackvein.quests.events.QuestsEvent;
|
|||
public abstract class ConditionsEditorEvent extends QuestsEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
protected ConversationContext context;
|
||||
protected ConditionFactory factory;
|
||||
protected Prompt prompt;
|
||||
private final ConditionFactory factory;
|
||||
private final Prompt prompt;
|
||||
|
||||
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt) {
|
||||
this.context = context;
|
||||
|
@ -35,7 +35,7 @@ public abstract class ConditionsEditorEvent extends QuestsEvent {
|
|||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt, boolean async) {
|
||||
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
|
||||
super(async);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
|
||||
|
|
|
@ -15,45 +15,24 @@ package me.blackvein.quests.events.editor.conditions;
|
|||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.conditions.ConditionFactory;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorNumericPrompt;
|
||||
|
||||
public class ConditionsEditorPostOpenNumericPromptEvent extends ConditionsEditorEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private ConditionFactory factory;
|
||||
private ConditionsEditorNumericPrompt prompt;
|
||||
private final ConditionsEditorNumericPrompt prompt;
|
||||
|
||||
public ConditionsEditorPostOpenNumericPromptEvent(ConversationContext context, ConditionsEditorNumericPrompt prompt) {
|
||||
public ConditionsEditorPostOpenNumericPromptEvent(final ConversationContext context, final ConditionsEditorNumericPrompt prompt) {
|
||||
super(context, prompt);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory involved in this event
|
||||
*
|
||||
* @return ConditionFactory which is involved in this event
|
||||
*/
|
||||
public ConditionFactory getConditionFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric prompt involved in this event
|
||||
*
|
||||
* @return Prompt which is involved in this event
|
||||
*/
|
||||
@Override
|
||||
public ConditionsEditorNumericPrompt getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
@ -15,45 +15,24 @@ package me.blackvein.quests.events.editor.conditions;
|
|||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.conditions.ConditionFactory;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorStringPrompt;
|
||||
|
||||
public class ConditionsEditorPostOpenStringPromptEvent extends ConditionsEditorEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private ConditionFactory factory;
|
||||
private ConditionsEditorStringPrompt prompt;
|
||||
private final ConditionsEditorStringPrompt prompt;
|
||||
|
||||
public ConditionsEditorPostOpenStringPromptEvent(ConversationContext context, ConditionsEditorStringPrompt prompt) {
|
||||
public ConditionsEditorPostOpenStringPromptEvent(final ConversationContext context, final ConditionsEditorStringPrompt prompt) {
|
||||
super(context, prompt);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory involved in this event
|
||||
*
|
||||
* @return ConditionFactory which is involved in this event
|
||||
*/
|
||||
public ConditionFactory getConditionFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string prompt involved in this event
|
||||
*
|
||||
* @return Prompt which is involved in this event
|
||||
*/
|
||||
@Override
|
||||
public ConditionsEditorStringPrompt getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import me.blackvein.quests.events.QuestsEvent;
|
|||
public abstract class QuestsEditorEvent extends QuestsEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
protected ConversationContext context;
|
||||
protected QuestFactory factory;
|
||||
protected Prompt prompt;
|
||||
private final QuestFactory factory;
|
||||
private final Prompt prompt;
|
||||
|
||||
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt) {
|
||||
this.context = context;
|
||||
|
@ -35,29 +35,13 @@ public abstract class QuestsEditorEvent extends QuestsEvent {
|
|||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt, boolean async) {
|
||||
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
|
||||
super(async);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QuestsEditorEvent(final ConversationContext context, QuestFactory factory, final Prompt prompt) {
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QuestsEditorEvent(final ConversationContext context, QuestFactory factory, final Prompt prompt,
|
||||
boolean async) {
|
||||
super(async);
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
|
|
|
@ -15,54 +15,24 @@ package me.blackvein.quests.events.editor.quests;
|
|||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
|
||||
public class QuestsEditorPostOpenNumericPromptEvent extends QuestsEditorEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private QuestFactory factory;
|
||||
private QuestsEditorNumericPrompt prompt;
|
||||
private final QuestsEditorNumericPrompt prompt;
|
||||
|
||||
public QuestsEditorPostOpenNumericPromptEvent(ConversationContext context, QuestsEditorNumericPrompt prompt) {
|
||||
public QuestsEditorPostOpenNumericPromptEvent(final ConversationContext context, final QuestsEditorNumericPrompt prompt) {
|
||||
super(context, prompt);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QuestsEditorPostOpenNumericPromptEvent(ConversationContext context, QuestFactory factory,
|
||||
QuestsEditorNumericPrompt prompt) {
|
||||
super(context, factory, prompt);
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory involved in this event
|
||||
*
|
||||
* @return QuestFactory which is involved in this event
|
||||
*/
|
||||
public QuestFactory getQuestFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric prompt involved in this event
|
||||
*
|
||||
* @return Prompt which is involved in this event
|
||||
*/
|
||||
@Override
|
||||
public QuestsEditorNumericPrompt getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
@ -15,54 +15,24 @@ package me.blackvein.quests.events.editor.quests;
|
|||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
|
||||
public class QuestsEditorPostOpenStringPromptEvent extends QuestsEditorEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private QuestFactory factory;
|
||||
private QuestsEditorStringPrompt prompt;
|
||||
private final QuestsEditorStringPrompt prompt;
|
||||
|
||||
public QuestsEditorPostOpenStringPromptEvent(ConversationContext context, QuestsEditorStringPrompt prompt) {
|
||||
public QuestsEditorPostOpenStringPromptEvent(final ConversationContext context, final QuestsEditorStringPrompt prompt) {
|
||||
super(context, prompt);
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public QuestsEditorPostOpenStringPromptEvent(ConversationContext context, QuestFactory factory,
|
||||
QuestsEditorStringPrompt prompt) {
|
||||
super(context, factory, prompt);
|
||||
this.context = context;
|
||||
this.factory = factory;
|
||||
this.prompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory involved in this event
|
||||
*
|
||||
* @return QuestFactory which is involved in this event
|
||||
*/
|
||||
public QuestFactory getQuestFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string prompt involved in this event
|
||||
*
|
||||
* @return Prompt which is involved in this event
|
||||
*/
|
||||
@Override
|
||||
public QuestsEditorStringPrompt getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ import me.blackvein.quests.events.QuestsEvent;
|
|||
*/
|
||||
public abstract class QuestEvent extends QuestsEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
protected Quest quest;
|
||||
private final Quest quest;
|
||||
|
||||
public QuestEvent(final Quest quest) {
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
public QuestEvent(final Quest quest, boolean async) {
|
||||
public QuestEvent(final Quest quest, final boolean async) {
|
||||
super(async);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public abstract class QuestEvent extends QuestsEvent {
|
|||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuestQuitEvent extends QuestEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quester quester;
|
||||
private final Quester quester;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuestQuitEvent(Quest quest, Quester who) {
|
||||
public QuestQuitEvent(final Quest quest, final Quester who) {
|
||||
super(quest);
|
||||
this.quester = who;
|
||||
}
|
||||
|
@ -46,10 +46,11 @@ public class QuestQuitEvent extends QuestEvent implements Cancellable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuestTakeEvent extends QuestEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quester quester;
|
||||
private final Quester quester;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuestTakeEvent(Quest quest, Quester who) {
|
||||
public QuestTakeEvent(final Quest quest, final Quester who) {
|
||||
super(quest);
|
||||
this.quester = who;
|
||||
}
|
||||
|
@ -46,10 +46,11 @@ public class QuestTakeEvent extends QuestEvent implements Cancellable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ import me.blackvein.quests.events.QuestsEvent;
|
|||
*/
|
||||
public abstract class QuesterEvent extends QuestsEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
protected Quester quester;
|
||||
private final Quester quester;
|
||||
|
||||
public QuesterEvent(final Quester quester) {
|
||||
this.quester = quester;
|
||||
}
|
||||
|
||||
public QuesterEvent(final Quester quester, boolean async) {
|
||||
public QuesterEvent(final Quester quester, final boolean async) {
|
||||
super(async);
|
||||
this.quester = quester;
|
||||
|
||||
|
@ -43,6 +43,7 @@ public abstract class QuesterEvent extends QuestsEvent {
|
|||
return quester;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@ import me.blackvein.quests.Stage;
|
|||
*/
|
||||
public class QuesterPostChangeStageEvent extends QuesterEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private Stage current;
|
||||
private Stage next;
|
||||
private final Quest quest;
|
||||
private final Stage current;
|
||||
private final Stage next;
|
||||
|
||||
public QuesterPostChangeStageEvent(Quester quester, Quest quest, Stage current, Stage next) {
|
||||
public QuesterPostChangeStageEvent(final Quester quester, final Quest quest, final Stage current, final Stage next) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
this.current = current;
|
||||
|
@ -51,6 +51,7 @@ public class QuesterPostChangeStageEvent extends QuesterEvent {
|
|||
return next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuesterPostCompleteQuestEvent extends QuesterEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private final Quest quest;
|
||||
|
||||
public QuesterPostCompleteQuestEvent(Quester quester, Quest quest) {
|
||||
public QuesterPostCompleteQuestEvent(final Quester quester, final Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class QuesterPostCompleteQuestEvent extends QuesterEvent {
|
|||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuesterPostFailQuestEvent extends QuesterEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private final Quest quest;
|
||||
|
||||
public QuesterPostFailQuestEvent(Quester quester, Quest quest) {
|
||||
public QuesterPostFailQuestEvent(final Quester quester, final Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class QuesterPostFailQuestEvent extends QuesterEvent {
|
|||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuesterPostStartQuestEvent extends QuesterEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private final Quest quest;
|
||||
|
||||
public QuesterPostStartQuestEvent(Quester quester, Quest quest) {
|
||||
public QuesterPostStartQuestEvent(final Quester quester, final Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class QuesterPostStartQuestEvent extends QuesterEvent {
|
|||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ import me.blackvein.quests.Stage;
|
|||
*/
|
||||
public class QuesterPreChangeStageEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private Stage current;
|
||||
private Stage next;
|
||||
private final Quest quest;
|
||||
private final Stage current;
|
||||
private final Stage next;
|
||||
private boolean cancel = false;;
|
||||
|
||||
public QuesterPreChangeStageEvent(Quester quester, Quest quest, Stage current, Stage next) {
|
||||
public QuesterPreChangeStageEvent(final Quester quester, final Quest quest, final Stage current, final Stage next) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
this.current = current;
|
||||
|
@ -59,10 +59,11 @@ public class QuesterPreChangeStageEvent extends QuesterEvent implements Cancella
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuesterPreCompleteQuestEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private final Quest quest;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreCompleteQuestEvent(Quester quester, Quest quest) {
|
||||
public QuesterPreCompleteQuestEvent(final Quester quester, final Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -46,10 +46,11 @@ public class QuesterPreCompleteQuestEvent extends QuesterEvent implements Cancel
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuesterPreFailQuestEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private final Quest quest;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreFailQuestEvent(Quester quester, Quest quest) {
|
||||
public QuesterPreFailQuestEvent(final Quester quester, final Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -46,10 +46,11 @@ public class QuesterPreFailQuestEvent extends QuesterEvent implements Cancellabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ import net.citizensnpcs.api.npc.NPC;
|
|||
*/
|
||||
public class QuesterPreOpenGUIEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private NPC npc;
|
||||
private final NPC npc;
|
||||
LinkedList<Quest> quests;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreOpenGUIEvent(Quester quester, NPC npc, LinkedList<Quest> quests) {
|
||||
public QuesterPreOpenGUIEvent(final Quester quester, final NPC npc, final LinkedList<Quest> quests) {
|
||||
super(quester);
|
||||
this.npc = npc;
|
||||
this.quests = quests;
|
||||
|
@ -60,10 +60,11 @@ public class QuesterPreOpenGUIEvent extends QuesterEvent implements Cancellable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ import me.blackvein.quests.Quester;
|
|||
*/
|
||||
public class QuesterPreStartQuestEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private Quest quest;
|
||||
private final Quest quest;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreStartQuestEvent(Quester quester, Quest quest) {
|
||||
public QuesterPreStartQuestEvent(final Quester quester, final Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
@ -46,10 +46,11 @@ public class QuesterPreStartQuestEvent extends QuesterEvent implements Cancellab
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ActionFormatException extends Exception {
|
|||
private final String message;
|
||||
private final String actionId;
|
||||
|
||||
public ActionFormatException(String message, String actionId) {
|
||||
public ActionFormatException(final String message, final String actionId) {
|
||||
super(message + ", see action of ID " + actionId);
|
||||
this.message = message + ", see action of ID " + actionId;
|
||||
this.actionId = actionId;
|
||||
|
@ -29,6 +29,7 @@ public class ActionFormatException extends Exception {
|
|||
*
|
||||
* @return The message.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ConditionFormatException extends Exception {
|
|||
private final String message;
|
||||
private final String conditionId;
|
||||
|
||||
public ConditionFormatException(String message, String conditionId) {
|
||||
public ConditionFormatException(final String message, final String conditionId) {
|
||||
super(message + ", see condition of ID " + conditionId);
|
||||
this.message = message + ", see condition of ID " + conditionId;
|
||||
this.conditionId = conditionId;
|
||||
|
@ -29,6 +29,7 @@ public class ConditionFormatException extends Exception {
|
|||
*
|
||||
* @return The message.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -18,18 +18,20 @@ public class QuestFormatException extends Exception {
|
|||
private final String message;
|
||||
private final String questId;
|
||||
|
||||
public QuestFormatException(String message, String questId) {
|
||||
public QuestFormatException(final String message, final String questId) {
|
||||
super(message + ", see quest of ID " + questId);
|
||||
this.message = message + ", see quest of ID " + questId;
|
||||
this.questId = questId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of this class with the afflicted.
|
||||
*
|
||||
* @deprecated Use {@link#QuestFormatException(String, String)}
|
||||
* @param quest The quest that an invalid value was set within.
|
||||
*/
|
||||
public QuestFormatException(String questId) {
|
||||
@Deprecated
|
||||
public QuestFormatException(final String questId) {
|
||||
this.message = "Failed to load quest of ID " + questId;
|
||||
this.questId = questId;
|
||||
}
|
||||
|
@ -39,6 +41,7 @@ public class QuestFormatException extends Exception {
|
|||
*
|
||||
* @return The message.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class StageFormatException extends Exception {
|
|||
private final int stage;
|
||||
|
||||
|
||||
public StageFormatException(String message, Quest quest, int stage) {
|
||||
public StageFormatException(final String message, final Quest quest, final int stage) {
|
||||
super(message + ", see quest " + quest.getName() + " stage " + stage);
|
||||
this.message = message + ", see quest " + quest.getName() + " stage " + stage;
|
||||
this.quest = quest;
|
||||
|
@ -36,7 +36,8 @@ public class StageFormatException extends Exception {
|
|||
* @param quest The quest that an invalid stage id was set within.
|
||||
* @param stage The invalid stage id that was set.
|
||||
*/
|
||||
public StageFormatException(Quest quest, int stage) {
|
||||
@Deprecated
|
||||
public StageFormatException(final Quest quest, final int stage) {
|
||||
this.message = "Failed to load quest " + quest.getName() + " stage " + stage;
|
||||
this.quest = quest;
|
||||
this.stage = stage;
|
||||
|
@ -47,6 +48,7 @@ public class StageFormatException extends Exception {
|
|||
*
|
||||
* @return The message.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -35,19 +35,19 @@ public class BlockListener implements Listener {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public BlockListener(Quests plugin) {
|
||||
public BlockListener(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.HIGH) // Because HIGHEST conflicts with AutoSell by extendedclip
|
||||
public void onBlockBreak(BlockBreakEvent evt) {
|
||||
public void onBlockBreak(final BlockBreakEvent evt) {
|
||||
final Player player = evt.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState()
|
||||
.getData().toItemStack().getDurability());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (evt.isCancelled() == false) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
|
@ -59,7 +59,7 @@ public class BlockListener implements Listener {
|
|||
quester.breakBlock(quest, blockItemStack);
|
||||
}
|
||||
}
|
||||
quester.dispatchMultiplayerEverything(quest, "breakBlock", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "breakBlock", (final Quester q) -> {
|
||||
if (!player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
q.breakBlock(quest, blockItemStack);
|
||||
}
|
||||
|
@ -67,18 +67,18 @@ public class BlockListener implements Listener {
|
|||
});
|
||||
if (quester.getCurrentQuests().containsKey(quest)
|
||||
&& quester.getCurrentStage(quest).containsObjective("placeBlock")) {
|
||||
for (ItemStack is : quester.getQuestData(quest).blocksPlaced) {
|
||||
for (final ItemStack is : quester.getQuestData(quest).blocksPlaced) {
|
||||
if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
|
||||
int index = quester.getQuestData(quest).blocksPlaced.indexOf(is);
|
||||
final int index = quester.getQuestData(quest).blocksPlaced.indexOf(is);
|
||||
is.setAmount(is.getAmount() - 1);
|
||||
quester.getQuestData(quest).blocksPlaced.set(index, is);
|
||||
}
|
||||
}
|
||||
}
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (Quester q) -> {
|
||||
for (ItemStack is : q.getQuestData(quest).blocksPlaced) {
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (final Quester q) -> {
|
||||
for (final ItemStack is : q.getQuestData(quest).blocksPlaced) {
|
||||
if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
|
||||
int index = q.getQuestData(quest).blocksPlaced.indexOf(is);
|
||||
final int index = q.getQuestData(quest).blocksPlaced.indexOf(is);
|
||||
is.setAmount(is.getAmount() - 1);
|
||||
q.getQuestData(quest).blocksPlaced.set(index, is);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class BlockListener implements Listener {
|
|||
quester.cutBlock(quest, blockItemStack);
|
||||
}
|
||||
}
|
||||
quester.dispatchMultiplayerEverything(quest, "cutBlock", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "cutBlock", (final Quester q) -> {
|
||||
if (player.getItemInHand().getType().equals(Material.SHEARS)) {
|
||||
q.cutBlock(quest, blockItemStack);
|
||||
}
|
||||
|
@ -104,13 +104,13 @@ public class BlockListener implements Listener {
|
|||
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
@EventHandler
|
||||
public void onBlockDamage(BlockDamageEvent evt) {
|
||||
public void onBlockDamage(final BlockDamageEvent evt) {
|
||||
final Player player = evt.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState()
|
||||
.getData().toItemStack().getDurability());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class BlockListener implements Listener {
|
|||
quester.damageBlock(quest, blockItemStack);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (final Quester q) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
|
@ -130,13 +130,13 @@ public class BlockListener implements Listener {
|
|||
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBlockPlace(BlockPlaceEvent evt) {
|
||||
public void onBlockPlace(final BlockPlaceEvent evt) {
|
||||
final Player player = evt.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final ItemStack blockItemStack = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState()
|
||||
.getData().toItemStack().getDurability());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (evt.isCancelled() == false) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
|
@ -147,7 +147,7 @@ public class BlockListener implements Listener {
|
|||
quester.placeBlock(quest, blockItemStack);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (final Quester q) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
|
@ -158,11 +158,11 @@ public class BlockListener implements Listener {
|
|||
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
@EventHandler
|
||||
public void onBlockUse(PlayerInteractEvent evt) {
|
||||
public void onBlockUse(final PlayerInteractEvent evt) {
|
||||
EquipmentSlot e = null;
|
||||
try {
|
||||
e = evt.getHand();
|
||||
} catch (NoSuchMethodError err) {
|
||||
} catch (final NoSuchMethodError err) {
|
||||
// Do nothing, getHand() not present pre-1.9
|
||||
}
|
||||
if (e == null || e.equals(EquipmentSlot.HAND)) { //If the event is fired by HAND (main hand)
|
||||
|
@ -173,7 +173,7 @@ public class BlockListener implements Listener {
|
|||
if (evt.isCancelled() == false) {
|
||||
final ItemStack blockItemStack = new ItemStack(evt.getClickedBlock().getType(), 1, evt
|
||||
.getClickedBlock().getState().getData().toItemStack().getDurability());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ public class BlockListener implements Listener {
|
|||
quester.useBlock(quest, blockItemStack);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "useBlock", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "useBlock", (final Quester q) -> {
|
||||
q.useBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,30 +21,29 @@ import de.erethon.dungeonsxl.api.event.group.GroupCreateEvent;
|
|||
import de.erethon.dungeonsxl.api.event.group.GroupDisbandEvent;
|
||||
import de.erethon.dungeonsxl.api.event.group.GroupPlayerJoinEvent;
|
||||
import de.erethon.dungeonsxl.api.event.group.GroupPlayerLeaveEvent;
|
||||
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
public class DungeonsListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onGroupCreate(GroupCreateEvent event) {
|
||||
public void onGroupCreate(final GroupCreateEvent event) {
|
||||
if (Lang.get("questDungeonsCreate").length() > 0) {
|
||||
event.getCreator().sendMessage(ChatColor.YELLOW + Lang.get("questDungeonsCreate"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGroupDisbandEvent(GroupDisbandEvent event) {
|
||||
public void onGroupDisbandEvent(final GroupDisbandEvent event) {
|
||||
if (Lang.get("questDungeonsDisband").length() > 0) {
|
||||
event.getDisbander().sendMessage(ChatColor.RED + Lang.get("questDungeonsDisband"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoinEvent(GroupPlayerJoinEvent event) {
|
||||
public void onPlayerJoinEvent(final GroupPlayerJoinEvent event) {
|
||||
if (event.getGroup() != null && event.getPlayer() != null) {
|
||||
Player i = event.getGroup().getLeader();
|
||||
Player p = event.getPlayer().getPlayer();
|
||||
final Player i = event.getGroup().getLeader();
|
||||
final Player p = event.getPlayer().getPlayer();
|
||||
if (i != null && p != null) {
|
||||
if (Lang.get("questDungeonsInvite").length() > 0) {
|
||||
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questDungeonsInvite")
|
||||
|
@ -58,10 +57,10 @@ public class DungeonsListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeaveEvent(GroupPlayerLeaveEvent event) {
|
||||
public void onPlayerLeaveEvent(final GroupPlayerLeaveEvent event) {
|
||||
if (event.getGroup() != null && event.getPlayer() != null) {
|
||||
Player k = event.getGroup().getLeader();
|
||||
Player p = event.getPlayer().getPlayer();
|
||||
final Player k = event.getGroup().getLeader();
|
||||
final Player p = event.getPlayer().getPlayer();
|
||||
if (k != null && p != null) {
|
||||
if (Lang.get("questDungeonsKicked").length() > 0) {
|
||||
k.sendMessage(ChatColor.RED + Lang.get(k, "questDungeonsKicked").replace("<player>", k.getName()));
|
||||
|
|
|
@ -34,18 +34,18 @@ public class ItemListener implements Listener {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public ItemListener(Quests plugin) {
|
||||
public ItemListener(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCraftItem(CraftItemEvent evt) {
|
||||
public void onCraftItem(final CraftItemEvent evt) {
|
||||
if (evt.getWhoClicked() instanceof Player) {
|
||||
final Player player = (Player) evt.getWhoClicked();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final ItemStack craftedItem = getCraftedItem(evt);
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class ItemListener implements Listener {
|
|||
quester.craftItem(quest, craftedItem);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "craftItem", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "craftItem", (final Quester q) -> {
|
||||
q.craftItem(quest, craftedItem);
|
||||
return null;
|
||||
});
|
||||
|
@ -65,12 +65,12 @@ public class ItemListener implements Listener {
|
|||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private ItemStack getCraftedItem(CraftItemEvent evt) {
|
||||
private ItemStack getCraftedItem(final CraftItemEvent evt) {
|
||||
if (evt.isShiftClick()) {
|
||||
final ItemStack recipeResult = evt.getRecipe().getResult();
|
||||
final int resultAmt = recipeResult.getAmount(); // Bread = 1, Cookie = 8, etc.
|
||||
int leastIngredient = 1;
|
||||
for (ItemStack item : evt.getInventory().getMatrix()) {
|
||||
for (final ItemStack item : evt.getInventory().getMatrix()) {
|
||||
if (item != null && !item.getType().equals(Material.AIR)) {
|
||||
leastIngredient = item.getAmount() * resultAmt;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class ItemListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent evt) {
|
||||
public void onInventoryClick(final InventoryClickEvent evt) {
|
||||
if (evt.getWhoClicked() instanceof Player) {
|
||||
final Player player = (Player) evt.getWhoClicked();
|
||||
if (evt.getInventory().getType() == InventoryType.FURNACE
|
||||
|
@ -89,7 +89,7 @@ public class ItemListener implements Listener {
|
|||
|| evt.getInventory().getType().name().equals("SMOKER")) {
|
||||
if (evt.getSlotType() == SlotType.RESULT) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class ItemListener implements Listener {
|
|||
quester.smeltItem(quest, evt.getCurrentItem());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "smeltItem", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "smeltItem", (final Quester q) -> {
|
||||
q.smeltItem(quest, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
|
@ -108,7 +108,7 @@ public class ItemListener implements Listener {
|
|||
} else if (evt.getInventory().getType() == InventoryType.BREWING) {
|
||||
if (evt.getSlotType() == SlotType.CRAFTING) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class ItemListener implements Listener {
|
|||
quester.brewItem(quest, evt.getCurrentItem());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "brewItem", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "brewItem", (final Quester q) -> {
|
||||
q.brewItem(quest, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
|
@ -129,24 +129,24 @@ public class ItemListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEnchantItem(EnchantItemEvent evt) {
|
||||
public void onEnchantItem(final EnchantItemEvent evt) {
|
||||
final Player player = evt.getEnchanter();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (quester.getCurrentQuests().containsKey(quest)
|
||||
&& quester.getCurrentStage(quest).containsObjective("enchantItem")) {
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
for (final Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
quester.enchantItem(quest, e, evt.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "enchantItem", (Quester q) -> {
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
quester.dispatchMultiplayerEverything(quest, "enchantItem", (final Quester q) -> {
|
||||
for (final Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
q.enchantItem(quest, e, evt.getItem().getType());
|
||||
}
|
||||
return null;
|
||||
|
@ -157,13 +157,13 @@ public class ItemListener implements Listener {
|
|||
|
||||
|
||||
@EventHandler
|
||||
public void onConsumeItem(PlayerItemConsumeEvent evt) {
|
||||
public void onConsumeItem(final PlayerItemConsumeEvent evt) {
|
||||
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
|
||||
final ItemStack consumedItem = evt.getItem().clone();
|
||||
consumedItem.setAmount(1);
|
||||
final Player player = evt.getPlayer();
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class ItemListener implements Listener {
|
|||
quester.consumeItem(quest, consumedItem);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "consumeItem", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "consumeItem", (final Quester q) -> {
|
||||
quester.consumeItem(quest, consumedItem);
|
||||
return null;
|
||||
});
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.Map.Entry;
|
|||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -48,13 +47,13 @@ public class NpcListener implements Listener {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public NpcListener(Quests plugin) {
|
||||
public NpcListener(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||
public void onNPCRightClick(final NPCRightClickEvent evt) {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
// Ensure that Citizens is linked (may not be if it loads after Quests)
|
||||
return;
|
||||
|
@ -68,23 +67,23 @@ public class NpcListener implements Listener {
|
|||
final Player player = evt.getClicker();
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
boolean delivery = false;
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.getCurrentStage(quest).containsObjective("deliverItem") && player.getItemInHand() != null) {
|
||||
ItemStack hand = player.getItemInHand();
|
||||
final ItemStack hand = player.getItemInHand();
|
||||
int currentIndex = -1;
|
||||
LinkedList<Integer> matches = new LinkedList<Integer>();
|
||||
final LinkedList<Integer> matches = new LinkedList<Integer>();
|
||||
int reasonCode = 0;
|
||||
for (ItemStack is : quester.getCurrentStage(quest).getItemsToDeliver()) {
|
||||
for (final ItemStack is : quester.getCurrentStage(quest).getItemsToDeliver()) {
|
||||
currentIndex++;
|
||||
reasonCode = ItemUtil.compareItems(is, hand, true);
|
||||
if (reasonCode == 0) {
|
||||
matches.add(currentIndex);
|
||||
}
|
||||
}
|
||||
NPC clicked = evt.getNPC();
|
||||
final NPC clicked = evt.getNPC();
|
||||
if (!matches.isEmpty()) {
|
||||
for (Integer match : matches) {
|
||||
Integer id = quester.getCurrentStage(quest).getItemDeliveryTargets().get(match);
|
||||
for (final Integer match : matches) {
|
||||
final Integer id = quester.getCurrentStage(quest).getItemDeliveryTargets().get(match);
|
||||
if (id.equals(clicked.getId())) {
|
||||
quester.deliverToNPC(quest, clicked, hand);
|
||||
delivery = true;
|
||||
|
@ -92,10 +91,10 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
}
|
||||
} else if (!hand.getType().equals(Material.AIR)) {
|
||||
for (Integer n : quester.getCurrentStage(quest).getItemDeliveryTargets()) {
|
||||
for (final Integer n : quester.getCurrentStage(quest).getItemDeliveryTargets()) {
|
||||
if (n.equals(clicked.getId())) {
|
||||
String text = "";
|
||||
boolean hasMeta = hand.hasItemMeta();
|
||||
final boolean hasMeta = hand.hasItemMeta();
|
||||
if (hasMeta) {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC
|
||||
+ (hand.getItemMeta().hasDisplayName() ? hand.getItemMeta().getDisplayName()
|
||||
|
@ -168,12 +167,12 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
if (hasMeta) {
|
||||
if (hand.getType().equals(Material.ENCHANTED_BOOK)) {
|
||||
EnchantmentStorageMeta esmeta = (EnchantmentStorageMeta) hand.getItemMeta();
|
||||
final EnchantmentStorageMeta esmeta = (EnchantmentStorageMeta) hand.getItemMeta();
|
||||
if (esmeta.hasStoredEnchants()) {
|
||||
// TODO translate Roman numerals
|
||||
for (Entry<Enchantment, Integer> e : esmeta.getStoredEnchants()
|
||||
for (final Entry<Enchantment, Integer> e : esmeta.getStoredEnchants()
|
||||
.entrySet()) {
|
||||
HashMap<Enchantment, Integer> single
|
||||
final HashMap<Enchantment, Integer> single
|
||||
= new HashMap<Enchantment, Integer>();
|
||||
single.put(e.getKey(), e.getValue());
|
||||
plugin.getLocaleQuery().sendMessage(player, ChatColor.GRAY + "\u2515 "
|
||||
|
@ -192,7 +191,7 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
if (plugin.getQuestNpcs().contains(evt.getNPC()) && delivery == false) {
|
||||
boolean hasObjective = false;
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.getCurrentStage(quest).containsObjective("talkToNPC")) {
|
||||
if (quester.getQuestData(quest) != null
|
||||
&& quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId())
|
||||
|
@ -204,8 +203,8 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
if (!hasObjective) {
|
||||
boolean hasAtLeastOneGUI = false;
|
||||
LinkedList<Quest> npcQuests = new LinkedList<Quest>();
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
final LinkedList<Quest> npcQuests = new LinkedList<Quest>();
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
if (quester.getCurrentQuests().containsKey(q))
|
||||
continue;
|
||||
if (q.getNpcStart() != null && q.getNpcStart().getId() == evt.getNPC().getId()) {
|
||||
|
@ -228,7 +227,7 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
}
|
||||
if (npcQuests.isEmpty() == false && npcQuests.size() == 1) {
|
||||
Quest q = npcQuests.get(0);
|
||||
final Quest q = npcQuests.get(0);
|
||||
if (quester.canAcceptOffer(q, true)) {
|
||||
quester.setQuestToTake(q.getName());
|
||||
if (!plugin.getSettings().canAskConfirmation()) {
|
||||
|
@ -237,10 +236,10 @@ public class NpcListener implements Listener {
|
|||
if (q.getGUIDisplay() != null) {
|
||||
quester.showGUIDisplay(evt.getNPC(), npcQuests);
|
||||
} else {
|
||||
for (String msg : extracted(quester).split("<br>")) {
|
||||
for (final String msg : extracted(quester).split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
plugin.getConversationFactory().buildConversation((Conversable) player).begin();
|
||||
plugin.getConversationFactory().buildConversation(player).begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +247,7 @@ public class NpcListener implements Listener {
|
|||
if (hasAtLeastOneGUI) {
|
||||
quester.showGUIDisplay(evt.getNPC(), npcQuests);
|
||||
} else {
|
||||
Conversation c = plugin.getNpcConversationFactory().buildConversation(player);
|
||||
final Conversation c = plugin.getNpcConversationFactory().buildConversation(player);
|
||||
c.getContext().setSessionData("npcQuests", npcQuests);
|
||||
c.getContext().setSessionData("npc", evt.getNPC().getName());
|
||||
c.begin();
|
||||
|
@ -331,7 +330,7 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onNPCLeftClick(NPCLeftClickEvent evt) {
|
||||
public void onNPCLeftClick(final NPCLeftClickEvent evt) {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
// Ensure that Citizens is linked (may not be if it loads after Quests)
|
||||
return;
|
||||
|
@ -343,7 +342,7 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onNPCDeath(NPCDeathEvent evt) {
|
||||
public void onNPCDeath(final NPCDeathEvent evt) {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
// Ensure that Citizens is linked (may not be if it loads after Quests)
|
||||
return;
|
||||
|
@ -353,13 +352,13 @@ public class NpcListener implements Listener {
|
|||
return;
|
||||
}
|
||||
if (evt.getNPC().getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent damageEvent
|
||||
final EntityDamageByEntityEvent damageEvent
|
||||
= (EntityDamageByEntityEvent) evt.getNPC().getEntity().getLastDamageCause();
|
||||
Entity damager = damageEvent.getDamager();
|
||||
final Entity damager = damageEvent.getDamager();
|
||||
if (damager != null) {
|
||||
if (damager instanceof Projectile) {
|
||||
if (evt.getNPC().getEntity().getLastDamageCause().getEntity() instanceof Player) {
|
||||
Player player = (Player) evt.getNPC().getEntity().getLastDamageCause().getEntity();
|
||||
final Player player = (Player) evt.getNPC().getEntity().getLastDamageCause().getEntity();
|
||||
boolean okay = true;
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player)) {
|
||||
|
@ -367,8 +366,8 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
}
|
||||
if (okay) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.getCurrentStage(quest).containsObjective("killNPC")) {
|
||||
quester.killNPC(quest, evt.getNPC());
|
||||
}
|
||||
|
@ -383,9 +382,9 @@ public class NpcListener implements Listener {
|
|||
}
|
||||
}
|
||||
if (okay) {
|
||||
Player player = (Player) damager;
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
final Player player = (Player) damager;
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.getCurrentStage(quest).containsObjective("killNPC")) {
|
||||
quester.killNPC(quest, evt.getNPC());
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import me.blackvein.quests.util.Lang;
|
|||
public class PartiesListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPartyCreate(BukkitPartiesPartyPostCreateEvent event) {
|
||||
public void onPartyCreate(final BukkitPartiesPartyPostCreateEvent event) {
|
||||
if (event.getCreator() != null) {
|
||||
final Player p = Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID());
|
||||
if (p != null) {
|
||||
|
@ -40,7 +40,7 @@ public class PartiesListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPartyDeleteEvent(BukkitPartiesPartyPostDeleteEvent event) {
|
||||
public void onPartyDeleteEvent(final BukkitPartiesPartyPostDeleteEvent event) {
|
||||
if (event.getCommandSender() != null) {
|
||||
final Player p = Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID());
|
||||
if (p != null) {
|
||||
|
@ -52,7 +52,7 @@ public class PartiesListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoinEvent(BukkitPartiesPlayerPostJoinEvent event) {
|
||||
public void onPlayerJoinEvent(final BukkitPartiesPlayerPostJoinEvent event) {
|
||||
if (event.isInvited() && event.getInviter() != null) {
|
||||
final Player i = Bukkit.getServer().getPlayer(event.getInviter());
|
||||
if (i != null) {
|
||||
|
@ -70,7 +70,7 @@ public class PartiesListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeaveEvent(BukkitPartiesPlayerPostLeaveEvent event) {
|
||||
public void onPlayerLeaveEvent(final BukkitPartiesPlayerPostLeaveEvent event) {
|
||||
if (event.isKicked() && event.getKicker() != null) {
|
||||
final Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID());
|
||||
if (k != null) {
|
||||
|
|
|
@ -75,13 +75,13 @@ public class PlayerListener implements Listener {
|
|||
|
||||
private final Quests plugin;
|
||||
|
||||
public PlayerListener(Quests plugin) {
|
||||
public PlayerListener(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInventoryClickEvent(InventoryClickEvent evt) {
|
||||
InventoryAction ac = evt.getAction();
|
||||
public void onInventoryClickEvent(final InventoryClickEvent evt) {
|
||||
final InventoryAction ac = evt.getAction();
|
||||
if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem())) {
|
||||
if (ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || ac.equals(InventoryAction.DROP_ALL_SLOT)
|
||||
|| ac.equals(InventoryAction.DROP_ONE_SLOT)) {
|
||||
|
@ -100,8 +100,8 @@ public class PlayerListener implements Listener {
|
|||
int upper = evt.getView().getTopInventory().getSize();
|
||||
if (evt.getView().getTopInventory().getType().equals(InventoryType.CRAFTING))
|
||||
upper += 4;
|
||||
int lower = evt.getView().getBottomInventory().getSize();
|
||||
int relative = evt.getRawSlot() - upper;
|
||||
final int lower = evt.getView().getBottomInventory().getSize();
|
||||
final int relative = evt.getRawSlot() - upper;
|
||||
if (relative < 0 || relative >= (lower)) {
|
||||
evt.setCancelled(true);
|
||||
return;
|
||||
|
@ -110,15 +110,15 @@ public class PlayerListener implements Listener {
|
|||
final Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
|
||||
final Player player = (Player) evt.getWhoClicked();
|
||||
if (evt.getView().getTitle().contains(Lang.get(player, "quests"))) {
|
||||
ItemStack clicked = evt.getCurrentItem();
|
||||
final ItemStack clicked = evt.getCurrentItem();
|
||||
if (clicked != null) {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (quest.getGUIDisplay() != null) {
|
||||
if (ItemUtil.compareItems(clicked, quest.getGUIDisplay(), false) == 0) {
|
||||
if (quester.canAcceptOffer(quest, true)) {
|
||||
try {
|
||||
quester.takeQuest(quest, false);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInventoryDragEvent(InventoryDragEvent evt) {
|
||||
public void onInventoryDragEvent(final InventoryDragEvent evt) {
|
||||
if (ItemUtil.isItem(evt.getOldCursor()) && ItemUtil.isJournal(evt.getOldCursor())
|
||||
|| ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {
|
||||
int upper = evt.getView().getTopInventory().getSize();
|
||||
if (evt.getView().getTopInventory().getType().equals(InventoryType.CRAFTING))
|
||||
upper += 4;
|
||||
int lower = evt.getView().getBottomInventory().getSize();
|
||||
final int lower = evt.getView().getBottomInventory().getSize();
|
||||
for (int relative : evt.getRawSlots()) {
|
||||
relative -= upper;
|
||||
if (relative < 0 || relative >= (lower)) {
|
||||
|
@ -150,7 +150,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent evt) {
|
||||
public void onPlayerDropItem(final PlayerDropItemEvent evt) {
|
||||
if (ItemUtil.isJournal(evt.getItemDrop().getItemStack())) {
|
||||
if (!evt.getPlayer().hasPermission("quests.admin.drop")) {
|
||||
evt.setCancelled(true);
|
||||
|
@ -160,11 +160,11 @@ public class PlayerListener implements Listener {
|
|||
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent evt) {
|
||||
public void onPlayerInteract(final PlayerInteractEvent evt) {
|
||||
EquipmentSlot e = null;
|
||||
try {
|
||||
e = evt.getHand();
|
||||
} catch (NoSuchMethodError err) {
|
||||
} catch (final NoSuchMethodError err) {
|
||||
// Do nothing, getHand() not present pre-1.9
|
||||
}
|
||||
if (e == null || e.equals(EquipmentSlot.HAND)) { // If the event is fired by HAND (main hand)
|
||||
|
@ -189,7 +189,7 @@ public class PlayerListener implements Listener {
|
|||
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
boolean hasObjective = false;
|
||||
if (evt.isCancelled() == false) {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (quester.getCurrentQuests().containsKey(quest)
|
||||
&& quester.getCurrentStage(quest).containsObjective("useBlock")) {
|
||||
hasObjective = true;
|
||||
|
@ -199,9 +199,9 @@ public class PlayerListener implements Listener {
|
|||
if (!hasObjective) {
|
||||
if (plugin.getQuestFactory().getSelectedBlockStarts().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation")
|
||||
|
@ -211,9 +211,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getActionFactory().getSelectedExplosionLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -223,9 +223,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getActionFactory().getSelectedEffectLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedEffectLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -235,9 +235,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getActionFactory().getSelectedMobLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedMobLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedMobLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -247,9 +247,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getActionFactory().getSelectedLightningLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedLightningLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -259,9 +259,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getActionFactory().getSelectedTeleportLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -271,9 +271,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getQuestFactory().getSelectedKillLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -283,9 +283,9 @@ public class PlayerListener implements Listener {
|
|||
evt.setCancelled(true);
|
||||
} else if (plugin.getQuestFactory().getSelectedReachLocations().containsKey(evt.getPlayer()
|
||||
.getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
final Block block = evt.getClickedBlock();
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " "
|
||||
|
@ -325,11 +325,11 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
quester.setQuestToTake(q.getName());
|
||||
String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE
|
||||
final String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE
|
||||
+ quester.getQuestToTake() + ChatColor.GOLD + " -\n" + "\n"
|
||||
+ ChatColor.RESET + plugin.getQuest(quester.getQuestToTake())
|
||||
.getDescription() + "\n";
|
||||
for (String msg : s.split("<br>")) {
|
||||
for (final String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
plugin.getConversationFactory().buildConversation(player).begin();
|
||||
|
@ -360,7 +360,7 @@ public class PlayerListener implements Listener {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent evt) {
|
||||
public void onPlayerInteractEntity(final PlayerInteractEntityEvent evt) {
|
||||
if (evt.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
||||
if (ItemUtil.isJournal(evt.getPlayer().getItemInHand())) {
|
||||
evt.setCancelled(true);
|
||||
|
@ -371,12 +371,12 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerBucketFill(PlayerBucketFillEvent evt) {
|
||||
public void onPlayerBucketFill(final PlayerBucketFillEvent evt) {
|
||||
if (evt.getItemStack().getType() == Material.MILK_BUCKET) {
|
||||
final Player player = evt.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public class PlayerListener implements Listener {
|
|||
quester.milkCow(quest);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "milkCow", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "milkCow", (final Quester q) -> {
|
||||
q.milkCow(quest);
|
||||
return null;
|
||||
});
|
||||
|
@ -396,7 +396,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(AsyncPlayerChatEvent evt) {
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent evt) {
|
||||
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
|
@ -412,7 +412,7 @@ public class PlayerListener implements Listener {
|
|||
continue;
|
||||
}
|
||||
if (currentStage.getChatActions().isEmpty() == false) {
|
||||
String chat = evt.getMessage();
|
||||
final String chat = evt.getMessage();
|
||||
for (final String s : currentStage.getChatActions().keySet()) {
|
||||
if (s.equalsIgnoreCase(chat)) {
|
||||
if (quester.getQuestData(quest).actionFired.get(s) == null
|
||||
|
@ -434,7 +434,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "password", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "password", (final Quester q) -> {
|
||||
q.sayPassword(quest, evt);
|
||||
return null;
|
||||
});
|
||||
|
@ -443,11 +443,11 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent evt) {
|
||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent evt) {
|
||||
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.getCurrentQuests().isEmpty() == false) {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (!quest.getOptions().getAllowCommands()) {
|
||||
if (!evt.getMessage().startsWith("/quest")) {
|
||||
evt.getPlayer().sendMessage(ChatColor.RED + Lang.get(evt.getPlayer(), "optCommandsDenied")
|
||||
|
@ -459,15 +459,15 @@ public class PlayerListener implements Listener {
|
|||
return;
|
||||
}
|
||||
}
|
||||
Stage currentStage = quester.getCurrentStage(quest);
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
|
||||
+ " on command for quest " + quest.getName());
|
||||
continue;
|
||||
}
|
||||
if (currentStage.getCommandActions().isEmpty() == false) {
|
||||
String command = evt.getMessage();
|
||||
for (String s : currentStage.getCommandActions().keySet()) {
|
||||
final String command = evt.getMessage();
|
||||
for (final String s : currentStage.getCommandActions().keySet()) {
|
||||
if (command.equalsIgnoreCase("/" + s)) {
|
||||
if (quester.getQuestData(quest).actionFired.get(s) == null
|
||||
|| quester.getQuestData(quest).actionFired.get(s) == false) {
|
||||
|
@ -483,13 +483,13 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerShearEntity(PlayerShearEntityEvent evt) {
|
||||
public void onPlayerShearEntity(final PlayerShearEntityEvent evt) {
|
||||
if (evt.getEntity().getType() == EntityType.SHEEP) {
|
||||
final Player player = evt.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Sheep sheep = (Sheep) evt.getEntity();
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ public class PlayerListener implements Listener {
|
|||
quester.shearSheep(quest, sheep.getColor());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "shearSheep", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "shearSheep", (final Quester q) -> {
|
||||
q.shearSheep(quest, sheep.getColor());
|
||||
return null;
|
||||
});
|
||||
|
@ -509,12 +509,12 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityTame(EntityTameEvent evt) {
|
||||
public void onEntityTame(final EntityTameEvent evt) {
|
||||
if (evt.getOwner() instanceof Player) {
|
||||
final Player player = (Player) evt.getOwner();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ public class PlayerListener implements Listener {
|
|||
quester.tameMob(quest, evt.getEntityType());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "tameMob", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "tameMob", (final Quester q) -> {
|
||||
q.tameMob(quest, evt.getEntityType());
|
||||
return null;
|
||||
});
|
||||
|
@ -534,25 +534,25 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent evt) {
|
||||
public void onEntityDeath(final EntityDeathEvent evt) {
|
||||
if (evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
|
||||
final EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
|
||||
final Entity damager = damageEvent.getDamager();
|
||||
|
||||
if (damager != null) {
|
||||
if (damager instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) damager;
|
||||
final Projectile projectile = (Projectile) damager;
|
||||
if (projectile.getShooter() != null && projectile.getShooter() instanceof Entity) {
|
||||
preKillMob((Entity)projectile.getShooter(), evt.getEntity());
|
||||
}
|
||||
} else if (damager instanceof TNTPrimed) {
|
||||
TNTPrimed tnt = (TNTPrimed) damager;
|
||||
Entity source = tnt.getSource();
|
||||
final TNTPrimed tnt = (TNTPrimed) damager;
|
||||
final Entity source = tnt.getSource();
|
||||
if (source != null && source.isValid()) {
|
||||
preKillMob(source, evt.getEntity());
|
||||
}
|
||||
} else if (damager instanceof Wolf) {
|
||||
Wolf wolf = (Wolf) damager;
|
||||
final Wolf wolf = (Wolf) damager;
|
||||
if (wolf.isTamed() && wolf.getOwner() != null) {
|
||||
final Quester quester = plugin.getQuester(wolf.getOwner().getUniqueId());
|
||||
if (quester != null) {
|
||||
|
@ -573,14 +573,14 @@ public class PlayerListener implements Listener {
|
|||
* @param target the entity being attacked
|
||||
* @since 3.1.4
|
||||
*/
|
||||
public void preKillMob(Entity damager, Entity target) {
|
||||
public void preKillMob(final Entity damager, final Entity target) {
|
||||
if (!plugin.canUseQuests(damager.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
if (damager instanceof Player) {
|
||||
final Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||
if (plugin.getDependencies().getCitizens() != null && CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -590,13 +590,13 @@ public class PlayerListener implements Listener {
|
|||
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "killNPC", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "killNPC", (final Quester q) -> {
|
||||
q.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ public class PlayerListener implements Listener {
|
|||
quester.killMob(quest, target.getLocation(), target.getType());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "killMob", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "killMob", (final Quester q) -> {
|
||||
q.killMob(quest, target.getLocation(), target.getType());
|
||||
return null;
|
||||
});
|
||||
|
@ -616,9 +616,9 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent evt) {
|
||||
public void onPlayerDeath(final PlayerDeathEvent evt) {
|
||||
if (evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
|
||||
final EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
|
||||
final Entity damager = damageEvent.getDamager();
|
||||
|
||||
if (damager != null) {
|
||||
|
@ -627,20 +627,20 @@ public class PlayerListener implements Listener {
|
|||
return;
|
||||
}
|
||||
if (damager instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) damager;
|
||||
final Projectile projectile = (Projectile) damager;
|
||||
if (projectile.getShooter() != null && projectile.getShooter() instanceof Entity) {
|
||||
preKillPlayer((Entity)projectile.getShooter(), evt.getEntity());
|
||||
}
|
||||
} else if (damager instanceof TNTPrimed) {
|
||||
TNTPrimed tnt = (TNTPrimed) damager;
|
||||
Entity source = tnt.getSource();
|
||||
final TNTPrimed tnt = (TNTPrimed) damager;
|
||||
final Entity source = tnt.getSource();
|
||||
if (source != null) {
|
||||
if (source.isValid()) {
|
||||
preKillPlayer(source, evt.getEntity());
|
||||
}
|
||||
}
|
||||
} else if (damager instanceof Wolf) {
|
||||
Wolf wolf = (Wolf) damager;
|
||||
final Wolf wolf = (Wolf) damager;
|
||||
if (wolf.isTamed()) {
|
||||
final Quester quester = plugin.getQuester(wolf.getOwner().getUniqueId());
|
||||
preKillPlayer(quester.getPlayer(), evt.getEntity());
|
||||
|
@ -654,15 +654,15 @@ public class PlayerListener implements Listener {
|
|||
final Player target = evt.getEntity();
|
||||
if (plugin.canUseQuests(target.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(target.getUniqueId());
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
Stage stage = quester.getCurrentStage(quest);
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
final Stage stage = quester.getCurrentStage(quest);
|
||||
if (stage != null && stage.getDeathAction() != null) {
|
||||
quester.getCurrentStage(quest).getDeathAction().fire(quester, quest);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack found = null;
|
||||
for (ItemStack stack : evt.getDrops()) {
|
||||
for (final ItemStack stack : evt.getDrops()) {
|
||||
if (ItemUtil.isJournal(stack)) {
|
||||
found = stack;
|
||||
break;
|
||||
|
@ -685,7 +685,7 @@ public class PlayerListener implements Listener {
|
|||
* @param target the entity being attacked
|
||||
* @since 3.1.4
|
||||
*/
|
||||
public void preKillPlayer(Entity damager, Entity target) {
|
||||
public void preKillPlayer(final Entity damager, final Entity target) {
|
||||
if (damager == null || target == null || damager.equals(target)) {
|
||||
return;
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
final Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ public class PlayerListener implements Listener {
|
|||
quester.killPlayer(quest, (Player)target);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "killPlayer", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "killPlayer", (final Quester q) -> {
|
||||
q.killPlayer(quest, (Player)target);
|
||||
return null;
|
||||
});
|
||||
|
@ -718,11 +718,11 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerFish(PlayerFishEvent evt) {
|
||||
public void onPlayerFish(final PlayerFishEvent evt) {
|
||||
final Player player = evt.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ public class PlayerListener implements Listener {
|
|||
quester.catchFish(quest);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "catchFish", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "catchFish", (final Quester q) -> {
|
||||
q.catchFish(quest);
|
||||
return null;
|
||||
});
|
||||
|
@ -742,12 +742,12 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) {
|
||||
public void onPlayerChangeWorld(final PlayerChangedWorldEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
quester.findCompassTarget();
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
if (!quester.meetsCondition(quest, true)) {
|
||||
return;
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
public void onPlayerRespawn(final PlayerRespawnEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (plugin.canUseQuests(player.getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
@ -771,7 +771,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent evt) {
|
||||
public void onPlayerJoin(final PlayerJoinEvent evt) {
|
||||
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
|
||||
final Quester quester = new Quester(plugin);
|
||||
quester.setUUID(evt.getPlayer().getUniqueId());
|
||||
|
@ -780,10 +780,10 @@ public class PlayerListener implements Listener {
|
|||
} else if (plugin.getSettings().canGenFilesOnJoin()) {
|
||||
quester.saveData();
|
||||
}
|
||||
LinkedList<Quester> temp = plugin.getQuesters();
|
||||
final LinkedList<Quester> temp = plugin.getQuesters();
|
||||
temp.add(quester);
|
||||
plugin.setQuesters(temp);
|
||||
for (String s : quester.getCompletedQuests()) {
|
||||
for (final String s : quester.getCompletedQuests()) {
|
||||
final Quest q = plugin.getQuest(s);
|
||||
if (q != null) {
|
||||
if (quester.getCompletedTimes().containsKey(q.getName()) == false
|
||||
|
@ -792,10 +792,10 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
quester.checkQuest(quest);
|
||||
}
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.getCurrentStage(quest).getDelay() > -1
|
||||
&& quester.getQuestData(quest).isDelayOver() == false) {
|
||||
quester.startStageTimer(quest);
|
||||
|
@ -817,11 +817,11 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent evt) {
|
||||
public void onPlayerQuit(final PlayerQuitEvent evt) {
|
||||
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
Stage currentStage = quester.getCurrentStage(quest);
|
||||
for (final Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
|
||||
+ " on quit for quest " + quest.getName());
|
||||
|
@ -834,7 +834,7 @@ public class PlayerListener implements Listener {
|
|||
currentStage.getDisconnectAction().fire(quester, quest);
|
||||
}
|
||||
}
|
||||
for (Integer timerId : quester.getTimers().keySet()) {
|
||||
for (final Integer timerId : quester.getTimers().keySet()) {
|
||||
plugin.getServer().getScheduler().cancelTask(timerId);
|
||||
if (quester.getTimers().containsKey(timerId)) {
|
||||
quester.getTimers().get(timerId).failQuest(quester);
|
||||
|
@ -846,13 +846,13 @@ public class PlayerListener implements Listener {
|
|||
quester.saveData();
|
||||
}
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getPlayer().getUniqueId())) {
|
||||
Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.remove(evt.getPlayer().getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
}
|
||||
LinkedList<Quester> temp = plugin.getQuesters();
|
||||
for (Iterator<Quester> iterator = temp.iterator(); iterator.hasNext();) {
|
||||
Quester q = iterator.next();
|
||||
final LinkedList<Quester> temp = plugin.getQuesters();
|
||||
for (final Iterator<Quester> iterator = temp.iterator(); iterator.hasNext();) {
|
||||
final Quester q = iterator.next();
|
||||
if (q.getUUID().equals(quester.getUUID())) {
|
||||
iterator.remove();
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent evt) {
|
||||
public void onPlayerMove(final PlayerMoveEvent evt) {
|
||||
if (evt.getPlayer() == null || evt.getTo() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ public class PlayerListener implements Listener {
|
|||
* @param location The current location of the Player
|
||||
* @since 3.8.2
|
||||
*/
|
||||
public void playerMove(UUID uuid, Location location) {
|
||||
public void playerMove(final UUID uuid, final Location location) {
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
|
@ -894,7 +894,7 @@ public class PlayerListener implements Listener {
|
|||
final Quester quester = plugin.getQuester(uuid);
|
||||
if (quester != null) {
|
||||
if (plugin.canUseQuests(uuid)) {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
for (final Quest quest : plugin.getQuests()) {
|
||||
// TODO - make sure this can be run asynchronously
|
||||
if (!quester.meetsCondition(quest, false)) {
|
||||
return;
|
||||
|
@ -907,7 +907,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, "reachLocation", (Quester q) -> {
|
||||
quester.dispatchMultiplayerEverything(quest, "reachLocation", (final Quester q) -> {
|
||||
q.reachLocation(quest, location);
|
||||
return null;
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
|
@ -24,8 +25,8 @@ public abstract class ParticleProvider {
|
|||
|
||||
static {
|
||||
try {
|
||||
String packageName = ParticleProvider.class.getPackage().getName();
|
||||
String internalsName = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
final String packageName = ParticleProvider.class.getPackage().getName();
|
||||
final String internalsName = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
if (internalsName.startsWith("v1_8_R")) {
|
||||
loaded = (ParticleProvider) Class.forName(packageName + ".ParticleProvider_" + internalsName)
|
||||
.newInstance();
|
||||
|
@ -67,16 +68,16 @@ public abstract class ParticleProvider {
|
|||
* packets such as block crack or particle colour on redstone /
|
||||
* firework particles.
|
||||
*/
|
||||
public static void sendToPlayer(Player player, Location location, String particleId, float offsetX, float offsetY,
|
||||
float offsetZ, float speed, int count, int[] data) {
|
||||
public static void sendToPlayer(final Player player, final Location location, final String particleId, final float offsetX, final float offsetY,
|
||||
final float offsetZ, final float speed, final int count, final int[] data) {
|
||||
Object particle;
|
||||
PreBuiltParticle pbp = PreBuiltParticle.fromIdentifier(particleId);
|
||||
final PreBuiltParticle pbp = PreBuiltParticle.fromIdentifier(particleId);
|
||||
if (pbp != null) {
|
||||
particle = loaded.getParticleMap().get(pbp);
|
||||
} else {
|
||||
try {
|
||||
particle = Particle.valueOf(particleId);
|
||||
} catch (IllegalArgumentException e2) {
|
||||
} catch (final IllegalArgumentException e2) {
|
||||
return; // Fail silently
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +94,10 @@ public abstract class ParticleProvider {
|
|||
* @param particleId
|
||||
* The particle identifier.
|
||||
*/
|
||||
public static void sendToPlayer(Player player, Location location, String particleId) {
|
||||
PreBuiltParticle particle = PreBuiltParticle.fromIdentifier(particleId);
|
||||
public static void sendToPlayer(final Player player, final Location location, final String particleId) {
|
||||
final PreBuiltParticle particle = PreBuiltParticle.fromIdentifier(particleId);
|
||||
if (particle != null) {
|
||||
Location pos = location.clone();
|
||||
final Location pos = location.clone();
|
||||
if (particle.getVector() != null) {
|
||||
pos.add(particle.getVector());
|
||||
}
|
||||
|
@ -104,9 +105,9 @@ public abstract class ParticleProvider {
|
|||
} else {
|
||||
try {
|
||||
loaded.spawnParticle(player, location, Particle.valueOf(particleId), 0, 0, 0, 1, 3, null);
|
||||
} catch (NoClassDefFoundError e1) {
|
||||
} catch (final NoClassDefFoundError e1) {
|
||||
Bukkit.getLogger().severe("[Quests] This protocol does not support npc-effect: " + particleId);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
} catch (final IllegalArgumentException exception) {
|
||||
// Fail silently
|
||||
}
|
||||
}
|
||||
|
@ -122,8 +123,8 @@ public abstract class ParticleProvider {
|
|||
* @param particle
|
||||
* The pre-built particle.
|
||||
*/
|
||||
public static void sendToPlayer(Player player, Location location, PreBuiltParticle particle) {
|
||||
Location pos = location.clone();
|
||||
public static void sendToPlayer(final Player player, final Location location, final PreBuiltParticle particle) {
|
||||
final Location pos = location.clone();
|
||||
if (particle.getVector() != null) {
|
||||
pos.add(particle.getVector());
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ package me.blackvein.quests.particle;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -43,8 +44,8 @@ class ParticleProvider_Bukkit extends ParticleProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, int[] data) {
|
||||
void spawnParticle(final Player player, final Location location, final Object particle, final float offsetX, final float offsetY, final float offsetZ,
|
||||
final float speed, final int count, final int[] data) {
|
||||
player.spawnParticle((Particle) particle, location, count, offsetX, offsetY, offsetZ, speed, data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public enum PreBuiltParticle {
|
|||
private int count;
|
||||
private Vector vector;
|
||||
|
||||
PreBuiltParticle(String identifier, float offsetX, float offsetY, float offsetZ, float speed, int count) {
|
||||
PreBuiltParticle(final String identifier, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int count) {
|
||||
this.identifier = identifier;
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
|
@ -43,8 +43,8 @@ public enum PreBuiltParticle {
|
|||
this.count = count;
|
||||
}
|
||||
|
||||
PreBuiltParticle(String identifier, float offsetX, float offsetY, float offsetZ, float speed, int count,
|
||||
Vector vector) {
|
||||
PreBuiltParticle(final String identifier, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int count,
|
||||
final Vector vector) {
|
||||
this(identifier, offsetX, offsetY, offsetZ, speed, count);
|
||||
this.vector = vector;
|
||||
}
|
||||
|
@ -88,10 +88,10 @@ public enum PreBuiltParticle {
|
|||
* @param identifier the identifier
|
||||
* @return the PreBuiltParticle represented by the specified identifier
|
||||
*/
|
||||
public static PreBuiltParticle fromIdentifier(String identifier) {
|
||||
public static PreBuiltParticle fromIdentifier(final String identifier) {
|
||||
try {
|
||||
return valueOf(identifier);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (final IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class DenizenAPI {
|
|||
= Class.forName("com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData");
|
||||
denizen_1_1_1 = Class.forName("com.denizenscript.denizen.Denizen");
|
||||
return;
|
||||
} catch (Exception e2) {
|
||||
} catch (final Exception e2) {
|
||||
// Fail silently
|
||||
}
|
||||
try {
|
||||
|
@ -62,7 +62,7 @@ public class DenizenAPI {
|
|||
|
||||
getScriptNamesMethod = scriptRegistry.getMethod("_getScriptNames");
|
||||
return;
|
||||
} catch (Exception e1) {
|
||||
} catch (final Exception e1) {
|
||||
// Fail silently
|
||||
}
|
||||
try {
|
||||
|
@ -82,7 +82,7 @@ public class DenizenAPI {
|
|||
.getMethod("getScriptContainerAs", String.class, taskScriptContainer.getClass());
|
||||
mirrorBukkitPlayerMethod = dPlayer.getMethod("mirrorBukkitPlayer", OfflinePlayer.class);
|
||||
mirrorCitizensNPCMethod = dNPC.getMethod("mirrorCitizensNPC", NPC.class);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// Fail silently
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class DenizenAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public boolean containsScript(String input) {
|
||||
public boolean containsScript(final String input) {
|
||||
if (denizen_1_1_1 != null) {
|
||||
return DenizenAPI_1_1_1.containsScript(input);
|
||||
} else if (denizen_1_1_0 != null) {
|
||||
|
@ -118,7 +118,7 @@ public class DenizenAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public String getScriptContainerName(String input) {
|
||||
public String getScriptContainerName(final String input) {
|
||||
if (denizen_1_1_1 != null) {
|
||||
return DenizenAPI_1_1_1.getScriptContainerName(input);
|
||||
} else if (denizen_1_1_0 != null) {
|
||||
|
@ -142,7 +142,7 @@ public class DenizenAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public Object getScriptContainerAs(String scriptName) {
|
||||
public Object getScriptContainerAs(final String scriptName) {
|
||||
if (denizen_1_1_1 != null) {
|
||||
return DenizenAPI_1_1_1.getScriptContainerAs(scriptName);
|
||||
} else if (denizen_1_1_0 != null) {
|
||||
|
@ -154,7 +154,7 @@ public class DenizenAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public Object mirrorBukkitPlayer(Player player) {
|
||||
public Object mirrorBukkitPlayer(final Player player) {
|
||||
if (denizen_1_1_1 != null) {
|
||||
return DenizenAPI_1_1_1.mirrorBukkitPlayer(player);
|
||||
} else if (denizen_1_1_0 != null) {
|
||||
|
@ -166,7 +166,7 @@ public class DenizenAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public Object mirrorCitizensNPC(NPC npc) {
|
||||
public Object mirrorCitizensNPC(final NPC npc) {
|
||||
if (denizen_1_1_1 != null) {
|
||||
return DenizenAPI_1_1_1.mirrorCitizensNPC(npc);
|
||||
} else if (denizen_1_1_0 != null) {
|
||||
|
@ -178,7 +178,7 @@ public class DenizenAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public void runTaskScript(String scriptName, Player player) {
|
||||
public void runTaskScript(final String scriptName, final Player player) {
|
||||
if (denizen_1_1_1 != null) {
|
||||
DenizenAPI_1_1_1.runTaskScript(scriptName, player);
|
||||
} else if (denizen_1_1_0 != null) {
|
||||
|
|
|
@ -33,27 +33,27 @@ public class DenizenAPI_1_0_9 {
|
|||
private static DenizenAPI api = quests.getDependencies().getDenizenApi();
|
||||
|
||||
@Nullable
|
||||
public static boolean containsScript(String input) {
|
||||
public static boolean containsScript(final String input) {
|
||||
if (api.scriptRegistry == null || api.containsScriptMethod == null) return false;
|
||||
boolean script = false;
|
||||
try {
|
||||
script = (boolean)api.containsScriptMethod.invoke(api.scriptRegistry, input);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen ScriptRegistry#containsScript", e);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getScriptContainerName(String input) {
|
||||
public static String getScriptContainerName(final String input) {
|
||||
if (api.scriptRegistry == null || api.scriptContainer == null) return null;
|
||||
String name = null;
|
||||
Object instance;
|
||||
try {
|
||||
Constructor<?> constructor = api.scriptRegistry.getConstructor(YamlConfiguration.class, String.class);
|
||||
final Constructor<?> constructor = api.scriptRegistry.getConstructor(YamlConfiguration.class, String.class);
|
||||
instance = constructor.newInstance(null, input);
|
||||
name = (String)instance.getClass().getMethod("getName").invoke(api.scriptContainer);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen ScriptContainer#getName", e);
|
||||
}
|
||||
return name;
|
||||
|
@ -66,57 +66,57 @@ public class DenizenAPI_1_0_9 {
|
|||
Set<String> names = null;
|
||||
try {
|
||||
names = (Set<String>)api.getScriptNamesMethod.invoke(api.scriptRegistry);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen ScriptRegistry#_getScriptNames", e);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object getScriptContainerAs(String scriptName) {
|
||||
public static Object getScriptContainerAs(final String scriptName) {
|
||||
if (api.scriptRegistry == null || api.taskScriptContainer == null) return null;
|
||||
Object container = null;
|
||||
try {
|
||||
container = api.getScriptContainerAsMethod.invoke(api.scriptRegistry, scriptName, api.taskScriptContainer);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen #getScriptContainerAs", e);
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object mirrorBukkitPlayer(Player player) {
|
||||
public static Object mirrorBukkitPlayer(final Player player) {
|
||||
if (api.dPlayer == null || api.mirrorBukkitPlayerMethod == null) return null;
|
||||
Object dp = null;
|
||||
try {
|
||||
dp = api.mirrorBukkitPlayerMethod.invoke(api.dPlayer, player);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen dPlayer#mirrorBukkitPlayer", e);
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object mirrorCitizensNPC(NPC npc) {
|
||||
public static Object mirrorCitizensNPC(final NPC npc) {
|
||||
if (api.dNPC == null || api.mirrorCitizensNPCMethod == null) return null;
|
||||
Object dp = null;
|
||||
try {
|
||||
dp = api.mirrorCitizensNPCMethod.invoke(api.dNPC, npc);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen dNPC#mirrorCitizensNPC", e);
|
||||
}
|
||||
return dp;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static void runTaskScript(String scriptName, Player player) {
|
||||
public static void runTaskScript(final String scriptName, final Player player) {
|
||||
if (api.scriptRegistry == null || api.bukkitScriptEntryData == null || api.scriptEntryData == null) return;
|
||||
try {
|
||||
Constructor<?> constructor = api.bukkitScriptEntryData.getConstructors()[0];
|
||||
Object tsc = getScriptContainerAs(scriptName);
|
||||
Method runTaskScript = tsc.getClass().getMethod("runTaskScript", api.scriptEntryData, Map.class);
|
||||
final Constructor<?> constructor = api.bukkitScriptEntryData.getConstructors()[0];
|
||||
final Object tsc = getScriptContainerAs(scriptName);
|
||||
final Method runTaskScript = tsc.getClass().getMethod("runTaskScript", api.scriptEntryData, Map.class);
|
||||
runTaskScript.invoke(tsc, constructor.newInstance(mirrorBukkitPlayer(player), null), null);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen TaskScriptContainer#runTaskScript", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ public class DenizenAPI_1_1_0 {
|
|||
private static DenizenAPI api = quests.getDependencies().getDenizenApi();
|
||||
|
||||
@Nullable
|
||||
public static boolean containsScript(String input) {
|
||||
public static boolean containsScript(final String input) {
|
||||
return ScriptRegistry.containsScript(input);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getScriptContainerName(String input) {
|
||||
public static String getScriptContainerName(final String input) {
|
||||
return ScriptRegistry.getScriptContainer(input).getName();
|
||||
}
|
||||
|
||||
|
@ -53,35 +53,35 @@ public class DenizenAPI_1_1_0 {
|
|||
Set<String> names = null;
|
||||
try {
|
||||
names = (Set<String>)api.getScriptNamesMethod.invoke(api.scriptRegistry);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen ScriptRegistry#_getScriptNames", e);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object getScriptContainerAs(String scriptName) {
|
||||
public static Object getScriptContainerAs(final String scriptName) {
|
||||
return ScriptRegistry.getScriptContainerAs(scriptName, TaskScriptContainer.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object mirrorBukkitPlayer(Player player) {
|
||||
public static Object mirrorBukkitPlayer(final Player player) {
|
||||
return PlayerTag.mirrorBukkitPlayer(player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object mirrorCitizensNPC(NPC npc) {
|
||||
public static Object mirrorCitizensNPC(final NPC npc) {
|
||||
return NPCTag.mirrorCitizensNPC(npc);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static void runTaskScript(String scriptName, Player player) {
|
||||
public static void runTaskScript(final String scriptName, final Player player) {
|
||||
try {
|
||||
Constructor<?> constructor = api.bukkitScriptEntryData.getConstructors()[0];
|
||||
Object tsc = getScriptContainerAs(scriptName);
|
||||
Method runTaskScript = tsc.getClass().getMethod("runTaskScript", api.scriptEntryData, Map.class);
|
||||
final Constructor<?> constructor = api.bukkitScriptEntryData.getConstructors()[0];
|
||||
final Object tsc = getScriptContainerAs(scriptName);
|
||||
final Method runTaskScript = tsc.getClass().getMethod("runTaskScript", api.scriptEntryData, Map.class);
|
||||
runTaskScript.invoke(tsc, constructor.newInstance(mirrorBukkitPlayer(player), null), null);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
quests.getLogger().log(Level.WARNING, "Error invoking Denizen TaskScriptContainer#runTaskScript", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ import net.citizensnpcs.api.npc.NPC;
|
|||
public class DenizenAPI_1_1_1 {
|
||||
|
||||
@Nullable
|
||||
public static boolean containsScript(String input) {
|
||||
public static boolean containsScript(final String input) {
|
||||
return ScriptRegistry.containsScript(input);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getScriptContainerName(String input) {
|
||||
public static String getScriptContainerName(final String input) {
|
||||
return ScriptRegistry.getScriptContainer(input).getName();
|
||||
}
|
||||
|
||||
|
@ -46,25 +46,25 @@ public class DenizenAPI_1_1_1 {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public static Object getScriptContainerAs(String scriptName) {
|
||||
public static Object getScriptContainerAs(final String scriptName) {
|
||||
return ScriptRegistry.getScriptContainerAs(scriptName, TaskScriptContainer.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object mirrorBukkitPlayer(Player player) {
|
||||
public static Object mirrorBukkitPlayer(final Player player) {
|
||||
return PlayerTag.mirrorBukkitPlayer(player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Object mirrorCitizensNPC(NPC npc) {
|
||||
public static Object mirrorCitizensNPC(final NPC npc) {
|
||||
return NPCTag.mirrorCitizensNPC(npc);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static void runTaskScript(String scriptName, Player player) {
|
||||
TaskScriptContainer taskScript = ScriptRegistry.getScriptContainerAs(scriptName, TaskScriptContainer.class);
|
||||
BukkitScriptEntryData entryData = new BukkitScriptEntryData(PlayerTag.mirrorBukkitPlayer(player), null);
|
||||
ScriptQueue queue = new InstantQueue(taskScript.getName())
|
||||
public static void runTaskScript(final String scriptName, final Player player) {
|
||||
final TaskScriptContainer taskScript = ScriptRegistry.getScriptContainerAs(scriptName, TaskScriptContainer.class);
|
||||
final BukkitScriptEntryData entryData = new BukkitScriptEntryData(PlayerTag.mirrorBukkitPlayer(player), null);
|
||||
final ScriptQueue queue = new InstantQueue(taskScript.getName())
|
||||
.addEntries(taskScript.getBaseEntries(entryData.clone()));
|
||||
queue.start();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class WorldGuardAPI {
|
|||
private Constructor<?> vectorConstructor = null;
|
||||
private boolean initialized = false;
|
||||
|
||||
public WorldGuardAPI(Plugin wg) {
|
||||
public WorldGuardAPI(final Plugin wg) {
|
||||
if (wg instanceof WorldGuardPlugin) {
|
||||
worldGuardPlugin = (WorldGuardPlugin)wg;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class WorldGuardAPI {
|
|||
Class.forName("com.sk89q.worldguard.WorldGuard");
|
||||
worldGuard7 = WorldGuardAPI_7_0_0.getInstance();
|
||||
// WorldGuard 7+
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
// WorldGuard <7
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class WorldGuardAPI {
|
|||
return worldGuardPlugin != null;
|
||||
}
|
||||
|
||||
protected RegionAssociable getAssociable(Player player) {
|
||||
protected RegionAssociable getAssociable(final Player player) {
|
||||
RegionAssociable associable;
|
||||
if (player == null) {
|
||||
associable = Associables.constant(Association.NON_MEMBER);
|
||||
|
@ -76,12 +76,12 @@ public class WorldGuardAPI {
|
|||
if (worldGuard7 == null) {
|
||||
// WorldGuard <7
|
||||
try {
|
||||
Method getRegionContainerMethod = worldGuardPlugin.getClass().getMethod("getRegionContainer");
|
||||
final Method getRegionContainerMethod = worldGuardPlugin.getClass().getMethod("getRegionContainer");
|
||||
regionContainer = getRegionContainerMethod.invoke(worldGuardPlugin);
|
||||
regionContainerGetMethod = regionContainer.getClass().getMethod("get", World.class);
|
||||
vector = Class.forName("com.sk89q.worldedit.Vector");
|
||||
vectorConstructor = vector.getConstructor(double.class, double.class, double.class);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING,
|
||||
"Quests failed to bind to WorldGuard, integration will not work!", e);
|
||||
regionContainer = null;
|
||||
|
@ -97,7 +97,7 @@ public class WorldGuardAPI {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public RegionManager getRegionManager(World world) {
|
||||
public RegionManager getRegionManager(final World world) {
|
||||
if (worldGuard7 != null) {
|
||||
return WorldGuardAPI_7_0_0.getRegionManager(world);
|
||||
} else {
|
||||
|
@ -106,7 +106,7 @@ public class WorldGuardAPI {
|
|||
RegionManager regionManager = null;
|
||||
try {
|
||||
regionManager = (RegionManager)regionContainerGetMethod.invoke(regionContainer, world);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING,
|
||||
"Quests encountered an error getting WorldGuard RegionManager", e);
|
||||
}
|
||||
|
@ -114,19 +114,19 @@ public class WorldGuardAPI {
|
|||
}
|
||||
}
|
||||
|
||||
public ApplicableRegionSet getApplicableRegions(World world, Location location) {
|
||||
public ApplicableRegionSet getApplicableRegions(final World world, final Location location) {
|
||||
if (worldGuard7 != null) {
|
||||
return WorldGuardAPI_7_0_0.getApplicableRegions(world, location);
|
||||
} else {
|
||||
initialize();
|
||||
RegionManager regionManager = getRegionManager(world);
|
||||
final RegionManager regionManager = getRegionManager(world);
|
||||
ApplicableRegionSet ars = null;
|
||||
if (regionManager == null) return null;
|
||||
try {
|
||||
Method getApplicableRegionsMethod = regionManager.getClass()
|
||||
final Method getApplicableRegionsMethod = regionManager.getClass()
|
||||
.getMethod("getApplicableRegions", Location.class);
|
||||
ars = (ApplicableRegionSet)getApplicableRegionsMethod.invoke(regionManager, location);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING,
|
||||
"Quests encountered an error getting RegionManager#getApplicableRegions", e);
|
||||
}
|
||||
|
@ -135,20 +135,20 @@ public class WorldGuardAPI {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<String> getApplicableRegionsIDs(World world, Location location) {
|
||||
public List<String> getApplicableRegionsIDs(final World world, final Location location) {
|
||||
if (worldGuard7 != null) {
|
||||
return WorldGuardAPI_7_0_0.getApplicableRegionsIDs(world, location);
|
||||
} else {
|
||||
initialize();
|
||||
RegionManager regionManager = getRegionManager(world);
|
||||
final RegionManager regionManager = getRegionManager(world);
|
||||
List<String> ari = null;
|
||||
if (regionManager == null) return null;
|
||||
try {
|
||||
Method getApplicableRegionsMethod = regionManager.getClass()
|
||||
final Method getApplicableRegionsMethod = regionManager.getClass()
|
||||
.getMethod("getApplicableRegionsIDs", vector);
|
||||
ari = (List<String>)getApplicableRegionsMethod.invoke(regionManager,
|
||||
vectorConstructor.newInstance(location.getX(), location.getY(), location.getZ()));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING,
|
||||
"Quests encountered an error getting RegionManager#getApplicableRegionsIDs", e);
|
||||
}
|
||||
|
|
|
@ -32,17 +32,17 @@ public class WorldGuardAPI_7_0_0 {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public static RegionManager getRegionManager(World world) {
|
||||
public static RegionManager getRegionManager(final World world) {
|
||||
return WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(world));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ApplicableRegionSet getApplicableRegions(World world, Location location) {
|
||||
public static ApplicableRegionSet getApplicableRegions(final World world, final Location location) {
|
||||
return getRegionManager(world).getApplicableRegions(BukkitAdapter.asBlockVector(location));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static List<String> getApplicableRegionsIDs(World world, Location location) {
|
||||
public static List<String> getApplicableRegionsIDs(final World world, final Location location) {
|
||||
return getRegionManager(world).getApplicableRegionsIDs(BukkitAdapter.asBlockVector(location));
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue