Search in sources :

Example 1 with MatchEndEvent

use of gg.projecteden.nexus.features.minigames.models.events.matches.MatchEndEvent in project Nexus by ProjectEdenGG.

the class HoleInTheWall method onMatchEnd.

@EventHandler
public void onMatchEnd(MatchEndEvent event) {
    Match match = event.getMatch();
    if (!match.isMechanic(this))
        return;
    HoleInTheWallMatchData matchData = match.getMatchData();
    if (!matchData.isEnding() && !shouldBeOver(match)) {
        if (match.getTimer().getTime() == 0)
            match.broadcast("Time is up!");
        matchData.setEnding(true);
        event.setCancelled(true);
        matchData.getTracks().stream().filter(track -> track.getMinigamer() != null).forEach(Track::end);
        match.getTasks().wait(TickTime.SECOND.x(5), match::end);
    }
}
Also used : ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) ActionGroup(gg.projecteden.nexus.utils.Utils.ActionGroup) PlayerManager(gg.projecteden.nexus.features.minigames.managers.PlayerManager) PlayerMoveEvent(org.bukkit.event.player.PlayerMoveEvent) Player(org.bukkit.entity.Player) Action(org.bukkit.event.block.Action) TeamlessMechanic(gg.projecteden.nexus.features.minigames.models.mechanics.multiplayer.teamless.TeamlessMechanic) Match(gg.projecteden.nexus.features.minigames.models.Match) MinigamerQuitEvent(gg.projecteden.nexus.features.minigames.models.events.matches.MinigamerQuitEvent) Countdown(gg.projecteden.nexus.utils.Tasks.Countdown) EventHandler(org.bukkit.event.EventHandler) GameMode(org.bukkit.GameMode) Location(org.bukkit.Location) MaterialTag(gg.projecteden.nexus.utils.MaterialTag) MatchEndEvent(gg.projecteden.nexus.features.minigames.models.events.matches.MatchEndEvent) PlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent) StringUtils.getLocationString(gg.projecteden.nexus.utils.StringUtils.getLocationString) MatchInitializeEvent(gg.projecteden.nexus.features.minigames.models.events.matches.MatchInitializeEvent) Material(org.bukkit.Material) BlockPlaceEvent(org.bukkit.event.block.BlockPlaceEvent) Sign(org.bukkit.block.Sign) SoundCategory(org.bukkit.SoundCategory) Minigamer(gg.projecteden.nexus.features.minigames.models.Minigamer) Set(java.util.Set) Sound(org.bukkit.Sound) UUID(java.util.UUID) MatchStartEvent(gg.projecteden.nexus.features.minigames.models.events.matches.MatchStartEvent) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) Track(gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData.Track) ItemStack(org.bukkit.inventory.ItemStack) StringUtils.stripColor(gg.projecteden.nexus.utils.StringUtils.stripColor) TickTime(gg.projecteden.utils.TimeUtils.TickTime) MinigameException(gg.projecteden.nexus.features.minigames.models.exceptions.MinigameException) PlayerLeavingRegionEvent(gg.projecteden.nexus.features.regionapi.events.player.PlayerLeavingRegionEvent) HoleInTheWallArena(gg.projecteden.nexus.features.minigames.models.arenas.HoleInTheWallArena) HoleInTheWallMatchData(gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData) Optional(java.util.Optional) NotNull(org.jetbrains.annotations.NotNull) HoleInTheWallMatchData(gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData) Track(gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData.Track) Match(gg.projecteden.nexus.features.minigames.models.Match) EventHandler(org.bukkit.event.EventHandler)

Aggregations

ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)1 PlayerManager (gg.projecteden.nexus.features.minigames.managers.PlayerManager)1 Match (gg.projecteden.nexus.features.minigames.models.Match)1 Minigamer (gg.projecteden.nexus.features.minigames.models.Minigamer)1 HoleInTheWallArena (gg.projecteden.nexus.features.minigames.models.arenas.HoleInTheWallArena)1 MatchEndEvent (gg.projecteden.nexus.features.minigames.models.events.matches.MatchEndEvent)1 MatchInitializeEvent (gg.projecteden.nexus.features.minigames.models.events.matches.MatchInitializeEvent)1 MatchStartEvent (gg.projecteden.nexus.features.minigames.models.events.matches.MatchStartEvent)1 MinigamerQuitEvent (gg.projecteden.nexus.features.minigames.models.events.matches.MinigamerQuitEvent)1 MinigameException (gg.projecteden.nexus.features.minigames.models.exceptions.MinigameException)1 HoleInTheWallMatchData (gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData)1 Track (gg.projecteden.nexus.features.minigames.models.matchdata.HoleInTheWallMatchData.Track)1 TeamlessMechanic (gg.projecteden.nexus.features.minigames.models.mechanics.multiplayer.teamless.TeamlessMechanic)1 PlayerLeavingRegionEvent (gg.projecteden.nexus.features.regionapi.events.player.PlayerLeavingRegionEvent)1 CooldownService (gg.projecteden.nexus.models.cooldown.CooldownService)1 MaterialTag (gg.projecteden.nexus.utils.MaterialTag)1 StringUtils.getLocationString (gg.projecteden.nexus.utils.StringUtils.getLocationString)1 StringUtils.stripColor (gg.projecteden.nexus.utils.StringUtils.stripColor)1 Countdown (gg.projecteden.nexus.utils.Tasks.Countdown)1 ActionGroup (gg.projecteden.nexus.utils.Utils.ActionGroup)1