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