From a5df50de92fc3eb4b3d2790f5543eccde1497ba6 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Wed, 21 Oct 2015 06:55:06 +0100 Subject: [PATCH] On going map tutorials started and finished. --- .../game/clans/clans/ClansDisplay.java | 2 + .../game/clans/tutorials/Tutorial.java | 4 +- .../game/clans/tutorials/TutorialManager.java | 2 + .../game/clans/tutorials/TutorialType.java | 4 +- .../commands/OngoingOptOutCommand.java | 31 ++++++++++++ .../types/TutorialGettingStarted.java | 6 +-- .../tutorials/types/TutorialOnGoingMap.java | 49 +++++++++++++++++++ 7 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/commands/OngoingOptOutCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialOnGoingMap.java diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDisplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDisplay.java index 3a2d62687..a2779ee34 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDisplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDisplay.java @@ -23,6 +23,7 @@ import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.tutorials.TutorialManager; import mineplex.game.clans.tutorials.TutorialType; import mineplex.game.clans.tutorials.types.TutorialGettingStarted; +import mineplex.game.clans.tutorials.types.TutorialOnGoingMap; public class ClansDisplay extends MiniPlugin { @@ -115,6 +116,7 @@ public class ClansDisplay extends MiniPlugin UtilTextMiddle.display("", ownerString, 0, 25, 10, player); UtilPlayer.message(player, F.main("Territory", ownerString)); ((TutorialGettingStarted) TutorialManager.Instance.getTutorials().get(TutorialType.GETTING_STARTED)).onEnterTerritory(player, ownerString); + ((TutorialOnGoingMap) TutorialManager.Instance.getTutorials().get(TutorialType.ON_GOING)).onEnterTerritory(player, ownerString); } public int width = 8; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index f2214e3e3..d109f7c6a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -34,7 +34,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener protected final TutorialManager _manager; protected final GoldManager _goldManager; protected final ClansManager _clansManager; - private final TaskManager _taskManager; + protected final TaskManager _taskManager; private final int _rewardAmount; @@ -60,7 +60,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener { ArrayList lines = new ArrayList<>(); - if (!isInTutorial(player) && _doScoreboard) + if (!isInTutorial(player) || !_doScoreboard) { return lines; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java index 788268ad1..17a852cef 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java @@ -17,6 +17,7 @@ import mineplex.game.clans.tutorials.commands.EndTutorialCommand; import mineplex.game.clans.tutorials.commands.QAResetCommand; import mineplex.game.clans.tutorials.commands.TaskInfoCommand; import mineplex.game.clans.tutorials.types.TutorialGettingStarted; +import mineplex.game.clans.tutorials.types.TutorialOnGoingMap; public class TutorialManager extends MiniPlugin { @@ -36,6 +37,7 @@ public class TutorialManager extends MiniPlugin _taskManager = taskManager; _tutorials.put(TutorialType.GETTING_STARTED, new TutorialGettingStarted(this, clansManager, goldManager, taskManager)); + _tutorials.put(TutorialType.ON_GOING, new TutorialOnGoingMap(this, clansManager, goldManager, taskManager)); registerEvents(_tutorials.get(TutorialType.GETTING_STARTED)); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialType.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialType.java index 0639c2dbc..d48c1c987 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialType.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialType.java @@ -1,10 +1,12 @@ package mineplex.game.clans.tutorials; import mineplex.game.clans.tutorials.types.TutorialGettingStarted; +import mineplex.game.clans.tutorials.types.TutorialOnGoingMap; public enum TutorialType { - GETTING_STARTED(TutorialGettingStarted.class, "Getting Started", "GettingStartedTutorial"); + GETTING_STARTED(TutorialGettingStarted.class, "Getting Started", "GettingStartedTutorial"), + ON_GOING(TutorialOnGoingMap.class, "Ongoing Map", "OngoingMapTutorial"); private final Class _clazz; private final String _uniqueId; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/commands/OngoingOptOutCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/commands/OngoingOptOutCommand.java new file mode 100644 index 000000000..cb30efe42 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/commands/OngoingOptOutCommand.java @@ -0,0 +1,31 @@ +package mineplex.game.clans.tutorials.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.tutorials.TutorialManager; + +public class OngoingOptOutCommand extends CommandBase +{ + public OngoingOptOutCommand(final TutorialManager plugin) + { + super(plugin, Rank.ALL, "optout"); + } + + @Override + public void Execute(final Player caller, final String[] args) + { + Plugin.getTaskManager().completedTask(new Callback() + { + public void run(Boolean completed) + { + UtilPlayer.message(caller, F.main("Tutorials", "You have opted out of territory warnings, be careful!")); + } + }, caller, "ClansOnGoingOptOut"); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java index fbe90fbf6..08002cd91 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java @@ -66,15 +66,15 @@ public class TutorialGettingStarted extends Tutorial public void onEnterTerritory(Player player, String ownerString) { - if (isInTutorial(player) && ownerString.contains("Spawn") && get(player).hasFinishedPart(getPart(2)) && !get(player).hasFinishedPart(getPart(3))) + if (isInTutorial(player) && ownerString.endsWith("Spawn") && get(player).hasFinishedPart(getPart(2)) && !get(player).hasFinishedPart(getPart(3))) { getPart(3).getWaiter().consume(player); } - else if (isInTutorial(player) && ownerString.contains("Wilderness") && get(player).hasFinishedPart(getPart(3)) && !get(player).hasFinishedPart(getPart(4))) + else if (isInTutorial(player) && ownerString.endsWith("Wilderness") && get(player).hasFinishedPart(getPart(3)) && !get(player).hasFinishedPart(getPart(4))) { getPart(4).getWaiter().consume(player); } - else if (isInTutorial(player) && ownerString.contains("Shop") && get(player).hasFinishedPart(getPart(5)) && !get(player).hasFinishedPart(getPart(6))) + else if (isInTutorial(player) && ownerString.endsWith("Shops") && get(player).hasFinishedPart(getPart(5)) && !get(player).hasFinishedPart(getPart(6))) { getPart(6).getWaiter().consume(player); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialOnGoingMap.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialOnGoingMap.java new file mode 100644 index 000000000..38af58081 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialOnGoingMap.java @@ -0,0 +1,49 @@ +package mineplex.game.clans.tutorials.types; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.task.TaskManager; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.economy.GoldManager; +import mineplex.game.clans.tutorials.Tutorial; +import mineplex.game.clans.tutorials.TutorialManager; +import mineplex.game.clans.tutorials.TutorialType; + +public class TutorialOnGoingMap extends Tutorial +{ + public TutorialOnGoingMap(final TutorialManager manager, final ClansManager clansManager, final GoldManager goldManager, final TaskManager taskManager) + { + super(0, goldManager, taskManager, clansManager, manager, TutorialType.ON_GOING); + + _doScoreboard = false; + } + + public void onEnterTerritory(Player player, String ownerString) + { + if (!_taskManager.hasCompletedTask(player, "ClansOnGoingOptOut")) + { + if (ownerString.contains("Fields")) + { + UtilPlayer.message(player, C.cRedB + "Warning! You're now entering the Fields!"); + UtilPlayer.message(player, C.cRed + "Fields is a very lucrative area, filled with ores that periodically respawn over time. This is a great place to get a large amount of resources for your clan; however, be aware of other clans who may also be after the riches buried within the fields."); + UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)"); + } + else if (ownerString.contains("Shop")) + { + UtilPlayer.message(player, C.cGreenB + "Welcome the Shops!"); + UtilPlayer.message(player, C.cGreen + "Shops is a safe area where combat is disabled between players! Use this safety to purchase food, building blocks, armor, weapons, and other valuable resources. Be careful when leaving though, others may be hiding just outside the gates, eager to steal your recent purchases."); + UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)"); + } + else if (ownerString.contains("Borderlands")) + { + UtilPlayer.message(player, C.cRedB + "Warning! You're now entering the Borderlands!"); + UtilPlayer.message(player, C.cRed + "The Borderlands are the very outer reaches of the maps. Be careful as very powerful boss monsters will periodically spawn out here! Don't try to fight them alone! If you do manage to slay one of these powerful beasts, you'll be handsomely rewarded with powerful gear or legendary weapons."); + UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)"); + } + } + } + +}