Skip to content

Commit

Permalink
(fix) Config nesting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-DT committed Feb 8, 2024
1 parent 143f525 commit 31f7613
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.4+build.3
loader_version=0.15.6

# Mod Properties
mod_version=0.1.1
mod_version=0.1.2
maven_group=nl.jandt
archives_base_name=survivaltools

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/nl/jandt/information/InfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import nl.jandt.SurvivalTools;
import nl.jandt.utils.SrvConfigModel;
import nl.jandt.utils.SrvConfig;
import org.jetbrains.annotations.Nullable;

public class InfoCommand implements Command<ServerCommandSource> {
private static final SrvConfigModel.InfoConfig INFO_CONFIG = SurvivalTools.CONFIG.infoConfig();
private static final SrvConfig.InfoConfig INFO_CONFIG = SurvivalTools.CONFIG.infoConfig;
public static InfoCommand instance = new InfoCommand();

public void registerCommand(CommandDispatcher<ServerCommandSource> dispatcher) {
if (!INFO_CONFIG.enabled) {
if (!INFO_CONFIG.enabled()) {
return;
}

dispatcher.register(CommandManager
.literal(INFO_CONFIG.command)
.literal(INFO_CONFIG.command())
.executes(this));
}

Expand All @@ -34,7 +34,7 @@ public int run(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxExce
final @Nullable ServerPlayerEntity player = source.getPlayerOrThrow();
assert player != null;

player.sendMessage(Text.Serialization.fromJson(INFO_CONFIG.message));
player.sendMessage(Text.Serialization.fromJson(INFO_CONFIG.message()));

return 0;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/nl/jandt/information/MotdCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import nl.jandt.SurvivalTools;
import nl.jandt.utils.SrvConfigModel;
import nl.jandt.utils.SrvConfig;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class MotdCommand implements Command<ServerCommandSource> {
public static final SrvConfigModel.MotdConfig MOTD_CONFIG = SurvivalTools.CONFIG.motdConfig();
public static final SrvConfig.MotdConfig MOTD_CONFIG = SurvivalTools.CONFIG.motdConfig;
public static MotdCommand instance = new MotdCommand();

public void registerCommand(CommandDispatcher<ServerCommandSource> dispatcher) {
if (!MOTD_CONFIG.enabled) {
if (!MOTD_CONFIG.enabled()) {
return;
}

dispatcher.register(CommandManager
.literal(MOTD_CONFIG.command)
.literal(MOTD_CONFIG.command())
.executes(this));
}

public void registerJoin(ServerPlayNetworkHandler handler) {
if (!MOTD_CONFIG.enabled) {
if (!MOTD_CONFIG.enabled()) {
return;
}

Expand All @@ -51,6 +51,6 @@ public int run(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxExce
}

public void sendMotd(@NotNull ServerPlayerEntity targetPlayer) {
targetPlayer.sendMessage(Text.Serialization.fromJson(MOTD_CONFIG.message));
targetPlayer.sendMessage(Text.Serialization.fromJson(MOTD_CONFIG.message()));
}
}

0 comments on commit 31f7613

Please sign in to comment.