From 9ff7e2da8257fec5198710611b338a492d17e2e0 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 28 Mar 2016 11:52:18 +1100 Subject: [PATCH] PC-21 - Combine Tutorial 1 and 2 --- .../tutorials/clans/ClansMainTutorial.java | 2 - .../clans/objective/ClanObjective.java | 2 + .../clans/objective/LeaveSpawnObjective.java | 58 ------------------ .../objective/goals/clan/LeaveSpawnGoal.java | 59 +++++++++++++++++++ 4 files changed, 61 insertions(+), 60 deletions(-) delete mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java index 80f1a9253..89bdc48c8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java @@ -41,7 +41,6 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.EnergyObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective; -import mineplex.game.clans.tutorial.tutorials.clans.objective.LeaveSpawnObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.PurchaseItemsObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective; //import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository; @@ -69,7 +68,6 @@ public class ClansMainTutorial extends Tutorial // _repository = new TutorialRepository(ClansManager.getInstance().getClientManager()); - addObjective(new LeaveSpawnObjective(this, plugin)); addObjective(new ClanObjective(this, plugin)); addObjective(new AttackEnemyObjective(this, plugin)); addObjective(new ShopsObjective(this, npcManager, plugin)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java index 885fd7397..9126afab5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java @@ -11,6 +11,7 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.BuildHo import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClaimLandGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClanDetailsGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.CreateClanGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.LeaveSpawnGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.SetHomeGoal; public class ClanObjective extends OrderedObjective @@ -19,6 +20,7 @@ public class ClanObjective extends OrderedObjective { super(clansMainTutorial, javaPlugin, "Clans", "Create clan with /c create "); + addGoal(new LeaveSpawnGoal(this)); addGoal(new CreateClanGoal(this)); addGoal(new ClanDetailsGoal(this)); addGoal(new ClaimLandGoal(this)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java deleted file mode 100644 index 185e80e3c..000000000 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java +++ /dev/null @@ -1,58 +0,0 @@ -package mineplex.game.clans.tutorial.tutorials.clans.objective; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; - -import mineplex.core.common.util.C; -import mineplex.game.clans.tutorial.TutorialRegion; -import mineplex.game.clans.tutorial.objective.SingleObjective; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; - -public class LeaveSpawnObjective extends SingleObjective -{ - public LeaveSpawnObjective(ClansMainTutorial plugin, JavaPlugin javaPlugin) - { - super(plugin, javaPlugin, "Leave Spawn", "Exit the tutorial spawn area"); - } - - @Override - public void setup(Player player, TutorialRegion region) - { - getPlugin().addHologram(player, - getPlugin().getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1, -3), - C.cGoldB + "Welcome to Clans Beta!", C.cWhite + "Walk forward to Start Tutorial"); - } - - @Override - protected void customStart(Player player) - { - } - - @Override - protected void customLeave(Player player) - { - } - - @Override - protected void customFinish(Player player) - { - } - - @EventHandler - public void checkRegion(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : getActivePlayers()) - { - if (!getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN)) - { - finish(player); - } - } - } -} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java new file mode 100644 index 000000000..242568b65 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java @@ -0,0 +1,59 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; + +public class LeaveSpawnGoal extends ObjectiveGoal +{ + public LeaveSpawnGoal(ClanObjective objective) + { + super(objective, "Leave Spawn", "Exit the tutorial spawn area"); + } + + @Override + protected void setup(Player player, TutorialRegion region) + { + getObjective().getPlugin().addHologram(player, + getObjective().getPlugin().getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1, -3), + C.cGoldB + "Welcome to Clans Beta!", C.cWhite + "Walk forward to Start Tutorial"); + } + + @Override + protected void customStart(Player player) + { + + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void checkRegion(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (UUID uuid : getActivePlayers()) + { + Player player = Bukkit.getPlayer(uuid); + if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN)) + { + finish(player); + } + } + } +}