Updating environment does not work
Closed this issue · 7 comments
Hello again,
I've seen that you have implemented the changes as result of issue #25. Now then I try to update a single environment variable, it simply does nothing.
The code:
applicationServer.getManager().setEnvironment(Collections.singletonMap("BOOST_LEVEL", EnvironmentValue.ofInteger(boostLevel.get()))).execute();
Do I have to completely specify all existing environment variables or is it enough to only set the one I want to change?
Okay this doesn't work either
Map<String, EnvironmentValue<?>> environment = applicationServer.getContainer().getEnvironment();
environment.put("BOOST_LEVEL", EnvironmentValue.ofInteger(boostLevel.intValue()));
applicationServer.getManager().setEnvironment(environment).execute();
Apologies for the delayed response. I'll play around with it this afternoon and see what I find.
Fixed in 2.BETA_44
Sorry this is not fixed with this version. But I now have a stacktrace you can work with:
org.json.JSONException: JSONObject["threads"] not a string.
at org.json.JSONObject.getString(JSONObject.java:721)
at com.mattmalec.pterodactyl4j.entities.impl.LimitImpl.getThreads(LimitImpl.java:41)
at com.mattmalec.pterodactyl4j.application.managers.ServerManager.lambda$setDisk$25(ServerManager.java:229)
at com.mattmalec.pterodactyl4j.requests.PteroActionImpl.execute(PteroActionImpl.java:89)
at com.mattmalec.pterodactyl4j.PteroAction.execute(PteroAction.java:41)
at de.cytooxien.realms.enderman.module.providers.RealmsUserBoostProvider.lambda$updateRealmSpecifications$14(RealmsUserBoostProvider.java:191)
at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:753)
at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:731)
at java.base/java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2178)
at de.cytooxien.realms.enderman.module.providers.RealmsUserBoostProvider.updateRealmSpecifications(RealmsUserBoostProvider.java:178)
at de.cytooxien.realms.enderman.module.providers.RealmsUserBoostProvider.lambda$boostRealm$12(RealmsUserBoostProvider.java:162)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
The original problem is fixed, now you have an error of something completely unrelated. In the meantime while I fix this, a workaround is to set the CPU pinning to anything and then remove it. After it's been removed, the API will return an empty String for the threads key instead of null.
Oh, yes I see. I just wait until you have fixed it.
Resolved. See 2.BETA_45