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);
}
}
}
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);
}
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));
}
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;
}
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();
}
Aggregations