ServerCommandManager .java

net.minecraft.command.ServerCommandManager (class): members: notifyOperators. strings: "chat.type.admin", "logAdminCommands", "sendCommandFeedback".

net.minecraft.commandclass163 linescommonextends CommandHandler7.3 KB

Implements

API Surface (1)

void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams)

String literals (3)

"chat.type.admin"
"logAdminCommands"
"sendCommandFeedback"

Code Graph: Dependencies (71)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ServerCommandManager.java163 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.command;
2
3
import net.minecraft.command.server.CommandAchievement;
4
import net.minecraft.command.server.CommandBanIp;
5
import net.minecraft.command.server.CommandBanPlayer;
6
import net.minecraft.command.server.CommandBlockLogic;
7
import net.minecraft.command.server.CommandBroadcast;
8
import net.minecraft.command.server.CommandDeOp;
9
import net.minecraft.command.server.CommandEmote;
10
import net.minecraft.command.server.CommandListBans;
11
import net.minecraft.command.server.CommandListPlayers;
12
import net.minecraft.command.server.CommandMessage;
13
import net.minecraft.command.server.CommandMessageRaw;
14
import net.minecraft.command.server.CommandOp;
15
import net.minecraft.command.server.CommandPardonIp;
16
import net.minecraft.command.server.CommandPardonPlayer;
17
import net.minecraft.command.server.CommandPublishLocalServer;
18
import net.minecraft.command.server.CommandSaveAll;
19
import net.minecraft.command.server.CommandSaveOff;
20
import net.minecraft.command.server.CommandSaveOn;
21
import net.minecraft.command.server.CommandScoreboard;
22
import net.minecraft.command.server.CommandSetBlock;
23
import net.minecraft.command.server.CommandSetDefaultSpawnpoint;
24
import net.minecraft.command.server.CommandStop;
25
import net.minecraft.command.server.CommandSummon;
26
import net.minecraft.command.server.CommandTeleport;
27
import net.minecraft.command.server.CommandTestFor;
28
import net.minecraft.command.server.CommandTestForBlock;
29
import net.minecraft.command.server.CommandWhitelist;
30
import net.minecraft.entity.player.EntityPlayer;
31
import net.minecraft.network.rcon.RConConsoleSource;
32
import net.minecraft.server.MinecraftServer;
33
import net.minecraft.util.ChatComponentTranslation;
34
import net.minecraft.util.EnumChatFormatting;
35
import net.minecraft.util.IChatComponent;
36
37
public class ServerCommandManager extends CommandHandler implements IAdminCommand
38
{
39
    public ServerCommandManager()
40
    {
41
        this.registerCommand(new CommandTime());
42
        this.registerCommand(new CommandGameMode());
43
        this.registerCommand(new CommandDifficulty());
44
        this.registerCommand(new CommandDefaultGameMode());
45
        this.registerCommand(new CommandKill());
46
        this.registerCommand(new CommandToggleDownfall());
47
        this.registerCommand(new CommandWeather());
48
        this.registerCommand(new CommandXP());
49
        this.registerCommand(new CommandTeleport());
50
        this.registerCommand(new CommandGive());
51
        this.registerCommand(new CommandReplaceItem());
52
        this.registerCommand(new CommandStats());
53
        this.registerCommand(new CommandEffect());
54
        this.registerCommand(new CommandEnchant());
55
        this.registerCommand(new CommandParticle());
56
        this.registerCommand(new CommandEmote());
57
        this.registerCommand(new CommandShowSeed());
58
        this.registerCommand(new CommandHelp());
59
        this.registerCommand(new CommandDebug());
60
        this.registerCommand(new CommandMessage());
61
        this.registerCommand(new CommandBroadcast());
62
        this.registerCommand(new CommandSetSpawnpoint());
63
        this.registerCommand(new CommandSetDefaultSpawnpoint());
64
        this.registerCommand(new CommandGameRule());
65
        this.registerCommand(new CommandClearInventory());
66
        this.registerCommand(new CommandTestFor());
67
        this.registerCommand(new CommandSpreadPlayers());
68
        this.registerCommand(new CommandPlaySound());
69
        this.registerCommand(new CommandScoreboard());
70
        this.registerCommand(new CommandExecuteAt());
71
        this.registerCommand(new CommandTrigger());
72
        this.registerCommand(new CommandAchievement());
73
        this.registerCommand(new CommandSummon());
74
        this.registerCommand(new CommandSetBlock());
75
        this.registerCommand(new CommandFill());
76
        this.registerCommand(new CommandClone());
77
        this.registerCommand(new CommandCompare());
78
        this.registerCommand(new CommandBlockData());
79
        this.registerCommand(new CommandTestForBlock());
80
        this.registerCommand(new CommandMessageRaw());
81
        this.registerCommand(new CommandWorldBorder());
82
        this.registerCommand(new CommandTitle());
83
        this.registerCommand(new CommandEntityData());
84
85
        if (MinecraftServer.getServer().isDedicatedServer())
86
        {
87
            this.registerCommand(new CommandOp());
88
            this.registerCommand(new CommandDeOp());
89
            this.registerCommand(new CommandStop());
90
            this.registerCommand(new CommandSaveAll());
91
            this.registerCommand(new CommandSaveOff());
92
            this.registerCommand(new CommandSaveOn());
93
            this.registerCommand(new CommandBanIp());
94
            this.registerCommand(new CommandPardonIp());
95
            this.registerCommand(new CommandBanPlayer());
96
            this.registerCommand(new CommandListBans());
97
            this.registerCommand(new CommandPardonPlayer());
98
            this.registerCommand(new CommandServerKick());
99
            this.registerCommand(new CommandListPlayers());
100
            this.registerCommand(new CommandWhitelist());
101
            this.registerCommand(new CommandSetPlayerTimeout());
102
        }
103
        else
104
        {
105
            this.registerCommand(new CommandPublishLocalServer());
106
        }
107
108
        CommandBase.setAdminCommander(this);
109
    }
110
111
    /**
112
     * Send an informative message to the server operators
113
     */
114
    public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams)
115
    {
116
        boolean flag = true;
117
        MinecraftServer minecraftserver = MinecraftServer.getServer();
118
119
        if (!sender.sendCommandFeedback())
120
        {
121
            flag = false;
122
        }
123
124
        IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)});
125
        ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY);
126
        ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true));
127
128
        if (flag)
129
        {
130
            for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().getPlayerList())
131
            {
132
                if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender))
133
                {
134
                    boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().shouldBroadcastConsoleToOps();
135
                    boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().shouldBroadcastRconToOps();
136
137
                    if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
138
                    {
139
                        entityplayer.addChatMessage(ichatcomponent);
140
                    }
141
                }
142
            }
143
        }
144
145
        if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
146
        {
147
            minecraftserver.addChatMessage(ichatcomponent);
148
        }
149
150
        boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");
151
152
        if (sender instanceof CommandBlockLogic)
153
        {
154
            flag3 = ((CommandBlockLogic)sender).shouldTrackOutput();
155
        }
156
157
        if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
158
        {
159
            sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams));
160
        }
161
    }
162
}
163

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