Skip to content

Commit

Permalink
Merge pull request #3 from ErmacMKIII/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ErmacMKIII committed Jun 30, 2024
2 parents 66412a7 + 89be526 commit 7578a1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rs/alexanderstojanovich/evgds/main/GameServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ public void startServer() {
@Override
public void run() {
// Decrease time-to-live for each client and remove expired clients
clients.forEach((ClientInfo client) -> client.timeToLive--);
clients.forEach((ClientInfo client) -> {
client.timeToLive--;
if (client.timeToLive <= 0) {
kicklist.remove(client.uniqueId);
performCleanUp(gameObject, client.uniqueId, client.timeToLive <= 0);
}
});
clients.removeIf(cli -> cli.timeToLive <= 0);

// Update server window title with current player count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public GameServerProcessor.Result process(IoSession session, Object message) thr

gameServer.kicklist.remove(clientGuid);
gameServer.clients.removeIf(c -> c.uniqueId.equals(clientGuid));
GameServer.performCleanUp(gameServer.gameObject, clientGuid, false);

return new Result(Status.OK, clientHostName, clientGuid, "OK => kick issued to the client!");
}
Expand Down
2 changes: 2 additions & 0 deletions src/rs/alexanderstojanovich/evgds/main/Window.form
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<Image iconType="3" name="/rs/alexanderstojanovich/evgds/resources/stop.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Stop"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fileMenuStopActionPerformed"/>
Expand All @@ -37,6 +38,7 @@
<Image iconType="3" name="/rs/alexanderstojanovich/evgds/resources/restart.png"/>
</Property>
<Property name="text" type="java.lang.String" value="Restart"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fileMenuRestartActionPerformed"/>
Expand Down
2 changes: 2 additions & 0 deletions src/rs/alexanderstojanovich/evgds/main/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

fileMenuStop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/rs/alexanderstojanovich/evgds/resources/stop.png"))); // NOI18N
fileMenuStop.setText("Stop");
fileMenuStop.setEnabled(false);
fileMenuStop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fileMenuStopActionPerformed(evt);
Expand All @@ -789,6 +790,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

fileMenuRestart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/rs/alexanderstojanovich/evgds/resources/restart.png"))); // NOI18N
fileMenuRestart.setText("Restart");
fileMenuRestart.setEnabled(false);
fileMenuRestart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fileMenuRestartActionPerformed(evt);
Expand Down

0 comments on commit 7578a1c

Please sign in to comment.