#Loading MapList out of YAML
1 messages · Page 1 of 1 (latest)
timedCommands.forEach(command -> {
try {
command.cancel();
} catch (IllegalStateException e) {
// no op
}
});
timedCommands.clear();
for (Map<?, ?> m : scheduleConfig.get().getMapList("timed")) {
Map<String, Object> map = (Map<String, Object>) m;
if (map.get("time") == null || map.get("command") == null) {
getLogger().warning("Invalid entry in schedules.yml");
continue;
}
timedCommands.add(new TimedCommand((String) map.get("command"), (Long) map.get("time"), this));
}
timedCommands.forEach(TimedCommand::start);```
Tried triggering the print statement in here and nothing occurred under a situation that should have caused the warning
But the cast didn't cause an exception?
No exceptions in console
I haven't tried retrieving yet, as I have no outputs. But theoretically if a map that has no time or command keys doesn't trigger the error then nothings getting read
I can try to get time if you want
But if it doesn't trigger the error the code is not executed
Yes
which is weird if there was no exception
so ye pls try retrieving it when it's set correctly
Mk
No output at all
I put a log inside the loop to log the values of each one it adds and nothing
and you are sure that it even reaches that point? Can you add a log in front of the cast?
Yeah it does run this code
I'm thinking it might just give up after the cast or something
Add a log before and after the cast and check exactly for that behaviour
Ah yes after too, Shouldve thought
Also I hope you did not put a huge try catch block around that catches the exception and does nothing
No the only try catch nearby this code is included in my excerpt
alright
One moment it might not be running anything... I'm going to test more
:D
Yeah getting the yaml
# For timed:
# - time: [time in seconds]
# command: [command to run]
timed:
- time: 86400
command: example
that should work no?
It's even self-generating that so I don't think the yaml is the problem
Yeah running it again still quits at the loop
I'll try adding more entries...
I never made a map with multiple entries in one of my configs so I'm unsure if it works like that
Using a JSON-YAML converter it appears to work how I want
Maybe it loads another (old version) config?
Wdym?
Like an old yaml parser or an old yaml?
Because it can't be loading an old yaml
Its generating the yaml that I showed you before that code runs
In that case it might be time to start a remote debugger and step into the getmaplist function
or the loadconfiguration one if the first one does not yield results
Discovered a problem in the same system but it shouldn't effect this current error.
I haven't been able to get that to work
There's a guide on spigot. It's actually pretty easy
wait what
wait I'll link it for you
tried it and it couldn't find the server
Ok so I added more entries and it ran, but we have a stacktrace
ah cool that makes it easier
then you probably forgot the startup parameters. https://www.spigotmc.org/wiki/intellij-debug-your-plugin/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
It wouldn't let me change them
Huh?
I could not change the box with startup paramaters in it
why? You can just run a local server on your computer to test your plugin
wdym
how does that relate
On your personal computer you can freely set any startup paramters inside your start skript
or inside cmd if you want to type it all manually every time
no in intellij
ohh
wait you don't have to change that in intellij
oh?
but since we got a stacktrace you probably don't have to debug
Anyway I might do that later
Stacktrace is easy, its saying yaml has an Integer not a Long
Wait a minute
I think I fixed the issue a second ago
testing time
Yes yes
this ended up fixing it, just a few easy errors left