Package de.creepsmash.server.model

Examples of de.creepsmash.server.model.Player


      gameJournalEntry.setStart_date(startDate);
      gameJournalEntry.setEnd_date(System.currentTimeMillis() / 1000);
      int i = 0;
      for (String playerName : playerNamePositionMap.keySet()) {
        i++;
        Player player = AuthenticationService.getPlayer(playerName);
        if (player != null) {
          int num = playerNamePositionMap.get(playerName);
          // Ich habe keine idee wie man da ohne switch macht^^
          switch(i) {
            case 1:
              gameJournalEntry.setPlayer1(player.getName());
              gameJournalEntry.setPlayer1_score(player.getOldElopoints());
              gameJournalEntry.setScore1(player.getElopoints());
              gameJournalEntry.setPlayer1_position(num);
              gameJournalEntry.setIp1(player.getIp());
              gameJournalEntry.setMac1(player.getMac());
              break;
            case 2:
              gameJournalEntry.setPlayer2(player.getName());
              gameJournalEntry.setPlayer2_score(player.getOldElopoints());
              gameJournalEntry.setScore2(player.getElopoints());
              gameJournalEntry.setPlayer2_position(num);
              gameJournalEntry.setIp2(player.getIp());
              gameJournalEntry.setMac2(player.getMac());
              break;
            case 3:
              gameJournalEntry.setPlayer3(player.getName());
              gameJournalEntry.setPlayer3_score(player.getOldElopoints());
              gameJournalEntry.setScore3(player.getElopoints());
              gameJournalEntry.setPlayer3_position(num);
              gameJournalEntry.setIp3(player.getIp());
              gameJournalEntry.setMac3(player.getMac());
              break;
            case 4:
              gameJournalEntry.setPlayer4(player.getName());
              gameJournalEntry.setPlayer4_score(player.getOldElopoints());
              gameJournalEntry.setScore4(player.getElopoints());
              gameJournalEntry.setPlayer4_position(num);
              gameJournalEntry.setIp4(player.getIp());
              gameJournalEntry.setMac4(player.getMac());
              break;
            default:
              logger.error("False number of players: " + i);
              break;
          }
View Full Code Here


        // Kick User Modulo Permission = 2
        if (msgSplit[0].equalsIgnoreCase("/kick")) {

          if (this.getClient().getUserPermissionFor(2)) {

            Player User = null;
            User = getAnonymousState().getAuthenticationService()
                .getPlayer(msgSplit[1]);
           
            if (User != null) {
             
              this.lobby.kickClient(User, this.getClient(), false, false);
                           
            }else{
              this.getClient().send(new MessageMessage("System", msgSplit[1]+" user Not found."));
            }
            sendMSG = false;
          }
         
        // Ban and Kick User Modulo Permission = 4
        }else if (msgSplit[0].equalsIgnoreCase("/ban")) {
          if (this.getClient().getUserPermissionFor(4)) {

            Player User = null;
            User = getAnonymousState().getAuthenticationService()
                .getPlayer(msgSplit[1]);
           
            if (User != null) {
             
              this.lobby.kickClient(User, this.getClient(), true, true);
                           
            }else{
              this.getClient().send(new MessageMessage("System", msgSplit[1]+" user Not found."));
            }
            sendMSG = false;
          }
        // UnBan User Modulo Permission = 8
        }else if (msgSplit[0].equalsIgnoreCase("/unban")) {
          if (this.getClient().getUserPermissionFor(8)) {

            Player User = null;
            User = getAnonymousState().getAuthenticationService()
                .getPlayer(msgSplit[1]);
           
            if (User != null) {
             
View Full Code Here

   * @param playerName the username.
   * @return a ScoreResponseMessage with the user's data.
   */
  public static ScoreResponseMessage getScoreMessage(String playerName) {
    ScoreResponseMessage scoreResponseMessage = new ScoreResponseMessage();
    Player player = AuthenticationService.getPlayer(playerName);
    if (player != null) {
      scoreResponseMessage.setPlayerName(player.getName());
      scoreResponseMessage.setPoints(player.getElopoints() - 500);
      scoreResponseMessage.setOldPoints(player.getOldElopoints() - 500)
    }
    return scoreResponseMessage;
  }
View Full Code Here

      EntityManager entityManager = PersistenceManager.getInstance()
          .getEntityManager();

      HashSet<ExtendedPlayer> players = new HashSet<ExtendedPlayer>();
      for (String playerName : playerNamePositionMap.keySet()) {
        Player player = AuthenticationService.getPlayer(playerName);
        if (player != null) {
          players.add(new ExtendedPlayer(player,
              playerNamePositionMap.get(playerName)));
        }
      }
View Full Code Here

          this.getClient().setUserName(
              loginRequestMessage.getUsername());
          this.getClient().setMACAddress(
              loginRequestMessage.getMacaddress());
         
          Player player = entityManager.find(Player.class, loginRequestMessage.getUsername());
          EntityTransaction entityTransaction = entityManager.getTransaction();
          entityTransaction.begin();
          player.setLastlogin(System.currentTimeMillis()/1000L);
          player.setIp(this.getClient().getIPAddress());
          player.setMac(this.getClient().getMACAddress());
          entityManager.merge(player);
          entityManager.flush();
          entityTransaction.commit();
         
          this.sendMessage(loginResponseMessage);
View Full Code Here

TOP

Related Classes of de.creepsmash.server.model.Player

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.