    001    package net.minecraft.command;
    002
    003    import java.util.Iterator;
    004    import net.minecraft.entity.player.EntityPlayerMP;
    005    import net.minecraft.server.MinecraftServer;
    006    import net.minecraft.tileentity.TileEntityCommandBlock;
    007
    008    public class ServerCommandManager extends CommandHandler implements IAdminCommand
    009    {
    010        public ServerCommandManager()
    011        {
    012            this.registerCommand(new CommandTime());
    013            this.registerCommand(new CommandGameMode());
    014            this.registerCommand(new CommandDifficulty());
    015            this.registerCommand(new CommandDefaultGameMode());
    016            this.registerCommand(new CommandKill());
    017            this.registerCommand(new CommandToggleDownfall());
    018            this.registerCommand(new CommandWeather());
    019            this.registerCommand(new CommandXP());
    020            this.registerCommand(new CommandServerTp());
    021            this.registerCommand(new CommandGive());
    022            this.registerCommand(new CommandEnchant());
    023            this.registerCommand(new CommandServerEmote());
    024            this.registerCommand(new CommandShowSeed());
    025            this.registerCommand(new CommandHelp());
    026            this.registerCommand(new CommandDebug());
    027            this.registerCommand(new CommandServerMessage());
    028            this.registerCommand(new CommandServerSay());
    029            this.registerCommand(new CommandSetSpawnpoint());
    030            this.registerCommand(new CommandGameRule());
    031            this.registerCommand(new CommandClearInventory());
    032
    033            if (MinecraftServer.getServer().isDedicatedServer())
    034            {
    035                this.registerCommand(new CommandServerOp());
    036                this.registerCommand(new CommandServerDeop());
    037                this.registerCommand(new CommandServerStop());
    038                this.registerCommand(new CommandServerSaveAll());
    039                this.registerCommand(new CommandServerSaveOff());
    040                this.registerCommand(new CommandServerSaveOn());
    041                this.registerCommand(new CommandServerBanIp());
    042                this.registerCommand(new CommandServerPardonIp());
    043                this.registerCommand(new CommandServerBan());
    044                this.registerCommand(new CommandServerBanlist());
    045                this.registerCommand(new CommandServerPardon());
    046                this.registerCommand(new CommandServerKick());
    047                this.registerCommand(new CommandServerList());
    048                this.registerCommand(new CommandServerWhitelist());
    049            }
    050            else
    051            {
    052                this.registerCommand(new CommandServerPublishLocal());
    053            }
    054
    055            CommandBase.setAdminCommander(this);
    056        }
    057
    058        /**
    059         * Sends a message to the admins of the server from a given CommandSender with the given resource string and given
    060         * extra srings. If the int par2 is even or zero, the original sender is also notified.
    061         */
    062        public void notifyAdmins(ICommandSender par1ICommandSender, int par2, String par3Str, Object ... par4ArrayOfObj)
    063        {
    064            boolean var5 = true;
    065
    066            if (par1ICommandSender instanceof TileEntityCommandBlock && !MinecraftServer.getServer().worldServers[0].getGameRules().getGameRuleBooleanValue("commandBlockOutput"))
    067            {
    068                var5 = false;
    069            }
    070
    071            if (var5)
    072            {
    073                Iterator var6 = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator();
    074
    075                while (var6.hasNext())
    076                {
    077                    EntityPlayerMP var7 = (EntityPlayerMP)var6.next();
    078
    079                    if (var7 != par1ICommandSender && MinecraftServer.getServer().getConfigurationManager().areCommandsAllowed(var7.username))
    080                    {
    081                        var7.sendChatToPlayer("\u00a77\u00a7o[" + par1ICommandSender.getCommandSenderName() + ": " + var7.translateString(par3Str, par4ArrayOfObj) + "]");
    082                    }
    083                }
    084            }
    085
    086            if (par1ICommandSender != MinecraftServer.getServer())
    087            {
    088                MinecraftServer.logger.info("[" + par1ICommandSender.getCommandSenderName() + ": " + MinecraftServer.getServer().translateString(par3Str, par4ArrayOfObj) + "]");
    089            }
    090
    091            if ((par2 & 1) != 1)
    092            {
    093                par1ICommandSender.sendChatToPlayer(par1ICommandSender.translateString(par3Str, par4ArrayOfObj));
    094            }
    095        }
    096    }