Search in sources :

Example 6 with BattleSession

use of com.gmail.goosius.siegewar.objects.BattleSession in project SiegeWar by TownyAdvanced.

the class SiegeWarBattleSessionUtil method startBattleSession.

public static void startBattleSession() {
    BattleSession battleSession = BattleSession.getBattleSession();
    battleSession.setActive(true);
    // Set the start time
    battleSession.setStartTime(System.currentTimeMillis());
    // Set the scheduled end time
    battleSession.setScheduledEndTime(System.currentTimeMillis() + (SiegeWarSettings.getWarSiegeBattleSessionsDurationMinutes() * 60000));
    // Clear the scheduled start time
    battleSession.setScheduledStartTime(null);
    // Send up the Bukkit event for other plugins to listen for.
    Bukkit.getPluginManager().callEvent(new BattleSessionStartedEvent());
    // Send global message to let the server know that the battle session started
    Messaging.sendGlobalMessage(Translatable.of("msg_war_siege_battle_session_started"));
    // Start the bossbar for the Battle Session
    BossBarUtil.updateBattleSessionBossBar();
}
Also used : BattleSession(com.gmail.goosius.siegewar.objects.BattleSession) BattleSessionStartedEvent(com.gmail.goosius.siegewar.events.BattleSessionStartedEvent)

Aggregations

BattleSession (com.gmail.goosius.siegewar.objects.BattleSession)6 BattleSessionEndedEvent (com.gmail.goosius.siegewar.events.BattleSessionEndedEvent)1 BattleSessionPreStartEvent (com.gmail.goosius.siegewar.events.BattleSessionPreStartEvent)1 BattleSessionStartedEvent (com.gmail.goosius.siegewar.events.BattleSessionStartedEvent)1 Siege (com.gmail.goosius.siegewar.objects.Siege)1 BossBar (com.palmergames.adventure.bossbar.BossBar)1 TextComponent (com.palmergames.adventure.text.TextComponent)1 Resident (com.palmergames.bukkit.towny.object.Resident)1 Translatable (com.palmergames.bukkit.towny.object.Translatable)1 Player (org.bukkit.entity.Player)1