Skip to content

Commit

Permalink
Change order of config loading
Browse files Browse the repository at this point in the history
  • Loading branch information
NeumimTo committed Aug 4, 2019
1 parent 34cb6ea commit ed2ea1d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'cz.neumimto.rpg'
version = '2.0.0-SNAPSHOT-RC2'
version = '2.0.0-SNAPSHOT-RC3'

blossom {
String str = "src/main/java/cz/neumimto/rpg/NtRpgPlugin.java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package cz.neumimto.rpg.common.scripting;

import static cz.neumimto.rpg.api.logging.Log.error;
import static cz.neumimto.rpg.api.logging.Log.info;
import com.google.inject.Injector;
import cz.neumimto.rpg.ResourceLoader;
import cz.neumimto.rpg.api.Rpg;
Expand All @@ -38,16 +36,18 @@
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import ninja.leaping.configurate.objectmapping.ObjectMapper;

import javax.inject.Inject;
import javax.inject.Singleton;
import javax.script.*;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.*;
import java.util.*;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.script.*;

import static cz.neumimto.rpg.api.logging.Log.error;
import static cz.neumimto.rpg.api.logging.Log.info;

/**
* Created by NeumimTo on 13.3.2015.
Expand Down Expand Up @@ -239,6 +239,7 @@ protected void finalize() throws Throwable {


for (File confFile : ResourceLoader.addonDir.listFiles(pathname -> pathname.isFile() && pathname.getName().endsWith(".conf"))) {
info("Loading file " + confFile);
loadSkillDefinitionFile(urlClassLoader, confFile);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ public abstract class SkillServiceimpl implements SkillService {

@Override
public void load() {
init();
skillTrees.putAll(skillTreeDao.getAll());
scriptSkillsParents.put("active", ActiveScriptSkill.class);
scriptSkillsParents.put("passive", PassiveScriptSkill.class);
}

@Override
Expand Down Expand Up @@ -283,6 +280,8 @@ public void registerSkillType(@NonNull ISkillType skillType) {

@Override
public void init() {
scriptSkillsParents.put("active", ActiveScriptSkill.class);
scriptSkillsParents.put("passive", PassiveScriptSkill.class);
Stream.of(SkillType.values()).forEach(this::registerSkillType);
}
}
3 changes: 2 additions & 1 deletion Plugin/src/main/java/cz/neumimto/rpg/sponge/NtRpgPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,12 @@ private void postInit() {
GlobalScope.inventorySerivce.load();
GlobalScope.eventFactory.registerEventProviders();
GlobalScope.experienceService.load();
GlobalScope.skillService.load();
GlobalScope.skillService.init();
GlobalScope.spongePropertyService.init(Paths.get(NtRpgPlugin.workingDir + "/Attributes.conf"), Paths.get(NtRpgPlugin.workingDir + File.separator + "properties_dump.info"));
GlobalScope.spongePropertyService.reLoadAttributes(Paths.get(NtRpgPlugin.workingDir + "/Attributes.conf"));
GlobalScope.spongePropertyService.loadMaximalServerPropertyValues(Paths.get(NtRpgPlugin.workingDir, "max_server_property_values.properties"));
GlobalScope.jsLoader.initEngine();
GlobalScope.skillService.load();
GlobalScope.rwService.load();
GlobalScope.classService.loadClasses();
GlobalScope.vanillaMessaging.load();
Expand Down

0 comments on commit ed2ea1d

Please sign in to comment.