diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/main/java/eu/olli/cowlection/Cowlection.java | 2 | ||||
-rw-r--r-- | src/main/java/eu/olli/cowlection/command/MooCommand.java | 5 | ||||
-rw-r--r-- | src/main/java/eu/olli/cowlection/command/ReplyCommand.java | 35 | ||||
-rw-r--r-- | src/main/java/eu/olli/cowlection/util/ChatHelper.java | 2 |
6 files changed, 45 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0526450..ef20e89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Added SkyBlock Dungeon deaths counter - sends current deaths automatically; or manually with `/moo deaths` - New alias for `/moo` command: `/m` +- New command `/rr`: alias for `/r` without the auto-replacement to `/msg <latest username>` + - useful when someone has direct messages disabled and can only be messaged back with `/r` - Config option: Change position of item quality in tooltip of dungeon items - Added `/moo say [optional text]`: You can say `moo` again without triggering the command `/moo` 🎉 @@ -16,7 +16,7 @@ It is a collection of different features mainly focused on Hypixel SkyBlock. ðŸ | Copy chat component | <kbd>ALT</kbd> + <kbd>right click</kbd><br>Hold <kbd>shift</kbd> to copy full component | | Copy inventories to clipboard as JSON | <kbd>CTRL</kbd> + <kbd>C</kbd> | | Tab-completable usernames for several commands (e.g. `/party`, `/invite`, ...) | `/moo config` → `Commands with Tab-completable usernames` for full list of commands | -| Auto-replace `/r` with `/w <latest username>` | `/r ` | +| Auto-replace `/r` with `/w <latest username>` | `/r `, use `/rr` to avoid auto-replacement | | Change guiScale to any value | `/moo guiscale [newValue]` | | Check for mod updates on server login and via command | `/moo update` | diff --git a/src/main/java/eu/olli/cowlection/Cowlection.java b/src/main/java/eu/olli/cowlection/Cowlection.java index 2811e15..cff48ad 100644 --- a/src/main/java/eu/olli/cowlection/Cowlection.java +++ b/src/main/java/eu/olli/cowlection/Cowlection.java @@ -1,6 +1,7 @@ package eu.olli.cowlection; import eu.olli.cowlection.command.MooCommand; +import eu.olli.cowlection.command.ReplyCommand; import eu.olli.cowlection.command.ShrugCommand; import eu.olli.cowlection.command.TabCompletableCommand; import eu.olli.cowlection.config.MooConfig; @@ -65,6 +66,7 @@ public class Cowlection { MinecraftForge.EVENT_BUS.register(new ChatListener(this)); MinecraftForge.EVENT_BUS.register(new PlayerListener(this)); ClientCommandHandler.instance.registerCommand(new MooCommand(this)); + ClientCommandHandler.instance.registerCommand(new ReplyCommand(this)); ClientCommandHandler.instance.registerCommand(new ShrugCommand(this)); for (String tabCompletableNamesCommand : MooConfig.tabCompletableNamesCommands) { ClientCommandHandler.instance.registerCommand(new TabCompletableCommand(this, tabCompletableNamesCommand)); diff --git a/src/main/java/eu/olli/cowlection/command/MooCommand.java b/src/main/java/eu/olli/cowlection/command/MooCommand.java index 26ccb35..16547af 100644 --- a/src/main/java/eu/olli/cowlection/command/MooCommand.java +++ b/src/main/java/eu/olli/cowlection/command/MooCommand.java @@ -180,6 +180,8 @@ public class MooCommand extends CommandBase { Minecraft.getMinecraft().gameSettings.guiScale = scale; main.getChatHelper().sendMessage(EnumChatFormatting.GREEN, "\u2714 New GUI scale: " + EnumChatFormatting.DARK_GREEN + scale + EnumChatFormatting.GREEN + " (previous: " + EnumChatFormatting.DARK_GREEN + currentGuiScale + EnumChatFormatting.GREEN + ")"); } + } else if (args[0].equalsIgnoreCase("rr")) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/r " + CommandBase.buildString(args, 1)); } else if (args[0].equalsIgnoreCase("shrug")) { main.getChatHelper().sendShrug(buildString(args, 1)); } else if (args[0].equalsIgnoreCase("apikey")) { @@ -516,6 +518,7 @@ public class MooCommand extends CommandBase { .appendSibling(createCmdHelpEntry("config", "Open mod's configuration")) .appendSibling(createCmdHelpEntry("search", "Open Minecraft log search")) .appendSibling(createCmdHelpEntry("guiScale", "Change GUI scale")) + .appendSibling(createCmdHelpEntry("rr", "Alias for /r without auto-replacement to /msg")) .appendSibling(createCmdHelpEntry("shrug", "\u00AF\\_(\u30C4)_/\u00AF")) // ¯\_(ツ)_/¯ .appendSibling(createCmdHelpSection(3, "Update mod")) .appendSibling(createCmdHelpEntry("update", "Check for new mod updates")) @@ -546,7 +549,7 @@ public class MooCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, /* friends & other players */ "stalk", "stalkskyblock", "skyblockstalk", "analyzeIsland", "deaths", "add", "remove", "list", "nameChangeCheck", "toggle", - /* miscellaneous */ "config", "search", "guiscale", "shrug", "apikey", + /* miscellaneous */ "config", "search", "guiscale", "rr", "shrug", "apikey", /* update mod */ "update", "updateHelp", "version", "directory", /* help */ "help"); } else if (args.length == 2 && args[0].equalsIgnoreCase("remove")) { diff --git a/src/main/java/eu/olli/cowlection/command/ReplyCommand.java b/src/main/java/eu/olli/cowlection/command/ReplyCommand.java new file mode 100644 index 0000000..bc7b9e6 --- /dev/null +++ b/src/main/java/eu/olli/cowlection/command/ReplyCommand.java @@ -0,0 +1,35 @@ +package eu.olli.cowlection.command; + +import eu.olli.cowlection.Cowlection; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; + +public class ReplyCommand extends CommandBase { + private final Cowlection main; + + public ReplyCommand(Cowlection main) { + this.main = main; + } + + @Override + public String getCommandName() { + return "rr"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/rr <message>"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/r " + CommandBase.buildString(args, 0)); + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } +} diff --git a/src/main/java/eu/olli/cowlection/util/ChatHelper.java b/src/main/java/eu/olli/cowlection/util/ChatHelper.java index 202390f..54e5739 100644 --- a/src/main/java/eu/olli/cowlection/util/ChatHelper.java +++ b/src/main/java/eu/olli/cowlection/util/ChatHelper.java @@ -17,7 +17,7 @@ import java.util.regex.Pattern; public class ChatHelper { private static final Pattern USELESS_JSON_CONTENT_PATTERN = Pattern.compile("\"[A-Za-z]+\":false,?"); private static final int DISPLAY_DURATION = 5000; - private List<IChatComponent> offlineMessages = new ArrayList<>(); + private final List<IChatComponent> offlineMessages = new ArrayList<>(); private String[] aboveChatMessage; private long aboveChatMessageExpiration; |