- Add complete PlayHours mod source code with all features: * Schedule enforcement with per-day schedules and midnight-spanning support * Login control with configurable thresholds and exemptions * Warnings and auto-kick system with countdown functionality * Force modes (NORMAL/FORCE_OPEN/FORCE_CLOSED) for maintenance * Whitelist/blacklist system for player access control * Date exceptions for holidays and special events * Multi-language support (English/French) with smart time formatting * LuckPerms integration with vanilla ops fallback * Dynamic MOTD system with real-time schedule display * Comprehensive command system with permission integration * TOML configuration with hot-reload support - Add comprehensive documentation suite: * Installation guide with step-by-step setup instructions * Complete configuration reference with all options * Commands reference with usage examples * Features overview with detailed explanations * MOTD system configuration and customization guide * Permissions system documentation with LuckPerms integration * Technical details covering architecture and limitations * Usage examples with real-world scenarios * Changelog with version history - Add resource files: * Language files (en_us.json, fr_fr.json) with localized messages * Mod metadata (mods.toml) with proper Forge configuration * Resource pack metadata (pack.mcmeta) - Update build configuration: * Gradle build system with proper dependencies * Project properties and version management * Development environment setup - Restructure documentation: * Replace old README.txt with new comprehensive README.md * Create modular documentation structure in docs/ directory * Add cross-references and navigation between documents * Include quick start guide and common use cases This commit represents the complete v1.0.0 release of PlayHours, a production-ready server operation hours enforcement mod for Minecraft Forge 1.20.1.
58 lines
2.3 KiB
Java
58 lines
2.3 KiB
Java
package com.mrkayjaydee.playhours;
|
|
|
|
import com.mojang.logging.LogUtils;
|
|
import com.mrkayjaydee.playhours.command.HoursCommand;
|
|
import com.mrkayjaydee.playhours.config.ConfigEventHandler;
|
|
import com.mrkayjaydee.playhours.config.ServerConfig;
|
|
import com.mrkayjaydee.playhours.events.LoginGuard;
|
|
import com.mrkayjaydee.playhours.events.TickScheduler;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.event.RegisterCommandsEvent;
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.ModLoadingContext;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|
import org.slf4j.Logger;
|
|
|
|
/**
|
|
* PlayHours - Server-side mod for enforcing operating hours.
|
|
* Provides schedule-based access control with warnings, auto-kick, and admin commands.
|
|
* Compatible with LuckPerms for permissions (soft dependency).
|
|
*/
|
|
@Mod(PlayHoursMod.MODID)
|
|
public class PlayHoursMod {
|
|
public static final String MODID = "playhours";
|
|
public static final Logger LOGGER = LogUtils.getLogger();
|
|
|
|
/**
|
|
* Mod constructor. Registers config, events, and command handlers.
|
|
*/
|
|
public PlayHoursMod() {
|
|
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
|
modEventBus.register(ConfigEventHandler.class);
|
|
// Register as COMMON so the file is created under <server>/config (root), not per-world
|
|
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, ServerConfig.SPEC, MODID + ".toml");
|
|
modEventBus.addListener(this::onCommonSetup);
|
|
|
|
// Register gameplay/event listeners
|
|
MinecraftForge.EVENT_BUS.register(new LoginGuard());
|
|
MinecraftForge.EVENT_BUS.register(new TickScheduler());
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
LOGGER.info("PlayHours loading... (modId={})", MODID);
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void onRegisterCommands(RegisterCommandsEvent event) {
|
|
LOGGER.info("Registering /hours command tree");
|
|
HoursCommand.register(event.getDispatcher());
|
|
}
|
|
|
|
private void onCommonSetup(final FMLCommonSetupEvent event) {
|
|
LOGGER.info("PlayHours common setup initialized");
|
|
}
|
|
}
|
|
|