net.sourceforge.simplegamenet.specs.tools
Class MultiPlayerGameSettings

java.lang.Object
  extended bynet.sourceforge.simplegamenet.specs.to.GameSettings
      extended bynet.sourceforge.simplegamenet.specs.tools.MultiPlayerGameSettings
All Implemented Interfaces:
Serializable

public class MultiPlayerGameSettings
extends GameSettings

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.simplegamenet.specs.to.GameSettings
engine
 
Constructor Summary
MultiPlayerGameSettings()
           
MultiPlayerGameSettings(int maximumParticipantsAmount, int maximumConnectionsAmount)
           
MultiPlayerGameSettings(int defaultMaximumParticipantsAmount, int minimumMaximumParticipantsAmount, int maximumMaximumParticipantsAmount, int defaultMaximumConnectionsAmount, int minimumMaximumConnectionsAmount, int maximumMaximumConnectionsAmount)
           
MultiPlayerGameSettings(int minimumParticipantsAmount, int defaultMaximumParticipantsAmount, int minimumMaximumParticipantsAmount, int maximumMaximumParticipantsAmount, int defaultMaximumConnectionsAmount, int minimumMaximumConnectionsAmount, int maximumMaximumConnectionsAmount)
           
 
Method Summary
 GameSettings createChangedGameSettings(GameSettingsPanel gameSettingsPanel)
          Creates a new GameSettings based on the GameSettingsPanel.
 PlayerSettings createDefaultPlayerSettings(Integer playerID, int playerType, String nickname)
          Creates a new PlayerSettings based on the current game state.
 GameSettingsPanel createGameSettingsPanel()
          Creates a new GameSettingsPanel based on these game settings.
 int getMaximumConnectionsAmount()
           
 int getMaximumMaximumConnectionsAmount()
           
 int getMaximumMaximumParticipantsAmount()
           
 int getMaximumParticipantsAmount()
           
 int getMinimumMaximumConnectionsAmount()
           
 int getMinimumMaximumParticipantsAmount()
           
 int getMinimumParticipantsAmount()
           
 boolean isChangeGameSettingsAllowed(GameSettings changedGameSettings)
          Returns true if the current game state allows these game settings to be updated to the changed game settings.
 boolean isChangePlayerSettingsAllowed(PlayerSettings currentPlayerSettings, PlayerSettings changedPlayerSettings)
          Return true if the current game state and these game settings allow a player to change his player settings.
 boolean isCreateDefaultPlayerSettingsAllowed(int playerType)
          Returns true if the current game state and these game settings allow the new player to connect.
 boolean isStartGameAllowed()
          Returns true if the current game state allows a game to be started.
 void setMaximumConnectionsAmount(int maximumConnectionsAmount)
           
 void setMaximumMaximumConnectionsAmount(int maximumMaximumConnectionsAmount)
           
 void setMaximumMaximumParticipantsAmount(int maximumMaximumParticipantsAmount)
           
 void setMaximumParticipantsAmount(int maximumParticipantsAmount)
           
 void setMinimumMaximumConnectionsAmount(int minimumMaximumConnectionsAmount)
           
 void setMinimumMaximumParticipantsAmount(int minimumMaximumParticipantsAmount)
           
 void setMinimumParticipantsAmount(int minimumParticipantsAmount)
           
 
Methods inherited from class net.sourceforge.simplegamenet.specs.to.GameSettings
setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPlayerGameSettings

public MultiPlayerGameSettings()

MultiPlayerGameSettings

public MultiPlayerGameSettings(int maximumParticipantsAmount,
                               int maximumConnectionsAmount)

MultiPlayerGameSettings

public MultiPlayerGameSettings(int defaultMaximumParticipantsAmount,
                               int minimumMaximumParticipantsAmount,
                               int maximumMaximumParticipantsAmount,
                               int defaultMaximumConnectionsAmount,
                               int minimumMaximumConnectionsAmount,
                               int maximumMaximumConnectionsAmount)

MultiPlayerGameSettings

public MultiPlayerGameSettings(int minimumParticipantsAmount,
                               int defaultMaximumParticipantsAmount,
                               int minimumMaximumParticipantsAmount,
                               int maximumMaximumParticipantsAmount,
                               int defaultMaximumConnectionsAmount,
                               int minimumMaximumConnectionsAmount,
                               int maximumMaximumConnectionsAmount)
Method Detail

createGameSettingsPanel

public GameSettingsPanel createGameSettingsPanel()
Description copied from class: GameSettings
Creates a new GameSettingsPanel based on these game settings. This new GameSettingsPanel is shown in the "Connection wizard" dialog or the "Game settings" tab. That panel is enabled with the host which allows him to change the game settings, but it is disabled with all other users, who can just see the game settings.

During this method the engine variable can be null.

Specified by:
createGameSettingsPanel in class GameSettings
Returns:
a new GameSettingsPanel

createChangedGameSettings

public GameSettings createChangedGameSettings(GameSettingsPanel gameSettingsPanel)
Description copied from class: GameSettings
Creates a new GameSettings based on the GameSettingsPanel. This method fetches all the data a host can edit with custom methods from the GameSettingsPanel and copies any non editable data from these game settings into the new GameSettings.

This method will never be called when the game is playing because the host is not allowed to change the game settings during the game.

During this method the engine variable can be null.

Specified by:
createChangedGameSettings in class GameSettings
Parameters:
gameSettingsPanel - a GameSettingsPanel changed by the host
Returns:
a new GameSettings

isChangeGameSettingsAllowed

public boolean isChangeGameSettingsAllowed(GameSettings changedGameSettings)
Description copied from class: GameSettings
Returns true if the current game state allows these game settings to be updated to the changed game settings. This method is called after GameSettings.createChangedGameSettings(GameSettingsPanel) has been called.

If a subclass does not overwrite this method it always returns true. A subclass should override this method if it wants to prevent the host to change the game settings to certain settings sometimes.

Overrides:
isChangeGameSettingsAllowed in class GameSettings
Parameters:
changedGameSettings - the changed game settings created by GameSettings.createChangedGameSettings(net.sourceforge.simplegamenet.specs.gui.GameSettingsPanel)
Returns:
true if the game settings are allowed to change

isCreateDefaultPlayerSettingsAllowed

public boolean isCreateDefaultPlayerSettingsAllowed(int playerType)
Description copied from class: GameSettings
Returns true if the current game state and these game settings allow the new player to connect. If true the GameSettings.createDefaultPlayerSettings(Integer, int, String) is called next, which will decide whether the new player becomes a participant or observer.

If a subclass does not overwrite this method it always returns true. A subclass should overwrite this method if it wants to block new players sometimes.

Overrides:
isCreateDefaultPlayerSettingsAllowed in class GameSettings
Parameters:
playerType - the new player's playerType, as defined in PlayerSettings
Returns:
true if the player is allowed to connect

createDefaultPlayerSettings

public PlayerSettings createDefaultPlayerSettings(Integer playerID,
                                                  int playerType,
                                                  String nickname)
Description copied from class: GameSettings
Creates a new PlayerSettings based on the current game state. Subclasses that overwrite this method should not make any changes to the playerID, playerType or nickname and pass it to the constructor of a subclass of PlayerSettings, together with the engine variable.

If a subclass does not overwrite this method it creates a new StandardPlayerSettings, a participating if the game is not playing and observing if the game is playing. A subclass should overwrite this method if it wants to use custom PlayerSettings.

Overrides:
createDefaultPlayerSettings in class GameSettings
Parameters:
playerID - the new player's unique identification
playerType - the new player's playerType, as defined in PlayerSettings
nickname - the new player's preferred nickname filtered from bad language if bad language is filtered by the server.
Returns:
default player settings for the new player

isChangePlayerSettingsAllowed

public boolean isChangePlayerSettingsAllowed(PlayerSettings currentPlayerSettings,
                                             PlayerSettings changedPlayerSettings)
Description copied from class: GameSettings
Return true if the current game state and these game settings allow a player to change his player settings.

If true the PlayerSettings.isChangePlayerSettingsAllowed(PlayerSettings) is called next, which checks if the old player settings allow the change.

If a subclass does not overwrite this method it always returns true. A subclass should overwrite this method if it wants to block players changing their player settings sometimes.

Overrides:
isChangePlayerSettingsAllowed in class GameSettings
Parameters:
currentPlayerSettings - the current player settings
changedPlayerSettings - the changed player settings
Returns:
true if player is allowed to change his player settings

isStartGameAllowed

public boolean isStartGameAllowed()
Description copied from class: GameSettings
Returns true if the current game state allows a game to be started.

If a subclass does not overwrite this method it always returns true. A subclass should overwrite this method if it wants to disallow a game to be started, for example when there aren't enough participants.

Overrides:
isStartGameAllowed in class GameSettings
Returns:
true if a game is allowed to start

getMinimumParticipantsAmount

public int getMinimumParticipantsAmount()

setMinimumParticipantsAmount

public void setMinimumParticipantsAmount(int minimumParticipantsAmount)

getMaximumParticipantsAmount

public int getMaximumParticipantsAmount()

setMaximumParticipantsAmount

public void setMaximumParticipantsAmount(int maximumParticipantsAmount)

getMaximumConnectionsAmount

public int getMaximumConnectionsAmount()

setMaximumConnectionsAmount

public void setMaximumConnectionsAmount(int maximumConnectionsAmount)

getMinimumMaximumParticipantsAmount

public int getMinimumMaximumParticipantsAmount()

setMinimumMaximumParticipantsAmount

public void setMinimumMaximumParticipantsAmount(int minimumMaximumParticipantsAmount)

getMaximumMaximumParticipantsAmount

public int getMaximumMaximumParticipantsAmount()

setMaximumMaximumParticipantsAmount

public void setMaximumMaximumParticipantsAmount(int maximumMaximumParticipantsAmount)

getMinimumMaximumConnectionsAmount

public int getMinimumMaximumConnectionsAmount()

setMinimumMaximumConnectionsAmount

public void setMinimumMaximumConnectionsAmount(int minimumMaximumConnectionsAmount)

getMaximumMaximumConnectionsAmount

public int getMaximumMaximumConnectionsAmount()

setMaximumMaximumConnectionsAmount

public void setMaximumMaximumConnectionsAmount(int maximumMaximumConnectionsAmount)


Copyright © 2003-2004 The 3 Belgians. All Rights Reserved.