A Shared Library mod for Necesse.
I think providing a shared library would avoid a lot of duplication of work. So this project was born.
This project currently offers the following features.
- Mod configuration and autoload.
- Reload Mod configuration command.
- Events for client connections and Mod configure reload.
- ModOptionChangedEvent
- ClientClientDisconnectEvent
- ClientClientConnectedEvent
TOML config path:
- Linux:
~/.config/Necesse/cfg/ModOptions.toml
- Windows:
C:/Users/USER_NAME/AppData/Roaming/Necesse/cfg/ModOptions.toml
public class ExampleMod {
public void init() {
ModOption option = ModOptionBuilder.build("EntoLibExample");
GameLog.out.println(option.getString("Example", "Hello World!"));
GameEvents.addListener(ServerStartEvent.class, new GameEventListener<ServerStartEvent>() {
@Override
public void onEvent(ServerStartEvent event) {
option.setValue("Example", "Value Changed!");
}
});
GameEvents.addListener(ModOptionChangedEvent.class, new GameEventListener<ModOptionChangedEvent>() {
@Override
public void onEvent(ModOptionChangedEvent event) {
if (event.isLocalConfig) {
GameLog.out.println("Local Option: " + option.getString("Example", "Hello World!"));
} else {
GameLog.out.println("Server Option: " + option.getString("Example", "Hello World!"));
}
}
});
}
}
Beta interface is unstable. I did my best to write. But maybe there are better ones.
Some of my code should be very bad. Contributions are welcome.
You can communicate with me in English, although I need to use translation software in many places. Using translated Chinese to communicate with me is not as good as having me read English.
- Add more events.
Check out the modding wiki page for more.