CommandEmote .java

net.minecraft.command.server.CommandEmote (class, 61 lines): members: addTabCompletionOptions, getRequiredPermissionLevel, getCommandUsage, getCommandName.

net.minecraft.command.serverclass61 linesserverextends CommandBase1.8 KB

API Surface (5)

String getCommandName()
int getRequiredPermissionLevel()
String getCommandUsage(ICommandSender sender)
void processCommand(ICommandSender sender, String[] args)
List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)

String literals (2)

"commands.me.usage"
"chat.type.emote"

Full Source

CommandEmote.java61 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.command.server;
2
3
import java.util.List;
4
import net.minecraft.command.CommandBase;
5
import net.minecraft.command.CommandException;
6
import net.minecraft.command.ICommandSender;
7
import net.minecraft.command.WrongUsageException;
8
import net.minecraft.entity.player.EntityPlayer;
9
import net.minecraft.server.MinecraftServer;
10
import net.minecraft.util.BlockPos;
11
import net.minecraft.util.ChatComponentTranslation;
12
import net.minecraft.util.IChatComponent;
13
14
public class CommandEmote extends CommandBase
15
{
16
    /**
17
     * Gets the name of the command
18
     */
19
    public String getCommandName()
20
    {
21
        return "me";
22
    }
23
24
    /**
25
     * Return the required permission level for this command.
26
     */
27
    public int getRequiredPermissionLevel()
28
    {
29
        return 0;
30
    }
31
32
    /**
33
     * Gets the usage string for the command.
34
     */
35
    public String getCommandUsage(ICommandSender sender)
36
    {
37
        return "commands.me.usage";
38
    }
39
40
    /**
41
     * Callback when the command is invoked
42
     */
43
    public void processCommand(ICommandSender sender, String[] args) throws CommandException
44
    {
45
        if (args.length <= 0)
46
        {
47
            throw new WrongUsageException("commands.me.usage", new Object[0]);
48
        }
49
        else
50
        {
51
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, !(sender instanceof EntityPlayer));
52
            MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.emote", new Object[] {sender.getDisplayName(), ichatcomponent}));
53
        }
54
    }
55
56
    public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
57
    {
58
        return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
59
    }
60
}
61

Deobfuscated MCP 1.8.9 source of CommandEmote from Marcelektro/MavenMCP-1.8.9 (net/minecraft/command/server/CommandEmote.java), stored verbatim.