Let's not eagerly delete clans

This commit is contained in:
samczsun 2016-06-13 22:05:52 -04:00
parent 5564b07a36
commit 18d7eba9db
No known key found for this signature in database
GPG Key ID: B0AFDBD87206805D
3 changed files with 26 additions and 2 deletions

View File

@ -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
}
}
@ -464,9 +465,17 @@ public class ClansMainTutorial extends Tutorial
// });
if (!_taskManager.hasCompletedTask(event.getPlayer(), getTaskIdentifier()))
{
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()))
{
Spawn.getInstance().teleport(event.getPlayer(), Spawn.getInstance().getSpawnLocation(), 2);

View File

@ -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<ClanObjective>
}
@EventHandler
public void onClanPreCreate(ClanCreatedEvent event)
{
if (contains(event.getFounder()))
{
event.setName("TUTORIAL-" + event.getName());
}
}
@EventHandler
public void onClanCreate(ClanCreationCompleteEvent event)
{

View File

@ -47,6 +47,11 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
{
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."));