Search in sources :

Example 11 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class MatchStartCountdown method playSound.

private void playSound() {
    long left = this.getLeftSeconds();
    ArcadeSound sound = null;
    if (left == 0) {
        sound = ArcadeSound.STARTED;
    } else if (left == 1 || left == 2 || left == 3) {
        sound = ArcadeSound.STARTING;
    }
    if (sound != null) {
        for (ArcadePlayer player : this.plugin.getPlayers()) {
            player.play(sound);
        }
    }
}
Also used : ArcadeSound(pl.themolka.arcade.session.ArcadeSound) ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer)

Example 12 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class ChannelListeners method onAsyncPlayerChat.

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
    if (event.isCancelled()) {
        return;
    }
    ArcadePlayer player = this.game.getPlugin().getPlayer(event.getPlayer());
    ChatChannel channel = this.game.getChannelFor(player);
    if (!player.getChatState().chat()) {
        player.sendError("You may not chat because your chat is disabled.");
        event.setCancelled(true);
        return;
    }
    String message = event.getMessage();
    if (message.startsWith(GlobalChatChannel.GLOBAL_CHANNEL_KEY)) {
        // global
        channel = this.game.getGlobalChannel();
        message = message.substring(1);
    }
    channel.sendChatMessage(player, message.trim());
    // this breaks other plugins :/
    event.setCancelled(true);
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) EventHandler(org.bukkit.event.EventHandler)

Example 13 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class CycleCountdown method onUpdate.

@Override
public void onUpdate(long seconds, long secondsLeft) {
    if (!this.plugin.getGames().getQueue().hasNextMap()) {
        this.cancelCountdown();
        return;
    } else if (!this.isPrintable(secondsLeft)) {
        return;
    }
    OfflineMap nextMap = this.plugin.getGames().getQueue().getNextMap();
    Game game = this.plugin.getGames().getCurrentGame();
    if (game == null) {
        return;
    }
    String message = this.getPrintMessage(this.getCycleMessage(nextMap.getName()));
    for (ArcadePlayer player : this.plugin.getPlayers()) {
        player.getPlayer().send(message);
    }
    this.plugin.getLogger().info(ChatColor.stripColor(message));
}
Also used : Game(pl.themolka.arcade.game.Game) ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) OfflineMap(pl.themolka.arcade.map.OfflineMap)

Example 14 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class BukkitCommands method onTabComplete.

@Override
public List<String> onTabComplete(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
    List<String> completer = this.handleCompleter(this.findSender(sender), this.getCommand(label), label, args);
    if (completer == null || completer.isEmpty()) {
        completer = new ArrayList<>();
        for (ArcadePlayer online : this.plugin.getPlayers()) {
            completer.add(online.getUsername());
        }
    }
    Collections.sort(completer);
    return completer;
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer)

Example 15 with ArcadePlayer

use of pl.themolka.arcade.session.ArcadePlayer in project Arcade2 by ShootGame.

the class BlockTransformListeners method post.

private boolean post(Event cause, Block block, BlockState oldState, BlockState newState, Player bukkit, boolean cancel) {
    ArcadePlayer player = null;
    if (bukkit != null) {
        player = this.plugin.getPlayer(bukkit);
    }
    BlockTransformEvent event = new BlockTransformEvent(this.plugin, block, cause, newState, oldState, player);
    this.plugin.getEventBus().publish(event);
    boolean canceled = cancel && event.isCanceled() && cause instanceof Cancellable;
    if (canceled) {
        ((Cancellable) cause).setCancelled(true);
    }
    return event.isCanceled();
}
Also used : ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) Cancellable(org.bukkit.event.Cancellable) BlockTransformEvent(pl.themolka.arcade.event.BlockTransformEvent)

Aggregations

ArcadePlayer (pl.themolka.arcade.session.ArcadePlayer)19 GamePlayer (pl.themolka.arcade.game.GamePlayer)5 TextComponent (net.md_5.bungee.api.chat.TextComponent)3 BossBar (pl.themolka.arcade.bossbar.BossBar)3 Game (pl.themolka.arcade.game.Game)3 OfflineMap (pl.themolka.arcade.map.OfflineMap)2 ArcadeSound (pl.themolka.arcade.session.ArcadeSound)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Handler (net.engio.mbassy.listener.Handler)1 BaseComponent (net.md_5.bungee.api.chat.BaseComponent)1 World (org.bukkit.World)1 CraftWorld (org.bukkit.craftbukkit.CraftWorld)1 Cancellable (org.bukkit.event.Cancellable)1 EventHandler (org.bukkit.event.EventHandler)1 BlockTransformEvent (pl.themolka.arcade.event.BlockTransformEvent)1 KitContent (pl.themolka.arcade.kit.content.KitContent)1 MapManager (pl.themolka.arcade.map.MapManager)1