diff --git a/src/main/java/com/fibermc/essentialcommands/commands/ProfileCommand.java b/src/main/java/com/fibermc/essentialcommands/commands/ProfileCommand.java index 03137980..17e8e273 100644 --- a/src/main/java/com/fibermc/essentialcommands/commands/ProfileCommand.java +++ b/src/main/java/com/fibermc/essentialcommands/commands/ProfileCommand.java @@ -43,7 +43,7 @@ public static LiteralCommandNode buildNode() { var player = context.getSource().getPlayerOrThrow(); var profile = ((ServerPlayerEntityAccess) player).ec$getProfile(); context.getSource().sendFeedback(() -> - Text.literal(option.profileGetter().getValue(profile).toString()), + Text.literal(option.profileGetter().getValue(profile).map(Object::toString).orElse("")), CONFIG.BROADCAST_TO_OPS); return 0; }) diff --git a/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfig.java b/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfig.java index bf99a82c..5b0cdc20 100644 --- a/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfig.java +++ b/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfig.java @@ -12,11 +12,9 @@ import com.fibermc.essentialcommands.ManagerLocator; import com.fibermc.essentialcommands.playerdata.PlayerDataManager; import com.fibermc.essentialcommands.types.RespawnCondition; - -import net.minecraft.registry.DynamicRegistryManager; - import org.jetbrains.annotations.NotNull; +import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.registry.RegistryKey; import net.minecraft.text.Style; import net.minecraft.text.Text; @@ -111,6 +109,7 @@ public final class EssentialCommandsConfig extends Config FLY_MAX_SPEED = new Option<>("fly_max_speed", 5, ConfigUtil::parseInt); @ConfigOption public final Option NEAR_COMMAND_DEFAULT_RADIUS = new Option<>("near_command_default_radius", 200, ConfigUtil::parseInt); @ConfigOption public final Option NEAR_COMMAND_MAX_RADIUS = new Option<>("near_command_max_radius", 200, ConfigUtil::parseInt); + @ConfigOption public final Option PRINT_TELEPORT_COORDINATES = new Option<>("print_teleport_coordinates", true, Boolean::parseBoolean); public EssentialCommandsConfig(Path savePath, String displayName, String documentationLink) { super(savePath, displayName, documentationLink); diff --git a/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfigSnapshot.java b/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfigSnapshot.java index b95b78e1..69a42a07 100644 --- a/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfigSnapshot.java +++ b/src/main/java/com/fibermc/essentialcommands/config/EssentialCommandsConfigSnapshot.java @@ -86,6 +86,7 @@ public final class EssentialCommandsConfigSnapshot { public final int FLY_MAX_SPEED; public final int NEAR_COMMAND_DEFAULT_RADIUS; public final int NEAR_COMMAND_MAX_RADIUS; + public final boolean PRINT_TELEPORT_COORDINATES; private EssentialCommandsConfigSnapshot(EssentialCommandsConfig config) { this.FORMATTING_DEFAULT = config.FORMATTING_DEFAULT.getValue(); @@ -158,6 +159,7 @@ private EssentialCommandsConfigSnapshot(EssentialCommandsConfig config) { this.FLY_MAX_SPEED = config.FLY_MAX_SPEED.getValue(); this.NEAR_COMMAND_DEFAULT_RADIUS = config.NEAR_COMMAND_DEFAULT_RADIUS.getValue(); this.NEAR_COMMAND_MAX_RADIUS = config.NEAR_COMMAND_MAX_RADIUS.getValue(); + this.PRINT_TELEPORT_COORDINATES = config.PRINT_TELEPORT_COORDINATES.getValue(); } public static EssentialCommandsConfigSnapshot create(EssentialCommandsConfig config) { diff --git a/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java b/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java index f5b8de09..fdc85abf 100644 --- a/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java +++ b/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java @@ -38,11 +38,12 @@ public PlayerProfile(@NotNull ServerPlayerEntity player, File saveFile) { this.profileOptions = new ProfileOptions(); } + @SuppressWarnings("OptionalUsedAsFieldOrParameterType") private static final class ProfileOptions { - private Style formattingDefault; - private Style formattingAccent; - private Style formattingError; - private boolean printTeleportCoordinates = true; + private Optional