Skip to content

Commit

Permalink
Only register on server
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Nov 20, 2024
1 parent e836251 commit 40e6a9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx2G

# Mod Properties
mod_version = 0.0.41
mod_version = 0.0.42
maven_group = dev.ithundxr
archives_base_name = RailwaysTweaks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import dev.ithundxr.railwaystweaks.mixin.compat.tconstruct.SimpleChannelAccessor;
import me.pepperbell.simplenetworking.C2SPacket;
import me.pepperbell.simplenetworking.S2CPacket;
import net.fabricmc.api.EnvType;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.Util;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -39,15 +41,17 @@ public static void init() {
.executes(ctx -> avgMSPT(ctx.getSource())));
});

CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal("railwaystweaks")
.then(literal("dump_db")
.requires(cs -> cs.hasPermission(4))
.executes(ctx -> {
Util.ioPool().execute(DumpDatabase::dump);
return 0;
})));
});
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal("railwaystweaks")
.then(literal("dump_db")
.requires(cs -> cs.hasPermission(4))
.executes(ctx -> {
Util.ioPool().execute(DumpDatabase::dump);
return 0;
})));
});
}
}

private static ArgumentBuilder<CommandSourceStack, ?> $dump_hephaestus_packets() {
Expand Down

0 comments on commit 40e6a9b

Please sign in to comment.