Skip to content

Commit

Permalink
Node: setMaintanceMode
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMistkaefer committed Dec 27, 2023
1 parent d99570a commit ae17c8d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 Matt Malec, and the Pterodactyl4J contributors
* Copyright 2021-2023 Matt Malec, and the Pterodactyl4J contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,6 +55,7 @@ protected RequestBody finalizeData() {
json.put("daemon_listen", daemonListenPort);
json.put("daemon_sftp", daemonSFTPPort);
json.put("throttle", new JSONObject().put("enabled", throttle));
json.put("maintenance_mode", hasMaintanceMode ? "1" : "0");
return getRequestBody(json);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 Matt Malec, and the Pterodactyl4J contributors
* Copyright 2021-2023 Matt Malec, and the Pterodactyl4J contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,6 +63,10 @@ protected RequestBody finalizeData() {
json.put(
"throttle",
throttle == null ? new JSONObject().put("enabled", false) : new JSONObject().put("enabled", throttle));
json.put(
"maintenance_mode",
hasMaintanceMode == null ? (node.hasMaintanceMode() ? "1" : "0") : (hasMaintanceMode ? "1" : "0"));

return getRequestBody(json);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 Matt Malec, and the Pterodactyl4J contributors
* Copyright 2021-2023 Matt Malec, and the Pterodactyl4J contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -65,4 +65,6 @@ default NodeAction setDiskSpaceOverallocate(long diskSpaceOverallocate) {
NodeAction setThrottle(boolean throttle);

NodeAction setScheme(boolean secure);

NodeAction setMaintanceMode(boolean hasMaintanceMode);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 Matt Malec, and the Pterodactyl4J contributors
* Copyright 2021-2023 Matt Malec, and the Pterodactyl4J contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@ public abstract class AbstractNodeAction extends PteroActionImpl<Node> implement
protected String daemonListenPort;
protected Boolean throttle;
protected Boolean secure;
protected Boolean hasMaintanceMode;

public AbstractNodeAction(PteroApplicationImpl impl, Route.CompiledRoute route) {
super(impl.getP4J(), route, (response, request) -> new NodeImpl(response.getObject(), impl));
Expand Down Expand Up @@ -128,4 +129,10 @@ public NodeAction setScheme(boolean secure) {
this.secure = secure;
return this;
}

@Override
public NodeAction setMaintanceMode(boolean hasMaintanceMode) {
this.hasMaintanceMode = hasMaintanceMode;
return this;
}
}

0 comments on commit ae17c8d

Please sign in to comment.