From 60a10747599a41178ff71ae8d845ac539352ba43 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 6 May 2023 10:05:31 +0700 Subject: [PATCH] Text i guess --- .../chipmunkmod/command/TextMessage.java | 25 ------------------- .../arguments/LocationArgumentType.java | 5 ++-- .../chipmunkmod/commands/MusicCommand.java | 7 +++--- 3 files changed, 5 insertions(+), 32 deletions(-) delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/command/TextMessage.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/command/TextMessage.java b/src/main/java/land/chipmunk/chipmunkmod/command/TextMessage.java deleted file mode 100644 index e8b91f9..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/command/TextMessage.java +++ /dev/null @@ -1,25 +0,0 @@ -package land.chipmunk.chipmunkmod.command; - -import com.mojang.brigadier.Message; -import lombok.Getter; -import net.minecraft.text.Text; - -public class TextMessage implements Message { - @Getter private final Text text; - - private TextMessage(Text text) { - this.text = text; - } - - public static TextMessage wrap (Text text) { - return new TextMessage(text); - } - - public String getString () { - return text.getString(); - } - - public String toString () { - return text.toString(); - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/command/arguments/LocationArgumentType.java b/src/main/java/land/chipmunk/chipmunkmod/command/arguments/LocationArgumentType.java index cfb554e..d6aeffb 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/command/arguments/LocationArgumentType.java +++ b/src/main/java/land/chipmunk/chipmunkmod/command/arguments/LocationArgumentType.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import land.chipmunk.chipmunkmod.command.TextMessage; import net.minecraft.text.Text; import java.net.MalformedURLException; @@ -17,7 +16,7 @@ import java.util.Collection; public class LocationArgumentType implements ArgumentType { private static final Collection EXAMPLES = Arrays.asList("songs/amogus.mid", "images/cat.jpg", "videos/badapple.mp4"); - private static final SimpleCommandExceptionType OOB_FILEPATH = new SimpleCommandExceptionType(TextMessage.wrap(Text.translatable("The specified file path is outside of the allowed directory"))); + private static final SimpleCommandExceptionType OOB_FILEPATH = new SimpleCommandExceptionType(Text.translatable("The specified file path is outside of the allowed directory")); private boolean allowsUrls = false; private boolean allowsPaths = false; @@ -52,7 +51,7 @@ public class LocationArgumentType implements ArgumentType { try { return new URL(sb.toString()); } catch (MalformedURLException exception) { - throw new SimpleCommandExceptionType(TextMessage.wrap(Text.literal(exception.getMessage()))).create(); + throw new SimpleCommandExceptionType(Text.literal(exception.getMessage())).create(); } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java index b12aeca..b4a1e7c 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import land.chipmunk.chipmunkmod.command.CommandManager; -import land.chipmunk.chipmunkmod.command.TextMessage; import land.chipmunk.chipmunkmod.modules.SongPlayer; import land.chipmunk.chipmunkmod.song.Song; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; @@ -34,9 +33,9 @@ import static land.chipmunk.chipmunkmod.command.arguments.LocationArgumentType.* import static land.chipmunk.chipmunkmod.command.arguments.TimestampArgumentType.timestamp; public class MusicCommand { - private static final SimpleCommandExceptionType NO_SONG_IS_CURRENTLY_PLAYING = new SimpleCommandExceptionType(TextMessage.wrap(Text.translatable("No song is currently playing"))); - private static final SimpleCommandExceptionType OOB_TIMESTAMP = new SimpleCommandExceptionType(TextMessage.wrap(Text.translatable("Invalid timestamp for the current song"))); - private static final SimpleCommandExceptionType DIRECTORY_DOES_NOT_EXIST = new SimpleCommandExceptionType(TextMessage.wrap(Text.translatable("The specified directory does not exist"))); + private static final SimpleCommandExceptionType NO_SONG_IS_CURRENTLY_PLAYING = new SimpleCommandExceptionType(Text.translatable("No song is currently playing")); + private static final SimpleCommandExceptionType OOB_TIMESTAMP = new SimpleCommandExceptionType(Text.translatable("Invalid timestamp for the current song")); + private static final SimpleCommandExceptionType DIRECTORY_DOES_NOT_EXIST = new SimpleCommandExceptionType(Text.translatable("The specified directory does not exist")); public static void register (CommandDispatcher dispatcher) { final MusicCommand instance = new MusicCommand();