diff options
author | huskcasaca <[email protected]> | 2022-09-29 00:17:10 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-09-29 00:39:10 +0800 |
commit | 7d40308cf9cdded54159b783b83149fd43f697b7 (patch) | |
tree | da90df0a6277e3828c54459721b4e033465f90b3 /src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | |
parent | da1b7d4c482d482d201547899411fcbc330c7abe (diff) |
Port to 1.19.2
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java index 2b2865e..cc74e3f 100644 --- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java +++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java @@ -11,8 +11,8 @@ import com.keuin.kbackupfabric.ui.KBCommands; import com.keuin.kbackupfabric.util.DateUtil; import com.keuin.kbackupfabric.util.PrintUtil; import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.server.ServerStartCallback; -import net.fabricmc.fabric.api.registry.CommandRegistry; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.minecraft.server.MinecraftServer; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -27,18 +27,21 @@ import static org.apache.commons.io.FileUtils.forceDelete; * This is the Main file of this plugin. * It contains all events, including the init event. */ -public final class KBPluginEvents implements ModInitializer, ServerStartCallback { +public final class KBPluginEvents implements ModInitializer { //private static final Logger LOGGER = LogManager.getLogger(); @Override public void onInitialize() { System.out.println("Binding events and commands ..."); - CommandRegistry.INSTANCE.register(false, KBCommandsRegister::registerCommands); - ServerStartCallback.EVENT.register(this); + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { + KBCommandsRegister.registerCommands(dispatcher); + }); + ServerLifecycleEvents.SERVER_STARTED.register( + this::onStartServer + ); } - @Override public void onStartServer(MinecraftServer server) { // Buggy: this does not work |