Skip to content

Commit 99cfaf3

Browse files
committed
Node: setMaintanceMode - change property name / fix function naming
1 parent 0ba95c4 commit 99cfaf3

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

src/main/java/com/mattmalec/pterodactyl4j/application/entities/Node.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2022 Matt Malec, and the Pterodactyl4J contributors
2+
* Copyright 2021-2024 Matt Malec, and the Pterodactyl4J contributors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,16 @@ public interface Node extends ISnowflake {
4242

4343
boolean isBehindProxy();
4444

45-
boolean hasMaintanceMode();
45+
boolean isInMaintenanceMode();
46+
47+
/**
48+
* @deprecated Use {@link #isInMaintenanceMode()} instead
49+
* @return {@code true} if the node is in maintenance mode
50+
*/
51+
@Deprecated
52+
default boolean hasMaintanceMode() {
53+
return isInMaintenanceMode();
54+
}
4655

4756
default String getMemory() {
4857
return Long.toUnsignedString(getMemoryLong());

src/main/java/com/mattmalec/pterodactyl4j/application/entities/impl/CreateNodeImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected RequestBody finalizeData() {
5555
json.put("daemon_listen", daemonListenPort);
5656
json.put("daemon_sftp", daemonSFTPPort);
5757
json.put("throttle", new JSONObject().put("enabled", throttle));
58-
json.put("maintenance_mode", isInMaintenanceMode ? "1" : "0");
58+
json.put("maintenance_mode", maintenanceMode ? "1" : "0");
5959
return getRequestBody(json);
6060
}
6161
}

src/main/java/com/mattmalec/pterodactyl4j/application/entities/impl/EditNodeImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ protected RequestBody finalizeData() {
6565
throttle == null ? new JSONObject().put("enabled", false) : new JSONObject().put("enabled", throttle));
6666
json.put(
6767
"maintenance_mode",
68-
isInMaintenanceMode == null
69-
? (node.hasMaintanceMode() ? "1" : "0")
70-
: (isInMaintenanceMode ? "1" : "0"));
68+
maintenanceMode == null ? (node.isInMaintenanceMode() ? "1" : "0") : (maintenanceMode ? "1" : "0"));
7169

7270
return getRequestBody(json);
7371
}

src/main/java/com/mattmalec/pterodactyl4j/application/entities/impl/NodeImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2022 Matt Malec, and the Pterodactyl4J contributors
2+
* Copyright 2021-2024 Matt Malec, and the Pterodactyl4J contributors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -89,7 +89,7 @@ public boolean isBehindProxy() {
8989
}
9090

9191
@Override
92-
public boolean hasMaintanceMode() {
92+
public boolean isInMaintenanceMode() {
9393
return json.getBoolean("maintenance_mode");
9494
}
9595

src/main/java/com/mattmalec/pterodactyl4j/application/managers/NodeAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ default NodeAction setDiskSpaceOverallocate(long diskSpaceOverallocate) {
6666

6767
NodeAction setScheme(boolean secure);
6868

69-
NodeAction setMaintanceMode(boolean isInMaintenanceMode);
69+
NodeAction setMaintenanceMode(boolean maintenanceMode);
7070
}

src/main/java/com/mattmalec/pterodactyl4j/requests/action/AbstractNodeAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public abstract class AbstractNodeAction extends PteroActionImpl<Node> implement
4040
protected String daemonListenPort;
4141
protected Boolean throttle;
4242
protected Boolean secure;
43-
protected Boolean isInMaintenanceMode;
43+
protected Boolean maintenanceMode;
4444

4545
public AbstractNodeAction(PteroApplicationImpl impl, Route.CompiledRoute route) {
4646
super(impl.getP4J(), route, (response, request) -> new NodeImpl(response.getObject(), impl));
@@ -131,8 +131,8 @@ public NodeAction setScheme(boolean secure) {
131131
}
132132

133133
@Override
134-
public NodeAction setMaintanceMode(boolean isInMaintenanceMode) {
135-
this.isInMaintenanceMode = isInMaintenanceMode;
134+
public NodeAction setMaintenanceMode(boolean maintenanceMode) {
135+
this.maintenanceMode = maintenanceMode;
136136
return this;
137137
}
138138
}

0 commit comments

Comments
 (0)