Store location for teleport home
This commit is contained in:
parent
8afed30c5a
commit
8c7d653cca
@ -276,6 +276,10 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
_playerSessionMap.get(player).getHolograms().add(hologram);
|
||||
hologram.start();
|
||||
}
|
||||
}
|
||||
|
||||
public TutorialSession getTutorialSession(Player player)
|
||||
{
|
||||
return _playerSessionMap.get(player);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package mineplex.game.clans.tutorial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import mineplex.core.hologram.Hologram;
|
||||
|
||||
public class TutorialSession
|
||||
@ -10,6 +12,7 @@ public class TutorialSession
|
||||
private int _objectiveIndex;
|
||||
private TutorialRegion _region;
|
||||
private List<Hologram> _hologramList = new ArrayList<>();
|
||||
private Location _homeLocation;
|
||||
|
||||
public TutorialSession()
|
||||
{
|
||||
@ -39,4 +42,14 @@ public class TutorialSession
|
||||
{
|
||||
_region = region;
|
||||
}
|
||||
|
||||
public Location getHomeLocation()
|
||||
{
|
||||
return _homeLocation;
|
||||
}
|
||||
|
||||
public void setHomeLocation(Location homeLocation)
|
||||
{
|
||||
_homeLocation = homeLocation;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
@ -34,6 +35,9 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
|
||||
{
|
||||
if (getObjective().getPlugin().isIn(event.getPlayer(), ClansMainTutorial.Bounds.LAND_CLAIM))
|
||||
{
|
||||
// we need to save this for later when the player teleports home!
|
||||
getObjective().getPlugin().getTutorialSession(event.getPlayer()).setHomeLocation(event.getPlayer().getLocation());
|
||||
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
else
|
||||
|
@ -3,13 +3,15 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.end;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.tutorial.objective.Objective;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
|
||||
|
||||
public class TpClanHomeGoal extends ObjectiveGoal
|
||||
public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>
|
||||
{
|
||||
public TpClanHomeGoal(Objective objective)
|
||||
public TpClanHomeGoal(FinalObjective objective)
|
||||
{
|
||||
super(objective, "Teleport to Clan Home", "Use the /c home command to teleport to your Clan Home");
|
||||
}
|
||||
@ -25,9 +27,9 @@ public class TpClanHomeGoal extends ObjectiveGoal
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teleport(ClansCommandExecutedEvent event)
|
||||
public void teleport(ClansCommandPreExecutedEvent event)
|
||||
{
|
||||
if (!event.getCommand().equals("tphome"))
|
||||
if (event.getArguments().length != 1 || !event.getArguments()[0].equalsIgnoreCase("home"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -37,6 +39,7 @@ public class TpClanHomeGoal extends ObjectiveGoal
|
||||
return;
|
||||
}
|
||||
|
||||
event.getPlayer().teleport(getObjective().getPlugin().getTutorialSession(event.getPlayer()).getHomeLocation());
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user