feat: add reload support
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
de18b0f628
commit
0df2d2b71f
@ -7,6 +7,7 @@ import org.spongepowered.api.config.ConfigDir;
|
|||||||
import org.spongepowered.api.event.Listener;
|
import org.spongepowered.api.event.Listener;
|
||||||
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
|
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
|
||||||
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
||||||
|
import org.spongepowered.api.event.game.GameReloadEvent;
|
||||||
import org.spongepowered.api.plugin.Plugin;
|
import org.spongepowered.api.plugin.Plugin;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
@ -40,4 +41,12 @@ public class MiaoScriptSponge {
|
|||||||
public void onStop(GameStoppingServerEvent event) {
|
public void onStop(GameStoppingServerEvent event) {
|
||||||
engine.disableEngine();
|
engine.disableEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Listener
|
||||||
|
@SneakyThrows
|
||||||
|
public void reload(GameReloadEvent event) {
|
||||||
|
engine.disableEngine();
|
||||||
|
engine = new ScriptEngine(pluginConfigDir.getCanonicalPath(), logger);
|
||||||
|
engine.enableEngine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user