Skip to content

Commit

Permalink
Rename AutoRestart module to Restart
Browse files Browse the repository at this point in the history
  • Loading branch information
Ale32bit committed Dec 24, 2024
1 parent 0625d50 commit 432784f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import me.alexdevs.solstice.api.module.ModuleBase;
import me.alexdevs.solstice.modules.afk.AfkModule;
import me.alexdevs.solstice.modules.autoAnnouncement.AutoAnnouncementModule;
import me.alexdevs.solstice.modules.autoRestart.AutoRestartModule;
import me.alexdevs.solstice.modules.restart.RestartModule;
import me.alexdevs.solstice.modules.back.BackModule;
import me.alexdevs.solstice.modules.ban.BanModule;
import me.alexdevs.solstice.modules.broadcast.BroadcastModule;
Expand Down Expand Up @@ -54,7 +54,7 @@ public class ModuleProvider {
private static final List<? extends ModuleBase> modules = List.of(
new AfkModule(),
new AutoAnnouncementModule(),
new AutoRestartModule(),
new RestartModule(),
new BackModule(),
new BanModule(),
new BroadcastModule(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package me.alexdevs.solstice.modules.autoRestart;
package me.alexdevs.solstice.modules.restart;

import me.alexdevs.solstice.Solstice;
import me.alexdevs.solstice.api.events.RestartEvents;
import me.alexdevs.solstice.api.events.SolsticeEvents;
import me.alexdevs.solstice.api.events.TimeBarEvents;
import me.alexdevs.solstice.api.module.ModuleBase;
import me.alexdevs.solstice.modules.autoRestart.commands.RestartCommand;
import me.alexdevs.solstice.modules.autoRestart.data.AutoRestartConfig;
import me.alexdevs.solstice.modules.autoRestart.data.AutoRestartLocale;
import me.alexdevs.solstice.modules.restart.commands.RestartCommand;
import me.alexdevs.solstice.modules.restart.data.RestartConfig;
import me.alexdevs.solstice.modules.restart.data.RestartLocale;
import me.alexdevs.solstice.modules.timeBar.TimeBar;
import me.alexdevs.solstice.modules.timeBar.TimeBarModule;
import net.minecraft.entity.boss.BossBar;
Expand All @@ -24,24 +24,24 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

public class AutoRestartModule extends ModuleBase {
public static final String ID = "autorestart";
public class RestartModule extends ModuleBase {
public static final String ID = "restart";

private TimeBar restartBar = null;
private SoundEvent sound;
private ScheduledFuture<?> currentSchedule = null;

private AutoRestartConfig config;
private RestartConfig config;

public AutoRestartModule() {
public RestartModule() {
super(ID);
Solstice.configManager.registerData(ID, AutoRestartConfig.class, AutoRestartConfig::new);
Solstice.localeManager.registerModule(ID, AutoRestartLocale.MODULE);
Solstice.configManager.registerData(ID, RestartConfig.class, RestartConfig::new);
Solstice.localeManager.registerModule(ID, RestartLocale.MODULE);

commands.add(new RestartCommand(this));

SolsticeEvents.READY.register((instance, server) -> {
config = Solstice.configManager.getData(AutoRestartConfig.class);
config = Solstice.configManager.getData(RestartConfig.class);
setup();
if (config.enable) {
scheduleNextRestart();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.alexdevs.solstice.modules.autoRestart.commands;
package me.alexdevs.solstice.modules.restart.commands;

import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
Expand All @@ -7,7 +7,7 @@
import me.alexdevs.solstice.Solstice;
import me.alexdevs.solstice.api.command.TimeSpan;
import me.alexdevs.solstice.api.module.ModCommand;
import me.alexdevs.solstice.modules.autoRestart.AutoRestartModule;
import me.alexdevs.solstice.modules.restart.RestartModule;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
Expand All @@ -18,8 +18,8 @@
import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal;

public class RestartCommand extends ModCommand<AutoRestartModule> {
public RestartCommand(AutoRestartModule module) {
public class RestartCommand extends ModCommand<RestartModule> {
public RestartCommand(RestartModule module) {
super(module);
}

Expand Down Expand Up @@ -52,7 +52,7 @@ public LiteralArgumentBuilder<ServerCommandSource> command(String name) {

private int schedule(CommandContext<ServerCommandSource> context, int seconds, @Nullable String message) {
if (message == null) {
message = Solstice.localeManager.getLocale(AutoRestartModule.ID).raw("barLabel");
message = Solstice.localeManager.getLocale(RestartModule.ID).raw("barLabel");
}
module.schedule(seconds, message);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.alexdevs.solstice.modules.autoRestart.data;
package me.alexdevs.solstice.modules.restart.data;

import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
Expand All @@ -7,7 +7,7 @@
import java.util.List;

@ConfigSerializable
public class AutoRestartConfig {
public class RestartConfig {
@Comment("Enable auto restart functionality.")
public boolean enable = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package me.alexdevs.solstice.modules.autoRestart.data;
package me.alexdevs.solstice.modules.restart.data;

import java.util.Map;

public class AutoRestartLocale {
public class RestartLocale {
public static final Map<String, String> MODULE = Map.ofEntries(
Map.entry("barLabel", "Server restarting in ${remaining_time}"),
Map.entry("kickMessage", "The server is restarting!"),
Expand Down

0 comments on commit 432784f

Please sign in to comment.