本文整理汇总了Java中in.twizmwaz.cardinal.match.MatchState.PLAYING属性的典型用法代码示例。如果您正苦于以下问题:Java MatchState.PLAYING属性的具体用法?Java MatchState.PLAYING怎么用?Java MatchState.PLAYING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类in.twizmwaz.cardinal.match.MatchState
的用法示例。
在下文中一共展示了MatchState.PLAYING属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServerListPing
@EventHandler(priority = EventPriority.HIGHEST)
public void onServerListPing(ServerListPingEvent event) {
try {
String name = match.getLoadedMap().getName();
if (match.getState() == MatchState.ENDED) {
event.setMotd(ChatColor.RED + "\u00BB " + ChatColor.AQUA + name + ChatColor.RED + " \u00AB");
} else if (match.getState() == MatchState.PLAYING) {
event.setMotd(ChatColor.GOLD + "\u00BB " + ChatColor.AQUA + name + ChatColor.GOLD + " \u00AB");
} else if (match.getState() == MatchState.STARTING) {
event.setMotd(ChatColor.GREEN + "\u00BB " + ChatColor.AQUA + name + ChatColor.GREEN + " \u00AB");
} else {
event.setMotd(ChatColor.GRAY + "\u00BB " + ChatColor.AQUA + name + ChatColor.GRAY + " \u00AB");
}
} catch (NullPointerException ex) {
}
}
示例2: onMatchStart
/**
* Spawn all players when the match starts.
*
* @param event The event.
*/
@EventHandler
public void onMatchStart(MatchChangeStateEvent event) {
if (event.getState() == MatchState.PLAYING) {
for (Player player : event.getMatch()) {
Spawn spawn = ListUtil.getRandom(getSpawns(event.getMatch(), event.getMatch().getPlayingContainer(player)));
Bukkit.getPluginManager().callEvent(new CardinalRespawnEvent(player, spawn));
}
}
}
示例3: onBlockPlace
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
return;
if (event.getBlock().getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
event.getPlayer().closeInventory();
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
if ((event.getBlock().getType().equals(Material.ACACIA_DOOR) || event.getBlock().getType().equals(Material.BIRCH_DOOR) || event.getBlock().getType().equals(Material.DARK_OAK_DOOR) || event.getBlock().getType().equals(Material.IRON_DOOR) || event.getBlock().getType().equals(Material.JUNGLE_DOOR) || event.getBlock().getType().equals(Material.SPRUCE_DOOR) || event.getBlock().getType().equals(Material.WOOD_DOOR) || event.getBlock().getType().equals(Material.WOODEN_DOOR) || event.getBlock().getType().equals(Material.LONG_GRASS)) && event.getBlock().getY() + 1 >= height) {
event.setCancelled(true);
event.getPlayer().closeInventory();
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
}
示例4: onBlockBreak
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
return;
if (event.getBlock().getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
}
示例5: onEmptyBucket
@EventHandler
public void onEmptyBucket(PlayerBucketEmptyEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
return;
Block toFill = event.getBlockClicked().getRelative(event.getBlockFace());
if (toFill.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
}
示例6: onFillBucket
@EventHandler
public void onFillBucket(PlayerBucketFillEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
return;
Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace());
if (toEmpty.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
}
示例7: startTimer
public boolean startTimer(int seconds) {
if (match.getState() != MatchState.PLAYING) {
setOriginalState(match.getState());
setTime(seconds);
setCancelled(false);
return true;
} else return false;
}
示例8: onInventoryClick
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getWhoClicked() instanceof Player) {
if (TeamUtils.getTeamByPlayer((Player) event.getWhoClicked()).isObserver() || match.getState() != MatchState.PLAYING) {
if (event.getInventory().getType() != InventoryType.PLAYER) {
event.setCancelled(true);
}
}
}
}
示例9: onPlayerTeamChange
@EventHandler
public void onPlayerTeamChange(PlayerChangeTeamEvent event) {
if (event.getNewTeam().isObserver() || match.getState() != MatchState.PLAYING) {
event.getPlayer().setGameMode(GameMode.CREATIVE);
event.getPlayer().setAffectsSpawning(false);
} else {
event.getPlayer().setAffectsSpawning(true);
}
}
示例10: end
@Command(aliases = {"end", "finish"}, desc = "Ends the match.", usage = "[team]")
@CommandPermissions("cardinal.match.end")
public static void end(CommandContext cmd, CommandSender sender) throws CommandException {
if (GameHandler.getGameHandler().getMatch().getState() == MatchState.PLAYING) {
try {
TeamModule team = TeamUtils.getTeamByName(cmd.getString(0));
GameHandler.getGameHandler().getMatch().end(team);
} catch (IndexOutOfBoundsException ex) {
GameHandler.getGameHandler().getMatch().end(null);
}
} else throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_NO_END).getMessage(ChatUtils.getLocale(sender)));
}
示例11: onBlockChange
@EventHandler
public void onBlockChange(BlockPlaceEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING) {
event.setCancelled(true);
}
}
示例12: onPlayerPickupExperience
@EventHandler
public void onPlayerPickupExperience(PlayerPickupExperienceEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING) {
event.setCancelled(true);
}
}
示例13: onPlayerDropItem
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING) {
event.getItemDrop().remove();
}
}