content: package me.adda.terramath.forge.events;
  
  import me.adda.terramath.command.TerraMathCommand;
  import me.adda.terramath.events.PlatformEvents;
  import me.adda.terramath.events.TerraMathEvents;
  import net.minecraft.server.level.ServerLevel;
  import net.minecraftforge.common.MinecraftForge;
  import net.minecraftforge.event.RegisterCommandsEvent;
  import net.minecraftforge.event.level.LevelEvent;
  import net.minecraftforge.eventbus.api.SubscribeEvent;
  
  public class ForgeEvents implements PlatformEvents {
  
      @Override
      public void registerEvents() {
          MinecraftForge.EVENT_BUS.register(ForgeEvents.class);
      }
  
      @SubscribeEvent
      public static void onLevelLoad(LevelEvent.Load event) {
          if (event.getLevel() instanceof ServerLevel serverLevel) {
              TerraMathEvents.onLevelLoad(serverLevel);
          }
      }
  
      @SubscribeEvent
      public static void onLevelUnload(LevelEvent.Unload event) {
          if (event.getLevel() instanceof ServerLevel serverLevel) {
              TerraMathEvents.onLevelUnload(serverLevel);
          }
      }
  
      @SubscribeEvent
      public static void onCommandsRegister(RegisterCommandsEvent event) {
          TerraMathCommand.register(event.getDispatcher());
      }
  }