aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2020-07-23 17:12:32 +0200
committerCow <cow@volloeko.de>2020-07-23 17:12:32 +0200
commit265c2eb4cfbdce3184c48855fba5f1250f2b8797 (patch)
treed6c4382695becd6d4c6c30b7f050c7c3c50ebdcf /src
parent745a7c428971ed08eb91057a7c8a4ba18825a54f (diff)
downloadCowlection-265c2eb4cfbdce3184c48855fba5f1250f2b8797.tar.gz
Cowlection-265c2eb4cfbdce3184c48855fba5f1250f2b8797.tar.bz2
Cowlection-265c2eb4cfbdce3184c48855fba5f1250f2b8797.zip
Added /rr command
Same as /r but without auto-replacement to /msg <latest name>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/olli/cowlection/Cowlection.java2
-rw-r--r--src/main/java/eu/olli/cowlection/command/MooCommand.java5
-rw-r--r--src/main/java/eu/olli/cowlection/command/ReplyCommand.java35
-rw-r--r--src/main/java/eu/olli/cowlection/util/ChatHelper.java2
4 files changed, 42 insertions, 2 deletions
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;