#Loading MapList out of YAML

1 messages · Page 1 of 1 (latest)

rustic crag
#
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

flint orbit
#

But the cast didn't cause an exception?

rustic crag
#

No exceptions in console

flint orbit
#

And if you set everything correctly, can you retrieve time?

#

the key "time"

rustic crag
#

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

flint orbit
#

But if it doesn't trigger the error the code is not executed

rustic crag
#

Yes

flint orbit
#

which is weird if there was no exception

#

so ye pls try retrieving it when it's set correctly

rustic crag
#

Mk

#

No output at all

#

I put a log inside the loop to log the values of each one it adds and nothing

flint orbit
#

and you are sure that it even reaches that point? Can you add a log in front of the cast?

rustic crag
#

Yeah it does run this code

#

I'm thinking it might just give up after the cast or something

flint orbit
#

Add a log before and after the cast and check exactly for that behaviour

rustic crag
#

Ah yes after too, Shouldve thought

flint orbit
#

Also I hope you did not put a huge try catch block around that catches the exception and does nothing

rustic crag
#

No the only try catch nearby this code is included in my excerpt

flint orbit
#

alright

rustic crag
#

One moment it might not be running anything... I'm going to test more

flint orbit
#

:D

rustic crag
#

Weird...

#

Its quitting at the loop

#

Its not even making it to the cast

flint orbit
#

then it doesn't catch your map

#

so the map list you try to receive is empty

rustic crag
#

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...

flint orbit
#

I never made a map with multiple entries in one of my configs so I'm unsure if it works like that

rustic crag
#

Using a JSON-YAML converter it appears to work how I want

flint orbit
#

Maybe it loads another (old version) config?

rustic crag
#

Wdym?

#

Like an old yaml parser or an old yaml?

#

Because it can't be loading an old yaml

flint orbit
#

An old yaml

#

oh ok

rustic crag
#

Its generating the yaml that I showed you before that code runs

flint orbit
#

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

rustic crag
#

Discovered a problem in the same system but it shouldn't effect this current error.

flint orbit
#

Remote debug it

#

run it line by line and check if it reads your map list

rustic crag
#

I haven't been able to get that to work

flint orbit
#

There's a guide on spigot. It's actually pretty easy

rustic crag
#

wait what

flint orbit
#

wait I'll link it for you

rustic crag
rustic crag
flint orbit
#

ah cool that makes it easier

flint orbit
flint orbit
#

Huh?

rustic crag
#

I could not change the box with startup paramaters in it

flint orbit
#

why? You can just run a local server on your computer to test your plugin

rustic crag
#

how does that relate

flint orbit
#

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

rustic crag
#

no in intellij

flint orbit
#

ohh

rustic crag
flint orbit
#

wait you don't have to change that in intellij

rustic crag
#

oh?

flint orbit
#

you have to change it for the server

#

inside the servers startup parameters

rustic crag
#

?

#

oh you add that to server startup script?

flint orbit
#

you just copy all that and add it there ye

#

just like it says in the guide xD

rustic crag
#

I thought it toldd me to do it in intellij

#

a

flint orbit
#

but since we got a stacktrace you probably don't have to debug

rustic crag
#

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

flint orbit
#

Sounds good

#

good luck

rustic crag
#

Yes yes

rustic crag