mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-15 15:16:41 +01:00
Refactoring for getter/setter methods, part 6
This commit is contained in:
parent
8bb1a402ce
commit
700ecd0f42
182
src/main/java/me/blackvein/quests/Dependencies.java
Normal file
182
src/main/java/me/blackvein/quests/Dependencies.java
Normal file
@ -0,0 +1,182 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import net.aufdemrand.denizen.BukkitScriptEntryData;
|
||||
import net.aufdemrand.denizen.Denizen;
|
||||
import net.aufdemrand.denizen.objects.dPlayer;
|
||||
import net.aufdemrand.denizencore.scripts.ScriptRegistry;
|
||||
import net.aufdemrand.denizencore.scripts.containers.core.TaskScriptContainer;
|
||||
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;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.live.bemmamin.gps.Vars;
|
||||
import com.live.bemmamin.gps.api.GPSAPI;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
public class Dependencies {
|
||||
|
||||
private Quests plugin;
|
||||
private static Economy economy = null;
|
||||
private static Permission permission = null;
|
||||
private static WorldGuardPlugin worldGuard = null;
|
||||
private static mcMMO mcmmo = null;
|
||||
private static GPSAPI gpsapi = null;
|
||||
private static Heroes heroes = null;
|
||||
private static PhatLoots phatLoots = null;
|
||||
private static PlaceholderAPIPlugin placeholder = null;
|
||||
private static CitizensPlugin citizens;
|
||||
private static Denizen denizen = null;
|
||||
private static CitizensBooksAPI citizensBooks = null;
|
||||
private static PartiesAPI parties = null;
|
||||
|
||||
public Dependencies(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public Economy getVaultEconomy() {
|
||||
return economy;
|
||||
}
|
||||
|
||||
public Permission getVaultPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public WorldGuardPlugin getWorldGuard() {
|
||||
return worldGuard;
|
||||
}
|
||||
|
||||
public mcMMO getMcmmo() {
|
||||
return mcmmo;
|
||||
}
|
||||
|
||||
public GPSAPI getGpsApi() {
|
||||
return gpsapi;
|
||||
}
|
||||
|
||||
public Heroes getHeroes() {
|
||||
return heroes;
|
||||
}
|
||||
|
||||
public PhatLoots getPhatLoots() {
|
||||
return phatLoots;
|
||||
}
|
||||
|
||||
public PlaceholderAPIPlugin getPlaceholderApi() {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
public CitizensPlugin getCitizens() {
|
||||
return citizens;
|
||||
}
|
||||
|
||||
public Denizen getDenizen() {
|
||||
return denizen;
|
||||
}
|
||||
|
||||
public CitizensBooksAPI getCitizensBooksApi() {
|
||||
return citizensBooks;
|
||||
}
|
||||
|
||||
public PartiesAPI getPartiesApi() {
|
||||
return parties;
|
||||
}
|
||||
|
||||
public boolean isPluginAvailable(String pluginName) {
|
||||
if (plugin.getServer().getPluginManager().getPlugin(pluginName) != null ) {
|
||||
if (!plugin.getServer().getPluginManager().getPlugin(pluginName).isEnabled()) {
|
||||
plugin.getLogger().warning(pluginName + " was detected, but is not enabled! Fix "+ pluginName + " to allow linkage.");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void init() {
|
||||
try {
|
||||
if (isPluginAvailable("Citizens")) {
|
||||
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled.");
|
||||
}
|
||||
if (isPluginAvailable("WorldGuard")) {
|
||||
worldGuard = (WorldGuardPlugin) plugin.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
}
|
||||
if (isPluginAvailable("Denizen")) {
|
||||
denizen = (Denizen) plugin.getServer().getPluginManager().getPlugin("Denizen");
|
||||
}
|
||||
if (isPluginAvailable("mcMMO")) {
|
||||
mcmmo = (mcMMO) plugin.getServer().getPluginManager().getPlugin("mcMMO");
|
||||
}
|
||||
if (plugin.getSettings().canUseGPS() && isPluginAvailable("GPS")) {
|
||||
gpsapi = new GPSAPI(plugin);
|
||||
}
|
||||
if (isPluginAvailable("Heroes")) {
|
||||
heroes = (Heroes) plugin.getServer().getPluginManager().getPlugin("Heroes");
|
||||
}
|
||||
if (isPluginAvailable("PhatLoots")) {
|
||||
phatLoots = (PhatLoots) plugin.getServer().getPluginManager().getPlugin("PhatLoots");
|
||||
}
|
||||
if (isPluginAvailable("PlaceholderAPI")) {
|
||||
placeholder = (PlaceholderAPIPlugin) plugin.getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
||||
}
|
||||
if (isPluginAvailable("CitizensBooks")) {
|
||||
citizensBooks = ((CitizensBooksPlugin) plugin.getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
|
||||
}
|
||||
if (isPluginAvailable("Parties")) {
|
||||
parties = Parties.getApi();
|
||||
Vars.getInstance().setMaxDistanceToEntry(9999.0);
|
||||
}
|
||||
if (isPluginAvailable("Vault")) {
|
||||
if (!setupEconomy()) {
|
||||
plugin.getLogger().warning("Economy not found.");
|
||||
}
|
||||
if (!setupPermissions()) {
|
||||
plugin.getLogger().warning("Permissions not found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean setupEconomy() {
|
||||
try {
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean setupPermissions() {
|
||||
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||
if (permissionProvider != null) {
|
||||
permission = permissionProvider.getProvider();
|
||||
}
|
||||
return (permission != null);
|
||||
}
|
||||
|
||||
public boolean runDenizenScript(String scriptName, Quester quester) {
|
||||
if (scriptName != null) {
|
||||
return false;
|
||||
}
|
||||
if (ScriptRegistry.containsScript(scriptName)) {
|
||||
TaskScriptContainer task_script = ScriptRegistry.getScriptContainerAs(scriptName, TaskScriptContainer.class);
|
||||
BukkitScriptEntryData entryData = new BukkitScriptEntryData(dPlayer.mirrorBukkitPlayer(quester.getPlayer()), null);
|
||||
task_script.runTaskScript(entryData, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -265,7 +265,7 @@ public class Event {
|
||||
public void fire(Quester quester, Quest quest) {
|
||||
Player player = quester.getPlayer();
|
||||
if (message != null) {
|
||||
player.sendMessage(Quests.parseString(message, quest, player));
|
||||
player.sendMessage(plugin.parseString(message, quest, player));
|
||||
}
|
||||
if (clearInv == true) {
|
||||
player.getInventory().clear();
|
||||
@ -334,9 +334,9 @@ public class Event {
|
||||
}
|
||||
if (book != null) {
|
||||
if (!book.isEmpty()) {
|
||||
if (Quests.citizensBooks != null) {
|
||||
if (Quests.citizensBooks.hasFilter(book)) {
|
||||
Quests.citizensBooks.openBook(player, Quests.citizensBooks.getFilter(book));
|
||||
if (plugin.getDependencies().getCitizensBooksApi() != null) {
|
||||
if (plugin.getDependencies().getCitizensBooksApi().hasFilter(book)) {
|
||||
plugin.getDependencies().getCitizensBooksApi().openBook(player, plugin.getDependencies().getCitizensBooksApi().getFilter(book));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,21 +56,69 @@ import me.blackvein.quests.util.RomanNumeral;
|
||||
public class EventFactory implements ConversationAbandonedListener {
|
||||
|
||||
private Quests plugin;
|
||||
public Map<UUID, Block> selectedExplosionLocations = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedEffectLocations = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedMobLocations = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedLightningLocations = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
||||
List<String> names = new LinkedList<String>();
|
||||
private Map<UUID, Block> selectedExplosionLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedEffectLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedMobLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedLightningLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
||||
private List<String> names = new LinkedList<String>();
|
||||
private ConversationFactory convoCreator;
|
||||
File eventsFile;
|
||||
private File eventsFile;
|
||||
|
||||
public EventFactory(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
// Ensure to initialize convoCreator last, to ensure that 'this' is fully initialized before it is passed
|
||||
eventsFile = new File(plugin.getDataFolder(), "events.yml");
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new MenuPrompt()).withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!").addConversationAbandonedListener(this);
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedExplosionLocations() {
|
||||
return selectedExplosionLocations;
|
||||
}
|
||||
|
||||
public void setSelectedExplosionLocations(
|
||||
Map<UUID, Block> selectedExplosionLocations) {
|
||||
this.selectedExplosionLocations = selectedExplosionLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedEffectLocations() {
|
||||
return selectedEffectLocations;
|
||||
}
|
||||
|
||||
public void setSelectedEffectLocations(Map<UUID, Block> selectedEffectLocations) {
|
||||
this.selectedEffectLocations = selectedEffectLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedMobLocations() {
|
||||
return selectedMobLocations;
|
||||
}
|
||||
|
||||
public void setSelectedMobLocations(Map<UUID, Block> selectedMobLocations) {
|
||||
this.selectedMobLocations = selectedMobLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedLightningLocations() {
|
||||
return selectedLightningLocations;
|
||||
}
|
||||
|
||||
public void setSelectedLightningLocations(
|
||||
Map<UUID, Block> selectedLightningLocations) {
|
||||
this.selectedLightningLocations = selectedLightningLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedTeleportLocations() {
|
||||
return selectedTeleportLocations;
|
||||
}
|
||||
|
||||
public void setSelectedTeleportLocations(
|
||||
Map<UUID, Block> selectedTeleportLocations) {
|
||||
this.selectedTeleportLocations = selectedTeleportLocations;
|
||||
}
|
||||
|
||||
public ConversationFactory getConversationFactory() {
|
||||
return convoCreator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||
Player player = (Player) abandonedEvent.getContext().getForWhom();
|
||||
@ -81,10 +129,6 @@ public class EventFactory implements ConversationAbandonedListener {
|
||||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public ConversationFactory getConversationFactory() {
|
||||
return convoCreator;
|
||||
}
|
||||
|
||||
private class QuestCreatorPrefix implements ConversationPrefix {
|
||||
|
||||
@Override
|
||||
|
@ -47,13 +47,13 @@ public class NpcEffectThread implements Runnable {
|
||||
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||
if (nearby.isEmpty() == false) {
|
||||
for (Entity e : nearby) {
|
||||
if (Quests.citizens != null) {
|
||||
if (Quests.citizens.getNPCRegistry().isNPC(e)) {
|
||||
NPC npc = Quests.citizens.getNPCRegistry().getNPC(e);
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(e)) {
|
||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(e);
|
||||
if (plugin.hasQuest(npc, quester)) {
|
||||
showEffect(player, npc, plugin.effect);
|
||||
showEffect(player, npc, plugin.getSettings().getEffect());
|
||||
} else if (plugin.hasCompletedRedoableQuest(npc, quester)) {
|
||||
showEffect(player, npc, plugin.redoEffect);
|
||||
showEffect(player, npc, plugin.getSettings().getRedoEffect());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,39 +70,39 @@ public class NpcEffectThread implements Runnable {
|
||||
*/
|
||||
public void showEffect(Player player, NPC npc, String effectType) {
|
||||
try {
|
||||
if (Quests.bukkitVersion.contains("1.13.2")
|
||||
|| Quests.bukkitVersion.contains("1.13.1")) {
|
||||
if (plugin.getDetectedBukkitVersion().contains("1.13.2")
|
||||
|| plugin.getDetectedBukkitVersion().contains("1.13.1")) {
|
||||
showEffect_1_13_R2(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.13")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.13")) {
|
||||
showEffect_1_13_R1(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.12")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.12")) {
|
||||
showEffect_1_12_R1(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.11")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.11")) {
|
||||
showEffect_1_11_R1(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.10")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.10")) {
|
||||
showEffect_1_10_R1(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.9.4")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.9.4")) {
|
||||
showEffect_1_9_R2(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.9")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.9")) {
|
||||
showEffect_1_9_R1(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.8.9")
|
||||
|| Quests.bukkitVersion.contains("1.8.8")
|
||||
|| Quests.bukkitVersion.contains("1.8.7")
|
||||
|| Quests.bukkitVersion.contains("1.8.6")
|
||||
|| Quests.bukkitVersion.contains("1.8.5")
|
||||
|| Quests.bukkitVersion.contains("1.8.4")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.8.9")
|
||||
|| plugin.getDetectedBukkitVersion().contains("1.8.8")
|
||||
|| plugin.getDetectedBukkitVersion().contains("1.8.7")
|
||||
|| plugin.getDetectedBukkitVersion().contains("1.8.6")
|
||||
|| plugin.getDetectedBukkitVersion().contains("1.8.5")
|
||||
|| plugin.getDetectedBukkitVersion().contains("1.8.4")) {
|
||||
showEffect_1_8_R3(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.8.3")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.8.3")) {
|
||||
showEffect_1_8_R2(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.8")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.8")) {
|
||||
showEffect_1_8_R1(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.7.10")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.7.10")) {
|
||||
showEffect_R4(player, npc, effectType);
|
||||
} else if (Quests.bukkitVersion.contains("1.7.9")) {
|
||||
} else if (plugin.getDetectedBukkitVersion().contains("1.7.9")) {
|
||||
showEffect_R3(player, npc, effectType);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().severe("Bukkit version detected as " + Quests.bukkitVersion);
|
||||
plugin.getLogger().severe("Bukkit version detected as " + plugin.getDetectedBukkitVersion());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ public class Quest {
|
||||
protected String finished;
|
||||
protected String region = null;
|
||||
protected ItemStack guiDisplay = null;
|
||||
//private int parties = 0;
|
||||
private LinkedList<Stage> orderedStages = new LinkedList<Stage>();
|
||||
protected NPC npcStart;
|
||||
protected Location blockStart;
|
||||
@ -156,27 +155,26 @@ public class Quest {
|
||||
public void nextStage(Quester q) {
|
||||
String stageCompleteMessage = q.getCurrentStage(this).completeMessage;
|
||||
if (stageCompleteMessage != null) {
|
||||
String s = Quests.parseString(stageCompleteMessage, this, q.getPlayer());
|
||||
if(Quests.placeholder != null) {
|
||||
String s = plugin.parseString(stageCompleteMessage, this, q.getPlayer());
|
||||
if(plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
s = PlaceholderAPI.setPlaceholders(q.getPlayer(), s);
|
||||
}
|
||||
q.getPlayer().sendMessage(s);
|
||||
}
|
||||
if (plugin.useCompass) {
|
||||
if (plugin.getSettings().canUseCompass()) {
|
||||
q.resetCompass();
|
||||
q.findCompassTarget();
|
||||
}
|
||||
if (q.getCurrentStage(this).delay < 0) {
|
||||
Player player = q.getPlayer();
|
||||
if (q.currentQuests.get(this) == (orderedStages.size() - 1)) {
|
||||
if (q.getCurrentStage(this).script != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(q.getCurrentStage(this).script, player);
|
||||
plugin.getDependencies().runDenizenScript(q.getCurrentStage(this).script, q);
|
||||
}
|
||||
if (q.getCurrentStage(this).finishEvent != null) {
|
||||
q.getCurrentStage(this).finishEvent.fire(q, this);
|
||||
}
|
||||
if (Quests.parties != null) {
|
||||
Party party = Quests.parties.getParty(Quests.parties.getPartyPlayer(q.getUUID()).getPartyName());
|
||||
if (plugin.getDependencies().getPartiesApi() != null) {
|
||||
Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies().getPartiesApi().getPartyPlayer(q.getUUID()).getPartyName());
|
||||
if (party != null) {
|
||||
for (UUID id : party.getMembers()) {
|
||||
if (!id.equals(q.getUUID())) {
|
||||
@ -224,7 +222,7 @@ public class Quest {
|
||||
quester.hardStagePut(this, stage);
|
||||
quester.addEmptiesFor(this, stage);
|
||||
if (currentStage.script != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(currentStage.script, quester.getPlayer());
|
||||
plugin.getDependencies().runDenizenScript(quester.getCurrentStage(this).script, quester);
|
||||
}
|
||||
/*
|
||||
* if (quester.getCurrentStage(this).finishEvent != null) { quester.getCurrentStage(this).finishEvent.fire(quester); }
|
||||
@ -241,7 +239,7 @@ public class Quest {
|
||||
plugin.showObjectives(this, quester, false);
|
||||
String stageStartMessage = quester.getCurrentStage(this).startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
quester.getPlayer().sendMessage(Quests.parseString(stageStartMessage, this, quester.getPlayer()));
|
||||
quester.getPlayer().sendMessage(plugin.parseString(stageStartMessage, this, quester.getPlayer()));
|
||||
}
|
||||
quester.updateJournal();
|
||||
}
|
||||
@ -255,7 +253,7 @@ public class Quest {
|
||||
* @return true if successful
|
||||
*/
|
||||
protected boolean updateGPS(Quester quester) {
|
||||
if (Quests.gpsapi == null) {
|
||||
if (plugin.getDependencies().getGpsApi() == null) {
|
||||
return false;
|
||||
}
|
||||
Stage stage = quester.getCurrentStage(this);
|
||||
@ -275,7 +273,7 @@ public class Quest {
|
||||
targetLocations.addAll(stage.locationsToReach);
|
||||
} else if (stage.itemDeliveryTargets != null && stage.itemDeliveryTargets.size() > 0) {
|
||||
for (Integer i : stage.itemDeliveryTargets) {
|
||||
NPC npc = Quests.citizens.getNPCRegistry().getById(i);
|
||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(i);
|
||||
targetLocations.add(npc.getStoredLocation());
|
||||
}
|
||||
}
|
||||
@ -284,19 +282,19 @@ public class Quest {
|
||||
String pointName = "quests-" + quester.getPlayer().getUniqueId().toString();
|
||||
for (Location l : targetLocations) {
|
||||
if (l.getWorld().getName().equals(quester.getPlayer().getWorld().getName())) {
|
||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||
Quests.gpsapi.addPoint(pointName + index, l);
|
||||
if (!plugin.getDependencies().getGpsApi().gpsIsActive(quester.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().addPoint(pointName + index, l);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 1 ; i < targetLocations.size(); i++) {
|
||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||
Quests.gpsapi.connect(pointName + i, pointName + (i + 1), true);
|
||||
if (!plugin.getDependencies().getGpsApi().gpsIsActive(quester.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().connect(pointName + i, pointName + (i + 1), true);
|
||||
}
|
||||
}
|
||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||
Quests.gpsapi.startGPS(quester.getPlayer(), pointName + (index - 1));
|
||||
if (!plugin.getDependencies().getGpsApi().gpsIsActive(quester.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().startGPS(quester.getPlayer(), pointName + (index - 1));
|
||||
}
|
||||
}
|
||||
return targetLocations != null && !targetLocations.isEmpty();
|
||||
@ -312,7 +310,7 @@ public class Quest {
|
||||
* @return true if successful
|
||||
*/
|
||||
public boolean updateCompass(Quester quester, Stage nextStage) {
|
||||
if (!plugin.useCompass) {
|
||||
if (!plugin.getSettings().canUseCompass()) {
|
||||
return false;
|
||||
}
|
||||
if (nextStage == null) {
|
||||
@ -326,7 +324,7 @@ public class Quest {
|
||||
} else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) {
|
||||
targetLocation = nextStage.locationsToReach.getFirst();
|
||||
} else if (nextStage.itemDeliveryTargets != null && nextStage.itemDeliveryTargets.size() > 0) {
|
||||
NPC npc = Quests.citizens.getNPCRegistry().getById(nextStage.itemDeliveryTargets.getFirst());
|
||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(nextStage.itemDeliveryTargets.getFirst());
|
||||
targetLocation = npc.getStoredLocation();
|
||||
}
|
||||
if (targetLocation != null) {
|
||||
@ -355,8 +353,8 @@ public class Quest {
|
||||
*/
|
||||
protected boolean testRequirements(Player player) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (reqs.getMoney() != 0 && Quests.economy != null) {
|
||||
if (Quests.economy.getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) < reqs.getMoney()) {
|
||||
if (reqs.getMoney() != 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
||||
if (plugin.getDependencies().getVaultEconomy().getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) < reqs.getMoney()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -399,7 +397,7 @@ public class Quest {
|
||||
}
|
||||
for (String s : reqs.getCustomRequirements().keySet()) {
|
||||
CustomRequirement found = null;
|
||||
for (CustomRequirement cr : plugin.customRequirements) {
|
||||
for (CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||
if (cr.getName().equalsIgnoreCase(s)) {
|
||||
found = cr;
|
||||
break;
|
||||
@ -443,7 +441,7 @@ public class Quest {
|
||||
q.completedQuests.add(name);
|
||||
}
|
||||
String none = ChatColor.GRAY + "- (" + Lang.get(player, "none") + ")";
|
||||
final String ps = Quests.parseString(finished, this, player);
|
||||
final String ps = plugin.parseString(finished, this, player);
|
||||
for (Map.Entry<Integer, Quest> entry : q.timers.entrySet()) {
|
||||
if (entry.getValue().getName().equals(getName())) {
|
||||
plugin.getServer().getScheduler().cancelTask(entry.getKey());
|
||||
@ -459,8 +457,8 @@ public class Quest {
|
||||
}
|
||||
}
|
||||
}, 40);
|
||||
if (rews.getMoney() > 0 && Quests.economy != null) {
|
||||
Quests.economy.depositPlayer(q.getOfflinePlayer(), rews.getMoney());
|
||||
if (rews.getMoney() > 0 && plugin.getDependencies().getVaultEconomy() != null) {
|
||||
plugin.getDependencies().getVaultEconomy().depositPlayer(q.getOfflinePlayer(), rews.getMoney());
|
||||
none = null;
|
||||
}
|
||||
if (pln.getCooldown() > -1) {
|
||||
@ -498,8 +496,8 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
for (String s : rews.getPermissions()) {
|
||||
if (Quests.permission != null) {
|
||||
Quests.permission.playerAdd(player, s);
|
||||
if (plugin.getDependencies().getVaultPermission() != null) {
|
||||
plugin.getDependencies().getVaultPermission().playerAdd(player, s);
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
@ -509,7 +507,7 @@ public class Quest {
|
||||
}
|
||||
for (String s : rews.getHeroesClasses()) {
|
||||
Hero hero = plugin.getHero(player.getUniqueId());
|
||||
hero.addExp(rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)), Quests.heroes.getClassManager().getClass(s), player.getLocation());
|
||||
hero.addExp(rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)), plugin.getDependencies().getHeroes().getClassManager().getClass(s), player.getLocation());
|
||||
none = null;
|
||||
}
|
||||
LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
|
||||
@ -522,8 +520,8 @@ public class Quest {
|
||||
player.giveExp(lb.getExp());
|
||||
}
|
||||
if (lb.getMoney() > 0) {
|
||||
if (Quests.economy != null) {
|
||||
Quests.economy.depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
plugin.getDependencies().getVaultEconomy().depositPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()), lb.getMoney());
|
||||
}
|
||||
}
|
||||
if (lb.getItemList().isEmpty() == false) {
|
||||
@ -556,7 +554,7 @@ public class Quest {
|
||||
complete = complete.replace("<quest>", ChatColor.YELLOW + name + ChatColor.GOLD);
|
||||
player.sendMessage(ChatColor.GOLD + complete);
|
||||
player.sendMessage(ChatColor.GREEN + Lang.get(player, "questRewardsTitle"));
|
||||
if (plugin.showQuestTitles) {
|
||||
if (plugin.getSettings().canShowQuestTitles()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||
+ " title " + "{\"text\":\"" + Lang.get(player, "quest") + " " + Lang.get(player, "complete") + "\",\"color\":\"gold\"}");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||
@ -640,10 +638,10 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
if (rews.getMoney() > 1) {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true));
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE + plugin.getCurrency(true));
|
||||
none = null;
|
||||
} else if (rews.getMoney() == 1) {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false));
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE + plugin.getCurrency(false));
|
||||
none = null;
|
||||
}
|
||||
if (rews.getExp() > 0 || phatLootExp > 0) {
|
||||
@ -671,7 +669,7 @@ public class Quest {
|
||||
}
|
||||
for (String s : rews.getCustomRewards().keySet()) {
|
||||
CustomReward found = null;
|
||||
for (CustomReward cr : plugin.customRewards) {
|
||||
for (CustomReward cr : plugin.getCustomRewards()) {
|
||||
if (cr.getName().equalsIgnoreCase(s)) {
|
||||
found = cr;
|
||||
break;
|
||||
@ -700,9 +698,9 @@ public class Quest {
|
||||
q.saveData();
|
||||
player.updateInventory();
|
||||
q.updateJournal();
|
||||
if (Quests.gpsapi != null) {
|
||||
if (Quests.gpsapi.gpsIsActive(player)) {
|
||||
Quests.gpsapi.stopGPS(player);
|
||||
if (plugin.getDependencies().getGpsApi() != null) {
|
||||
if (plugin.getDependencies().getGpsApi().gpsIsActive(player)) {
|
||||
plugin.getDependencies().getGpsApi().stopGPS(player);
|
||||
}
|
||||
}
|
||||
q.findCompassTarget();
|
||||
@ -751,7 +749,7 @@ public class Quest {
|
||||
if (region == null) {
|
||||
return true;
|
||||
} else {
|
||||
ApplicableRegionSet ars = Quests.worldGuard.getRegionManager(player.getWorld()).getApplicableRegions(player.getLocation());
|
||||
ApplicableRegionSet ars = plugin.getDependencies().getWorldGuard().getRegionManager(player.getWorld()).getApplicableRegions(player.getLocation());
|
||||
Iterator<ProtectedRegion> i = ars.iterator();
|
||||
while (i.hasNext()) {
|
||||
ProtectedRegion pr = i.next();
|
||||
|
@ -59,21 +59,65 @@ import net.citizensnpcs.api.CitizensAPI;
|
||||
public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
private final Quests plugin;
|
||||
public Map<UUID, Block> selectedBlockStarts = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedKillLocations = new HashMap<UUID, Block>();
|
||||
public Map<UUID, Block> selectedReachLocations = new HashMap<UUID, Block>();
|
||||
public HashSet<Player> selectingNPCs = new HashSet<Player>();
|
||||
public List<String> names = new LinkedList<String>();
|
||||
ConversationFactory convoCreator;
|
||||
File questsFile;
|
||||
private Map<UUID, Block> selectedBlockStarts = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedKillLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedReachLocations = new HashMap<UUID, Block>();
|
||||
private HashSet<Player> selectingNpcs = new HashSet<Player>();
|
||||
private List<String> names = new LinkedList<String>();
|
||||
private ConversationFactory convoCreator;
|
||||
private File questsFile;
|
||||
|
||||
public QuestFactory(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||
// Ensure to initialize convoCreator last, to ensure that 'this' is fully initialized before it is passed
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false).withFirstPrompt(new MenuPrompt()).withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!").addConversationAbandonedListener(this);
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedBlockStarts() {
|
||||
return selectedBlockStarts;
|
||||
}
|
||||
|
||||
public void setSelectedBlockStarts(Map<UUID, Block> selectedBlockStarts) {
|
||||
this.selectedBlockStarts = selectedBlockStarts;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedKillLocations() {
|
||||
return selectedKillLocations;
|
||||
}
|
||||
|
||||
public void setSelectedKillLocations(Map<UUID, Block> selectedKillLocations) {
|
||||
this.selectedKillLocations = selectedKillLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedReachLocations() {
|
||||
return selectedReachLocations;
|
||||
}
|
||||
|
||||
public void setSelectedReachLocations(Map<UUID, Block> selectedReachLocations) {
|
||||
this.selectedReachLocations = selectedReachLocations;
|
||||
}
|
||||
|
||||
public HashSet<Player> getSelectingNpcs() {
|
||||
return selectingNpcs;
|
||||
}
|
||||
|
||||
public void setSelectingNpcs(HashSet<Player> selectingNpcs) {
|
||||
this.selectingNpcs = selectingNpcs;
|
||||
}
|
||||
|
||||
public List<String> getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
public void setNames(List<String> names) {
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public ConversationFactory getConversationFactory() {
|
||||
return convoCreator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||
if (abandonedEvent.getContext().getSessionData(CK.Q_NAME) != null) {
|
||||
@ -85,10 +129,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
selectedReachLocations.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public ConversationFactory getConversationFactory() {
|
||||
return convoCreator;
|
||||
}
|
||||
|
||||
private class MenuPrompt extends FixedSetPrompt {
|
||||
|
||||
public MenuPrompt() {
|
||||
@ -157,9 +197,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (" + context.getSessionData(CK.Q_FINISH_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_START_NPC) == null && Quests.citizens != null) {
|
||||
if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens() != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else if (Quests.citizens != null) {
|
||||
} else if (plugin.getDependencies().getCitizens() != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||
@ -170,7 +210,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
Location l = (Location) context.getSessionData(CK.Q_START_BLOCK);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n";
|
||||
}
|
||||
if (Quests.worldGuard != null) {
|
||||
if (plugin.getDependencies().getWorldGuard() != null) {
|
||||
if (context.getSessionData(CK.Q_REGION) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -186,9 +226,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null && Quests.citizens != null) {
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null && plugin.getDependencies().getCitizens() != null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else if (Quests.citizens != null ){
|
||||
} else if (plugin.getDependencies().getCitizens() != null ){
|
||||
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + ItemUtil.getDisplayString(stack) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||
} else {
|
||||
@ -212,7 +252,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new FinishMessagePrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new SetNpcStartPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
@ -221,7 +261,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
return new BlockStartPrompt();
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
if (Quests.worldGuard != null) {
|
||||
if (plugin.getDependencies().getWorldGuard() != null) {
|
||||
return new RegionPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
@ -229,7 +269,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
return new InitialEventPrompt();
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new GUIDisplayPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
@ -330,7 +370,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
selectingNPCs.add((Player) context.getForWhom());
|
||||
selectingNpcs.add((Player) context.getForWhom());
|
||||
return ChatColor.YELLOW + Lang.get("questEditorEnterNPCStart") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||
}
|
||||
|
||||
@ -345,7 +385,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
return new SetNpcStartPrompt();
|
||||
}
|
||||
context.setSessionData(CK.Q_START_NPC, i);
|
||||
selectingNPCs.remove((Player) context.getForWhom());
|
||||
selectingNpcs.remove((Player) context.getForWhom());
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
@ -356,7 +396,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.Q_START_NPC, null);
|
||||
}
|
||||
selectingNPCs.remove((Player) context.getForWhom());
|
||||
selectingNpcs.remove((Player) context.getForWhom());
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
}
|
||||
@ -581,7 +621,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n";
|
||||
boolean any = false;
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(world);
|
||||
RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(world);
|
||||
for (String region : rm.getRegions().keySet()) {
|
||||
any = true;
|
||||
text += ChatColor.GREEN + region + ", ";
|
||||
@ -603,7 +643,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
String found = null;
|
||||
boolean done = false;
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(world);
|
||||
RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(world);
|
||||
for (String region : rm.getRegions().keySet()) {
|
||||
if (region.equalsIgnoreCase(input)) {
|
||||
found = region;
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.aufdemrand.denizen.BukkitScriptEntryData;
|
||||
import net.aufdemrand.denizen.objects.dPlayer;
|
||||
import net.aufdemrand.denizencore.scripts.ScriptRegistry;
|
||||
import net.aufdemrand.denizencore.scripts.containers.core.TaskScriptContainer;
|
||||
|
||||
public class QuestTaskTrigger {
|
||||
|
||||
public boolean parseQuestTaskTrigger(String theScriptName, Player player) {
|
||||
if (!ScriptRegistry.containsScript(theScriptName)) {
|
||||
return false;
|
||||
}
|
||||
TaskScriptContainer task_script = ScriptRegistry.getScriptContainerAs(theScriptName, TaskScriptContainer.class);
|
||||
BukkitScriptEntryData entryData = new BukkitScriptEntryData(dPlayer.mirrorBukkitPlayer(player), null);
|
||||
task_script.runTaskScript(entryData, null);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -465,8 +465,8 @@ public class Quester {
|
||||
Requirements reqs = q.getRequirements();
|
||||
if (!override) {
|
||||
if (reqs.getMoney() > 0) {
|
||||
if (Quests.economy != null) {
|
||||
Quests.economy.withdrawPlayer(getOfflinePlayer(), reqs.getMoney());
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
plugin.getDependencies().getVaultEconomy().withdrawPlayer(getOfflinePlayer(), reqs.getMoney());
|
||||
}
|
||||
}
|
||||
for (ItemStack is : reqs.getItems()) {
|
||||
@ -478,7 +478,7 @@ public class Quester {
|
||||
accepted = accepted.replace("<quest>", q.getName());
|
||||
player.sendMessage(ChatColor.GREEN + accepted);
|
||||
player.sendMessage("");
|
||||
if (plugin.showQuestTitles) {
|
||||
if (plugin.getSettings().canShowQuestTitles()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||
+ " title " + "{\"text\":\"" + Lang.get(getPlayer(), "quest") + " " + Lang.get(getPlayer(), "accepted") + "\",\"color\":\"gold\"}");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||
@ -491,7 +491,7 @@ public class Quester {
|
||||
plugin.showObjectives(q, this, false);
|
||||
String stageStartMessage = stage.startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
getPlayer().sendMessage(Quests.parseString(stageStartMessage, q, getPlayer()));
|
||||
getPlayer().sendMessage(plugin.parseString(stageStartMessage, q, getPlayer()));
|
||||
}
|
||||
if (stage.chatEvents.isEmpty() == false) {
|
||||
for (String chatTrigger : stage.chatEvents.keySet()) {
|
||||
@ -915,7 +915,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
broken = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
broken = is;
|
||||
}
|
||||
@ -932,7 +932,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toBreak = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
toBreak = is;
|
||||
}
|
||||
@ -966,7 +966,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
damaged = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
damaged = is;
|
||||
}
|
||||
@ -982,7 +982,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toDamage = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
toDamage = is;
|
||||
}
|
||||
@ -1016,7 +1016,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
placed = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
placed = is;
|
||||
}
|
||||
@ -1032,7 +1032,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toPlace = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
toPlace = is;
|
||||
}
|
||||
@ -1066,7 +1066,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
used = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
used = is;
|
||||
}
|
||||
@ -1082,7 +1082,7 @@ public class Quester {
|
||||
//Blocks are solid, so check durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toUse = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
toUse = is;
|
||||
}
|
||||
@ -1116,7 +1116,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
cut = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
cut = is;
|
||||
}
|
||||
@ -1132,7 +1132,7 @@ public class Quester {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toCut = is;
|
||||
} else if (!LocaleQuery.isBelow113(Quests.bukkitVersion)) {
|
||||
} else if (!LocaleQuery.isBelow113(plugin.getDetectedBukkitVersion())) {
|
||||
//Ignore durability for 1.13+
|
||||
toCut = is;
|
||||
}
|
||||
@ -1342,7 +1342,7 @@ public class Quester {
|
||||
getQuestData(quest).itemsDelivered.put(found, (amount + i.getAmount()));
|
||||
player.getInventory().setItem(player.getInventory().first(i), null);
|
||||
player.updateInventory();
|
||||
String message = Quests.parseString(getCurrentStage(quest).deliverMessages.get(new Random().nextInt(getCurrentStage(quest).deliverMessages.size())), Quests.citizens.getNPCRegistry().getById(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(found))));
|
||||
String message = Quests.parseString(getCurrentStage(quest).deliverMessages.get(new Random().nextInt(getCurrentStage(quest).deliverMessages.size())), plugin.getDependencies().getCitizens().getNPCRegistry().getById(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(found))));
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
@ -1419,7 +1419,7 @@ public class Quester {
|
||||
String stack = getQuestData(quest).blocksBroken.toString();
|
||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||
message = message + " " + amount + "/" + amount;
|
||||
plugin.query.sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1428,7 +1428,7 @@ public class Quester {
|
||||
String stack = getQuestData(quest).blocksDamaged.toString();
|
||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||
message = message + " " + amount + "/" + amount;
|
||||
plugin.query.sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1437,7 +1437,7 @@ public class Quester {
|
||||
String stack = getQuestData(quest).blocksPlaced.toString();
|
||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||
message = message + " " + amount + "/" + amount;
|
||||
plugin.query.sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1446,7 +1446,7 @@ public class Quester {
|
||||
String stack = getQuestData(quest).blocksUsed.toString();
|
||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||
message = message + " " + amount + "/" + amount;
|
||||
plugin.query.sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1455,7 +1455,7 @@ public class Quester {
|
||||
String stack = getQuestData(quest).blocksCut.toString();
|
||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||
message = message + " " + amount + "/" + amount;
|
||||
plugin.query.sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(p, message, itemStack.getType(), itemStack.getDurability());
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1475,7 +1475,7 @@ public class Quester {
|
||||
break;
|
||||
}
|
||||
}
|
||||
plugin.query.sendMessage(p, message, itemStack.getType(), itemStack.getDurability(), enchantment);
|
||||
plugin.getLocaleQuery().sendMessage(p, message, itemStack.getType(), itemStack.getDurability(), enchantment);
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1484,14 +1484,14 @@ public class Quester {
|
||||
obj = obj.replace("<npc>", plugin.getNPCName(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(delivery))));
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
|
||||
ItemStack is = getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver.indexOf(delivery));
|
||||
plugin.query.sendMessage(p, message, is.getType(), is.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(p, message, is.getType(), is.getDurability());
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
} else if (objective.equalsIgnoreCase("killMob")) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " <mob>";
|
||||
message = message + " " + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob)) + "/" + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob));
|
||||
plugin.query.sendMessage(p, message, mob);
|
||||
plugin.getLocaleQuery().sendMessage(p, message, mob);
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -1520,7 +1520,7 @@ public class Quester {
|
||||
} else if (objective.equalsIgnoreCase("tameMob")) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "tame") + " <mob>";
|
||||
message = message + " " + getCurrentStage(quest).mobsToTame.get(mob) + "/" + getCurrentStage(quest).mobsToTame.get(mob);
|
||||
plugin.query.sendMessage(p, message, mob);
|
||||
plugin.getLocaleQuery().sendMessage(p, message, mob);
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this);
|
||||
}
|
||||
@ -2608,7 +2608,7 @@ public class Quester {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this, quest), (long) (getCurrentStage(quest).delay * 0.02));
|
||||
if (getCurrentStage(quest).delayMessage != null) {
|
||||
Player p = plugin.getServer().getPlayer(id);
|
||||
p.sendMessage(Quests.parseString((getCurrentStage(quest).delayMessage), quest, p));
|
||||
p.sendMessage(plugin.parseString((getCurrentStage(quest).delayMessage), quest, p));
|
||||
}
|
||||
}
|
||||
getQuestData(quest).delayStartTime = System.currentTimeMillis();
|
||||
@ -2810,9 +2810,9 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Quests.gpsapi != null) {
|
||||
if (Quests.gpsapi.gpsIsActive(this.getPlayer())) {
|
||||
Quests.gpsapi.stopGPS(this.getPlayer());
|
||||
if (plugin.getDependencies().getGpsApi() != null) {
|
||||
if (plugin.getDependencies().getGpsApi().gpsIsActive(this.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().stopGPS(this.getPlayer());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -2855,7 +2855,7 @@ public class Quester {
|
||||
}
|
||||
|
||||
public void resetCompass() {
|
||||
if (!plugin.useCompass)
|
||||
if (!plugin.getSettings().canUseCompass())
|
||||
return;
|
||||
Player player = getPlayer();
|
||||
if (player == null)
|
||||
@ -2868,7 +2868,7 @@ public class Quester {
|
||||
}
|
||||
|
||||
public void findCompassTarget() {
|
||||
if (!plugin.useCompass)
|
||||
if (!plugin.getSettings().canUseCompass())
|
||||
return;
|
||||
Player player = getPlayer();
|
||||
if (player == null)
|
||||
|
@ -67,25 +67,16 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.alessiodp.parties.api.Parties;
|
||||
import com.alessiodp.parties.api.interfaces.PartiesAPI;
|
||||
import com.codisimus.plugins.phatloots.PhatLoots;
|
||||
import com.codisimus.plugins.phatloots.PhatLootsAPI;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||
import com.live.bemmamin.gps.Vars;
|
||||
import com.live.bemmamin.gps.api.GPSAPI;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
@ -99,78 +90,34 @@ import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.LocaleQuery;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import net.aufdemrand.denizen.Denizen;
|
||||
import net.aufdemrand.denizencore.scripts.ScriptRegistry;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.CitizensPlugin;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.milkbowl.vault.Vault;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import ro.nicuch.citizensbooks.CitizensBooksAPI;
|
||||
import ro.nicuch.citizensbooks.CitizensBooksPlugin;
|
||||
|
||||
public class Quests extends JavaPlugin implements ConversationAbandonedListener {
|
||||
|
||||
public static String bukkitVersion = "0";
|
||||
// Dependencies
|
||||
public static Economy economy = null;
|
||||
public static Permission permission = null;
|
||||
public static WorldGuardPlugin worldGuard = null;
|
||||
public static mcMMO mcmmo = null;
|
||||
public static GPSAPI gpsapi = null;
|
||||
public static Heroes heroes = null;
|
||||
public static PhatLoots phatLoots = null;
|
||||
public static PlaceholderAPIPlugin placeholder = null;
|
||||
public static Vault vault = null;
|
||||
public static CitizensPlugin citizens;
|
||||
public static Denizen denizen = null;
|
||||
public static CitizensBooksAPI citizensBooks = null;
|
||||
public static PartiesAPI parties = null;
|
||||
// Config settings
|
||||
public int acceptTimeout = 20;
|
||||
public boolean allowCommands = true;
|
||||
public boolean allowCommandsForNpcQuests = false;
|
||||
public boolean allowQuitting = true;
|
||||
public boolean askConfirmation = true;
|
||||
public boolean genFilesOnJoin = true;
|
||||
public boolean ignoreLockedQuests = false;
|
||||
public int killDelay = 0;
|
||||
public int maxQuests = 0;
|
||||
public boolean npcEffects = true;
|
||||
public String effect = "note";
|
||||
public String redoEffect = "angry_villager";
|
||||
public boolean showQuestReqs = true;
|
||||
public boolean showQuestTitles = true;
|
||||
public boolean translateItems = false;
|
||||
public boolean translateSubCommands = false;
|
||||
public boolean useCompass = true;
|
||||
public boolean useGPS = true;
|
||||
// Interfaces
|
||||
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
|
||||
public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
|
||||
public final List<CustomReward> customRewards = new LinkedList<CustomReward>();
|
||||
public final List<CustomObjective> customObjectives = new LinkedList<CustomObjective>();
|
||||
private String bukkitVersion = "0";
|
||||
private Dependencies depends;
|
||||
private Settings settings;
|
||||
private final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
|
||||
private final List<CustomReward> customRewards = new LinkedList<CustomReward>();
|
||||
private final List<CustomObjective> customObjectives = new LinkedList<CustomObjective>();
|
||||
private LinkedList<Quester> questers = new LinkedList<Quester>();
|
||||
private LinkedList<Quest> quests = new LinkedList<Quest>();
|
||||
private LinkedList<Event> events = new LinkedList<Event>();
|
||||
private LinkedList<NPC> questNpcs = new LinkedList<NPC>();
|
||||
private LinkedList<Integer> questNpcGuis = new LinkedList<Integer>();
|
||||
// Classes
|
||||
public CommandExecutor cmdExecutor;
|
||||
private CommandExecutor cmdExecutor;
|
||||
private ConversationFactory conversationFactory;
|
||||
private ConversationFactory npcConversationFactory;
|
||||
public QuestFactory questFactory;
|
||||
public EventFactory eventFactory;
|
||||
public PlayerListener playerListener;
|
||||
public NpcListener npcListener;
|
||||
public NpcEffectThread effThread;
|
||||
public PartiesListener partiesListener;
|
||||
public QuestTaskTrigger trigger;
|
||||
public Lang lang = new Lang(this);
|
||||
public LocaleQuery query = new LocaleQuery(this);
|
||||
private QuestFactory questFactory;
|
||||
private EventFactory eventFactory;
|
||||
private PlayerListener playerListener;
|
||||
private NpcListener npcListener;
|
||||
private NpcEffectThread effThread;
|
||||
private PartiesListener partiesListener;
|
||||
private Lang lang = new Lang(this);
|
||||
private LocaleQuery localeQuery = new LocaleQuery(this);
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class StageFailedException extends Exception {
|
||||
@ -181,28 +128,31 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// ORDER MATTERS
|
||||
bukkitVersion = Bukkit.getServer().getBukkitVersion().split("-")[0];
|
||||
query.setBukkitVersion(bukkitVersion);
|
||||
localeQuery.setBukkitVersion(bukkitVersion);
|
||||
playerListener = new PlayerListener(this);
|
||||
effThread = new NpcEffectThread(this);
|
||||
npcListener = new NpcListener(this);
|
||||
partiesListener = new PartiesListener();
|
||||
questFactory = new QuestFactory(this);
|
||||
eventFactory = new EventFactory(this);
|
||||
|
||||
// 1 - Load main config
|
||||
settings.init();
|
||||
|
||||
// 2 - Load command executor
|
||||
cmdExecutor = new CmdExecutor(this);
|
||||
|
||||
//Load main config before plugins because GPS is optional
|
||||
loadConfig();
|
||||
// 3 - Load soft-depends
|
||||
depends.init();
|
||||
|
||||
// Link with soft-depends
|
||||
linkOtherPlugins();
|
||||
|
||||
// Save resources
|
||||
// 4 - Save resources from jar
|
||||
saveResourceAs("quests.yml", "quests.yml", false);
|
||||
saveResourceAs("events.yml", "events.yml", false);
|
||||
saveResourceAs("data.yml", "data.yml", false);
|
||||
|
||||
// Load other configs and modules
|
||||
// 5 - Load other configs and modules
|
||||
loadModules();
|
||||
try {
|
||||
setupLang();
|
||||
@ -213,25 +163,30 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
loadData();
|
||||
|
||||
// Save config with any new options
|
||||
// 6 - Save config with any new options
|
||||
getConfig().options().copyDefaults(true);
|
||||
saveConfig();
|
||||
|
||||
// Setup commands
|
||||
loadSubCommands();
|
||||
// 7 - Setup commands
|
||||
getCommand("quests").setExecutor(cmdExecutor);
|
||||
getCommand("questadmin").setExecutor(cmdExecutor);
|
||||
getCommand("quest").setExecutor(cmdExecutor);
|
||||
|
||||
// Setup conversation factory after timeout has loaded
|
||||
this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new QuestsPrefix()).withFirstPrompt(new QuestPrompt()).withTimeout(acceptTimeout).thatExcludesNonPlayersWithMessage("Console may not perform this conversation!").addConversationAbandonedListener(this);
|
||||
this.npcConversationFactory = new ConversationFactory(this).withModality(false).withFirstPrompt(new QuestAcceptPrompt(this)).withTimeout(acceptTimeout).withLocalEcho(false).addConversationAbandonedListener(this);
|
||||
// 8 - Setup conversation factory after timeout has loaded
|
||||
this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new QuestsPrefix())
|
||||
.withFirstPrompt(new QuestPrompt()).withTimeout(settings.getAcceptTimeout())
|
||||
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!").addConversationAbandonedListener(this);
|
||||
this.npcConversationFactory = new ConversationFactory(this).withModality(false).withFirstPrompt(new QuestAcceptPrompt(this))
|
||||
.withTimeout(settings.getAcceptTimeout()).withLocalEcho(false).addConversationAbandonedListener(this);
|
||||
|
||||
getServer().getPluginManager().registerEvents(playerListener, this);
|
||||
if (npcEffects) {
|
||||
if (depends.getCitizens() != null) {
|
||||
getServer().getPluginManager().registerEvents(npcListener, this);
|
||||
if (settings.canNpcEffects()) {
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, effThread, 20, 20);
|
||||
}
|
||||
if (parties != null) {
|
||||
}
|
||||
if (depends.getPartiesApi() != null) {
|
||||
getServer().getPluginManager().registerEvents(partiesListener, this);
|
||||
}
|
||||
delayLoadQuestInfo();
|
||||
@ -241,9 +196,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public void onDisable() {
|
||||
getLogger().info("Saving Quester data.");
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
if (gpsapi != null) {
|
||||
if (gpsapi.gpsIsActive(p)) {
|
||||
gpsapi.stopGPS(p);
|
||||
if (depends.getGpsApi() != null) {
|
||||
if (depends.getGpsApi().gpsIsActive(p)) {
|
||||
depends.getGpsApi().stopGPS(p);
|
||||
}
|
||||
}
|
||||
Quester quester = getQuester(p.getUniqueId());
|
||||
@ -252,6 +207,30 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
updateData();
|
||||
}
|
||||
|
||||
public String getDetectedBukkitVersion() {
|
||||
return bukkitVersion;
|
||||
}
|
||||
|
||||
public Dependencies getDependencies() {
|
||||
return depends;
|
||||
}
|
||||
|
||||
public Settings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public List<CustomRequirement> getCustomRequirements() {
|
||||
return customRequirements;
|
||||
}
|
||||
|
||||
public List<CustomReward> getCustomRewards() {
|
||||
return customRewards;
|
||||
}
|
||||
|
||||
public List<CustomObjective> getCustomObjectives() {
|
||||
return customObjectives;
|
||||
}
|
||||
|
||||
public LinkedList<Quest> getQuests() {
|
||||
return quests;
|
||||
}
|
||||
@ -296,6 +275,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return npcConversationFactory;
|
||||
}
|
||||
|
||||
public QuestFactory getQuestFactory() {
|
||||
return questFactory;
|
||||
}
|
||||
|
||||
public EventFactory getEventFactory() {
|
||||
return eventFactory;
|
||||
}
|
||||
|
||||
public Lang getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public LocaleQuery getLocaleQuery() {
|
||||
return localeQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||
if (abandonedEvent.gracefulExit() == false) {
|
||||
@ -434,154 +429,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}, 5L);
|
||||
}
|
||||
|
||||
private void loadSubCommands() {
|
||||
// [] - required
|
||||
// {} - optional
|
||||
if (translateSubCommands) {
|
||||
commands.put(Lang.get("COMMAND_LIST"), 1); // list {page}
|
||||
commands.put(Lang.get("COMMAND_TAKE"), 2); // take [quest]
|
||||
commands.put(Lang.get("COMMAND_QUIT"), 2); // quit [quest]
|
||||
commands.put(Lang.get("COMMAND_EDITOR"), 1); // editor
|
||||
commands.put(Lang.get("COMMAND_EVENTS_EDITOR"), 1); // events
|
||||
commands.put(Lang.get("COMMAND_STATS"), 1); // stats
|
||||
commands.put(Lang.get("COMMAND_TOP"), 2); // top {number}
|
||||
commands.put(Lang.get("COMMAND_INFO"), 1); // info
|
||||
commands.put(Lang.get("COMMAND_JOURNAL"), 1); // journal
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_STATS"), 2); // stats [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVE"), 3); // give [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_QUIT"), 3); // quit [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_REMOVE"), 3); // remove [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTS"), 3); // points [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS"), 3); // takepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS"), 3); // givepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTSALL"), 2); // pointsall [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_FINISH"), 3); // finish [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"), 3); // nextstage [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"), 4); // setstage [player] [quest] [stage]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RESET"), 2); // reset [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"), 2); // togglegui [npc id]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RELOAD"), 1); // reload
|
||||
} else {
|
||||
commands.put("list", 1); // list {page}
|
||||
commands.put("take", 2); // take [quest]
|
||||
commands.put("quit", 2); // quit [quest]
|
||||
commands.put("editor", 1); // editor
|
||||
commands.put("events", 1); // events
|
||||
commands.put("stats", 1); // stats
|
||||
commands.put("top", 2); // top [number]
|
||||
commands.put("info", 1); // info
|
||||
commands.put("journal", 1); // journal
|
||||
adminCommands.put("stats", 2); // stats [player]
|
||||
adminCommands.put("give", 3); // give [player] [quest]
|
||||
adminCommands.put("quit", 3); // quit [player] [quest]
|
||||
adminCommands.put("remove", 3); // remove [player] [quest]
|
||||
adminCommands.put("points", 3); // points [player] [amount]
|
||||
adminCommands.put("takepoints", 3); // takepoints [player] [amount]
|
||||
adminCommands.put("givepoints", 3); // givepoints [player] [amount]
|
||||
adminCommands.put("pointsall", 2); // pointsall [amount]
|
||||
adminCommands.put("finish", 3); // finish [player] [quest]
|
||||
adminCommands.put("nextstage", 3); // nextstage [player] [quest]
|
||||
adminCommands.put("setstage", 4); // setstage [player] [quest] [stage]
|
||||
adminCommands.put("reset", 2); // reset [player]
|
||||
adminCommands.put("togglegui", 2); // togglegui [npc id]
|
||||
adminCommands.put("reload", 1); // reload
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPluginAvailable(String pluginName) {
|
||||
if (getServer().getPluginManager().getPlugin(pluginName) != null ) {
|
||||
if (!getServer().getPluginManager().getPlugin(pluginName).isEnabled()) {
|
||||
getLogger().warning(pluginName + " was detected, but is not enabled! Fix "+ pluginName + " to allow linkage.");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void linkOtherPlugins() {
|
||||
try {
|
||||
if (isPluginAvailable("Citizens")) {
|
||||
citizens = (CitizensPlugin) getServer().getPluginManager().getPlugin("Citizens");
|
||||
}
|
||||
if (citizens != null) {
|
||||
getServer().getPluginManager().registerEvents(npcListener, this);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled.");
|
||||
}
|
||||
if (isPluginAvailable("WorldGuard")) {
|
||||
worldGuard = (WorldGuardPlugin) getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
}
|
||||
if (isPluginAvailable("Denizen")) {
|
||||
denizen = (Denizen) getServer().getPluginManager().getPlugin("Denizen");
|
||||
}
|
||||
if (isPluginAvailable("mcMMO")) {
|
||||
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
|
||||
}
|
||||
if (useGPS && isPluginAvailable("GPS")) {
|
||||
gpsapi = new GPSAPI(this);
|
||||
}
|
||||
if (isPluginAvailable("Heroes")) {
|
||||
heroes = (Heroes) getServer().getPluginManager().getPlugin("Heroes");
|
||||
}
|
||||
if (isPluginAvailable("PhatLoots")) {
|
||||
phatLoots = (PhatLoots) getServer().getPluginManager().getPlugin("PhatLoots");
|
||||
}
|
||||
if (isPluginAvailable("PlaceholderAPI")) {
|
||||
placeholder = (PlaceholderAPIPlugin) getServer().getPluginManager().getPlugin("PlaceholderAPI");
|
||||
}
|
||||
if (isPluginAvailable("CitizensBooks")) {
|
||||
citizensBooks = ((CitizensBooksPlugin) getServer().getPluginManager().getPlugin("CitizensBooks")).getAPI();
|
||||
}
|
||||
if (isPluginAvailable("Parties")) {
|
||||
parties = Parties.getApi();
|
||||
Vars.getInstance().setMaxDistanceToEntry(9999.0);
|
||||
}
|
||||
if (isPluginAvailable("Vault")) {
|
||||
if (!setupEconomy()) {
|
||||
getLogger().warning("Economy not found.");
|
||||
}
|
||||
if (!setupPermissions()) {
|
||||
getLogger().warning("Permissions not found.");
|
||||
}
|
||||
vault = (Vault) getServer().getPluginManager().getPlugin("Vault");
|
||||
}
|
||||
}
|
||||
|
||||
public void loadConfig() {
|
||||
FileConfiguration config = getConfig();
|
||||
acceptTimeout = config.getInt("accept-timeout", 20);
|
||||
allowCommands = config.getBoolean("allow-command-questing", true);
|
||||
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false);
|
||||
allowQuitting = config.getBoolean("allow-quitting", true);
|
||||
askConfirmation = config.getBoolean("ask-confirmation", true);
|
||||
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
|
||||
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
|
||||
killDelay = config.getInt("kill-delay", 600);
|
||||
if (config.getString("language").equalsIgnoreCase("en")) {
|
||||
//Legacy
|
||||
lang.setISO("en-US");
|
||||
} else {
|
||||
lang.setISO(config.getString("language", "en-US"));
|
||||
}
|
||||
maxQuests = config.getInt("max-quests", maxQuests);
|
||||
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
||||
effect = config.getString("npc-effects.new-quest", "note");
|
||||
redoEffect = config.getString("npc-effects.redo-quest", "angry_villager");
|
||||
showQuestReqs = config.getBoolean("show-requirements", true);
|
||||
showQuestTitles = config.getBoolean("show-titles", true);
|
||||
translateItems = config.getBoolean("translate-items", false);
|
||||
translateSubCommands = config.getBoolean("translate-subcommands", false);
|
||||
useCompass = config.getBoolean("use-compass", true);
|
||||
useGPS = config.getBoolean("use-gps-plugin", true);
|
||||
try {
|
||||
config.save(new File(this.getDataFolder(), "config.yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
File dataFile = new File(this.getDataFolder(), "data.yml");
|
||||
@ -674,59 +521,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
|
||||
public void printHelp(Player player) {
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questHelpTitle"));
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp"));
|
||||
if (player.hasPermission("quests.list")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests "+ Lang.get(player, "COMMAND_LIST_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_LIST") : "list"));
|
||||
}
|
||||
if (player.hasPermission("quests.take")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TAKE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_TAKE") : "take"));
|
||||
}
|
||||
if (player.hasPermission("quests.quit")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_QUIT_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_QUIT") : "quit"));
|
||||
}
|
||||
if (player.hasPermission("quests.journal")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_JOURNAL_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_JOURNAL") : "journal"));
|
||||
}
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.editor")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EDITOR_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_EDITOR") : "editor"));
|
||||
}
|
||||
if (player.hasPermission("quests.events.*") || player.hasPermission("quests.events.editor")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EVENTS_EDITOR_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_EVENTS") : "events"));
|
||||
}
|
||||
if (player.hasPermission("quests.stats")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_STATS_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_STATS") : "stats"));
|
||||
}
|
||||
if (player.hasPermission("quests.top")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TOP_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_TOP") : "top"));
|
||||
}
|
||||
if (player.hasPermission("quests.info")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_INFO_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_INFO") : "info"));
|
||||
}
|
||||
player.sendMessage(" ");
|
||||
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUEST_HELP"));
|
||||
if (player.hasPermission("quests.questinfo")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUESTINFO_HELP"));
|
||||
}
|
||||
if (player.hasPermission("quests.admin.*") || player.hasPermission("quests.admin")) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get(player, "COMMAND_QUESTADMIN_HELP"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show all of a player's objectives for the current stage of a quest.<p>
|
||||
*
|
||||
@ -739,7 +533,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
@SuppressWarnings("deprecation")
|
||||
public void showObjectives(Quest quest, Quester quester, boolean ignoreOverrides) {
|
||||
for (String obj : quester.getObjectives(quest, false)) {
|
||||
if (placeholder != null) {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
obj = PlaceholderAPI.setPlaceholders(quester.getPlayer(), obj);
|
||||
}
|
||||
try {
|
||||
@ -752,7 +546,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (ItemStack is : stage.blocksToBreak) {
|
||||
if (Material.matchMaterial(serial) != null) {
|
||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -761,7 +555,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (ItemStack is : stage.blocksToDamage) {
|
||||
if (Material.matchMaterial(serial) != null) {
|
||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -770,7 +564,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (ItemStack is : stage.blocksToPlace) {
|
||||
if (Material.matchMaterial(serial) != null) {
|
||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -779,7 +573,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (ItemStack is : stage.blocksToUse) {
|
||||
if (Material.matchMaterial(serial) != null) {
|
||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -788,7 +582,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (ItemStack is : stage.blocksToCut) {
|
||||
if (Material.matchMaterial(serial) != null) {
|
||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -802,11 +596,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
String enchant = "";
|
||||
if (!is.getEnchantments().isEmpty()) {
|
||||
//TODO parse multiple enchantments?
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>").replace(enchant, "<enchantment>"),
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>").replace(enchant, "<enchantment>"),
|
||||
is.getType(), is.getDurability(), is.getEnchantments().entrySet().iterator().next().getKey());
|
||||
break;
|
||||
} else {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -822,7 +616,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
try {
|
||||
EntityType et = EntityType.valueOf(serial.toUpperCase().replace(" ", "_"));
|
||||
if (et.equals(type)) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<mob>"), type);
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<mob>"), type);
|
||||
break;
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
@ -837,7 +631,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
EntityType type = e.getKey();
|
||||
EntityType et = EntityType.valueOf(serial.toUpperCase().replace(" ", "_"));
|
||||
if (et.equals(type)) {
|
||||
query.sendMessage(quester.getPlayer(), obj.replace(serial, "<mob>"), type);
|
||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<mob>"), type);
|
||||
break;
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
@ -892,7 +686,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
loadEvents();
|
||||
// Reload config from disc in-case a setting was changed
|
||||
reloadConfig();
|
||||
loadConfig();
|
||||
settings.init();
|
||||
Lang.clear();
|
||||
try {
|
||||
lang.loadLang();
|
||||
@ -918,8 +712,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (quester == null) {
|
||||
quester = new Quester(this);
|
||||
quester.setUUID(id);
|
||||
if (citizens != null) {
|
||||
if (citizens.getNPCRegistry().getByUniqueId(id) != null) {
|
||||
if (depends.getCitizens() != null) {
|
||||
if (depends.getCitizens().getNPCRegistry().getByUniqueId(id) != null) {
|
||||
return quester;
|
||||
}
|
||||
}
|
||||
@ -988,7 +782,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
} else {
|
||||
skipQuestProcess("Quest block \'" + questKey + "\' is missing " + ChatColor.RED + "name:");
|
||||
}
|
||||
if (citizens != null && config.contains("quests." + questKey + ".npc-giver-id")) {
|
||||
if (depends.getCitizens() != null && config.contains("quests." + questKey + ".npc-giver-id")) {
|
||||
if (CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + questKey + ".npc-giver-id")) != null) {
|
||||
quest.npcStart = CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + questKey + ".npc-giver-id"));
|
||||
questNpcs.add(CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + questKey + ".npc-giver-id")));
|
||||
@ -1135,13 +929,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
skipQuestProcess("quest-points: Reward in Quest " + quest.getName() + " is not a number!");
|
||||
}
|
||||
}
|
||||
if (isPluginAvailable("mcMMO")) {
|
||||
if (depends.isPluginAvailable("mcMMO")) {
|
||||
if (config.contains("quests." + questKey + ".rewards.mcmmo-skills")) {
|
||||
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.mcmmo-skills"), String.class)) {
|
||||
if (config.contains("quests." + questKey + ".rewards.mcmmo-levels")) {
|
||||
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.mcmmo-levels"), Integer.class)) {
|
||||
for (String skill : config.getStringList("quests." + questKey + ".rewards.mcmmo-skills")) {
|
||||
if (Quests.mcmmo == null) {
|
||||
if (depends.getMcmmo() == null) {
|
||||
skipQuestProcess("" + skill + " in mcmmo-skills: Reward in Quest " + quest.getName() + " requires the mcMMO plugin!");
|
||||
} else if (Quests.getMcMMOSkill(skill) == null) {
|
||||
skipQuestProcess("" + skill + " in mcmmo-skills: Reward in Quest " + quest.getName() + " is not a valid mcMMO skill name!");
|
||||
@ -1160,15 +954,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isPluginAvailable("Heroes")) {
|
||||
if (depends.isPluginAvailable("Heroes")) {
|
||||
if (config.contains("quests." + questKey + ".rewards.heroes-exp-classes")) {
|
||||
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.heroes-exp-classes"), String.class)) {
|
||||
if (config.contains("quests." + questKey + ".rewards.heroes-exp-amounts")) {
|
||||
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.heroes-exp-amounts"), Double.class)) {
|
||||
for (String heroClass : config.getStringList("quests." + questKey + ".rewards.heroes-exp-classes")) {
|
||||
if (Quests.heroes == null) {
|
||||
if (depends.getHeroes() == null) {
|
||||
skipQuestProcess("" + heroClass + " in heroes-exp-classes: Reward in Quest " + quest.getName() + " requires the Heroes plugin!");
|
||||
} else if (Quests.heroes.getClassManager().getClass(heroClass) == null) {
|
||||
} else if (depends.getHeroes().getClassManager().getClass(heroClass) == null) {
|
||||
skipQuestProcess("" + heroClass + " in heroes-exp-classes: Reward in Quest " + quest.getName() + " is not a valid Heroes class name!");
|
||||
}
|
||||
}
|
||||
@ -1185,11 +979,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isPluginAvailable("PhatLoots")) {
|
||||
if (depends.isPluginAvailable("PhatLoots")) {
|
||||
if (config.contains("quests." + questKey + ".rewards.phat-loots")) {
|
||||
if (Quests.checkList(config.getList("quests." + questKey + ".rewards.phat-loots"), String.class)) {
|
||||
for (String loot : config.getStringList("quests." + questKey + ".rewards.phat-loots")) {
|
||||
if (Quests.phatLoots == null) {
|
||||
if (depends.getPhatLoots() == null) {
|
||||
skipQuestProcess("" + loot + " in phat-loots: Reward in Quest " + quest.getName() + " requires the PhatLoots plugin!");
|
||||
} else if (PhatLootsAPI.getPhatLoot(loot) == null) {
|
||||
skipQuestProcess("" + loot + " in phat-loots: Reward in Quest " + quest.getName() + " is not a valid PhatLoot name!");
|
||||
@ -1368,7 +1162,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
if (config.contains("quests." + questKey + ".requirements.heroes-primary-class")) {
|
||||
String className = config.getString("quests." + questKey + ".requirements.heroes-primary-class");
|
||||
HeroClass hc = heroes.getClassManager().getClass(className);
|
||||
HeroClass hc = depends.getHeroes().getClassManager().getClass(className);
|
||||
if (hc != null && hc.isPrimary()) {
|
||||
reqs.setHeroesPrimaryClass(hc.getName());
|
||||
} else if (hc != null) {
|
||||
@ -1379,7 +1173,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
if (config.contains("quests." + questKey + ".requirements.heroes-secondary-class")) {
|
||||
String className = config.getString("quests." + questKey + ".requirements.heroes-secondary-class");
|
||||
HeroClass hc = heroes.getClassManager().getClass(className);
|
||||
HeroClass hc = depends.getHeroes().getClassManager().getClass(className);
|
||||
if (hc != null && hc.isSecondary()) {
|
||||
reqs.setHeroesSecondaryClass(hc.getName());
|
||||
} else if (hc != null) {
|
||||
@ -1459,7 +1253,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
private boolean regionFound(Quest quest, String region) {
|
||||
boolean exists = false;
|
||||
for (World world : getServer().getWorlds()) {
|
||||
RegionManager rm = worldGuard.getRegionManager(world);
|
||||
RegionManager rm = depends.getWorldGuard().getRegionManager(world);
|
||||
if (rm != null) {
|
||||
ProtectedRegion pr = rm.getRegion(region);
|
||||
if (pr != null) {
|
||||
@ -1502,7 +1296,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
// Denizen script load
|
||||
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".script-to-run")) {
|
||||
if (ScriptRegistry.containsScript(config.getString("quests." + questKey + ".stages.ordered." + s2 + ".script-to-run"))) {
|
||||
trigger = new QuestTaskTrigger();
|
||||
oStage.script = config.getString("quests." + questKey + ".stages.ordered." + s2 + ".script-to-run");
|
||||
} else {
|
||||
stageFailed("script-to-run: in Stage " + s2 + " of Quest " + quest.getName() + " is not a Denizen script!");
|
||||
@ -2262,9 +2055,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return parsed;
|
||||
}
|
||||
|
||||
public static String parseString(String s, Quest quest, Player player) {
|
||||
public String parseString(String s, Quest quest, Player player) {
|
||||
String parsed = parseString(s, quest);
|
||||
if (Quests.placeholder != null && player != null) {
|
||||
if (depends.getPlaceholderApi() != null && player != null) {
|
||||
parsed = PlaceholderAPI.setPlaceholders(player, parsed);
|
||||
}
|
||||
return parsed;
|
||||
@ -2309,26 +2102,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return parsed;
|
||||
}
|
||||
|
||||
private boolean setupEconomy() {
|
||||
try {
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null) {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
return (economy != null);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean setupPermissions() {
|
||||
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||
if (permissionProvider != null) {
|
||||
permission = permissionProvider.getProvider();
|
||||
}
|
||||
return (permission != null);
|
||||
}
|
||||
|
||||
public static Location getLocation(String arg) {
|
||||
String[] info = arg.split(" ");
|
||||
|
||||
@ -2542,21 +2315,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrency(boolean plural) {
|
||||
if (Quests.economy == null) {
|
||||
public String getCurrency(boolean plural) {
|
||||
if (depends.getVaultEconomy() == null) {
|
||||
return Lang.get("money");
|
||||
}
|
||||
if (plural) {
|
||||
if (Quests.economy.currencyNamePlural().trim().isEmpty()) {
|
||||
if (depends.getVaultEconomy().currencyNamePlural().trim().isEmpty()) {
|
||||
return Lang.get("money");
|
||||
} else {
|
||||
return Quests.economy.currencyNamePlural();
|
||||
return depends.getVaultEconomy().currencyNamePlural();
|
||||
}
|
||||
} else {
|
||||
if (Quests.economy.currencyNameSingular().trim().isEmpty()) {
|
||||
if (depends.getVaultEconomy().currencyNameSingular().trim().isEmpty()) {
|
||||
return Lang.get("money");
|
||||
} else {
|
||||
return Quests.economy.currencyNameSingular();
|
||||
return depends.getVaultEconomy().currencyNameSingular();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2660,11 +2433,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
|
||||
public Location getNPCLocation(int id) {
|
||||
return citizens.getNPCRegistry().getById(id).getStoredLocation();
|
||||
return depends.getCitizens().getNPCRegistry().getById(id).getStoredLocation();
|
||||
}
|
||||
|
||||
public String getNPCName(int id) {
|
||||
return citizens.getNPCRegistry().getById(id).getName();
|
||||
return depends.getCitizens().getNPCRegistry().getById(id).getName();
|
||||
}
|
||||
|
||||
public static int countInv(Inventory inv, Material m, int subtract) {
|
||||
@ -2807,6 +2580,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (Quest q : quests) {
|
||||
if (q.npcStart != null && quester.completedQuests.contains(q.getName()) == false) {
|
||||
if (q.npcStart.getId() == npc.getId()) {
|
||||
boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||
if (ignoreLockedQuests == false || ignoreLockedQuests == true && q.testRequirements(quester) == true) {
|
||||
return true;
|
||||
}
|
||||
@ -2821,6 +2595,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (Quest q : quests) {
|
||||
if (q.npcStart != null && quester.completedQuests.contains(q.getName()) == true) {
|
||||
if (q.npcStart.getId() == npc.getId()) {
|
||||
boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||
if (ignoreLockedQuests == false || ignoreLockedQuests == true && q.testRequirements(quester) == true) {
|
||||
return true;
|
||||
}
|
||||
@ -2834,6 +2609,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (Quest q : quests) {
|
||||
if (q.npcStart != null && quester.completedQuests.contains(q.getName()) == true && q.getPlanner().getCooldown() > -1) {
|
||||
if (q.npcStart.getId() == npc.getId()) {
|
||||
boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||
if (ignoreLockedQuests == false || ignoreLockedQuests == true && q.testRequirements(quester) == true) {
|
||||
return true;
|
||||
}
|
||||
@ -2856,7 +2632,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (p == null) {
|
||||
return null;
|
||||
}
|
||||
return heroes.getCharacterManager().getHero(p);
|
||||
return depends.getHeroes().getCharacterManager().getHero(p);
|
||||
}
|
||||
|
||||
public boolean testPrimaryHeroesClass(String primaryClass, UUID uuid) {
|
||||
|
175
src/main/java/me/blackvein/quests/Settings.java
Normal file
175
src/main/java/me/blackvein/quests/Settings.java
Normal file
@ -0,0 +1,175 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class Settings {
|
||||
|
||||
private Quests plugin;
|
||||
private int acceptTimeout = 20;
|
||||
private boolean allowCommands = true;
|
||||
private boolean allowCommandsForNpcQuests = false;
|
||||
private boolean allowQuitting = true;
|
||||
private boolean askConfirmation = true;
|
||||
private boolean genFilesOnJoin = true;
|
||||
private boolean ignoreLockedQuests = false;
|
||||
private int killDelay = 0;
|
||||
private int maxQuests = 0;
|
||||
private boolean npcEffects = true;
|
||||
private String effect = "note";
|
||||
private String redoEffect = "angry_villager";
|
||||
private boolean showQuestReqs = true;
|
||||
private boolean showQuestTitles = true;
|
||||
private boolean translateItems = false;
|
||||
private boolean translateSubCommands = false;
|
||||
private boolean useCompass = true;
|
||||
private boolean useGPS = true;
|
||||
|
||||
public Settings(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public int getAcceptTimeout() {
|
||||
return acceptTimeout;
|
||||
}
|
||||
public void setAcceptTimeout(int acceptTimeout) {
|
||||
this.acceptTimeout = acceptTimeout;
|
||||
}
|
||||
public boolean canAllowCommands() {
|
||||
return allowCommands;
|
||||
}
|
||||
public void setAllowCommands(boolean allowCommands) {
|
||||
this.allowCommands = allowCommands;
|
||||
}
|
||||
public boolean canAllowCommandsForNpcQuests() {
|
||||
return allowCommandsForNpcQuests;
|
||||
}
|
||||
public void setAllowCommandsForNpcQuests(boolean allowCommandsForNpcQuests) {
|
||||
this.allowCommandsForNpcQuests = allowCommandsForNpcQuests;
|
||||
}
|
||||
public boolean canAllowQuitting() {
|
||||
return allowQuitting;
|
||||
}
|
||||
public void setAllowQuitting(boolean allowQuitting) {
|
||||
this.allowQuitting = allowQuitting;
|
||||
}
|
||||
public boolean canAskConfirmation() {
|
||||
return askConfirmation;
|
||||
}
|
||||
public void setAskConfirmation(boolean askConfirmation) {
|
||||
this.askConfirmation = askConfirmation;
|
||||
}
|
||||
public boolean canGenFilesOnJoin() {
|
||||
return genFilesOnJoin;
|
||||
}
|
||||
public void setGenFilesOnJoin(boolean genFilesOnJoin) {
|
||||
this.genFilesOnJoin = genFilesOnJoin;
|
||||
}
|
||||
public boolean canIgnoreLockedQuests() {
|
||||
return ignoreLockedQuests;
|
||||
}
|
||||
public void setIgnoreLockedQuests(boolean ignoreLockedQuests) {
|
||||
this.ignoreLockedQuests = ignoreLockedQuests;
|
||||
}
|
||||
public int getKillDelay() {
|
||||
return killDelay;
|
||||
}
|
||||
public void setKillDelay(int killDelay) {
|
||||
this.killDelay = killDelay;
|
||||
}
|
||||
public int getMaxQuests() {
|
||||
return maxQuests;
|
||||
}
|
||||
public void setMaxQuests(int maxQuests) {
|
||||
this.maxQuests = maxQuests;
|
||||
}
|
||||
public boolean canNpcEffects() {
|
||||
return npcEffects;
|
||||
}
|
||||
public void setNpcEffects(boolean npcEffects) {
|
||||
this.npcEffects = npcEffects;
|
||||
}
|
||||
public String getEffect() {
|
||||
return effect;
|
||||
}
|
||||
public void setEffect(String effect) {
|
||||
this.effect = effect;
|
||||
}
|
||||
public String getRedoEffect() {
|
||||
return redoEffect;
|
||||
}
|
||||
public void setRedoEffect(String redoEffect) {
|
||||
this.redoEffect = redoEffect;
|
||||
}
|
||||
public boolean canShowQuestReqs() {
|
||||
return showQuestReqs;
|
||||
}
|
||||
public void setShowQuestReqs(boolean showQuestReqs) {
|
||||
this.showQuestReqs = showQuestReqs;
|
||||
}
|
||||
public boolean canShowQuestTitles() {
|
||||
return showQuestTitles;
|
||||
}
|
||||
public void setShowQuestTitles(boolean showQuestTitles) {
|
||||
this.showQuestTitles = showQuestTitles;
|
||||
}
|
||||
public boolean canTranslateItems() {
|
||||
return translateItems;
|
||||
}
|
||||
public void setTranslateItems(boolean translateItems) {
|
||||
this.translateItems = translateItems;
|
||||
}
|
||||
public boolean canTranslateSubCommands() {
|
||||
return translateSubCommands;
|
||||
}
|
||||
public void setTranslateSubCommands(boolean translateSubCommands) {
|
||||
this.translateSubCommands = translateSubCommands;
|
||||
}
|
||||
public boolean canUseCompass() {
|
||||
return useCompass;
|
||||
}
|
||||
public void setUseCompass(boolean useCompass) {
|
||||
this.useCompass = useCompass;
|
||||
}
|
||||
public boolean canUseGPS() {
|
||||
return useGPS;
|
||||
}
|
||||
public void setUseGPS(boolean useGPS) {
|
||||
this.useGPS = useGPS;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
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);
|
||||
allowQuitting = config.getBoolean("allow-quitting", true);
|
||||
askConfirmation = config.getBoolean("ask-confirmation", true);
|
||||
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
|
||||
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
|
||||
killDelay = config.getInt("kill-delay", 600);
|
||||
if (config.getString("language").equalsIgnoreCase("en")) {
|
||||
//Legacy
|
||||
plugin.getLang().setISO("en-US");
|
||||
} else {
|
||||
plugin.getLang().setISO(config.getString("language", "en-US"));
|
||||
}
|
||||
maxQuests = config.getInt("max-quests", maxQuests);
|
||||
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
||||
effect = config.getString("npc-effects.new-quest", "note");
|
||||
redoEffect = config.getString("npc-effects.redo-quest", "angry_villager");
|
||||
showQuestReqs = config.getBoolean("show-requirements", true);
|
||||
showQuestTitles = config.getBoolean("show-titles", true);
|
||||
translateItems = config.getBoolean("translate-items", false);
|
||||
translateSubCommands = config.getBoolean("translate-subcommands", false);
|
||||
useCompass = config.getBoolean("use-compass", true);
|
||||
useGPS = config.getBoolean("use-gps-plugin", true);
|
||||
try {
|
||||
config.save(new File(plugin.getDataFolder(), "config.yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -43,9 +43,12 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
public class CmdExecutor implements CommandExecutor{
|
||||
private final Quests plugin;
|
||||
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
|
||||
|
||||
public CmdExecutor(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,13 +74,67 @@ public class CmdExecutor implements CommandExecutor{
|
||||
return false;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
// [] - required
|
||||
// {} - optional
|
||||
if (plugin.getSettings().canTranslateSubCommands()) {
|
||||
commands.put(Lang.get("COMMAND_LIST"), 1); // list {page}
|
||||
commands.put(Lang.get("COMMAND_TAKE"), 2); // take [quest]
|
||||
commands.put(Lang.get("COMMAND_QUIT"), 2); // quit [quest]
|
||||
commands.put(Lang.get("COMMAND_EDITOR"), 1); // editor
|
||||
commands.put(Lang.get("COMMAND_EVENTS_EDITOR"), 1); // events
|
||||
commands.put(Lang.get("COMMAND_STATS"), 1); // stats
|
||||
commands.put(Lang.get("COMMAND_TOP"), 2); // top {number}
|
||||
commands.put(Lang.get("COMMAND_INFO"), 1); // info
|
||||
commands.put(Lang.get("COMMAND_JOURNAL"), 1); // journal
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_STATS"), 2); // stats [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVE"), 3); // give [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_QUIT"), 3); // quit [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_REMOVE"), 3); // remove [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTS"), 3); // points [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS"), 3); // takepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS"), 3); // givepoints [player] [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_POINTSALL"), 2); // pointsall [amount]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_FINISH"), 3); // finish [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE"), 3); // nextstage [player] [quest]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_SETSTAGE"), 4); // setstage [player] [quest] [stage]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RESET"), 2); // reset [player]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI"), 2); // togglegui [npc id]
|
||||
adminCommands.put(Lang.get("COMMAND_QUESTADMIN_RELOAD"), 1); // reload
|
||||
} else {
|
||||
commands.put("list", 1); // list {page}
|
||||
commands.put("take", 2); // take [quest]
|
||||
commands.put("quit", 2); // quit [quest]
|
||||
commands.put("editor", 1); // editor
|
||||
commands.put("events", 1); // events
|
||||
commands.put("stats", 1); // stats
|
||||
commands.put("top", 2); // top [number]
|
||||
commands.put("info", 1); // info
|
||||
commands.put("journal", 1); // journal
|
||||
adminCommands.put("stats", 2); // stats [player]
|
||||
adminCommands.put("give", 3); // give [player] [quest]
|
||||
adminCommands.put("quit", 3); // quit [player] [quest]
|
||||
adminCommands.put("remove", 3); // remove [player] [quest]
|
||||
adminCommands.put("points", 3); // points [player] [amount]
|
||||
adminCommands.put("takepoints", 3); // takepoints [player] [amount]
|
||||
adminCommands.put("givepoints", 3); // givepoints [player] [amount]
|
||||
adminCommands.put("pointsall", 2); // pointsall [amount]
|
||||
adminCommands.put("finish", 3); // finish [player] [quest]
|
||||
adminCommands.put("nextstage", 3); // nextstage [player] [quest]
|
||||
adminCommands.put("setstage", 4); // setstage [player] [quest] [stage]
|
||||
adminCommands.put("reset", 2); // reset [player]
|
||||
adminCommands.put("togglegui", 2); // togglegui [npc id]
|
||||
adminCommands.put("reload", 1); // reload
|
||||
}
|
||||
}
|
||||
|
||||
public String checkCommand(String cmd, String[] args) {
|
||||
if (cmd.equalsIgnoreCase("quest") || args.length == 0) {
|
||||
return null;
|
||||
}
|
||||
if (cmd.equalsIgnoreCase("quests")) {
|
||||
if (plugin.commands.containsKey(args[0].toLowerCase())) {
|
||||
int min = plugin.commands.get(args[0].toLowerCase());
|
||||
if (commands.containsKey(args[0].toLowerCase())) {
|
||||
int min = commands.get(args[0].toLowerCase());
|
||||
if (args.length < min)
|
||||
return getQuestsCommandUsage(args[0]);
|
||||
else
|
||||
@ -85,8 +142,8 @@ public class CmdExecutor implements CommandExecutor{
|
||||
}
|
||||
return ChatColor.YELLOW + Lang.get("questsUnknownCommand");
|
||||
} else if (cmd.equalsIgnoreCase("questsadmin") || cmd.equalsIgnoreCase("questadmin")) {
|
||||
if (plugin.adminCommands.containsKey(args[0].toLowerCase())) {
|
||||
int min = plugin.adminCommands.get(args[0].toLowerCase());
|
||||
if (adminCommands.containsKey(args[0].toLowerCase())) {
|
||||
int min = adminCommands.get(args[0].toLowerCase());
|
||||
if (args.length < min)
|
||||
return getQuestadminCommandUsage(args[0]);
|
||||
else
|
||||
@ -137,23 +194,24 @@ public class CmdExecutor implements CommandExecutor{
|
||||
questsHelp(cs);
|
||||
return true;
|
||||
} else {
|
||||
if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_LIST") : "list")) {
|
||||
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands();
|
||||
if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_LIST") : "list")) {
|
||||
questsList(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_TAKE") : "take")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_TAKE") : "take")) {
|
||||
questsTake((Player) cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUIT") : "quit")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUIT") : "quit")) {
|
||||
questsQuit((Player) cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_STATS") : "stats")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_STATS") : "stats")) {
|
||||
questsStats(cs, null);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_JOURNAL") : "journal")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_JOURNAL") : "journal")) {
|
||||
questsJournal((Player) cs);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_TOP") : "top")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_TOP") : "top")) {
|
||||
questsTop(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_EDITOR") : "editor")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EDITOR") : "editor")) {
|
||||
questsEditor(cs);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_EVENTS_EDITOR") : "events")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_EVENTS_EDITOR") : "events")) {
|
||||
questsEvents(cs);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_INFO") : "info")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_INFO") : "info")) {
|
||||
questsInfo(cs);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownCommand"));
|
||||
@ -172,33 +230,34 @@ public class CmdExecutor implements CommandExecutor{
|
||||
adminHelp(cs);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats")) {
|
||||
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands();
|
||||
if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats")) {
|
||||
adminStats(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give")) {
|
||||
adminGive(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit")) {
|
||||
adminQuit(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points")) {
|
||||
adminPoints(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints")) {
|
||||
adminTakePoints(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints")) {
|
||||
adminGivePoints(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall")) {
|
||||
adminPointsAll(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish")) {
|
||||
adminFinish(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage")) {
|
||||
adminNextStage(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage")) {
|
||||
adminSetStage(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset")) {
|
||||
adminReset(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove")) {
|
||||
adminRemove(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui")) {
|
||||
adminToggieGUI(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase(plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload")) {
|
||||
} else if (args[0].equalsIgnoreCase(translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload")) {
|
||||
adminReload(cs);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.YELLOW + Lang.get("questsUnknownAdminCommand"));
|
||||
@ -245,12 +304,12 @@ public class CmdExecutor implements CommandExecutor{
|
||||
cs.sendMessage(ChatColor.YELLOW + q.getDescription());
|
||||
}
|
||||
cs.sendMessage(" ");
|
||||
if (plugin.showQuestReqs == true) {
|
||||
if (plugin.getSettings().canShowQuestReqs() == true) {
|
||||
cs.sendMessage(ChatColor.GOLD + Lang.get("requirements"));
|
||||
Requirements reqs = q.getRequirements();
|
||||
if (reqs.getPermissions().isEmpty() == false) {
|
||||
for (String perm : reqs.getPermissions()) {
|
||||
if (Quests.permission.has(player, perm)) {
|
||||
if (plugin.getDependencies().getVaultPermission().has(player, perm)) {
|
||||
cs.sendMessage(ChatColor.GREEN + Lang.get("permissionDisplay") + " " + perm);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("permissionDisplay") + " " + perm);
|
||||
@ -291,17 +350,17 @@ public class CmdExecutor implements CommandExecutor{
|
||||
}
|
||||
}
|
||||
if (reqs.getMoney() != 0) {
|
||||
if (Quests.economy != null && Quests.economy.getBalance(quester.getOfflinePlayer()) >= reqs.getMoney()) {
|
||||
if (plugin.getDependencies().getVaultEconomy() != null && plugin.getDependencies().getVaultEconomy().getBalance(quester.getOfflinePlayer()) >= reqs.getMoney()) {
|
||||
if (reqs.getMoney() == 1) {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " " + Quests.getCurrency(false));
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " " + plugin.getCurrency(false));
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " " + Quests.getCurrency(true));
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " " + plugin.getCurrency(true));
|
||||
}
|
||||
} else {
|
||||
if (reqs.getMoney() == 1) {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " " + Quests.getCurrency(false));
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " " + plugin.getCurrency(false));
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " " + Quests.getCurrency(true));
|
||||
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " " + plugin.getCurrency(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -357,7 +416,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
|
||||
private boolean questsEvents(final CommandSender cs) {
|
||||
if (cs.hasPermission("quests.editor.*") || cs.hasPermission("quests.events.editor")) {
|
||||
plugin.eventFactory.getConversationFactory().buildConversation((Conversable) cs).begin();
|
||||
plugin.getEventFactory().getConversationFactory().buildConversation((Conversable) cs).begin();
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
@ -366,7 +425,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
|
||||
private boolean questsEditor(final CommandSender cs) {
|
||||
if (cs.hasPermission("quests.editor.*") || cs.hasPermission("quests.editor.editor")) {
|
||||
plugin.questFactory.getConversationFactory().buildConversation((Conversable) cs).begin();
|
||||
plugin.getQuestFactory().getConversationFactory().buildConversation((Conversable) cs).begin();
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
@ -530,7 +589,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
}
|
||||
|
||||
private boolean questsQuit(final Player player, String[] args) {
|
||||
if (plugin.allowQuitting == true) {
|
||||
if (plugin.getSettings().canAllowQuitting() == true) {
|
||||
if (((Player) player).hasPermission("quests.quit")) {
|
||||
if (args.length == 1) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "COMMAND_QUIT_HELP"));
|
||||
@ -566,7 +625,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
}
|
||||
|
||||
private void questsTake(final Player player, String[] args) {
|
||||
if (plugin.allowCommands == true) {
|
||||
if (plugin.getSettings().canAllowCommands() == true) {
|
||||
if (((Player) player).hasPermission("quests.take")) {
|
||||
if (args.length == 1) {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "COMMAND_TAKE_USAGE"));
|
||||
@ -600,9 +659,9 @@ public class CmdExecutor implements CommandExecutor{
|
||||
if (questToFind != null) {
|
||||
final Quest q = questToFind;
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.getCurrentQuests().size() >= plugin.maxQuests && plugin.maxQuests > 0) {
|
||||
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests() > 0) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (quester.getCurrentQuests().containsKey(q)) {
|
||||
String msg = Lang.get(player, "questAlreadyOn");
|
||||
@ -611,7 +670,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
String msg = Lang.get(player, "questAlreadyCompleted");
|
||||
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + q.getName() + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (q.getNpcStart() != null && plugin.allowCommandsForNpcQuests == false) {
|
||||
} else if (q.getNpcStart() != null && plugin.getSettings().canAllowCommandsForNpcQuests() == false) {
|
||||
String msg = Lang.get(player, "mustSpeakTo");
|
||||
msg = msg.replace("<npc>", ChatColor.DARK_PURPLE + q.getNpcStart().getName() + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
@ -633,7 +692,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
if (q.getRegion() != null) {
|
||||
boolean inRegion = false;
|
||||
Player p = quester.getPlayer();
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(p.getWorld());
|
||||
RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(p.getWorld());
|
||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||
while (it.hasNext()) {
|
||||
ProtectedRegion pr = it.next();
|
||||
@ -657,7 +716,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
if (!plugin.askConfirmation) {
|
||||
if (!plugin.getSettings().canAskConfirmation()) {
|
||||
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).getQuestToTake()), false);
|
||||
} else {
|
||||
plugin.getConversationFactory().buildConversation((Conversable) player).begin();
|
||||
@ -706,12 +765,62 @@ public class CmdExecutor implements CommandExecutor{
|
||||
private void questsHelp(final CommandSender cs) {
|
||||
if (((Player) cs).hasPermission("quests.quests")) {
|
||||
Player p = (Player) cs;
|
||||
plugin.printHelp(p);
|
||||
printHelp(p);
|
||||
} else {
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
|
||||
}
|
||||
}
|
||||
|
||||
public void printHelp(Player player) {
|
||||
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands();
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questHelpTitle"));
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp"));
|
||||
if (player.hasPermission("quests.list")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests "+ Lang.get(player, "COMMAND_LIST_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_LIST") : "list"));
|
||||
}
|
||||
if (player.hasPermission("quests.take")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TAKE_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_TAKE") : "take"));
|
||||
}
|
||||
if (player.hasPermission("quests.quit")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_QUIT_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_QUIT") : "quit"));
|
||||
}
|
||||
if (player.hasPermission("quests.journal")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_JOURNAL_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_JOURNAL") : "journal"));
|
||||
}
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.editor")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EDITOR_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_EDITOR") : "editor"));
|
||||
}
|
||||
if (player.hasPermission("quests.events.*") || player.hasPermission("quests.events.editor")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EVENTS_EDITOR_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_EVENTS") : "events"));
|
||||
}
|
||||
if (player.hasPermission("quests.stats")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_STATS_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_STATS") : "stats"));
|
||||
}
|
||||
if (player.hasPermission("quests.top")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TOP_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_TOP") : "top"));
|
||||
}
|
||||
if (player.hasPermission("quests.info")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_INFO_HELP")
|
||||
.replace("<command>", translateSubCommands ? Lang.get(player, "COMMAND_INFO") : "info"));
|
||||
}
|
||||
player.sendMessage(" ");
|
||||
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUEST_HELP"));
|
||||
if (player.hasPermission("quests.questinfo")) {
|
||||
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUESTINFO_HELP"));
|
||||
}
|
||||
if (player.hasPermission("quests.admin.*") || player.hasPermission("quests.admin")) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get(player, "COMMAND_QUESTADMIN_HELP"));
|
||||
}
|
||||
}
|
||||
|
||||
public String getQuestsCommandUsage(String cmd) {
|
||||
return ChatColor.RED + Lang.get("usage") + ": " + ChatColor.YELLOW + "/quests " + Lang.get(Lang.getCommandKey(cmd) + "_HELP");
|
||||
}
|
||||
@ -740,7 +849,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.togglegui")) {
|
||||
try {
|
||||
int i = Integer.parseInt(args[1]);
|
||||
if (Quests.citizens.getNPCRegistry().getById(i) == null) {
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getById(i) == null) {
|
||||
String msg = Lang.get("errorNPCID");
|
||||
msg = msg.replace("errorNPCID", ChatColor.DARK_PURPLE + "" + i + ChatColor.RED);
|
||||
cs.sendMessage(ChatColor.RED + msg);
|
||||
@ -750,7 +859,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
plugin.setQuestNpcGuis(temp);
|
||||
plugin.updateData();
|
||||
String msg = Lang.get("disableNPCGUI");
|
||||
msg = msg.replace("<npc>", ChatColor.DARK_PURPLE + Quests.citizens.getNPCRegistry().getById(i).getName() + ChatColor.YELLOW);
|
||||
msg = msg.replace("<npc>", ChatColor.DARK_PURPLE + plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName() + ChatColor.YELLOW);
|
||||
cs.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else {
|
||||
LinkedList<Integer> temp = plugin.getQuestNpcGuis();
|
||||
@ -758,7 +867,7 @@ public class CmdExecutor implements CommandExecutor{
|
||||
plugin.setQuestNpcGuis(temp);
|
||||
plugin.updateData();
|
||||
String msg = Lang.get("enableNPCGUI");
|
||||
msg = msg.replace("<npc>", ChatColor.DARK_PURPLE + Quests.citizens.getNPCRegistry().getById(i).getName() + ChatColor.YELLOW);
|
||||
msg = msg.replace("<npc>", ChatColor.DARK_PURPLE + plugin.getDependencies().getCitizens().getNPCRegistry().getById(i).getName() + ChatColor.YELLOW);
|
||||
cs.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
@ -1279,91 +1388,92 @@ public class CmdExecutor implements CommandExecutor{
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questAdminHelpTitle"));
|
||||
cs.sendMessage("");
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin" + ChatColor.RED + " " + Lang.get("COMMAND_QUESTADMIN_HELP"));
|
||||
boolean translateSubCommands = plugin.getSettings().canTranslateSubCommands();
|
||||
if (cs.hasPermission("quests.admin.*")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui"));
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
|
||||
} else {
|
||||
if (cs.hasPermission("quests.admin.stats")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_STATS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.give")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.quit")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_QUIT_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.points")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.takepoints")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.givepoints")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.pointsall")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_POINTSALL_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_POINTSALL") : "pointsall"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.finish")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_FINISH_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.nextstage")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.setstage")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.reset")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RESET_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.remove")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_REMOVE_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.togglegui")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_TOGGLEGUI") : "togglegui"));
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.reload")) {
|
||||
cs.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_RELOAD_HELP")
|
||||
.replace("<command>", plugin.translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
|
||||
.replace("<command>", translateSubCommands ? Lang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class NpcListener implements Listener {
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||
if (plugin.questFactory.selectingNPCs.contains(evt.getClicker())) {
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getClicker())) {
|
||||
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID " + evt.getNPC().getId());
|
||||
return;
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class NpcListener implements Listener {
|
||||
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
|
||||
}
|
||||
text += " x " + ChatColor.DARK_AQUA + hand.getAmount() + ChatColor.GRAY;
|
||||
plugin.query.sendMessage(player, Lang.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand.getType(), hand.getDurability());
|
||||
plugin.getLocaleQuery().sendMessage(player, Lang.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand.getType(), hand.getDurability());
|
||||
switch(reasonCode) {
|
||||
case 1:
|
||||
player.sendMessage(Lang.get(player, "difference").replace("<data>", "one item is null"));
|
||||
@ -162,7 +162,7 @@ public class NpcListener implements Listener {
|
||||
if (quester.getCurrentQuests().containsKey(q))
|
||||
continue;
|
||||
if (q.getNpcStart() != null && q.getNpcStart().getId() == evt.getNPC().getId()) {
|
||||
if (plugin.ignoreLockedQuests && (quester.getCompletedQuests().contains(q.getName()) == false || q.getPlanner().getCooldown() > -1)) {
|
||||
if (plugin.getSettings().canIgnoreLockedQuests() && (quester.getCompletedQuests().contains(q.getName()) == false || q.getPlanner().getCooldown() > -1)) {
|
||||
if (q.testRequirements(quester)) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class NpcListener implements Listener {
|
||||
} else if (npcQuests.size() == 1) {
|
||||
Quest q = npcQuests.get(0);
|
||||
if (!quester.getCompletedQuests().contains(q.getName())) {
|
||||
if (quester.getCurrentQuests().size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
|
||||
quester.setQuestToTake(q.getName());
|
||||
String s = extracted(quester);
|
||||
for (String msg : s.split("<br>")) {
|
||||
@ -192,10 +192,10 @@ public class NpcListener implements Listener {
|
||||
plugin.getNpcConversationFactory().buildConversation(player).begin();
|
||||
} else if (quester.getCurrentQuests().containsKey(q) == false) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
} else if (quester.getCurrentQuests().size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||
} else if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
|
||||
if (quester.getCooldownDifference(q) > 0) {
|
||||
String early = Lang.get(player, "questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||
@ -215,7 +215,7 @@ public class NpcListener implements Listener {
|
||||
}
|
||||
} else if (quester.getCurrentQuests().containsKey(q) == false) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
} else if (npcQuests.isEmpty()) {
|
||||
@ -228,7 +228,7 @@ public class NpcListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onNPCLeftClick(NPCLeftClickEvent evt) {
|
||||
if (plugin.questFactory.selectingNPCs.contains(evt.getClicker())) {
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getClicker())) {
|
||||
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + Lang.get("id") + " " + evt.getNPC().getId());
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ public class NpcListener implements Listener {
|
||||
if (evt.getNPC().getEntity().getLastDamageCause().getEntity() instanceof Player) {
|
||||
Player player = (Player) evt.getNPC().getEntity().getLastDamageCause().getEntity();
|
||||
boolean okay = true;
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player)) {
|
||||
okay = false;
|
||||
}
|
||||
@ -259,8 +259,8 @@ public class NpcListener implements Listener {
|
||||
}
|
||||
} else if (damager instanceof Player) {
|
||||
boolean okay = true;
|
||||
if (Quests.citizens != null) {
|
||||
if (Quests.citizens.getNPCRegistry().isNPC(damager)) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(damager)) {
|
||||
okay = false;
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,11 @@
|
||||
package me.blackvein.quests.listeners;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -114,9 +117,9 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
if (quest.getGUIDisplay() != null) {
|
||||
if (ItemUtil.compareItems(clicked, quest.getGUIDisplay(), false) == 0) {
|
||||
if (quester.getCurrentQuests().size() >= plugin.maxQuests && plugin.maxQuests > 0) {
|
||||
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests() > 0) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (quester.getCompletedQuests().contains(quest.getName()) && quest.getPlanner().getCooldown() < 0) {
|
||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||
@ -136,7 +139,7 @@ public class PlayerListener implements Listener {
|
||||
if (quest.getRegion() != null) {
|
||||
boolean inRegion = false;
|
||||
Player p = quester.getPlayer();
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(p.getWorld());
|
||||
RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(p.getWorld());
|
||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||
while (it.hasNext()) {
|
||||
ProtectedRegion pr = it.next();
|
||||
@ -215,53 +218,69 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
if (!hasObjective) {
|
||||
if (plugin.questFactory.selectedBlockStarts.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
if (plugin.getQuestFactory().getSelectedBlockStarts().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer().getUniqueId(), block);
|
||||
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") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getEventFactory().getSelectedExplosionLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedExplosionLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getEventFactory().setSelectedExplosionLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getEventFactory().getSelectedEffectLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedEffectLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getEventFactory().setSelectedEffectLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getEventFactory().getSelectedMobLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedMobLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getEventFactory().setSelectedMobLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType()))+ ChatColor.GOLD + ")");
|
||||
} else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getEventFactory().getSelectedLightningLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedLightningLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getEventFactory().setSelectedLightningLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getEventFactory().getSelectedTeleportLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
Map<UUID, Block> temp = plugin.getEventFactory().getSelectedTeleportLocations();
|
||||
temp.put(evt.getPlayer().getUniqueId(), block);
|
||||
plugin.getEventFactory().setSelectedTeleportLocations(temp);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getQuestFactory().getSelectedKillLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedKillLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
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") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer().getUniqueId())) {
|
||||
} else if (plugin.getQuestFactory().getSelectedReachLocations().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedReachLocations.put(evt.getPlayer().getUniqueId(), block);
|
||||
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") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
} else if (player.isConversing() == false) {
|
||||
for (final Quest q : plugin.getQuests()) {
|
||||
if (q.getBlockStart() != null) {
|
||||
if (q.getBlockStart().equals(evt.getClickedBlock().getLocation())) {
|
||||
if (quester.getCurrentQuests().size() >= plugin.maxQuests && plugin.maxQuests > 0) {
|
||||
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests() > 0) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
} else {
|
||||
if (quester.getCompletedQuests().contains(q.getName())) {
|
||||
@ -516,7 +535,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (damager instanceof Player) {
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
@ -665,13 +684,13 @@ public class PlayerListener implements Listener {
|
||||
quester.setUUID(evt.getPlayer().getUniqueId());
|
||||
if (new File(plugin.getDataFolder(), "data" + File.separator + quester.getUUID() + ".yml").exists()) {
|
||||
quester.loadData();
|
||||
} else if (plugin.genFilesOnJoin) {
|
||||
} else if (plugin.getSettings().canGenFilesOnJoin()) {
|
||||
quester.saveData();
|
||||
}
|
||||
LinkedList<Quester> temp = plugin.getQuesters();
|
||||
temp.add(quester);
|
||||
plugin.setQuesters(temp);
|
||||
if (plugin.useCompass) {
|
||||
if (plugin.getSettings().canUseCompass()) {
|
||||
quester.resetCompass();
|
||||
}
|
||||
for (String s : quester.getCompletedQuests()) {
|
||||
@ -723,8 +742,10 @@ public class PlayerListener implements Listener {
|
||||
if (quester.hasData()) {
|
||||
quester.saveData();
|
||||
}
|
||||
if (plugin.questFactory.selectingNPCs.contains(evt.getPlayer())) {
|
||||
plugin.questFactory.selectingNPCs.remove(evt.getPlayer());
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getPlayer())) {
|
||||
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.remove(evt.getPlayer());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
}
|
||||
LinkedList<Quester> temp = plugin.getQuesters();
|
||||
for (Quester q : temp) {
|
||||
@ -741,7 +762,7 @@ public class PlayerListener implements Listener {
|
||||
if (evt.getFrom().getBlock().equals(evt.getTo().getBlock())) {
|
||||
return;
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(evt.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
@ -14,9 +14,11 @@ package me.blackvein.quests.prompts;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -150,7 +152,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA + Quester.prettyEnchantmentString(Quests.getEnchantment(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "9 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -165,7 +167,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.GRAY + "" + ChatColor.BOLD + "9 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDeliverItems") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -179,7 +181,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.GRAY + "" + ChatColor.BOLD + "10 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorTalkToNPCs") + ChatColor.GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||
}
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "11 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorKillNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -272,7 +274,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "18 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")\n";
|
||||
}
|
||||
if (Quests.denizen == null) {
|
||||
if (plugin.getDependencies().getDenizen() == null) {
|
||||
text += ChatColor.GRAY + "" + ChatColor.BOLD + "19 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + Lang.get("questDenNotInstalled") + ")\n";
|
||||
} else {
|
||||
if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
|
||||
@ -362,21 +364,21 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
return new EnchantmentListPrompt();
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new DeliveryListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new CreateStagePrompt(plugin, stageNum, questFactory, citizens);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new NPCIDsToTalkToPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new CreateStagePrompt(plugin, stageNum, questFactory, citizens);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
if (Quests.citizens != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new NPCKillListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
@ -412,7 +414,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
return new DelayMessagePrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("19")) {
|
||||
if (Quests.denizen == null) {
|
||||
if (plugin.getDependencies().getDenizen() == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen"));
|
||||
return new CreateStagePrompt(plugin, stageNum, questFactory, citizens);
|
||||
} else {
|
||||
@ -2124,7 +2126,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
questFactory.selectingNPCs.add((Player) context.getForWhom());
|
||||
HashSet<Player> temp = questFactory.getSelectingNpcs();
|
||||
temp.add((Player) context.getForWhom());
|
||||
questFactory.setSelectingNpcs(temp);
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||
}
|
||||
|
||||
@ -2149,7 +2153,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
}
|
||||
context.setSessionData(pref + CK.S_DELIVERY_NPCS, npcs);
|
||||
}
|
||||
questFactory.selectingNPCs.remove((Player) context.getForWhom());
|
||||
HashSet<Player> temp = questFactory.getSelectingNpcs();
|
||||
temp.remove((Player) context.getForWhom());
|
||||
questFactory.setSelectingNpcs(temp);
|
||||
return new DeliveryListPrompt();
|
||||
}
|
||||
}
|
||||
@ -2178,7 +2184,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
questFactory.selectingNPCs.add((Player) context.getForWhom());
|
||||
HashSet<Player> temp = questFactory.getSelectingNpcs();
|
||||
temp.add((Player) context.getForWhom());
|
||||
questFactory.setSelectingNpcs(temp);
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorNPCToTalkToPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||
}
|
||||
|
||||
@ -2201,7 +2209,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
return new NPCIDsToTalkToPrompt();
|
||||
}
|
||||
}
|
||||
questFactory.selectingNPCs.remove((Player) context.getForWhom());
|
||||
HashSet<Player> temp = questFactory.getSelectingNpcs();
|
||||
temp.remove((Player) context.getForWhom());
|
||||
questFactory.setSelectingNpcs(temp);
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null);
|
||||
@ -2298,7 +2308,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
questFactory.selectingNPCs.add((Player) context.getForWhom());
|
||||
HashSet<Player> temp = questFactory.getSelectingNpcs();
|
||||
temp.add((Player) context.getForWhom());
|
||||
questFactory.setSelectingNpcs(temp);
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||
}
|
||||
|
||||
@ -2323,7 +2335,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
}
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs);
|
||||
}
|
||||
questFactory.selectingNPCs.remove((Player) context.getForWhom());
|
||||
HashSet<Player> temp = questFactory.getSelectingNpcs();
|
||||
temp.remove((Player) context.getForWhom());
|
||||
questFactory.setSelectingNpcs(temp);
|
||||
return new NPCKillListPrompt();
|
||||
}
|
||||
}
|
||||
@ -2440,7 +2454,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoMobTypes"));
|
||||
return new MobListPrompt();
|
||||
} else {
|
||||
questFactory.selectedKillLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
Map<UUID, Block> temp = questFactory.getSelectedKillLocations();
|
||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
questFactory.setSelectedKillLocations(temp);
|
||||
return new MobLocationPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
@ -2627,7 +2643,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Block block = questFactory.selectedKillLocations.get(player.getUniqueId());
|
||||
Block block = questFactory.getSelectedKillLocations().get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
LinkedList<String> locs;
|
||||
@ -2638,14 +2654,18 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
}
|
||||
locs.add(Quests.getLocationInfo(loc));
|
||||
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs);
|
||||
questFactory.selectedKillLocations.remove(player.getUniqueId());
|
||||
Map<UUID, Block> temp = questFactory.getSelectedKillLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
questFactory.setSelectedKillLocations(temp);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoBlock"));
|
||||
return new MobLocationPrompt();
|
||||
}
|
||||
return new MobListPrompt();
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
questFactory.selectedKillLocations.remove(player.getUniqueId());
|
||||
Map<UUID, Block> temp = questFactory.getSelectedKillLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
questFactory.setSelectedKillLocations(temp);
|
||||
return new MobListPrompt();
|
||||
} else {
|
||||
return new MobLocationPrompt();
|
||||
@ -2748,7 +2768,9 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
questFactory.selectedReachLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
Map<UUID, Block> temp = questFactory.getSelectedReachLocations();
|
||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
questFactory.setSelectedReachLocations(temp);
|
||||
return new ReachLocationPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) {
|
||||
@ -2828,7 +2850,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||
Block block = questFactory.selectedReachLocations.get(player.getUniqueId());
|
||||
Block block = questFactory.getSelectedReachLocations().get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
Location loc = block.getLocation();
|
||||
LinkedList<String> locs;
|
||||
@ -2839,14 +2861,18 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
}
|
||||
locs.add(Quests.getLocationInfo(loc));
|
||||
context.setSessionData(pref + CK.S_REACH_LOCATIONS, locs);
|
||||
questFactory.selectedReachLocations.remove(player.getUniqueId());
|
||||
Map<UUID, Block> temp = questFactory.getSelectedReachLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
questFactory.setSelectedReachLocations(temp);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoBlockSelected"));
|
||||
return new ReachLocationPrompt();
|
||||
}
|
||||
return new ReachListPrompt();
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
questFactory.selectedReachLocations.remove(player.getUniqueId());
|
||||
Map<UUID, Block> temp = questFactory.getSelectedReachLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
questFactory.setSelectedReachLocations(temp);
|
||||
return new ReachListPrompt();
|
||||
} else {
|
||||
return new ReachLocationPrompt();
|
||||
@ -3807,10 +3833,10 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorCustom") + " -\n";
|
||||
if (plugin.customObjectives.isEmpty()) {
|
||||
if (plugin.getCustomObjectives().isEmpty()) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.DARK_PURPLE + "(" + Lang.get("stageEditorNoModules") + ") ";
|
||||
} else {
|
||||
for (CustomObjective co : plugin.customObjectives) {
|
||||
for (CustomObjective co : plugin.getCustomObjectives()) {
|
||||
text += ChatColor.DARK_PURPLE + " - " + co.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -3822,14 +3848,14 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : plugin.customObjectives) {
|
||||
for (CustomObjective co : plugin.getCustomObjectives()) {
|
||||
if (co.getName().equalsIgnoreCase(input)) {
|
||||
found = co;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == null) {
|
||||
for (CustomObjective co : plugin.customObjectives) {
|
||||
for (CustomObjective co : plugin.getCustomObjectives()) {
|
||||
if (co.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
found = co;
|
||||
break;
|
||||
@ -3895,7 +3921,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
String objName = list.getLast();
|
||||
text += objName + " -\n";
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : plugin.customObjectives) {
|
||||
for (CustomObjective co : plugin.getCustomObjectives()) {
|
||||
if (co.getName().equals(objName)) {
|
||||
found = co;
|
||||
break;
|
||||
@ -3917,7 +3943,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
|
||||
String objName = list.getLast();
|
||||
CustomObjective found = null;
|
||||
for (CustomObjective co : plugin.customObjectives) {
|
||||
for (CustomObjective co : plugin.getCustomObjectives()) {
|
||||
if (co.getName().equals(objName)) {
|
||||
found = co;
|
||||
break;
|
||||
|
@ -18,13 +18,13 @@ import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class DateTimePrompt extends FixedSetPrompt {
|
||||
|
||||
private Quests quests;
|
||||
private Quests plugin;
|
||||
private final Prompt oldPrompt;
|
||||
private String source = "";
|
||||
|
||||
public DateTimePrompt(Quests plugin, Prompt old, String origin) {
|
||||
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||
quests = plugin;
|
||||
this.plugin = plugin;
|
||||
oldPrompt = old;
|
||||
source = origin;
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
}
|
||||
TimeZone tz = TimeZone.getTimeZone((String) cc.getSessionData("tempZone"));
|
||||
cal.setTimeZone(tz);
|
||||
String[] iso = quests.lang.getISO().split("-");
|
||||
String[] iso = plugin.getLang().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("\\.");
|
||||
@ -154,14 +154,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
return new DayPrompt();
|
||||
} else {
|
||||
cc.setSessionData("tempDay", Integer.parseInt(input));
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new DayPrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,14 +184,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
return new MonthPrompt();
|
||||
} else {
|
||||
cc.setSessionData("tempMonth", Integer.parseInt(input) - 1);
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new MonthPrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,14 +214,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
return new YearPrompt();
|
||||
} else {
|
||||
cc.setSessionData("tempYear", Integer.parseInt(input));
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new YearPrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -244,14 +244,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
return new HourPrompt();
|
||||
} else {
|
||||
cc.setSessionData("tempHour", Integer.parseInt(input));
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new HourPrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -274,14 +274,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
return new MinutePrompt();
|
||||
} else {
|
||||
cc.setSessionData("tempMinute", Integer.parseInt(input));
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new MinutePrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -304,14 +304,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
return new SecondPrompt();
|
||||
} else {
|
||||
cc.setSessionData("tempSecond", Integer.parseInt(input));
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new SecondPrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -340,16 +340,16 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
cc.setSessionData("tempZone", t[0]);
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
quests.getLogger().severe("Unable to get time zone for converted offset " + input);
|
||||
plugin.getLogger().severe("Unable to get time zone for converted offset " + input);
|
||||
}
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new OffsetPrompt();
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -378,13 +378,13 @@ public class DateTimePrompt extends FixedSetPrompt {
|
||||
for (String z : zones) {
|
||||
if (z.toLowerCase().startsWith(input.toLowerCase())) {
|
||||
cc.setSessionData("tempZone", z);
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new ZonePrompt(zones);
|
||||
} else {
|
||||
return new DateTimePrompt(quests, oldPrompt, source);
|
||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class PlannerPrompt extends FixedSetPrompt {
|
||||
|
||||
private final Quests quests;
|
||||
private final Quests plugin;
|
||||
private final QuestFactory factory;
|
||||
|
||||
public PlannerPrompt(Quests plugin, QuestFactory qf) {
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||
quests = plugin;
|
||||
this.plugin = plugin;
|
||||
factory = qf;
|
||||
}
|
||||
|
||||
@ -81,9 +81,9 @@ public class PlannerPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new DateTimePrompt(quests, PlannerPrompt.this, "start");
|
||||
return new DateTimePrompt(plugin, PlannerPrompt.this, "start");
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new DateTimePrompt(quests, PlannerPrompt.this, "end");
|
||||
return new DateTimePrompt(plugin, PlannerPrompt.this, "end");
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RepeatPrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
@ -104,7 +104,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(quests, factory);
|
||||
return new PlannerPrompt(plugin, factory);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
|
||||
@ -123,7 +123,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
||||
+ Lang.get("stageEditorInvalidNumber"));
|
||||
return new RepeatPrompt();
|
||||
}
|
||||
return new PlannerPrompt(quests, factory);
|
||||
return new PlannerPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(quests, factory);
|
||||
return new PlannerPrompt(plugin, factory);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_COOLDOWN, null);
|
||||
@ -156,7 +156,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
||||
+ Lang.get("stageEditorInvalidNumber"));
|
||||
return new CooldownPrompt();
|
||||
}
|
||||
return new PlannerPrompt(quests, factory);
|
||||
return new PlannerPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
||||
|
||||
TimeZone tz = TimeZone.getTimeZone(date[6]);
|
||||
cal.setTimeZone(tz);
|
||||
String[] iso = quests.lang.getISO().split("-");
|
||||
String[] iso = plugin.getLang().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("\\.");
|
||||
|
@ -101,14 +101,14 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
} else {
|
||||
Player player = quester.getPlayer();
|
||||
if (!quester.getCompletedQuests().contains(q.getName())) {
|
||||
if (quester.getCurrentQuests().size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
|
||||
if (q.testRequirements(quester)) {
|
||||
quester.setQuestToTake(q.getName());
|
||||
String s = extracted(quester);
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
if (!plugin.askConfirmation) {
|
||||
if (!plugin.getSettings().canAskConfirmation()) {
|
||||
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).getQuestToTake()), false);
|
||||
} else {
|
||||
plugin.getConversationFactory().buildConversation((Conversable) player).begin();
|
||||
@ -118,11 +118,11 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
}
|
||||
} else if (quester.getCurrentQuests().containsKey(q) == false) {
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
} else if (quester.getCompletedQuests().contains(q.getName())) {
|
||||
if (quester.getCurrentQuests().size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||
if (quester.getCurrentQuests().size() < plugin.getSettings().getMaxQuests() || plugin.getSettings().getMaxQuests() < 1) {
|
||||
if (quester.getCooldownDifference(q) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||
@ -138,7 +138,7 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
if (!plugin.askConfirmation) {
|
||||
if (!plugin.getSettings().canAskConfirmation()) {
|
||||
plugin.getQuester(player.getUniqueId()).takeQuest(plugin.getQuest(plugin.getQuester(player.getUniqueId()).getQuestToTake()), false);
|
||||
} else {
|
||||
plugin.getConversationFactory().buildConversation((Conversable) player).begin();
|
||||
@ -146,7 +146,7 @@ public class QuestAcceptPrompt extends StringPrompt {
|
||||
}
|
||||
} else if (quester.getCurrentQuests().containsKey(q) == false) {
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ import me.blackvein.quests.util.MiscUtil;
|
||||
|
||||
public class RequirementsPrompt extends FixedSetPrompt {
|
||||
|
||||
private Quests quests;
|
||||
private Quests plugin;
|
||||
private final QuestFactory factory;
|
||||
|
||||
public RequirementsPrompt(Quests plugin, QuestFactory qf) {
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||
quests = plugin;
|
||||
this.plugin = plugin;
|
||||
factory = qf;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetMoney") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
int moneyReq = (Integer) context.getSessionData(CK.REQ_MONEY);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetMoney") + " (" + moneyReq + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetMoney") + " (" + moneyReq + " " + (moneyReq > 1 ? plugin.getCurrency(true) : plugin.getCurrency(false)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.REQ_QUEST_POINTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetQuestPoints") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
@ -95,7 +95,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + s + "\n";
|
||||
}
|
||||
}
|
||||
if (Quests.mcmmo != null) {
|
||||
if (plugin.getDependencies().getMcmmo() != null) {
|
||||
if (context.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetMcMMO") + " " + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -109,7 +109,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.GRAY + "7 - " + Lang.get("reqSetMcMMO") + " (" + Lang.get("reqNoMcMMO") + ")\n";
|
||||
}
|
||||
if (Quests.heroes != null) {
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null && context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("reqSetHeroes") + " " + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -159,16 +159,16 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
return new QuestListPrompt(false);
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
if (Quests.mcmmo != null) {
|
||||
if (plugin.getDependencies().getMcmmo() != null) {
|
||||
return new mcMMOPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (Quests.heroes != null) {
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
return new HeroesPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
return new CustomRequirementsPrompt();
|
||||
@ -178,7 +178,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
if (context.getSessionData(CK.REQ_MONEY) != null || context.getSessionData(CK.REQ_QUEST_POINTS) != null || context.getSessionData(CK.REQ_ITEMS) != null || context.getSessionData(CK.REQ_PERMISSION) != null || context.getSessionData(CK.REQ_QUEST) != null || context.getSessionData(CK.REQ_QUEST_BLOCK) != null || context.getSessionData(CK.REQ_MCMMO_SKILLS) != null || context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null || context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null || context.getSessionData(CK.REQ_CUSTOM) != null) {
|
||||
if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNoMessage"));
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
return factory.returnToMenu();
|
||||
@ -191,8 +191,8 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("reqMoneyPrompt");
|
||||
if (Quests.economy != null) {
|
||||
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + ((Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural())) + ChatColor.YELLOW);
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + ((plugin.getDependencies().getVaultEconomy().currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy().currencyNamePlural())) + ChatColor.YELLOW);
|
||||
} else {
|
||||
text = text.replaceAll("<money>", ChatColor.DARK_PURPLE + Lang.get("money") + ChatColor.YELLOW);
|
||||
}
|
||||
@ -217,9 +217,9 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_MONEY, null);
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,9 +248,9 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_QUEST_POINTS, null);
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("reqQuestListTitle") + "\n" + ChatColor.DARK_PURPLE;
|
||||
boolean none = true;
|
||||
for (Quest q : quests.getQuests()) {
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
text += q.getName() + ", ";
|
||||
none = false;
|
||||
}
|
||||
@ -286,7 +286,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
String[] args = input.split(Lang.get("charSemi"));
|
||||
LinkedList<String> questNames = new LinkedList<String>();
|
||||
for (String s : args) {
|
||||
if (quests.getQuest(s) == null) {
|
||||
if (plugin.getQuest(s) == null) {
|
||||
String text = Lang.get("reqNotAQuestName");
|
||||
text = text.replaceAll("<quest>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
|
||||
context.getForWhom().sendRawMessage(text);
|
||||
@ -296,7 +296,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listDuplicate"));
|
||||
return new QuestListPrompt(isRequiredQuest);
|
||||
}
|
||||
questNames.add(quests.getQuest(s).getName());
|
||||
questNames.add(plugin.getQuest(s).getName());
|
||||
}
|
||||
Collections.sort(questNames, new Comparator<String>() {
|
||||
|
||||
@ -317,7 +317,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(CK.REQ_QUEST_BLOCK, null);
|
||||
}
|
||||
}
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqListsNotSameSize"));
|
||||
return new ItemListPrompt();
|
||||
@ -466,7 +466,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_PERMISSION, null);
|
||||
}
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,10 +475,10 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("customRequirementsTitle") + "\n";
|
||||
if (quests.customRequirements.isEmpty()) {
|
||||
if (plugin.getCustomRequirements().isEmpty()) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.DARK_PURPLE + "(" + Lang.get("stageEditorNoModules") + ") ";
|
||||
} else {
|
||||
for (CustomRequirement cr : quests.customRequirements) {
|
||||
for (CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||
text += ChatColor.DARK_PURPLE + " - " + cr.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -490,14 +490,14 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
CustomRequirement found = null;
|
||||
for (CustomRequirement cr : quests.customRequirements) {
|
||||
for (CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||
if (cr.getName().equalsIgnoreCase(input)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == null) {
|
||||
for (CustomRequirement cr : quests.customRequirements) {
|
||||
for (CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||
if (cr.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
found = cr;
|
||||
break;
|
||||
@ -541,7 +541,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqCustomCleared"));
|
||||
}
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
return new RequirementCustomDataListPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -677,7 +677,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new mcMMOAmountsPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -795,7 +795,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new HeroesSecondaryPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -807,7 +807,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_PURPLE + Lang.get("heroesPrimaryTitle") + "\n";
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
|
||||
for (HeroClass hc : plugin.getDependencies().getHeroes().getClassManager().getClasses()) {
|
||||
if (hc.isPrimary()) {
|
||||
list.add(hc.getName());
|
||||
}
|
||||
@ -827,7 +827,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
HeroClass hc = Quests.heroes.getClassManager().getClass(input);
|
||||
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(input);
|
||||
if (hc != null) {
|
||||
if (hc.isPrimary()) {
|
||||
cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, hc.getName());
|
||||
@ -858,7 +858,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_PURPLE + Lang.get("heroesSecondaryTitle") + "\n";
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
|
||||
for (HeroClass hc : plugin.getDependencies().getHeroes().getClassManager().getClasses()) {
|
||||
if (hc.isSecondary()) {
|
||||
list.add(hc.getName());
|
||||
}
|
||||
@ -878,7 +878,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
HeroClass hc = Quests.heroes.getClassManager().getClass(input);
|
||||
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(input);
|
||||
if (hc != null) {
|
||||
if (hc.isSecondary()) {
|
||||
cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, hc.getName());
|
||||
@ -915,7 +915,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
||||
if (input.equalsIgnoreCase(Lang.get(Lang.get("cancel"))) == false) {
|
||||
context.setSessionData(CK.Q_FAIL_MESSAGE, input);
|
||||
}
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
return new RequirementsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
}
|
@ -40,12 +40,12 @@ import me.blackvein.quests.util.Lang;
|
||||
|
||||
public class RewardsPrompt extends FixedSetPrompt {
|
||||
|
||||
private final Quests quests;
|
||||
private final Quests plugin;
|
||||
private final QuestFactory factory;
|
||||
|
||||
public RewardsPrompt(Quests plugin, QuestFactory qf) {
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||
quests = plugin;
|
||||
this.plugin = plugin;
|
||||
factory = qf;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetMoney") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
int moneyRew = (Integer) context.getSessionData(CK.REW_MONEY);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetMoney") + " (" + moneyRew + " " + (moneyRew > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetMoney") + " (" + moneyRew + " " + (moneyRew > 1 ? plugin.getCurrency(true) : plugin.getCurrency(false)) + ")\n";
|
||||
}
|
||||
if (context.getSessionData(CK.REW_QUEST_POINTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetQuestPoints") + " (" + Lang.get("noneSet") + ")\n";
|
||||
@ -91,7 +91,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + perm + "\n";
|
||||
}
|
||||
}
|
||||
if (Quests.mcmmo != null) {
|
||||
if (plugin.getDependencies().getMcmmo() != null) {
|
||||
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetMcMMO") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -105,7 +105,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.GRAY + "7 - " + Lang.get("rewSetMcMMO") + " (" + Lang.get("reqNoMcMMO") + ")\n";
|
||||
}
|
||||
if (Quests.heroes != null) {
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetHeroes") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -119,7 +119,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.GRAY + "8 - " + Lang.get("rewSetHeroes") + " (" + Lang.get("reqNoHeroes") + ")\n";
|
||||
}
|
||||
if (Quests.phatLoots != null) {
|
||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||
if (context.getSessionData(CK.REW_PHAT_LOOTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("rewSetPhat") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
@ -160,22 +160,22 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
return new PermissionsPrompt();
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
if (Quests.mcmmo != null) {
|
||||
if (plugin.getDependencies().getMcmmo() != null) {
|
||||
return new mcMMOListPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (Quests.heroes != null) {
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
return new HeroesListPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
if (Quests.phatLoots != null) {
|
||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||
return new PhatLootsPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
return new CustomRewardsPrompt();
|
||||
@ -190,8 +190,8 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("rewMoneyPrompt");
|
||||
if (Quests.economy != null) {
|
||||
text = text.replaceAll("<money>", ChatColor.AQUA + (Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural()) + ChatColor.YELLOW);
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
text = text.replaceAll("<money>", ChatColor.AQUA + (plugin.getDependencies().getVaultEconomy().currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy().currencyNamePlural()) + ChatColor.YELLOW);
|
||||
} else {
|
||||
text = text.replaceAll("<money>", ChatColor.AQUA + Lang.get("money") + ChatColor.YELLOW);
|
||||
}
|
||||
@ -216,9 +216,9 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_MONEY, null);
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,9 +247,9 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_EXP, null);
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,9 +278,9 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_QUEST_POINTS, null);
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(CK.REW_ITEMS, null);
|
||||
return new ItemListPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -368,7 +368,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_COMMAND, null);
|
||||
}
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_PERMISSION, null);
|
||||
}
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewMcMMOListsNotSameSize"));
|
||||
return new mcMMOListPrompt();
|
||||
@ -612,7 +612,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewHeroesListsNotSameSize"));
|
||||
return new HeroesListPrompt();
|
||||
@ -638,7 +638,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_PURPLE + Lang.get("heroesClassesTitle") + "\n";
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
|
||||
for (HeroClass hc : plugin.getDependencies().getHeroes().getClassManager().getClasses()) {
|
||||
list.add(hc.getName());
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
@ -660,7 +660,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
String[] arr = input.split(" ");
|
||||
LinkedList<String> classes = new LinkedList<String>();
|
||||
for (String s : arr) {
|
||||
HeroClass hc = Quests.heroes.getClassManager().getClass(s);
|
||||
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(s);
|
||||
if (hc == null) {
|
||||
String text = Lang.get("rewHeroesInvalidClass");
|
||||
text = text.replaceAll("<input>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
|
||||
@ -738,13 +738,13 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
}
|
||||
loots.addAll(Arrays.asList(arr));
|
||||
cc.setSessionData(CK.REW_PHAT_LOOTS, loots);
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
cc.setSessionData(CK.REW_PHAT_LOOTS, null);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPhatLootsCleared"));
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -754,10 +754,10 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("customRewardsTitle") + "\n";
|
||||
if (quests.customRewards.isEmpty()) {
|
||||
if (plugin.getCustomRewards().isEmpty()) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.DARK_PURPLE + "(" + Lang.get("stageEditorNoModules") + ") ";
|
||||
} else {
|
||||
for (CustomReward cr : quests.customRewards) {
|
||||
for (CustomReward cr : plugin.getCustomRewards()) {
|
||||
text += ChatColor.DARK_PURPLE + " - " + cr.getName() + "\n";
|
||||
}
|
||||
}
|
||||
@ -769,14 +769,14 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
CustomReward found = null;
|
||||
for (CustomReward cr : quests.customRewards) {
|
||||
for (CustomReward cr : plugin.getCustomRewards()) {
|
||||
if (cr.getName().equalsIgnoreCase(input)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == null) {
|
||||
for (CustomReward cr : quests.customRewards) {
|
||||
for (CustomReward cr : plugin.getCustomRewards()) {
|
||||
if (cr.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
found = cr;
|
||||
break;
|
||||
@ -820,7 +820,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewCustomCleared"));
|
||||
}
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -882,7 +882,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
return new RewardCustomDataListPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||
return new RewardsPrompt(quests, factory);
|
||||
return new RewardsPrompt(plugin, factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ public class StagesPrompt extends StringPrompt {
|
||||
if (i < 0) {
|
||||
return new StagesPrompt(plugin, questFactory);
|
||||
} else if (i < (stages + 1) && i > 0) {
|
||||
return new CreateStagePrompt(plugin, (i), questFactory, Quests.citizens);
|
||||
return new CreateStagePrompt(plugin, (i), questFactory, plugin.getDependencies().getCitizens());
|
||||
} else if (i == (stages + 1)) {
|
||||
return new CreateStagePrompt(plugin, (stages + 1), questFactory, Quests.citizens);
|
||||
return new CreateStagePrompt(plugin, (stages + 1), questFactory, plugin.getDependencies().getCitizens());
|
||||
} else if (i == (stages + 2)) {
|
||||
return questFactory.returnToMenu();
|
||||
} else {
|
||||
|
@ -36,10 +36,9 @@ public class StageTimer implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (quester.getQuestData(quest).delayOver) {
|
||||
Player player = quester.getPlayer();
|
||||
if (quest.getStages().indexOf(quester.getCurrentStage(quest)) == (quest.getStages().size() - 1)) {
|
||||
if (quester.getCurrentStage(quest).getScript() != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.getCurrentStage(quest).getScript(), player);
|
||||
plugin.getDependencies().runDenizenScript(quester.getCurrentStage(quest).getScript(), quester);
|
||||
}
|
||||
if (quester.getCurrentStage(quest).getFinishEvent() != null) {
|
||||
quester.getCurrentStage(quest).getFinishEvent().fire(quester, quest);
|
||||
@ -50,7 +49,7 @@ public class StageTimer implements Runnable {
|
||||
int stageNum = quester.getCurrentQuests().get(quest) + 1;
|
||||
quester.hardQuit(quest);
|
||||
if (currentStage.getScript() != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(currentStage.getScript(), player);
|
||||
plugin.getDependencies().runDenizenScript(currentStage.getScript(), quester);
|
||||
}
|
||||
if (currentStage.getFinishEvent() != null) {
|
||||
currentStage.getFinishEvent().fire(quester, quest);
|
||||
@ -60,6 +59,7 @@ public class StageTimer implements Runnable {
|
||||
quester.getCurrentStage(quest).setDelay(-1);
|
||||
quester.getQuestData(quest).delayStartTime = 0;
|
||||
quester.getQuestData(quest).delayTimeLeft = -1;
|
||||
Player player = quester.getPlayer();
|
||||
String msg = Lang.get(player, "questObjectivesTitle");
|
||||
msg = msg.replace("<quest>", quest.getName());
|
||||
player.sendMessage(ChatColor.GOLD + msg);
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
|
||||
public class Lang {
|
||||
|
||||
@ -37,10 +38,12 @@ public class Lang {
|
||||
private static final LangToken tokens = new LangToken();
|
||||
private static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
|
||||
private final Quests plugin;
|
||||
private static PlaceholderAPIPlugin placeholder;
|
||||
|
||||
public Lang(Quests plugin) {
|
||||
tokens.initTokens();
|
||||
this.plugin = plugin;
|
||||
Lang.placeholder = plugin.getDependencies().getPlaceholderApi();
|
||||
}
|
||||
|
||||
public String getISO() {
|
||||
@ -237,7 +240,7 @@ public class Lang {
|
||||
for (String token : tokenMap.keySet()) {
|
||||
s = s.replace(token, tokenMap.get(token));
|
||||
s = s.replace(token.toUpperCase(), tokenMap.get(token));
|
||||
if (Quests.placeholder != null) {
|
||||
if (placeholder != null) {
|
||||
s = PlaceholderAPI.setPlaceholders(p, s);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class LocaleQuery {
|
||||
* @param durability Durability for the item being translated
|
||||
*/
|
||||
public void sendMessage(Player player, String message, Material material, short durability) {
|
||||
if (plugin.translateItems) {
|
||||
if (plugin.getSettings().canTranslateItems()) {
|
||||
String key = queryByType(material);
|
||||
if (key != null) {
|
||||
if (oldVersion) {
|
||||
@ -82,7 +82,7 @@ public class LocaleQuery {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void sendMessage(Player player, String message, Material material, short durability, Enchantment enchantment) {
|
||||
if (plugin.translateItems) {
|
||||
if (plugin.getSettings().canTranslateItems()) {
|
||||
String key = queryByType(material);
|
||||
if (key != null) {
|
||||
if (oldVersion) {
|
||||
@ -111,7 +111,7 @@ public class LocaleQuery {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void sendMessage(Player player, String message, EntityType type) {
|
||||
if (plugin.translateItems) {
|
||||
if (plugin.getSettings().canTranslateItems()) {
|
||||
String key = "";
|
||||
if (oldVersion) {
|
||||
key = "entity." + type.getName() + ".name";
|
||||
|
Loading…
Reference in New Issue
Block a user