Skip to content

Commit 00d207e

Browse files
committed
feat: server update event
1 parent 66d63fe commit 00d207e

18 files changed

+191
-29
lines changed

api/src/main/java/app/simplecloud/api/blueprint/RuntimeConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,4 @@ public Map<String, Object> getWith() {
3030
public void setWith(@Nullable Map<String, Object> with) {
3131
this.with = with;
3232
}
33-
}
34-
35-
33+
}

api/src/main/java/app/simplecloud/api/event/server/ServerEventApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,13 @@ public interface ServerEventApi {
4141
*/
4242
Subscription onDeleted(Consumer<ServerDeletedEvent> handler);
4343

44+
/**
45+
* Subscribes to server update events.
46+
*
47+
* @param handler the callback to invoke when a server is updated
48+
* @return a subscription that can be closed to stop receiving events
49+
*/
50+
Subscription onUpdated(Consumer<ServerUpdatedEvent> handler);
51+
4452
}
4553

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package app.simplecloud.api.event.server;
2+
3+
import app.simplecloud.api.server.Server;
4+
5+
/**
6+
* Event fired when a server instance is updated.
7+
*/
8+
public interface ServerUpdatedEvent {
9+
10+
/**
11+
* Returns the network ID this event belongs to.
12+
*
13+
* @return the network ID
14+
*/
15+
String getNetworkId();
16+
17+
/**
18+
* Returns the ID of the updated server.
19+
*
20+
* @return the server ID
21+
*/
22+
String getServerId();
23+
24+
/**
25+
* Returns the server group ID this server belongs to.
26+
*
27+
* @return the server group ID
28+
*/
29+
String getServerGroupId();
30+
31+
/**
32+
* Returns the updated server instance with complete configuration and runtime information.
33+
*
34+
* @return the server
35+
* @throws IllegalStateException if server data is not available
36+
*/
37+
Server getServer();
38+
39+
/**
40+
* Returns the timestamp when this event occurred (ISO 8601 format).
41+
*
42+
* @return the timestamp
43+
*/
44+
String getTimestamp();
45+
}
46+

api/src/main/java/app/simplecloud/api/group/DeploymentConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ public void setStrategy(@Nullable DeploymentStrategy strategy) {
2929
}
3030
}
3131

32+

api/src/main/java/app/simplecloud/api/group/DeploymentHost.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ public void setPriority(int priority) {
2727
this.priority = priority;
2828
}
2929
}
30+

api/src/main/java/app/simplecloud/api/group/GroupQuery.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,4 @@ public GroupQuery limit(Integer limit) {
6666
public static GroupQuery create() {
6767
return new GroupQuery();
6868
}
69-
}
70-
71-
69+
}

api/src/main/java/app/simplecloud/api/group/ScaleDownConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,4 @@ public boolean isIgnorePlayers() {
2626
public void setIgnorePlayers(boolean ignorePlayers) {
2727
this.ignorePlayers = ignorePlayers;
2828
}
29-
}
30-
31-
29+
}

api/src/main/java/app/simplecloud/api/group/ScalingConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,4 @@ public ScalingMode getScalingMode() {
6464
public void setScalingMode(@Nullable ScalingMode scalingMode) {
6565
this.scalingMode = scalingMode;
6666
}
67-
}
68-
69-
67+
}

api/src/main/java/app/simplecloud/api/group/SourceConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,4 @@ public String getImage() {
3939
public void setImage(@Nullable String image) {
4040
this.image = image;
4141
}
42-
}
43-
44-
42+
}

api/src/main/java/app/simplecloud/api/group/UpdateGroupRequest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,4 @@ public UpdateGroupRequest setTags(List<String> tags) {
131131
this.tags = tags;
132132
return this;
133133
}
134-
}
135-
136-
134+
}

0 commit comments

Comments
 (0)