-
Notifications
You must be signed in to change notification settings - Fork 32
Ptero support #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Ptero support #289
Changes from all commits
6b868fa
592f746
b5e19ca
783341f
9465599
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,13 +28,15 @@ public class UpdaterConfig extends MyYaml { | |
| public YamlSection self_updater; | ||
| public YamlSection self_updater_profile; | ||
| public YamlSection self_updater_build; | ||
| public YamlSection self_updater_safe_mode; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this anymore.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As i have outlined in this comment #289 (comment) i would rather keep it because it's still useful in Auto Plug specific eggs. Is that ok? |
||
|
|
||
| public YamlSection java_updater; | ||
| public YamlSection java_updater_profile; | ||
| //public YamlSection java_updater_vendor; // Currently not supported, because only adopt-api is implemented at the moment | ||
| public YamlSection java_updater_version; | ||
| public YamlSection java_updater_build_id; | ||
| public YamlSection java_updater_large_heap; | ||
| public YamlSection java_updater_force_enable; | ||
|
|
||
| public YamlSection server_updater; | ||
| public YamlSection server_updater_profile; | ||
|
|
@@ -125,6 +127,10 @@ public UpdaterConfig() throws IOException, DuplicateKeyException, YamlReaderExce | |
| self_updater_build = put(name, "self-updater", "build").setDefValues("stable").setComments( | ||
| "Choose between 'stable' and 'beta' builds.", | ||
| "Stable builds are recommended."); | ||
| self_updater_safe_mode = put(name, "self-updater", "safe-mode").setDefValues("true").setComments( | ||
| "If AutoPlug is disabled, it will update itself without advanced compatibility. Self-updating on Ptero will work in the same way as it does when not on Ptero.", | ||
| "Its strongly recommended to have this feature enabled on non AutoPlug specific eggs," | ||
|
Zoriot marked this conversation as resolved.
|
||
| ); | ||
|
|
||
| put(name, "java-updater").setCountTopLineBreaks(1); | ||
| java_updater = put(name, "java-updater", "enable").setDefValues("true"); | ||
|
|
@@ -141,6 +147,9 @@ public UpdaterConfig() throws IOException, DuplicateKeyException, YamlReaderExce | |
| "Otherwise don't touch this. It gets replaced after every successful update automatically."); | ||
| java_updater_large_heap = put(name, "java-updater", "large-heap").setDefValues("false").setComments( | ||
| "Only enable if you plan to give your server more than 57gb of ram, otherwise not recommended."); | ||
| java_updater_force_enable = put(name, "java-updater", "force-enable").setDefValues("false").setComments( | ||
| "If you are running AutoPlug via Pterodactyl Panel, the java-updater is disabled to avoid redundancy. Set to true to force the self-updater to run anyways." | ||
| ); | ||
|
|
||
|
|
||
| put(name, "server-updater").setCountTopLineBreaks(1); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Copyright (c) 2026 Osiris-Team. | ||
| * All rights reserved. | ||
| * | ||
| * This software is copyrighted work, licensed under the terms | ||
| * of the MIT-License. Consult the "LICENSE" file for details. | ||
| */ | ||
|
|
||
| package com.osiris.autoplug.client.utils; | ||
|
|
||
| import java.util.Locale; | ||
| import java.util.Map; | ||
|
|
||
| public class UtilsEnvironment { | ||
| public boolean isPterodactylEnvironment() { | ||
| return isPterodactylEnvironment(System.getenv()); | ||
| } | ||
|
|
||
| public boolean isPterodactylEnvironment(Map<String, String> env) { | ||
| for (String key : env.keySet()) { | ||
| if (key == null) continue; | ||
| String upperKey = key.toUpperCase(Locale.ROOT); | ||
| if (upperKey.startsWith("PTERODACTYL_")) return true; | ||
| if (upperKey.startsWith("P_SERVER_")) return true; | ||
| } | ||
| return false; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright (c) 2026 Osiris-Team. | ||
| * All rights reserved. | ||
| * | ||
| * This software is copyrighted work, licensed under the terms | ||
| * of the MIT-License. Consult the "LICENSE" file for details. | ||
| */ | ||
|
|
||
| package com.osiris.autoplug.client.utils; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| class UtilsEnvironmentTest { | ||
| @Test | ||
| void detectsPterodactylEnvVars() { | ||
| UtilsEnvironment utilsEnvironment = new UtilsEnvironment(); | ||
|
|
||
| Map<String, String> env = new HashMap<>(); | ||
| env.put("P_SERVER_UUID", "abc"); | ||
| assertTrue(utilsEnvironment.isPterodactylEnvironment(env)); | ||
|
|
||
| env.clear(); | ||
| env.put("PTERODACTYL_SERVER_UUID", "abc"); | ||
| assertTrue(utilsEnvironment.isPterodactylEnvironment(env)); | ||
| } | ||
|
|
||
| @Test | ||
| void ignoresNonPterodactylEnvVars() { | ||
| UtilsEnvironment utilsEnvironment = new UtilsEnvironment(); | ||
|
|
||
| Map<String, String> env = new HashMap<>(); | ||
| env.put("SERVER_UUID", "abc"); | ||
| env.put("PANEL_NAME", "AutoPlug"); | ||
| assertFalse(utilsEnvironment.isPterodactylEnvironment(env)); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.