コード例 #1
0
ファイル: Server.cs プロジェクト: slavagmail/Fougerite
        public bool UnbanByName(string name, string UnBanner = "Console")
        {
            var id = ReturnACNByName2(name);
            var ip = ReturnACNByName(name);

            if (id == null)
            {
                return(false);
            }
            string red   = "[color #FF0000]";
            string green = "[color #009900]";
            string white = "[color #FFFFFF]";

            foreach (Fougerite.Player pl in Server.GetServer().Players)
            {
                if (pl.Admin || pl.Moderator)
                {
                    pl.Message(red + name + white + " was unbanned by: "
                               + green + UnBanner);
                }
            }
            IniParser ini = GlobalBanList;

            name = id;
            var iprq = ini.GetSetting("NameIps", ip);
            var idrq = ini.GetSetting("NameIds", id);

            ini.DeleteSetting("Ips", iprq);
            ini.DeleteSetting("Ids", idrq);
            ini.DeleteSetting("NameIps", name);
            ini.DeleteSetting("NameIds", name);
            ini.Save();
            return(true);
        }
コード例 #2
0
        private void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc)
        {
            if (msgc.PluginSender == "WorldEditor")
            {
                if (msgc.MessageByClient == "worldeditadmin")
                {
                    msgc.ReturnMessage = user.Player.Admin ? "yes" : "no";
                }
                else if (msgc.MessageByClient == "worldedit_finished")
                {
//                    this._protectedPlayers.Remove(user.SteamID);
//                    user.Player.Notice("", "All custom objects loaded. You are no longer protected!", 10);
                    user.Player.Notice("", "All custom objects loaded.", 10);
                }
                else if (msgc.MessageByClient.Contains("worldedit_spawn"))
                {
                    var splitted = msgc.MessageByClient.Split('|');
                    foreach (var player in Server.GetServer().Players)
                    {
                        player.SendConsoleMessage("worldedit_spawn|" + splitted[1]);
                    }
                }
                else if (msgc.MessageByClient == "worldedit_kick")
                {
                    user.Player.Disconnect();
                }
            }
        }
コード例 #3
0
ファイル: Server.cs プロジェクト: slavagmail/Fougerite
        public void BanPlayer(Fougerite.Player player, string Banner = "Console", string reason = "You were banned.")
        {
            string red   = "[color #FF0000]";
            string green = "[color #009900]";
            string white = "[color #FFFFFF]";

            foreach (Fougerite.Player pl in Server.GetServer().Players)
            {
                if (pl.Admin || pl.Moderator)
                {
                    pl.Message(red + player.Name + white + " was banned by: "
                               + green + Banner);
                    pl.Message(red + " Reason: " + reason);
                }
            }
            IniParser ini = GlobalBanList;

            ini.AddSetting("Ips", player.IP, player.Name);
            ini.AddSetting("Ids", player.SteamID, player.Name);
            ini.AddSetting("NameIps", player.Name, player.IP);
            ini.AddSetting("NameIds", player.Name, player.SteamID);
            ini.AddSetting("AdminWhoBanned", player.Name, Banner);
            ini.Save();
            player.Message(red + " " + reason);
            player.Message(red + " Banned by: " + Banner);
            player.Disconnect();
        }
コード例 #4
0
ファイル: Hooks.cs プロジェクト: slavagmail/Fougerite
 public static void ClientMove(HumanController hc, Vector3 origin, int encoded, ushort stateFlags, uLink.NetworkMessageInfo info)
 {
     if (info.sender != hc.networkView.owner)
     {
         return;
     }
     if (float.IsNaN(origin.x) || float.IsInfinity(origin.x) ||
         float.IsNaN(origin.y) || float.IsInfinity(origin.y) ||
         float.IsNaN(origin.z) || float.IsInfinity(origin.z))
     {
         Logger.LogDebug("[TeleportHack] " + hc.netUser.displayName + " sent invalid packets. " + hc.netUser.userID);
         Server.GetServer().Broadcast(hc.netUser.displayName + " might have tried to teleport with hacks.");
         if (Fougerite.Bootstrap.BI)
         {
             Fougerite.Server.GetServer().BanPlayer(Fougerite.Server.Cache[hc.netUser.userID]);
             return;
         }
         hc.netUser.Kick(NetError.Facepunch_Kick_Violation, true);
         return;
     }
     if (OnPlayerMove != null)
     {
         OnPlayerMove(hc, origin, encoded, stateFlags, info);
     }
 }
コード例 #5
0
 void ExecutePlayerUpdate()
 {
     foreach (Fougerite.Player player in Server.GetServer().Players)
     {
         if (player.IsOnline)
         {
             Hooks.PlayerUpdate(player);
         }
     }
     CTimer.SetTimer(() => ExecutePlayerUpdate(), 1000, 1);
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: Sergey-RustReduX/Fougerite
 public void Disconnect(bool SendNotification = true)
 {
     if (this.IsOnline)
     {
         //Logger.LogError("Same? " + Thread.CurrentThread.ManagedThreadId + " - " +  Bootstrap.CurrentThread.ManagedThreadId);
         if (Thread.CurrentThread.ManagedThreadId != Util.GetUtil().MainThreadID)
         {
             //Logger.LogError("Nope, invoking");
             Loom.QueueOnMainThread(() =>
             {
                 this.Disconnect(SendNotification);
             });
             return;
         }
         Server.GetServer().RemovePlayer(uid);
         this.ourPlayer.netUser.Kick(NetError.Facepunch_Kick_RCON, false);
         IsDisconnecting = true;
     }
 }
コード例 #7
0
ファイル: Entity.cs プロジェクト: oscarafdev/HyRust-Server
        public Entity(object Obj)
        {
            this._obj = Obj;
            if (this.IsStructureMaster())
            {
                this._ownerid   = (Obj as StructureMaster).ownerID;
                this._creatorid = (Obj as StructureMaster).creatorID;
                this._name      = "Structure Master";
            }

            if (this.IsStructure())
            {
                StructureComponent comp = Obj as StructureComponent;

                if (comp != null && comp._master != null)
                {
                    this._ownerid   = comp._master.ownerID;
                    this._creatorid = comp._master.creatorID;
                }
                string clone = this.GetObject <StructureComponent>().ToString();
                var    index = clone.IndexOf("(Clone)");
                this._name = clone.Substring(0, index);
            }
            if (this.IsDeployableObject())
            {
                DeployableObject dobj = Obj as DeployableObject;
                this._ownerid   = dobj.ownerID;
                this._creatorid = dobj.creatorID;
                string clone = this.GetObject <DeployableObject>().ToString();
                if (clone.Contains("Barricade"))
                {
                    this._name = "Wood Barricade";
                }
                else
                {
                    var index = clone.IndexOf("(Clone)");
                    this._name = clone.Substring(0, index);
                }
                var deployable = Obj as DeployableObject;

                var inventory = deployable.GetComponent <Inventory>();
                if (inventory != null)
                {
                    this.hasInventory = true;
                    this.inv          = new EntityInv(inventory, this);
                }
                else
                {
                    this.hasInventory = false;
                }
            }
            else if (this.IsLootableObject())
            {
                this._ownerid   = 76561198095992578UL;
                this._creatorid = 76561198095992578UL;
                var loot = Obj as LootableObject;
                this._name = loot.name;
                var inventory = loot._inventory;
                if (inventory != null)
                {
                    this.hasInventory = true;
                    this.inv          = new EntityInv(inventory, this);
                }
                else
                {
                    this.hasInventory = false;
                }
            }
            else if (this.IsSupplyCrate())
            {
                this._ownerid   = 76561198095992578UL;
                this._creatorid = 76561198095992578UL;
                this._name      = "Supply Crate";
                var crate     = Obj as SupplyCrate;
                var inventory = crate.lootableObject._inventory;
                if (inventory != null)
                {
                    this.hasInventory = true;
                    this.inv          = new EntityInv(inventory, this);
                }
                else
                {
                    this.hasInventory = false;
                }
            }
            else if (IsResourceTarget())
            {
                var x = (ResourceTarget)Obj;
                this._ownerid     = 76561198095992578UL;
                this._creatorid   = 76561198095992578UL;
                this._name        = x.name;
                this.hasInventory = false;
            }
            else
            {
                this.hasInventory = false;
            }
            if (Fougerite.Server.Cache.ContainsKey(_ownerid))
            {
                this._ownername = Fougerite.Server.Cache[_ownerid].Name;
            }
            else if (Server.GetServer().HasRustPP)
            {
                if (Server.GetServer().GetRustPPAPI().Cache.ContainsKey(_ownerid))
                {
                    this._ownername = Server.GetServer().GetRustPPAPI().Cache[_ownerid];
                }
            }
            else
            {
                this._ownername = "UnKnown";
            }
            if (Fougerite.Server.Cache.ContainsKey(_creatorid))
            {
                this._creatorname = Fougerite.Server.Cache[_creatorid].Name;
            }
            else if (Server.GetServer().HasRustPP)
            {
                if (Server.GetServer().GetRustPPAPI().Cache.ContainsKey(_creatorid))
                {
                    this._creatorname = Server.GetServer().GetRustPPAPI().Cache[_creatorid];
                }
            }
            else
            {
                this._creatorname = "UnKnown";
            }
        }