当前位置: 首页>>代码示例>>Java>>正文


Java MatchState类代码示例

本文整理汇总了Java中in.twizmwaz.cardinal.match.MatchState的典型用法代码示例。如果您正苦于以下问题:Java MatchState类的具体用法?Java MatchState怎么用?Java MatchState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MatchState类属于in.twizmwaz.cardinal.match包,在下文中一共展示了MatchState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Override
public void run() {
  if (time == 0) {
    cancelled = true;
    match.setMatchState(MatchState.PLAYING);

    Channels.getGlobalChannel(match.getMatchThread()).sendMessage(new LocalizedComponentBuilder(
        ChatConstant.getConstant("match.start.started")).build());

  } else if (!cancelled) {
    if (time % 20 == 0) {
      Channels.getGlobalChannel(match.getMatchThread()).sendMessage(new LocalizedComponentBuilder(
          ChatConstant.getConstant("match.start.countdown"), new TimeComponentBuilder(time / 20)
          .color(ChatColor.DARK_RED).build()).color(ChatColor.DARK_AQUA).build());
    }
    time--;
    Bukkit.getScheduler().runTaskLaterAsynchronously(Cardinal.getInstance(), this, 1);
  }
}
 
开发者ID:CardinalDevelopment,项目名称:Cardinal,代码行数:20,代码来源:StartCountdown.java

示例2: resetVisibility

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
private void resetVisibility(Player viewer, Player toSee, TeamModule newTeam) {
    try {
        if (match.getState().equals(MatchState.PLAYING)) {
            if (TeamUtils.getTeamByPlayer(viewer).isObserver()) {
                if (TeamUtils.getTeamByPlayer(toSee) != null && TeamUtils.getTeamByPlayer(toSee).isObserver() && Settings.getSettingByName("Observers") != null && Settings.getSettingByName("Observers").getValueByPlayer(viewer).getValue().equalsIgnoreCase("none")) {
                    viewer.hidePlayer(toSee);
                } else {
                    viewer.showPlayer(toSee);
                }
            } else if (newTeam.isObserver()) {
                viewer.hidePlayer(toSee);
            } else {
                viewer.showPlayer(toSee);
            }
        } else {
            if (Settings.getSettingByName("Observers") != null && Settings.getSettingByName("Observers").getValueByPlayer(viewer).getValue().equalsIgnoreCase("none")) {
                viewer.hidePlayer(toSee);
            } else {
                viewer.showPlayer(toSee);
            }
        }
    } catch (NullPointerException e) {
        viewer.showPlayer(toSee);
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:26,代码来源:Visibility.java

示例3: onServerListPing

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@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) {

    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:18,代码来源:MOTD.java

示例4: run

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Override
public void run() {
    if (!isCancelled()) {
        match.setState(MatchState.CYCLING);
        float percent = (originalTime - time) / originalTime;
        BossBar.sendGlobalMessage(new UnlocalizedChatMessage(ChatColor.DARK_AQUA + "{0}", new LocalizedChatMessage(ChatConstant.UI_CYCLING_TIMER, new UnlocalizedChatMessage(ChatColor.AQUA + GameHandler.getGameHandler().getCycle().getMap().getName() + ChatColor.DARK_AQUA), (this.time == 1 ? new LocalizedChatMessage(ChatConstant.UI_SECOND, ChatColor.DARK_RED + "1" + ChatColor.DARK_AQUA) : new LocalizedChatMessage(ChatConstant.UI_SECONDS, ChatColor.DARK_RED + (time / 20 + "") + ChatColor.DARK_AQUA)))), percent);
        if ((time % 100 == 0 && time > 0) || (time < 100 && time > 0 && time % 20 == 0)) {
            ChatUtils.getGlobalChannel().sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.DARK_AQUA + "{0}", new LocalizedChatMessage(ChatConstant.UI_CYCLING_TIMER, new UnlocalizedChatMessage(ChatColor.AQUA + GameHandler.getGameHandler().getCycle().getMap().getName() + ChatColor.DARK_AQUA), (this.time == 1 ? new LocalizedChatMessage(ChatConstant.UI_SECOND, ChatColor.DARK_RED + "1" + ChatColor.DARK_AQUA) : new LocalizedChatMessage(ChatConstant.UI_SECONDS, ChatColor.DARK_RED + (time / 20 + "") + ChatColor.DARK_AQUA)))));
        }
        if (time == 0 && match.getState() == MatchState.CYCLING) {
            cancelled = true;
            BossBar.hideWitherGlobally();
            GameHandler.getGameHandler().cycleAndMakeMatch();
        }
        time--;
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:18,代码来源:CycleTimerModule.java

示例5: onPlayerSpawn

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@EventHandler
public void onPlayerSpawn(CardinalSpawnEvent event) {
    if (!event.getTeam().isObserver()) {
        if (match.isRunning()) {
            event.getPlayer().setGameMode(GameMode.SURVIVAL);
            event.getPlayer().setAffectsSpawning(true);
            event.getPlayer().setCollidesWithEntities(true);
            event.getPlayer().setCanPickupItems(true);
        }
    } else {
        resetPlayer(event.getPlayer(), false);
        if (!GameHandler.getGameHandler().getMatch().getState().equals(MatchState.ENDED)) {
            ItemStack picker = ItemUtils.createItem(Material.LEATHER_HELMET, 1, (short) 0,
                    ChatColor.GREEN + "" + ChatColor.BOLD + (GameHandler.getGameHandler().getMatch().getModules().getModule(ClassModule.class) != null ? new LocalizedChatMessage(ChatConstant.UI_TEAM_CLASS_SELECTION).getMessage(event.getPlayer().getLocale()) : new LocalizedChatMessage(ChatConstant.UI_TEAM_SELECTION).getMessage(event.getPlayer().getLocale())),
                    Arrays.asList(ChatColor.DARK_PURPLE + new LocalizedChatMessage(ChatConstant.UI_TEAM_JOIN_TIP).getMessage(event.getPlayer().getLocale())));
            event.getPlayer().getInventory().setItem(2, picker);
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:20,代码来源:ObserverModule.java

示例6: cycle

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Command(aliases = {"cycle"}, desc = "Cycles the world and loads a new world.", usage = "[time] [map]", flags = "f")
@CommandPermissions("cardinal.match.cycle")
public static void cycle(final CommandContext cmd, CommandSender sender) throws CommandException {
    if (GameHandler.getGameHandler().getMatch().isRunning()) {
        if(cmd.hasFlag('f')){
            TeamModule team = TeamUtils.getTeamByName(cmd.getFlag('f'));
            GameHandler.getGameHandler().getMatch().end(team);
        } else {
            throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_CYCLE_DURING_MATCH).getMessage(ChatUtils.getLocale(sender)));
        }
    } else if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.STARTING))
        throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_CYCLE_DURING_MATCH).getMessage(ChatUtils.getLocale(sender)));
    if (cmd.argsLength() > 1) {
        LoadedMap next = getMap(cmd.getJoinedStrings(1));
        if (next == null) {
            throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_NO_MAP_MATCH).getMessage(ChatUtils.getLocale(sender)));
        } else {
            setCycleMap(next);
        }
    }
    CycleTimerModule timer = GameHandler.getGameHandler().getMatch().getModules().getModule(CycleTimerModule.class);
    timer.setOriginalState(GameHandler.getGameHandler().getMatch().getState());
    timer.setCancelled(true);
    timer.startTimer(cmd.argsLength() > 0 ? cmd.getInteger(0) : 30);
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:26,代码来源:CycleCommand.java

示例7: recycle

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Command(aliases = {"recycle", "rc"}, desc = "Cycles to the current map.", usage = "[time]", flags = "f")
@CommandPermissions("cardinal.match.cycle")
public static void recycle(final CommandContext cmd, CommandSender sender) throws CommandException {
    if (GameHandler.getGameHandler().getMatch().isRunning()) {
        if(cmd.hasFlag('f')){
            TeamModule team = TeamUtils.getTeamByName(cmd.getFlag('f'));
            GameHandler.getGameHandler().getMatch().end(team);
        } else {
            throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_CYCLE_DURING_MATCH).getMessage(ChatUtils.getLocale(sender)));
        }
    } else if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.STARTING))
        throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_CYCLE_DURING_MATCH).getMessage(ChatUtils.getLocale(sender)));
    setCycleMap(GameHandler.getGameHandler().getMatch().getLoadedMap());
    CycleTimerModule timer = GameHandler.getGameHandler().getMatch().getModules().getModule(CycleTimerModule.class);
    timer.setOriginalState(GameHandler.getGameHandler().getMatch().getState());
    timer.setCancelled(true);
    timer.startTimer(cmd.argsLength() > 0 ? cmd.getInteger(0) : 30);
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:19,代码来源:CycleCommand.java

示例8: unready

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Command(aliases = {"unready"}, desc = "Make your team not ready.")
public static void unready(final CommandContext cmd, CommandSender sender) throws CommandException {
    if (!(sender instanceof Player)) throw new CommandException("Console cannot use this command!");
    if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.WAITING) || GameHandler.getGameHandler().getMatch().getState().equals(MatchState.STARTING)) {
        TeamModule team = TeamUtils.getTeamByPlayer((Player) sender);
        if (team.isReady()) {
            team.setReady(false);
            ChatUtils.getGlobalChannel().sendMessage(team.getCompleteName() + ChatColor.YELLOW + " is no longer ready");
            if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.STARTING)) {
                GameHandler.getGameHandler().getMatch().setState(MatchState.WAITING);
                GameHandler.getGameHandler().getMatch().getModules().getModule(StartTimer.class).setCancelled(true);
                ChatUtils.getGlobalChannel().sendMessage(ChatColor.RED + "Match start countdown cancelled because " + team.getCompleteName() + ChatColor.RED + " became un-ready.");
            }
        } else throw new CommandException("Your team is already not ready!");
    } else throw new CommandException("You cannot unready during or after a match");
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:17,代码来源:ReadyCommand.java

示例9: start

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Command(aliases = {"start", "begin"}, desc = "Starts the match.", usage = "[time]")
@CommandPermissions("cardinal.match.start")
public static void start(CommandContext cmd, CommandSender sender) throws CommandException {
    if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.WAITING)) {
        int time = 600;
        if (cmd.argsLength() > 0) time = cmd.getInteger(0) * 20;
        GameHandler.getGameHandler().getMatch().start(time);
    } else if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.STARTING)) {
        GameHandler.getGameHandler().getMatch().getModules().getModule(StartTimer.class).setTime(cmd.argsLength() > 0 ? cmd.getInteger(0) * 20 : 30 * 20);
    } else if (GameHandler.getGameHandler().getMatch().getState().equals(MatchState.ENDED)) {
        throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_NO_RESUME).getMessage(ChatUtils.getLocale(sender)));
    } else {
        throw new CommandException(new LocalizedChatMessage(ChatConstant.ERROR_NO_START).getMessage(ChatUtils.getLocale(sender)));
    }

}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:17,代码来源:StartAndEndCommand.java

示例10: onCountdownEnd

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@Override
public void onCountdownEnd() {
    if (forced || enoughPlayers()) {
        Players.broadcastSoundEffect(Sound.BLOCK_NOTE_PLING, 1, 2);
        Bukkit.getOnlinePlayers().forEach(player -> {
            if (!Teams.getTeamByPlayer(player).get().isObserver()) {
                String title = new LocalizedChatMessage(ChatConstant.UI_MATCH_START_TITLE).getMessage(player.getLocale());
                player.showTitle(new TextComponent(net.md_5.bungee.api.ChatColor.GREEN + title), new TextComponent(""), 0, 5, 15);
            }
        });
        match.setState(MatchState.PLAYING);
        ChatUtil.getGlobalChannel().sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.GREEN + "{0}", new LocalizedChatMessage(ChatConstant.UI_MATCH_STARTED)));
        Bukkit.getServer().getPluginManager().callEvent(new MatchStartEvent());
    } else {
        ChatUtil.getGlobalChannel().sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.RED + "{0}", new LocalizedChatMessage(ChatConstant.ERROR_NOT_ENOUGH_PLAYERS)));
        onCountdownCancel();
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:19,代码来源:StartTimer.java

示例11: onMatchStart

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
/**
 * 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));
    }
  }
}
 
开发者ID:CardinalDevelopment,项目名称:Cardinal,代码行数:15,代码来源:SpawnModule.java

示例12: onFurnaceBurn

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event) {
    if (!match.getState().equals(MatchState.PLAYING)) {
        event.setCancelled(true);
        event.setBurning(true);
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:8,代码来源:WorldFreeze.java

示例13: onBlockPlace

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@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)");
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:16,代码来源:BuildHeight.java

示例14: onBlockBreak

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@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)");
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:10,代码来源:BuildHeight.java

示例15: onEmptyBucket

import in.twizmwaz.cardinal.match.MatchState; //导入依赖的package包/类
@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)");
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:11,代码来源:BuildHeight.java


注:本文中的in.twizmwaz.cardinal.match.MatchState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。