diff options
author | Cow <cow@volloeko.de> | 2020-07-22 17:47:32 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2020-07-22 17:47:32 +0200 |
commit | d73b34dba09385b216890191853157c0e57aacd1 (patch) | |
tree | ce568b7f1c56450824c8740e5a64521b58b8d402 /src/main/java/eu/olli/cowlection/command | |
parent | 3e16f04965279ced357cc832d124eb46bf110b22 (diff) | |
download | Cowlection-d73b34dba09385b216890191853157c0e57aacd1.tar.gz Cowlection-d73b34dba09385b216890191853157c0e57aacd1.tar.bz2 Cowlection-d73b34dba09385b216890191853157c0e57aacd1.zip |
Added various improvements/fixes (mostly from #mod-suggestions)
- New alias for `/moo` command: `/m`
- Fixed more special case dungeon item tooltips
- Config option: Change position of item quality in tooltip of dungeon items
- `/moo stalk`: Fix players appearing offline when apiSession is set to `false`
- Added `/moo say [optional text]`: You can say `moo` again without triggering the command `/moo`
- Tab-completable player names now include names from more sources
- Some smaller improvements to Dungeon party finder
Diffstat (limited to 'src/main/java/eu/olli/cowlection/command')
-rw-r--r-- | src/main/java/eu/olli/cowlection/command/MooCommand.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/eu/olli/cowlection/command/MooCommand.java b/src/main/java/eu/olli/cowlection/command/MooCommand.java index bd90564..0f469fb 100644 --- a/src/main/java/eu/olli/cowlection/command/MooCommand.java +++ b/src/main/java/eu/olli/cowlection/command/MooCommand.java @@ -29,10 +29,8 @@ import org.apache.commons.lang3.StringUtils; import java.awt.*; import java.io.IOException; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.TimeUnit; public class MooCommand extends CommandBase { @@ -45,11 +43,16 @@ public class MooCommand extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { - sendCommandUsage(sender); + main.getChatHelper().sendMessage(EnumChatFormatting.GOLD, "Tried to say " + EnumChatFormatting.YELLOW + getCommandName() + EnumChatFormatting.GOLD + "? Use " + EnumChatFormatting.YELLOW + getCommandName() + " say [optional text]" + EnumChatFormatting.GOLD + " instead.\n" + + "Tried to use the command " + EnumChatFormatting.YELLOW + "/" + getCommandName() + EnumChatFormatting.GOLD + "? Use " + EnumChatFormatting.YELLOW + "/" + getCommandName() + " help" + EnumChatFormatting.GOLD + " for a list of available commands"); return; } // sub commands: friends & other players - if (args[0].equalsIgnoreCase("stalk")) { + if (args[0].equalsIgnoreCase("say")) { + // work-around so you can still say 'moo' in chat without triggering the client-side command + String msg = CommandBase.buildString(args, 1); + Minecraft.getMinecraft().thePlayer.sendChatMessage(getCommandName() + (!msg.isEmpty() ? " " + msg : "")); + } else if (args[0].equalsIgnoreCase("stalk")) { if (args.length != 2) { throw new WrongUsageException("/" + getCommandName() + " stalk <playerName>"); } else if (!Utils.isValidMcName(args[1])) { @@ -296,6 +299,9 @@ public class MooCommand extends CommandBase { main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, slothStalking.getPlayerNameFormatted() + EnumChatFormatting.YELLOW + " was last online " + EnumChatFormatting.GOLD + lastOnline.first() + EnumChatFormatting.YELLOW + " ago" + (lastOnline.second() != null ? " (" + EnumChatFormatting.GOLD + lastOnline.second() + EnumChatFormatting.YELLOW + ")" : "") + "."); + } else if (slothStalking.getLastLogin() > slothStalking.getLastLogout()) { + // player is logged in but is hiding their session details from API (My Profile > API settings > Online Status) + main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD + slothStalking.getPlayerNameFormatted() + EnumChatFormatting.YELLOW + " is currently playing " + EnumChatFormatting.GOLD + slothStalking.getLastGame() + "\n" + EnumChatFormatting.DARK_GRAY + "(" + slothStalking.getPlayerName() + " hides their session details from the API so that only their current game mode is visible)"); } else { Pair<String, String> lastOnline = Utils.getDurationAsWords(slothStalking.getLastLogout()); @@ -477,6 +483,11 @@ public class MooCommand extends CommandBase { } @Override + public List<String> getCommandAliases() { + return Collections.singletonList("m"); + } + + @Override public String getCommandUsage(ICommandSender sender) { return "/" + getCommandName() + " help"; } |