From 18d7eba9db5785947986ec0e977d8cfffb513577 Mon Sep 17 00:00:00 2001 From: samczsun Date: Mon, 13 Jun 2016 22:05:52 -0400 Subject: [PATCH] Let's not eagerly delete clans --- .../tutorial/tutorials/clans/ClansMainTutorial.java | 13 +++++++++++-- .../clans/objective/goals/clan/CreateClanGoal.java | 10 ++++++++++ .../objective/goals/finalobj/DisbandClanGoal.java | 5 +++++ 3 files changed, 26 insertions(+), 2 deletions(-) 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 a7080e3d9..bee18499e 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 @@ -209,7 +209,8 @@ public class ClansMainTutorial extends Tutorial ClanInfo clan = ClansManager.getInstance().getClan(player); if (clan != null) { - ClansManager.getInstance().getClanDataAccess().delete(clan, null); + UtilPlayer.message(player, F.main("Clans", "You are part of a clan - please leave or disband the clan before doing the tutorial")); + ClansManager.getInstance().getTutorial().finishTutorial(player); //nopenopenopenopenope } } @@ -465,7 +466,15 @@ public class ClansMainTutorial extends Tutorial if (!_taskManager.hasCompletedTask(event.getPlayer(), getTaskIdentifier())) { - start(event.getPlayer()); + ClanInfo clan = ClansManager.getInstance().getClan(event.getPlayer()); + if (clan == null) + { + start(event.getPlayer()); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "It seems you already have a clan here, so we can skip the tutorial")); + } } else if (!event.getPlayer().hasPlayedBefore() || !event.getPlayer().getLocation().getWorld().equals(Spawn.getSpawnWorld())) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java index 693b7cda2..8413cdb5a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java @@ -1,6 +1,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; import mineplex.core.common.util.F; +import mineplex.game.clans.clans.event.ClanCreatedEvent; import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -42,6 +43,15 @@ public class CreateClanGoal extends ObjectiveGoal } + @EventHandler + public void onClanPreCreate(ClanCreatedEvent event) + { + if (contains(event.getFounder())) + { + event.setName("TUTORIAL-" + event.getName()); + } + } + @EventHandler public void onClanCreate(ClanCreationCompleteEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java index 60a243659..9de897421 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java @@ -47,6 +47,11 @@ public class DisbandClanGoal extends ObjectiveGoal { return; } + if (!event.getClan().getName().startsWith("TUTORIAL-")) // How??? + { + UtilPlayer.message(event.getDisbander(), F.main("Clans", "Something has gone terribly wrong while disbanding your clan")); + return; + } event.setCancelled(true); UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan."));