mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 03:55:35 +01:00
Refactor to core module, part 6
This commit is contained in:
parent
47f52fbb1f
commit
7dbe851d8b
@ -1,9 +1,9 @@
|
||||
package me.blackvein.quests.player;
|
||||
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.quests.Objective;
|
||||
import me.blackvein.quests.QuestData;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import me.blackvein.quests.module.ICustomObjective;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -90,7 +90,7 @@ public interface IQuester extends Comparable<IQuester> {
|
||||
|
||||
void sendMessage(final String message);
|
||||
|
||||
Stage getCurrentStage(final IQuest quest);
|
||||
IStage getCurrentStage(final IQuest quest);
|
||||
|
||||
QuestData getQuestData(final IQuest quest);
|
||||
|
||||
@ -216,7 +216,7 @@ public interface IQuester extends Comparable<IQuester> {
|
||||
Set<String> dispatchMultiplayerEverything(final IQuest quest, final ObjectiveType type,
|
||||
final BiFunction<IQuester, IQuest, Void> fun);
|
||||
|
||||
Set<String> dispatchMultiplayerObjectives(final IQuest quest, final Stage currentStage,
|
||||
Set<String> dispatchMultiplayerObjectives(final IQuest quest, final IStage currentStage,
|
||||
final Function<IQuester, Void> fun);
|
||||
|
||||
List<IQuester> getMultiplayerQuesters(final IQuest quest);
|
||||
|
@ -39,9 +39,9 @@ public interface IQuest extends Comparable<IQuest> {
|
||||
|
||||
void setGUIDisplay(final ItemStack guiDisplay);
|
||||
|
||||
Stage getStage(final int index);
|
||||
IStage getStage(final int index);
|
||||
|
||||
LinkedList<Stage> getStages();
|
||||
LinkedList<IStage> getStages();
|
||||
|
||||
NPC getNpcStart();
|
||||
|
||||
@ -67,7 +67,7 @@ public interface IQuest extends Comparable<IQuest> {
|
||||
|
||||
void setStage(final IQuester quester, final int stage);
|
||||
|
||||
boolean updateCompass(final IQuester quester, final Stage stage);
|
||||
boolean updateCompass(final IQuester quester, final IStage stage);
|
||||
|
||||
boolean testRequirements(final IQuester quester);
|
||||
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
public interface Stage {
|
||||
public interface IStage {
|
||||
LinkedList<ItemStack> getBlocksToBreak();
|
||||
|
||||
boolean addBlockToBreak(ItemStack blockToBreak);
|
@ -18,7 +18,7 @@ import me.blackvein.quests.events.quester.QuesterPreUpdateObjectiveEvent;
|
||||
import me.blackvein.quests.module.ICustomObjective;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.quests.BukkitObjective;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -163,7 +163,7 @@ public abstract class CustomObjective implements ICustomObjective, Listener {
|
||||
final Quest quest) {
|
||||
final IQuester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester != null) {
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
final IStage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ import me.blackvein.quests.quests.BukkitPlanner;
|
||||
import me.blackvein.quests.quests.BukkitRequirements;
|
||||
import me.blackvein.quests.quests.BukkitRewards;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.quests.Options;
|
||||
import me.blackvein.quests.quests.Planner;
|
||||
import me.blackvein.quests.quests.Requirements;
|
||||
import me.blackvein.quests.quests.Rewards;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.util.ConfigUtil;
|
||||
import me.blackvein.quests.util.InventoryUtil;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
@ -82,7 +82,7 @@ public class Quest implements IQuest {
|
||||
protected String description;
|
||||
protected String finished;
|
||||
protected ItemStack guiDisplay = null;
|
||||
private final LinkedList<Stage> orderedStages = new LinkedList<>();
|
||||
private final LinkedList<IStage> orderedStages = new LinkedList<>();
|
||||
protected UUID npcStart;
|
||||
protected Location blockStart;
|
||||
protected String regionStart = null;
|
||||
@ -174,7 +174,7 @@ public class Quest implements IQuest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stage getStage(final int index) {
|
||||
public IStage getStage(final int index) {
|
||||
try {
|
||||
return orderedStages.get(index);
|
||||
} catch (final Exception e) {
|
||||
@ -183,7 +183,7 @@ public class Quest implements IQuest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<Stage> getStages() {
|
||||
public LinkedList<IStage> getStages() {
|
||||
return orderedStages;
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class Quest implements IQuest {
|
||||
* @param allowSharedProgress Whether to distribute progress to fellow questers
|
||||
*/
|
||||
public void nextStage(final IQuester quester, final boolean allowSharedProgress) {
|
||||
final Stage currentStage = quester.getCurrentStage(this);
|
||||
final IStage currentStage = quester.getCurrentStage(this);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("Current stage was null for quester " + quester.getPlayer().getUniqueId());
|
||||
return;
|
||||
@ -299,7 +299,7 @@ public class Quest implements IQuest {
|
||||
* Force player to proceed to the specified stage
|
||||
*
|
||||
* @param quester Player to force
|
||||
* @param stage Stage number to specify
|
||||
* @param stage IStage number to specify
|
||||
* @throws IndexOutOfBoundsException if stage does not exist
|
||||
*/
|
||||
public void setStage(final IQuester quester, final int stage) throws IndexOutOfBoundsException {
|
||||
@ -309,8 +309,8 @@ public class Quest implements IQuest {
|
||||
+ player.getName();
|
||||
throw new IndexOutOfBoundsException(msg);
|
||||
}
|
||||
final Stage currentStage = quester.getCurrentStage(this);
|
||||
final Stage nextStage = getStage(stage);
|
||||
final IStage currentStage = quester.getCurrentStage(this);
|
||||
final IStage nextStage = getStage(stage);
|
||||
if (player.isOnline()) {
|
||||
final QuesterPreChangeStageEvent preEvent
|
||||
= new QuesterPreChangeStageEvent((Quester) quester, this, currentStage, nextStage);
|
||||
@ -422,7 +422,7 @@ public class Quest implements IQuest {
|
||||
* @param stage The stage to process for targets
|
||||
* @return true if an attempt was made successfully
|
||||
*/
|
||||
public boolean updateCompass(final IQuester quester, final Stage stage) {
|
||||
public boolean updateCompass(final IQuester quester, final IStage stage) {
|
||||
if (quester == null) {
|
||||
return false;
|
||||
}
|
||||
@ -1139,7 +1139,7 @@ public class Quest implements IQuest {
|
||||
}
|
||||
final Player player = quester.getPlayer();
|
||||
if (!ignoreFailAction) {
|
||||
final Stage stage = quester.getCurrentStage(this);
|
||||
final IStage stage = quester.getCurrentStage(this);
|
||||
if (stage != null && stage.getFailAction() != null) {
|
||||
quester.getCurrentStage(this).getFailAction().fire(quester, this);
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ import me.blackvein.quests.item.QuestJournal;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.quests.BukkitObjective;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.quests.Objective;
|
||||
import me.blackvein.quests.quests.Planner;
|
||||
import me.blackvein.quests.quests.Requirements;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.storage.Storage;
|
||||
import me.blackvein.quests.tasks.StageTimer;
|
||||
import me.blackvein.quests.util.ConfigUtil;
|
||||
@ -393,7 +393,7 @@ public class Quester implements IQuester {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stage getCurrentStage(final IQuest quest) {
|
||||
public IStage getCurrentStage(final IQuest quest) {
|
||||
if (currentQuests.containsKey(quest)) {
|
||||
return quest.getStage(currentQuests.get(quest));
|
||||
}
|
||||
@ -574,7 +574,7 @@ public class Quester implements IQuester {
|
||||
plugin.getLogger().severe("Unable to add quest" + quest.getName() + " for player " + offlinePlayer.getName()
|
||||
+ ". Consider resetting player data or report on Github");
|
||||
}
|
||||
final Stage stage = quest.getStage(0);
|
||||
final IStage stage = quest.getStage(0);
|
||||
if (!ignoreRequirements) {
|
||||
final Requirements requirements = quest.getRequirements();
|
||||
if (requirements.getMoney() > 0) {
|
||||
@ -908,7 +908,7 @@ public class Quester implements IQuester {
|
||||
return objectives;
|
||||
}
|
||||
final QuestData data = getQuestData(quest);
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
final LinkedList<String> objectives = new LinkedList<>();
|
||||
for (final ItemStack e : stage.getBlocksToBreak()) {
|
||||
for (final ItemStack e2 : data.blocksBroken) {
|
||||
@ -1367,7 +1367,7 @@ public class Quester implements IQuester {
|
||||
* milkCow, catchFish, killMob, deliverItem, killPlayer, talkToNPC,
|
||||
* killNPC, tameMob, shearSheep, password, reachLocation
|
||||
*
|
||||
* @deprecated Use {@link Stage#containsObjective(ObjectiveType)}
|
||||
* @deprecated Use {@link IStage#containsObjective(ObjectiveType)}
|
||||
* @param quest The quest to check objectives of
|
||||
* @param name The type of objective to check for
|
||||
* @return true if stage contains specified objective
|
||||
@ -2386,7 +2386,7 @@ public class Quester implements IQuester {
|
||||
if (questData == null) {
|
||||
return;
|
||||
}
|
||||
final Stage currentStage = getCurrentStage(quest);
|
||||
final IStage currentStage = getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
return;
|
||||
}
|
||||
@ -2435,7 +2435,7 @@ public class Quester implements IQuester {
|
||||
if (questData == null) {
|
||||
return;
|
||||
}
|
||||
final Stage currentStage = getCurrentStage(quest);
|
||||
final IStage currentStage = getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
return;
|
||||
}
|
||||
@ -2486,7 +2486,7 @@ public class Quester implements IQuester {
|
||||
if (entityType == null) {
|
||||
return;
|
||||
}
|
||||
final Stage currentStage = getCurrentStage(quest);
|
||||
final IStage currentStage = getCurrentStage(quest);
|
||||
if (currentStage.getMobsToKill() == null) {
|
||||
return;
|
||||
}
|
||||
@ -2556,7 +2556,7 @@ public class Quester implements IQuester {
|
||||
if (questData == null) {
|
||||
return;
|
||||
}
|
||||
final Stage currentStage = getCurrentStage(quest);
|
||||
final IStage currentStage = getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
return;
|
||||
}
|
||||
@ -2684,7 +2684,7 @@ public class Quester implements IQuester {
|
||||
if (entityType == null) {
|
||||
return;
|
||||
}
|
||||
final Stage currentStage = getCurrentStage(quest);
|
||||
final IStage currentStage = getCurrentStage(quest);
|
||||
if (currentStage.getMobsToTame() == null) {
|
||||
return;
|
||||
}
|
||||
@ -2735,7 +2735,7 @@ public class Quester implements IQuester {
|
||||
if (color == null) {
|
||||
return;
|
||||
}
|
||||
final Stage currentStage = getCurrentStage(quest);
|
||||
final IStage currentStage = getCurrentStage(quest);
|
||||
if (currentStage.getSheepToShear() == null) {
|
||||
return;
|
||||
}
|
||||
@ -3289,7 +3289,7 @@ public class Quester implements IQuester {
|
||||
return;
|
||||
}
|
||||
if (quest.getStage(stage) == null) {
|
||||
plugin.getLogger().severe("Unable to find Stage " + stage + " of quest ID " + quest.getId());
|
||||
plugin.getLogger().severe("Unable to find IStage " + stage + " of quest ID " + quest.getId());
|
||||
return;
|
||||
}
|
||||
if (!quest.getStage(stage).getBlocksToBreak().isEmpty()) {
|
||||
@ -3593,7 +3593,7 @@ public class Quester implements IQuester {
|
||||
if (!questData.mobsTamed.isEmpty()) {
|
||||
questSec.set("mob-tame-amounts", questData.mobsTamed);
|
||||
}
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
if (stage != null) {
|
||||
if (stage.getFishToCatch() != null) {
|
||||
questSec.set("fish-caught", questData.getFishCaught());
|
||||
@ -3754,7 +3754,7 @@ public class Quester implements IQuester {
|
||||
boolean exists = false;
|
||||
for (final IQuest q : plugin.getLoadedQuests()) {
|
||||
if (q.getId().equalsIgnoreCase(quest.getId())) {
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
if (stage != null) {
|
||||
quest.updateCompass(this, stage);
|
||||
// TODO - decide whether or not to handle this
|
||||
@ -3962,7 +3962,7 @@ public class Quester implements IQuester {
|
||||
return;
|
||||
}
|
||||
for (final IQuest quest : currentQuests.keySet()) {
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
if (stage != null && quest.updateCompass(this, stage)) {
|
||||
break;
|
||||
}
|
||||
@ -3995,7 +3995,7 @@ public class Quester implements IQuester {
|
||||
if (list.size() > 0) {
|
||||
final IQuest quest = plugin.getQuestById(list.get(index));
|
||||
compassTargetQuestId = quest.getId();
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
if (stage != null) {
|
||||
quest.updateCompass(Quester.this, stage);
|
||||
if (notify) {
|
||||
@ -4081,7 +4081,7 @@ public class Quester implements IQuester {
|
||||
* @param currentStage The current stage of the quest
|
||||
* @param fun The function to execute, the event call
|
||||
*/
|
||||
public Set<String> dispatchMultiplayerObjectives(final IQuest quest, final Stage currentStage,
|
||||
public Set<String> dispatchMultiplayerObjectives(final IQuest quest, final IStage currentStage,
|
||||
final Function<IQuester, Void> fun) {
|
||||
final Set<String> appliedQuestIDs = new HashSet<>();
|
||||
if (quest.getOptions().getShareProgressLevel() == 2) {
|
||||
@ -4310,7 +4310,7 @@ public class Quester implements IQuester {
|
||||
}
|
||||
|
||||
public boolean meetsCondition(final IQuest quest, final boolean giveReason) {
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
if (stage != null && stage.getCondition() != null && !stage.getCondition().check(this, quest)) {
|
||||
if (stage.getCondition().isFailQuest()) {
|
||||
if (giveReason) {
|
||||
|
@ -48,14 +48,13 @@ import me.blackvein.quests.logging.QuestsLog4JFilter;
|
||||
import me.blackvein.quests.module.ICustomObjective;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.quests.BukkitQuestFactory;
|
||||
import me.blackvein.quests.quests.BukkitStage;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.Options;
|
||||
import me.blackvein.quests.quests.Planner;
|
||||
import me.blackvein.quests.quests.QuestFactory;
|
||||
import me.blackvein.quests.quests.Requirements;
|
||||
import me.blackvein.quests.quests.Rewards;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.statistics.Metrics;
|
||||
import me.blackvein.quests.storage.Storage;
|
||||
import me.blackvein.quests.storage.StorageFactory;
|
||||
@ -175,6 +174,8 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
public void onEnable() {
|
||||
/*----> WARNING: ORDER OF STEPS MATTERS <----*/
|
||||
|
||||
((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addFilter(new QuestsLog4JFilter());
|
||||
|
||||
// 1 - Initialize variables
|
||||
bukkitVersion = Bukkit.getServer().getBukkitVersion().split("-")[0];
|
||||
settings = new Settings(this);
|
||||
@ -273,7 +274,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
});
|
||||
|
||||
// 12 - Delay loading of Quests, Actions and modules
|
||||
((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addFilter(new QuestsLog4JFilter());
|
||||
delayLoadQuestInfo();
|
||||
}
|
||||
|
||||
@ -1069,7 +1069,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
return;
|
||||
}
|
||||
final QuestData data = quester.getQuestData(quest);
|
||||
final Stage stage = quester.getCurrentStage(quest);
|
||||
final IStage stage = quester.getCurrentStage(quest);
|
||||
for (final ItemStack e : stage.getBlocksToBreak()) {
|
||||
for (final ItemStack e2 : data.blocksBroken) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
@ -2379,10 +2379,10 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
try {
|
||||
stageNum = Integer.parseInt(stage);
|
||||
} catch (final NumberFormatException e) {
|
||||
getLogger().severe("Stage key " + stage + "must be a number!");
|
||||
getLogger().severe("IStage key " + stage + "must be a number!");
|
||||
continue;
|
||||
}
|
||||
final BukkitStage oStage = new BukkitStage();
|
||||
final Stage oStage = new Stage();
|
||||
List<String> breakNames = new LinkedList<>();
|
||||
List<Integer> breakAmounts = new LinkedList<>();
|
||||
List<Short> breakDurability = new LinkedList<>();
|
||||
@ -3954,7 +3954,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
+ " for " + quest.getName() + " was null");
|
||||
return;
|
||||
}
|
||||
final Stage oStage = quest.getStage(Integer.parseInt(stageNum) - 1);
|
||||
final IStage oStage = quest.getStage(Integer.parseInt(stageNum) - 1);
|
||||
oStage.clearCustomObjectives();
|
||||
oStage.clearCustomObjectiveCounts();
|
||||
oStage.clearCustomObjectiveData();
|
||||
@ -3982,7 +3982,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
oStage.addCustomObjectiveData(data);
|
||||
}
|
||||
} else {
|
||||
throw new QuestFormatException(name + " custom objective not found for Stage "
|
||||
throw new QuestFormatException(name + " custom objective not found for IStage "
|
||||
+ stageNum, questKey);
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,13 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package me.blackvein.quests.quests;
|
||||
package me.blackvein.quests;
|
||||
|
||||
import me.blackvein.quests.actions.IAction;
|
||||
import me.blackvein.quests.conditions.ICondition;
|
||||
import me.blackvein.quests.module.ICustomObjective;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -27,7 +28,7 @@ import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class BukkitStage implements Stage {
|
||||
public class Stage implements IStage {
|
||||
|
||||
private LinkedList<ItemStack> blocksToBreak = new LinkedList<>();
|
||||
private LinkedList<ItemStack> blocksToDamage = new LinkedList<>();
|
@ -15,7 +15,7 @@ package me.blackvein.quests.convo.actions.main;
|
||||
import me.blackvein.quests.actions.IAction;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
import me.blackvein.quests.convo.actions.ActionsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.actions.ActionsEditorStringPrompt;
|
||||
@ -1018,7 +1018,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
if (modifiedName != null) {
|
||||
modName = modifiedName;
|
||||
for (final IQuest q : plugin.getLoadedQuests()) {
|
||||
for (final Stage s : q.getStages()) {
|
||||
for (final IStage s : q.getStages()) {
|
||||
if (s.getFinishAction() != null && s.getFinishAction().getName() != null) {
|
||||
if (s.getFinishAction().getName().equalsIgnoreCase(modifiedName)) {
|
||||
modified.add(q.getName());
|
||||
|
@ -15,7 +15,7 @@ package me.blackvein.quests.convo.actions.menu;
|
||||
import me.blackvein.quests.actions.IAction;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
import me.blackvein.quests.convo.actions.ActionsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.actions.ActionsEditorStringPrompt;
|
||||
@ -296,7 +296,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
||||
final IAction a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||
for (final Stage stage : quest.getStages()) {
|
||||
for (final IStage stage : quest.getStages()) {
|
||||
if (stage.getFinishAction() != null
|
||||
&& stage.getFinishAction().getName().equalsIgnoreCase(a.getName())) {
|
||||
used.add(quest.getName());
|
||||
|
@ -15,7 +15,7 @@ package me.blackvein.quests.convo.conditions.main;
|
||||
import me.blackvein.quests.conditions.ICondition;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorStringPrompt;
|
||||
@ -483,7 +483,7 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
|
||||
if (modifiedName != null) {
|
||||
modName = modifiedName;
|
||||
for (final IQuest q : plugin.getLoadedQuests()) {
|
||||
for (final Stage s : q.getStages()) {
|
||||
for (final IStage s : q.getStages()) {
|
||||
if (s.getCondition() != null && s.getCondition().getName() != null) {
|
||||
if (s.getCondition().getName().equalsIgnoreCase(modifiedName)) {
|
||||
modified.add(q.getName());
|
||||
|
@ -15,7 +15,7 @@ package me.blackvein.quests.convo.conditions.menu;
|
||||
import me.blackvein.quests.conditions.ICondition;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorStringPrompt;
|
||||
@ -296,7 +296,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
||||
final ICondition c = plugin.getCondition(input);
|
||||
if (c != null) {
|
||||
for (final IQuest quest : plugin.getLoadedQuests()) {
|
||||
for (final Stage stage : quest.getStages()) {
|
||||
for (final IStage stage : quest.getStages()) {
|
||||
if (stage.getCondition() != null
|
||||
&& stage.getCondition().getName().equalsIgnoreCase(c.getName())) {
|
||||
used.add(quest.getName());
|
||||
|
@ -14,7 +14,7 @@ package me.blackvein.quests.events.quester;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -24,10 +24,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class QuesterPostChangeStageEvent extends QuesterEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final IQuest quest;
|
||||
private final Stage current;
|
||||
private final Stage next;
|
||||
private final IStage current;
|
||||
private final IStage next;
|
||||
|
||||
public QuesterPostChangeStageEvent(final Quester quester, final IQuest quest, final Stage current, final Stage next) {
|
||||
public QuesterPostChangeStageEvent(final Quester quester, final IQuest quest, final IStage current, final IStage next) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
this.current = current;
|
||||
@ -43,11 +43,11 @@ public class QuesterPostChangeStageEvent extends QuesterEvent {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public Stage getCurrentStage() {
|
||||
public IStage getCurrentStage() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public Stage getNextStage() {
|
||||
public IStage getNextStage() {
|
||||
return next;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ package me.blackvein.quests.events.quester;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -25,11 +25,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class QuesterPreChangeStageEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final IQuest quest;
|
||||
private final Stage current;
|
||||
private final Stage next;
|
||||
private final IStage current;
|
||||
private final IStage next;
|
||||
private boolean cancel = false;;
|
||||
|
||||
public QuesterPreChangeStageEvent(final Quester quester, final IQuest quest, final Stage current, final Stage next) {
|
||||
public QuesterPreChangeStageEvent(final Quester quester, final IQuest quest, final IStage current, final IStage next) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
this.current = current;
|
||||
@ -45,11 +45,11 @@ public class QuesterPreChangeStageEvent extends QuesterEvent implements Cancella
|
||||
return quest;
|
||||
}
|
||||
|
||||
public Stage getCurrentStage() {
|
||||
public IStage getCurrentStage() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public Stage getNextStage() {
|
||||
public IStage getNextStage() {
|
||||
return next;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import me.blackvein.quests.events.quester.QuesterPostUpdateObjectiveEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreUpdateObjectiveEvent;
|
||||
@ -69,7 +69,7 @@ public class BlockListener implements Listener {
|
||||
continue;
|
||||
}
|
||||
if (quester.getCurrentQuests().containsKey(quest)) {
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
final IStage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("Player " + player.getName() + " (" + player.getUniqueId()
|
||||
+ ") has invalid stage for quest " + quest.getName() + " (" + quest.getId() + ")");
|
||||
|
@ -15,8 +15,8 @@ package me.blackvein.quests.listeners;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.quests.Requirements;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.events.command.QuestsCommandPreQuestsEditorEvent;
|
||||
import me.blackvein.quests.events.command.QuestsCommandPreQuestsJournalEvent;
|
||||
import me.blackvein.quests.events.command.QuestsCommandPreQuestsListEvent;
|
||||
@ -200,7 +200,7 @@ public class CmdExecutor implements CommandExecutor {
|
||||
final IQuester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (!quester.getCurrentQuests().isEmpty()) {
|
||||
for (final IQuest q : quester.getCurrentQuests().keySet()) {
|
||||
final Stage stage = quester.getCurrentStage(q);
|
||||
final IStage stage = quester.getCurrentStage(q);
|
||||
q.updateCompass(quester, stage);
|
||||
if (plugin.getQuester(player.getUniqueId()).getQuestData(q).getDelayStartTime() == 0) {
|
||||
final String msg = Lang.get(player, "questObjectivesTitle")
|
||||
|
@ -15,7 +15,7 @@ package me.blackvein.quests.listeners;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
@ -485,7 +485,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (quester.getCurrentQuests().containsKey(quest)) {
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
final IStage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
continue;
|
||||
}
|
||||
@ -545,7 +545,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
final IStage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
|
||||
+ " on command for quest " + quest.getName());
|
||||
@ -734,7 +734,7 @@ public class PlayerListener implements Listener {
|
||||
if (plugin.canUseQuests(target.getUniqueId())) {
|
||||
final IQuester quester = plugin.getQuester(target.getUniqueId());
|
||||
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||
final Stage stage = quester.getCurrentStage(quest);
|
||||
final IStage stage = quester.getCurrentStage(quest);
|
||||
if (stage != null && stage.getDeathAction() != null) {
|
||||
quester.getCurrentStage(quest).getDeathAction().fire(quester, quest);
|
||||
}
|
||||
@ -913,7 +913,7 @@ public class PlayerListener implements Listener {
|
||||
if (plugin.canUseQuests(evt.getPlayer().getUniqueId())) {
|
||||
final IQuester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
for (final IQuest quest : quester.getCurrentQuests().keySet()) {
|
||||
final Stage currentStage = quester.getCurrentStage(quest);
|
||||
final IStage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
plugin.getLogger().severe("currentStage was null for " + quester.getUUID().toString()
|
||||
+ " on quit for quest " + quest.getName());
|
||||
|
@ -23,8 +23,12 @@ public class QuestsLog4JFilter extends AbstractFilter {
|
||||
if (message == null) {
|
||||
return Result.NEUTRAL;
|
||||
}
|
||||
// Hikari tries to nag author about unavoidable logger usage
|
||||
if (message.contains("[PikaMug]")) {
|
||||
return Result.DENY;
|
||||
}
|
||||
// Paper outputs errors when dependencies for module events are missing
|
||||
return message.contains("Plugin Quests") ? Result.DENY : Result.NEUTRAL;
|
||||
return message.startsWith("Plugin Quests") ? Result.DENY : Result.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -279,7 +279,7 @@ public class BukkitQuestFactory implements QuestFactory, ConversationAbandonedLi
|
||||
context.setSessionData(CK.OPT_HANDLE_OFFLINE_PLAYERS, opt.canHandleOfflinePlayers());
|
||||
// Stages (Objectives)
|
||||
int index = 1;
|
||||
for (final Stage stage : q.getStages()) {
|
||||
for (final IStage stage : q.getStages()) {
|
||||
final String pref = "stage" + index;
|
||||
index++;
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
|
@ -15,7 +15,7 @@ package me.blackvein.quests.storage.implementation.file;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.quests.Stage;
|
||||
import me.blackvein.quests.quests.IStage;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.storage.implementation.StorageImplementation;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -159,7 +159,7 @@ public class SeparatedYamlStorage implements StorageImplementation {
|
||||
if (quest == null || !quester.getCurrentQuests().containsKey(quest)) {
|
||||
continue;
|
||||
}
|
||||
final Stage stage = quester.getCurrentStage(quest);
|
||||
final IStage stage = quester.getCurrentStage(quest);
|
||||
if (stage == null) {
|
||||
quest.completeQuest(quester);
|
||||
plugin.getLogger().severe("[Quests] Invalid stage number for player: \"" + uniqueId + "\" on Quest \""
|
||||
|
Loading…
Reference in New Issue
Block a user