示例#1
0
    public static void host(int players, int port, string password)
    {
        NetworkTools.currentPort = port;
        NetworkEvents.triggerOnHosting();
        Network.InitializeSecurity();
        Network.incomingPassword = password;

        Network.SetSendingEnabled(0, false);
        Network.isMessageQueueRunning = false;

        string lower = Network.InitializeServer((!ServerSettings.dedicated ? players - 1 : players), port, false).ToString().ToLower();

        ServerSettings.passworded = password != string.Empty;
        NetworkBans.Load();

        if (lower == "noerror")
        {
            if (!ServerSettings.open)
            {
                System.Console.WriteLine("Server opened with no error!");
            }
        }
        else
        {
            NetworkTools.disconnect();
            NetworkEvents.triggerOnFailed(0);
        }
    }
示例#2
0
    public static void ban(string name, string id, string reason, string bannedBy)
    {
        BanEntry entry = new BanEntry(name, id, reason, bannedBy, System.DateTime.Now);

        bannedPlayers.Add(id, entry);
        Database.provider.AddBan(entry);

        // Reload
        NetworkBans.Load();
        // Save moved to /save command
    }
示例#3
0
 private void BanReload(CommandArgs args)
 {
     try {
         NetworkBans.GetBannedPlayers().Clear();
         NetworkBans.Load();
         Reference.Tell(args.sender.networkPlayer, "Ban table reloaded with " + NetworkBans.GetBannedPlayers().Count + " entries.");
     }
     catch (Exception e)
     {
         Console.WriteLine("Error! " + e.Message);
     }
 }