Search in sources :

Example 1 with Timespan

use of gg.projecteden.utils.TimeUtils.Timespan in project Nexus by ProjectEdenGG.

the class LockdownCommand method start.

@Path("start <time/reason...>")
void start(String input) {
    if (lockdown) {
        send(PREFIX + "Overriding previous lockdown: &c" + reason);
        reason = null;
        end = null;
    }
    lockdown = true;
    Timespan timespan = Timespan.find(input);
    reason = timespan.getRest();
    if (timespan.getOriginal() > 0)
        end = timespan.fromNow();
    String message = "&c" + name() + " initiated lockdown for &e" + (timespan.isNull() ? "" : timespan.format(FormatType.LONG) + "&c for &e") + timespan.getRest();
    broadcast(message);
    for (Player player : OnlinePlayers.getAll()) if (!canBypass(player.getUniqueId())) {
        player.kick(getLockdownReason());
        broadcast("Removed " + player.getName() + " from server");
    }
}
Also used : Timespan(gg.projecteden.utils.TimeUtils.Timespan) Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path)

Aggregations

Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)1 Timespan (gg.projecteden.utils.TimeUtils.Timespan)1 OfflinePlayer (org.bukkit.OfflinePlayer)1 Player (org.bukkit.entity.Player)1