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