    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 CommandDefaultGameMode());
    013            this.registerCommand(new CommandKill());
    014            this.registerCommand(new CommandToggleDownfall());
    015            this.registerCommand(new CommandXP());
    016            this.registerCommand(new CommandServerTp());
    017            this.registerCommand(new CommandGive());
    018            this.registerCommand(new CommandServerEmote());
    019            this.registerCommand(new CommandShowSeed());
    020            this.registerCommand(new CommandHelp());
    021            this.registerCommand(new CommandDebug());
    022            this.registerCommand(new CommandServerMessage());
    023
    024            if (MinecraftServer.getServer().isDedicatedServer())
    025            {
    026                this.registerCommand(new CommandServerOp());
    027                this.registerCommand(new CommandServerDeop());
    028                this.registerCommand(new CommandServerStop());
    029                this.registerCommand(new CommandServerSaveAll());
    030                this.registerCommand(new CommandServerSaveOff());
    031                this.registerCommand(new CommandServerSaveOn());
    032                this.registerCommand(new CommandServerBanIp());
    033                this.registerCommand(new CommandServerPardonIp());
    034                this.registerCommand(new CommandServerBan());
    035                this.registerCommand(new CommandServerBanlist());
    036                this.registerCommand(new CommandServerPardon());
    037                this.registerCommand(new CommandServerKick());
    038                this.registerCommand(new CommandServerList());
    039                this.registerCommand(new CommandServerSay());
    040                this.registerCommand(new CommandServerWhitelist());
    041            }
    042            else
    043            {
    044                this.registerCommand(new CommandServerPublishLocal());
    045            }
    046
    047            CommandBase.setAdminCommander(this);
    048        }
    049
    050        /**
    051         * Sends a message to the admins of the server from a given CommandSender with the given resource string and given
    052         * extra srings. If the int par2 is even or zero, the original sender is also notified.
    053         */
    054        public void notifyAdmins(ICommandSender par1ICommandSender, int par2, String par3Str, Object ... par4ArrayOfObj)
    055        {
    056            Iterator var5 = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator();
    057
    058            while (var5.hasNext())
    059            {
    060                EntityPlayerMP var6 = (EntityPlayerMP)var5.next();
    061
    062                if (var6 != par1ICommandSender && MinecraftServer.getServer().getConfigurationManager().areCommandsAllowed(var6.username))
    063                {
    064                    var6.sendChatToPlayer("\u00a77\u00a7o[" + par1ICommandSender.getCommandSenderName() + ": " + var6.translateString(par3Str, par4ArrayOfObj) + "]");
    065                }
    066            }
    067
    068            if (par1ICommandSender != MinecraftServer.getServer())
    069            {
    070                MinecraftServer.logger.info("[" + par1ICommandSender.getCommandSenderName() + ": " + MinecraftServer.getServer().translateString(par3Str, par4ArrayOfObj) + "]");
    071            }
    072
    073            if ((par2 & 1) != 1)
    074            {
    075                par1ICommandSender.sendChatToPlayer(par1ICommandSender.translateString(par3Str, par4ArrayOfObj));
    076            }
    077        }
    078    }