public class NetworkedWorldModelServer extends Object implements NetworkedWorldServer
Modifier and Type | Field and Description |
---|---|
protected Collection<L> |
listeners
The client connection listener.
|
protected N |
network
The network.
|
protected Collection<Networkable> |
networkables
List of networkable objects.
|
protected Collection<Networkable> |
toAdd
List of networkable objects.
|
Constructor and Description |
---|
NetworkedWorldModelServer(NetworkMessageDecoder decoder)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(L listener)
Add a client connection listener.
|
void |
addMessage(NetworkMessage message)
Add a network message.
|
void |
addMessages(Collection<NetworkMessage> messages)
Add a list of network messages.
|
void |
addNetworkable(Networkable networkable)
Add a networkable entity to the world.
|
void |
disconnect()
Disconnect.
|
int |
getBandwidth()
Get the amount of bytes sent per second.
|
void |
notifyClientConnected(Byte id,
String name)
Notify when a new client is connected.
|
void |
notifyClientConnected(Byte id,
String name)
Notify when a new client is connected.
|
void |
notifyClientDisconnected(Byte id,
String name)
Notify when a client is disconnected.
|
void |
notifyClientDisconnected(Byte id,
String name)
Notify when a client is disconnected.
|
void |
notifyClientNameChanged(Byte id,
String name)
Notify when a client changed its name.
|
void |
notifyClientNameChanged(Byte id,
String name)
Notify when a client changed its name.
|
void |
receiveMessages()
Receive all messages from the network.
|
void |
removeListener(L listener)
Remove a client connection listener.
|
void |
removeNetworkable(Networkable networkable)
Remove a networkable entity to the world.
|
void |
sendMessages()
Send all messages to the network.
|
void |
startServer(String name,
int port,
String messageOfTheDay)
Start the server.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addMessage, addMessages, addNetworkable, getBandwidth, receiveMessages, removeNetworkable, sendMessages
protected final Collection<Networkable> networkables
protected final Collection<Networkable> toAdd
protected final Collection<L extends com.b3dgs.lionengine.network.ClientListener> listeners
protected final N extends com.b3dgs.lionengine.network.NetworkModel<L> network
public NetworkedWorldModelServer(NetworkMessageDecoder decoder)
decoder
- The decoder reference.public void startServer(String name, int port, String messageOfTheDay)
NetworkedWorldServer
startServer
in interface NetworkedWorldServer
name
- The server name.port
- The port number.messageOfTheDay
- The message of the day.public void disconnect()
NetworkedWorld
disconnect
in interface NetworkedWorld
public void notifyClientConnected(Byte id, String name)
id
- The client id.name
- The client name.public void notifyClientDisconnected(Byte id, String name)
id
- The client id.name
- The client name.public void notifyClientNameChanged(Byte id, String name)
id
- The client id.name
- The client new name.public void addListener(L listener)
listener
- The listener.public void removeListener(L listener)
listener
- The listener.public void addNetworkable(Networkable networkable)
NetworkedWorld
addNetworkable
in interface NetworkedWorld
networkable
- The networkable entity.public void removeNetworkable(Networkable networkable)
NetworkedWorld
removeNetworkable
in interface NetworkedWorld
networkable
- The networkable entity.public void addMessage(NetworkMessage message)
NetworkedWorld
addMessage
in interface NetworkedWorld
message
- The message.public void addMessages(Collection<NetworkMessage> messages)
NetworkedWorld
addMessages
in interface NetworkedWorld
messages
- The messages list.public void sendMessages()
NetworkedWorld
sendMessages
in interface NetworkedWorld
public void receiveMessages()
NetworkedWorld
receiveMessages
in interface NetworkedWorld
public int getBandwidth()
NetworkedWorld
getBandwidth
in interface NetworkedWorld
public void notifyClientConnected(Byte id, String name)
id
- The client id.name
- The client name.public void notifyClientDisconnected(Byte id, String name)
id
- The client id.name
- The client name.Copyright © 2017 Byron 3D Games Studio. All rights reserved.