PC-40 - Add cooldown to Tutorial /c home
This commit is contained in:
parent
0bbfbff0b8
commit
1d4472255f
@ -3,6 +3,11 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.delayedtask.DelayedTask;
|
||||
import mineplex.core.delayedtask.DelayedTaskClient;
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.tutorial.objective.Objective;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
@ -40,10 +45,40 @@ public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have teleported to your Clan's Home."));
|
||||
event.getPlayer().teleport(getObjective().getPlugin().getTutorialSession(event.getPlayer()).getHomeLocation());
|
||||
finish(event.getPlayer());
|
||||
|
||||
DelayedTask.Instance.doDelay(
|
||||
event.getPlayer(),
|
||||
"Tutorial Home Teleport",
|
||||
new Callback<DelayedTaskClient>()
|
||||
{
|
||||
@Override
|
||||
public void run(DelayedTaskClient data)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have teleported to your Clan's Home."));
|
||||
event.getPlayer().teleport(getObjective().getPlugin().getTutorialSession(event.getPlayer()).getHomeLocation());
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
},
|
||||
new Callback<DelayedTaskClient>()
|
||||
{
|
||||
@Override
|
||||
public void run(DelayedTaskClient data)
|
||||
{
|
||||
UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.time(UtilTime.MakeStr(Math.max(0, data.getTimeLeft("Tutorial Home Teleport")))), 0, 5, 0, data.getPlayer());
|
||||
}
|
||||
},
|
||||
new Callback<DelayedTaskClient>()
|
||||
{
|
||||
@Override
|
||||
public void run(DelayedTaskClient data)
|
||||
{
|
||||
UtilPlayer.message(data.getPlayer(), F.main("Clans", "Teleport has been cancelled due to movement."));
|
||||
}
|
||||
},
|
||||
15 * 1000, // 15 second cooldown
|
||||
false
|
||||
);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user