Пример #1
0
  public GameUtils() {

    word = plugin.getMapHandler().getRandomWord();

    minPlayers = plugin.getConfig().getInt("game.min_players");
    maxPlayers = plugin.getConfig().getInt("game.max_players");
    maxParticles = plugin.getConfig().getInt("options.particles.max");
  }
Пример #2
0
public class GameUtils {

  public static String word;
  public static GameState currentGameState;
  public static Map currentMap;
  public static Gamer currentGamer;
  public static List<Region> usedRegions = new ArrayList<Region>();
  public static int minPlayers;
  public static int maxPlayers;
  public static int maxParticles;
  public static int[] stateTime;
  static MasterBuilders plugin = MasterBuilders.getInstance();

  public GameUtils() {

    word = plugin.getMapHandler().getRandomWord();

    minPlayers = plugin.getConfig().getInt("game.min_players");
    maxPlayers = plugin.getConfig().getInt("game.max_players");
    maxParticles = plugin.getConfig().getInt("options.particles.max");
  }

  public static int getStateTime(GameState state) {
    return plugin.getConfig().getInt("game.time." + state.toString().toLowerCase());
  }
}
Пример #3
0
  public static Scoreboard createMainScoreboard() {
    ScoreboardManager sm = plugin.getServer().getScoreboardManager();
    Scoreboard sb = sm.getMainScoreboard();

    if (sb.getObjective(DisplaySlot.SIDEBAR) != null) {
      return sb;
    }

    Objective main = sb.registerNewObjective("main", "dummy");
    main.setDisplayName("§3MasterBuilders");
    main.setDisplaySlot(DisplaySlot.SIDEBAR);

    main.getScore("§6Werbung").setScore(0);

    return sb;
  }
Пример #4
0
public class ScoreboardUtils {

  static MasterBuilders plugin = MasterBuilders.getInstance();

  static Scoreboard mainBoard = createMainScoreboard();
  static Scoreboard gameBoard = plugin.getServer().getScoreboardManager().getNewScoreboard();
  static Scoreboard votingBoard = plugin.getServer().getScoreboardManager().getNewScoreboard();

  public ScoreboardUtils() {}

  public static Scoreboard createMainScoreboard() {
    ScoreboardManager sm = plugin.getServer().getScoreboardManager();
    Scoreboard sb = sm.getMainScoreboard();

    if (sb.getObjective(DisplaySlot.SIDEBAR) != null) {
      return sb;
    }

    Objective main = sb.registerNewObjective("main", "dummy");
    main.setDisplayName("§3MasterBuilders");
    main.setDisplaySlot(DisplaySlot.SIDEBAR);

    main.getScore("§6Werbung").setScore(0);

    return sb;
  }

  public static void setGameScoreboard(int counter) {
    Objective layer = gameBoard.getObjective("game");
    if (layer == null) {
      layer = gameBoard.registerNewObjective("game", "dummy");
    }
    layer.setDisplaySlot(DisplaySlot.SIDEBAR);
    layer.setDisplayName(
        "§3MasterBuilders §8| §a§b" + String.format("%02d:%02d", counter / 60, counter % 60));

    layer.getScore("§6------------").setScore(6);

    layer.getScore("§b ").setScore(5);

    layer.getScore("§6Thema:").setScore(4);
    layer.getScore("§a" + GameUtils.word).setScore(3);

    layer.getScore("§a ").setScore(2);

    layer.getScore("§c§6------------").setScore(1);

    for (Player p : Bukkit.getOnlinePlayers()) {
      p.setScoreboard(gameBoard);
    }
  }

  public static void updateGameScoreboard(int counter) {
    gameBoard
        .getObjective(DisplaySlot.SIDEBAR)
        .setDisplayName(
            "§3MasterBuilders §8| §a" + String.format("%02d:%02d", counter / 60, counter % 60));
  }

  public static void setVotingScoreboard(int counter) {

    Objective layer = votingBoard.getObjective("voting");
    if (layer == null) {
      layer = votingBoard.registerNewObjective("voting", "dummy");
    }
    layer.setDisplaySlot(DisplaySlot.SIDEBAR);
    layer.setDisplayName(
        "§3MasterBuilders §8| §a" + String.format("%02d:%02d", counter / 60, counter % 60));

    layer.getScore("§6--------------").setScore(9);

    layer.getScore("§c ").setScore(8);

    layer.getScore("§6Thema:").setScore(7);
    layer.getScore("§a" + GameUtils.word).setScore(6);

    layer.getScore("§b ").setScore(5);

    layer.getScore("§6Erbauer:").setScore(4);
    layer.getScore("§a*****").setScore(3);

    layer.getScore("§a ").setScore(2);

    layer.getScore("§c§6--------------").setScore(1);

    for (Player p : Bukkit.getOnlinePlayers()) {
      p.setScoreboard(votingBoard);
    }
  }

  public static void updateVotingScoreboard(int counter) {
    votingBoard
        .getObjective(DisplaySlot.SIDEBAR)
        .setDisplayName(
            "§3MasterBuilders §8| §a" + String.format("%02d:%02d", counter / 60, counter % 60));
  }

  public static void showBuilderVotingScoreboard(String builder) {
    votingBoard.resetScores("§a*****");
    votingBoard.getObjective(DisplaySlot.SIDEBAR).getScore("§a" + builder).setScore(3);
  }

  public static void hideBuilderVotingScoreboard(String exBuilder) {
    votingBoard.resetScores("§a" + exBuilder);
    votingBoard.getObjective(DisplaySlot.SIDEBAR).getScore("§a*****").setScore(3);
  }

  public static Scoreboard getMainScoreboard() {
    return mainBoard;
  }

  public static Scoreboard getGameboard() {
    return gameBoard;
  }

  public static Scoreboard getVotingboard() {
    return votingBoard;
  }
}
Пример #5
0
 public static int getStateTime(GameState state) {
   return plugin.getConfig().getInt("game.time." + state.toString().toLowerCase());
 }