Skip to content

Commit

Permalink
Node: setMaintanceMode - change property name / fix function naming
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMistkaefer committed Jan 2, 2024
1 parent 0ba95c4 commit 99cfaf3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 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-2024 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 @@ -42,7 +42,16 @@ public interface Node extends ISnowflake {

boolean isBehindProxy();

boolean hasMaintanceMode();
boolean isInMaintenanceMode();

/**
* @deprecated Use {@link #isInMaintenanceMode()} instead
* @return {@code true} if the node is in maintenance mode
*/
@Deprecated
default boolean hasMaintanceMode() {
return isInMaintenanceMode();
}

default String getMemory() {
return Long.toUnsignedString(getMemoryLong());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +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", isInMaintenanceMode ? "1" : "0");
json.put("maintenance_mode", maintenanceMode ? "1" : "0");
return getRequestBody(json);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ protected RequestBody finalizeData() {
throttle == null ? new JSONObject().put("enabled", false) : new JSONObject().put("enabled", throttle));
json.put(
"maintenance_mode",
isInMaintenanceMode == null
? (node.hasMaintanceMode() ? "1" : "0")
: (isInMaintenanceMode ? "1" : "0"));
maintenanceMode == null ? (node.isInMaintenanceMode() ? "1" : "0") : (maintenanceMode ? "1" : "0"));

return getRequestBody(json);
}
Expand Down
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-2024 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 @@ -89,7 +89,7 @@ public boolean isBehindProxy() {
}

@Override
public boolean hasMaintanceMode() {
public boolean isInMaintenanceMode() {
return json.getBoolean("maintenance_mode");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ default NodeAction setDiskSpaceOverallocate(long diskSpaceOverallocate) {

NodeAction setScheme(boolean secure);

NodeAction setMaintanceMode(boolean isInMaintenanceMode);
NodeAction setMaintenanceMode(boolean maintenanceMode);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class AbstractNodeAction extends PteroActionImpl<Node> implement
protected String daemonListenPort;
protected Boolean throttle;
protected Boolean secure;
protected Boolean isInMaintenanceMode;
protected Boolean maintenanceMode;

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

@Override
public NodeAction setMaintanceMode(boolean isInMaintenanceMode) {
this.isInMaintenanceMode = isInMaintenanceMode;
public NodeAction setMaintenanceMode(boolean maintenanceMode) {
this.maintenanceMode = maintenanceMode;
return this;
}
}

0 comments on commit 99cfaf3

Please sign in to comment.