Closed TheLimeGlass closed 11 months ago
//SkriptEvent private final SectionConfiguration configuration = new SectionConfiguration.Builder().addOptionalList("aliases").build();
@Override public List<Statement> loadSection(FileSection section, ParserState parserState, SkriptLogger logger) { configuration.loadConfiguration(null, section, parserState, logger); Optional.ofNullable(configuration.getStringList("aliases")).ifPresent(list -> Arrays.stream(list).forEach(aliases -> this.aliases.add(aliases))); return configuration.getSection("trigger").getItems(); }
Then when calling:
@Override public List<Statement> loadSection(FileSection section, ParserState parserState, SkriptLogger logger) { Optional.ofNullable(configuration.getStringList("aliases")) .ifPresent(list -> Arrays.stream(list).forEach(aliases -> this.aliases.add(aliases))); }
command /test: #aliases: no aliases node trigger: broadcast "testing"
Throws this:
[Server thread/ERROR] #!#! Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "result" is null [Server thread/ERROR] #!#! at io.github.syst3ms.skriptparser.lang.entries.SectionConfiguration.getValue(SectionConfiguration.java:135) [Server thread/ERROR] #!#! at io.github.syst3ms.skriptparser.lang.entries.SectionConfiguration.getStringList(SectionConfiguration.java:145)
Then when calling:
Throws this: