⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverconfig.java

📁 Vyger offers a D & D and Rogue-like environment in a graphical online roleplay game.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * Light And Shadow. A Persistent Universe based on Robert Jordan's Wheel of Time Books.
 * Copyright (C) 2001-2002 WOTLAS Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package wotlas.common;


/** A ServerConfig contains all the basic information of a server : name, ports, etc...
 *<p>
 *  It has two purposes :<p><br>
 *
 *   - provide start-up information for the ServerManager or for the client side.<br>
 *
 *   - provide server information to export to a central web server
 *     ( http://wotlas.net for instance ). This central server registers
 *     game servers and publish a up-to-date list of active servers. Wotlas Client Software
 *     can then download this list and display it to the user.<br><p>
 *
 * The ServerConfig class is saved in $base$/servers/server-<id>.cfg. and
 * $base$/servers/server-<id>-adr.cfg
 *
 * When you install a wotlas server you need to create this file. To help you a setup tool
 * is provided in the package : wotlas.server.setup.ServerSetup
 *
 * @author Aldiss
 * @see wotlas.server.setup.ServerSetup
 */

public class ServerConfig
{
 /*------------------------------------------------------------------------------------*/

   /** Server Symbolic Name.
    */
      private String serverSymbolicName;

   /** Server Name, normally the host name. Example: "tatoo.wotlas.org"
    *  Since wotlas v1.2 the serverName is transient and saved separately in an other file.
    *  see javadoc header of this class.
    */
      transient private String serverName;

   /** Server ID. This ID is given by light-and-shadow.org. See the wotlas.setup package.
    */
      private int serverID;

   /** Port for the AccountServer. There is no restriction on this number.
    */
      private int accountServerPort;

   /** Port for the GameServer. There is no restriction on this number.
    */
      private int gameServerPort;

   /** Port for the GatewayServer. There is no restriction on this number.
    */
      private int gatewayServerPort;

   /** Maximum Number of Connections on the Game Server.
    */
      private int maxNumberOfGameConnections;

   /** Maximum Number of Connections on the Account Server.
    */
      private int maxNumberOfAccountConnections;

   /** Maximum Number of Connections on the Gateway Server.
    */
      private int maxNumberOfGatewayConnections;

   /** A description of the content of this server : towns, guilds, etc ...
    */
      private String description;

   /** Server Physical Location. Is it in France, England, USA, Australia ?
    */
      private String location;

   /** Email of the Wotlas Server Administrator.
    */
      private String adminEmail;

   /** ServerConfig Version.
    */
      private String configVersion;

   /** The first x position in the world.
    */
      private int worldFirstXPosition;

   /** The first y position in the world.
    */
      private int worldFirstYPosition;

 /*------------------------------------------------------------------------------------*/

   /** Last time we updated the server data.
    */
      transient private long lastUpdateTime;

 /*------------------------------------------------------------------------------------*/

  /** Empty Constructor for persistence.
   *  Data is loaded by the PersistenceManager.
   */
     public ServerConfig() {
        serverSymbolicName = new String("Wotlas Server");
        serverName = null;
        serverID = 0;
        accountServerPort = 25500;
        gameServerPort = 26500;
        gatewayServerPort = 27500;
        maxNumberOfGameConnections = 110;
        maxNumberOfAccountConnections = 20;
        maxNumberOfGatewayConnections = 20;
        description = new String("Enter a description for your server...");
        location = new String("France / USA / Germany / England / Italy...");
        adminEmail = new String("myAdress@foobar.net");
        lastUpdateTime=0;
        
        worldFirstXPosition = 743;
        worldFirstYPosition = 277;  // default is Tar Valon
     }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To update this ServerConfig from another.
    * @param other other ServerConfig.
    */
     public void update( ServerConfig other ) {
        serverSymbolicName = other.getServerSymbolicName();
        serverName = other.getServerName();
        serverID = other.getServerID();
        accountServerPort = other.getAccountServerPort();
        gameServerPort = other.getGameServerPort();
        gatewayServerPort = other.getGatewayServerPort();
        maxNumberOfGameConnections = other.getMaxNumberOfGameConnections();
        maxNumberOfAccountConnections = other.getMaxNumberOfAccountConnections();
        maxNumberOfGatewayConnections = other.getMaxNumberOfGatewayConnections();
        description = other.getDescription();
        location = other.getLocation();
        adminEmail = other.getAdminEmail();
        configVersion = other.getConfigVersion();
        worldFirstXPosition = other.getWorldFirstXPosition();
        worldFirstYPosition = other.getWorldFirstYPosition();

        lastUpdateTime=System.currentTimeMillis();
     }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To get the Server Name. Normally it's the host name. Example: "tatoo.wotlas.org"
    *
    * @return server name
    */
      public String getServerName() {
          return serverName;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To set the Server Name. Normally it's the host name. Example: "tatoo.wotlas.org"
    *
    * @param serverName server name
    */
      public void setServerName( String serverName ) {
          this.serverName = serverName;
          lastUpdateTime=System.currentTimeMillis();
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To get the Server Symbolic Name. Example: "My Wotlas Server"
    *
    * @return server symbolic name
    */
      public String getServerSymbolicName() {
          return serverSymbolicName;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To set the Server Symbolic Name. Example: "My Wotlas Server"
    *
    * @param serverSymbolicName server symbolic name
    */
      public void setServerSymbolicName( String serverSymbolicName ) {
          this.serverSymbolicName = serverSymbolicName;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To get the Server ID. This ID is given by light-and-shadow.org.
    *  See the wotlas.setup.
    *
    * @return serverID
    */
      public int getServerID() {
         return serverID;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To set the Server ID. This ID is given by light-and-shadow.org.
    *  See the wotlas.setup.
    *
    * @param serverID server ID to set
    */
      public void setServerID( int serverID ) {
         this.serverID = serverID;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To get the port for the AccountServer.
    *
    * @return accountServerPort
    */
      public int getAccountServerPort() {
         return accountServerPort;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To set the port for the AccountServer. There is no restriction on this number.
    *
    * @param accountServerPort account Server Port to set
    */
      public void setAccountServerPort(  int accountServerPort ) {
         this.accountServerPort = accountServerPort;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To get the port for the GameServer.
    *
    * @return gameServerPort
    */
      public int getGameServerPort() {
         return gameServerPort;
      }

 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

   /** To set the port for the GameServer. There is no restriction on this number.
    *
    * @param gameServerPort game Server Port to set
    */
      public void setGameServerPort(  int gameServerPort ) {
         this.gameServerPort = gameServerPort;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -