コード例 #1
0
ファイル: PlayerListeners.java プロジェクト: ShootGame/Arcade
  @EventHandler
  public void onAsyncPlayerPreLoginEvent(AsyncPlayerPreLoginEvent e) {
    if (Arcade.getMatches().getStatus() == ArcadeMatchStatus.RESTARTING) {
      e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_WHITELIST);
      e.setKickMessage(Color.RED + "Serwer jest teraz restartowany...");
    }

    if (this.server.isFull()) {
      boolean allowed = false;
      // TODO Mongo query to check if the player is allowed to join this server

      if (!allowed) {
        e.disallow(
            AsyncPlayerPreLoginEvent.Result.KICK_FULL,
            Color.RED
                + "Ten serwer jest obecnie pelny. Spróbuj "
                + "polaczyc sie ponownie pózniej, lub wybierz inny "
                + "serwer. Tylko ranga "
                + Color.GOLD
                + Color.BOLD
                + "VIP"
                + Color.RESET
                + Color.RED
                + " moze dolaczac "
                + "na pelne serwery.");
      }
    }
  }
コード例 #2
0
ファイル: PlayerListeners.java プロジェクト: ShootGame/Arcade
 private List<Spawn> getSpawnLocations(Player player) {
   if (Arcade.getMatches().getStatus() == ArcadeMatchStatus.RUNNING) {
     return player.getTeam().getSpawns();
   } else {
     return Arcade.getTeams().getObservers().getSpawns();
   }
 }
コード例 #3
0
ファイル: PlayerListeners.java プロジェクト: ShootGame/Arcade
  @EventHandler
  public void onPlayerDeath(PlayerDeathEvent e) {
    if (e.getDeathMessage() == null) {
      return;
    } else if (e.getDeathMessage().endsWith(" died")) {
      e.setDeathMessage(null);
    }

    if (Arcade.getMatches().getStatus() != ArcadeMatchStatus.RUNNING) {
      e.getDrops().clear();
    }
  }
コード例 #4
0
ファイル: PlayerListeners.java プロジェクト: ShootGame/Arcade
  @EventHandler
  public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent e) {
    e.setCancelled(true);
    String message = e.getMessage();
    Player player = Arcade.getServer().getPlayer(e.getPlayer().getUniqueId());
    ArcadeMatchStatus matchStatus = Arcade.getMatches().getStatus();

    if (matchStatus != ArcadeMatchStatus.RUNNING || Arcade.getTeams().getTeams().size() == 1) {
      Arcade.getTeams().getObservers().getChat().sendMessage(player, message);
    } else {
      player.getTeam().getChat().sendMessage(player, message);
    }
  }