Exemple #1
0
        protected override void Execute(CallArgs args)
        {
            Player playerToKick = args.Get <Player>(0);

            if (args.SenderName == playerToKick.Name)
            {
                SendMessage(args.Sender, "You can't kick yourself");
                return;
            }

            if (!args.IsConsole && playerToKick.Permissions >= args.Sender.Value.Permissions)
            {
                SendMessage(args.Sender, $"You're not allowed to kick {playerToKick.Name}");
                return;
            }

            playerToKick.SendPacket(new PlayerKicked(args.GetTillEnd(1)));
            playerManager.PlayerDisconnected(playerToKick.Connection);

            List <SimulatedEntity> revokedEntities = entitySimulation.CalculateSimulationChangesFromPlayerDisconnect(playerToKick);

            if (revokedEntities.Count > 0)
            {
                SimulationOwnershipChange ownershipChange = new(revokedEntities);
                playerManager.SendPacketToAllPlayers(ownershipChange);
            }

            playerManager.SendPacketToOtherPlayers(new Disconnect(playerToKick.Id), playerToKick);
            SendMessage(args.Sender, $"The player {playerToKick.Name} has been disconnected");
        }
Exemple #2
0
        protected override void Execute(CallArgs args)
        {
            Player foundPlayer = args.Get <Player>(0);
            string message     = $"[{args.SenderName} -> YOU]: {args.GetTillEnd(1)}";

            SendMessageToPlayer(foundPlayer, message);
        }
Exemple #3
0
        protected override void Execute(CallArgs args)
        {
            string joinedArgs = args.GetTillEnd();

            playerManager.SendPacketToAllPlayers(new ChatMessage(ChatMessage.SERVER_ID, joinedArgs));
            Log.Info("BROADCAST: " + joinedArgs);
        }
Exemple #4
0
        protected override void Execute(CallArgs args)
        {
            System.Net.IPAddress temp;
            if (!System.Net.IPAddress.TryParse(args.Get(0), out temp))
            {
                Player playerToBan = args.Get <Player>(0);
                playerToBan.SendPacket(new PlayerKicked(args.GetTillEnd(1)));
                playerManager.PlayerDisconnected(playerToBan.connection);

                List <SimulatedEntity> revokedEntities = entitySimulation.CalculateSimulationChangesFromPlayerDisconnect(playerToBan);
                if (revokedEntities.Count > 0)
                {
                    SimulationOwnershipChange ownershipChange = new SimulationOwnershipChange(revokedEntities);
                    playerManager.SendPacketToAllPlayers(ownershipChange);
                }

                Banning.IpBanning.AddNewBan(playerToBan.connection.Endpoint.Address.ToString());
                playerManager.SendPacketToOtherPlayers(new Disconnect(playerToBan.Id), playerToBan);
                SendMessage(args.Sender, $"The player {playerToBan.Name} has been banned");
            }
            else
            {
                foreach (Player playerToBan in playerManager.GetAllPlayers())
                {
                    if (playerToBan.connection.Endpoint.Address.ToString() == temp.ToString())
                    {
                        playerToBan.SendPacket(new PlayerKicked(args.GetTillEnd(1)));
                        playerManager.PlayerDisconnected(playerToBan.connection);

                        List <SimulatedEntity> revokedEntities = entitySimulation.CalculateSimulationChangesFromPlayerDisconnect(playerToBan);
                        if (revokedEntities.Count > 0)
                        {
                            SimulationOwnershipChange ownershipChange = new SimulationOwnershipChange(revokedEntities);
                            playerManager.SendPacketToAllPlayers(ownershipChange);
                        }

                        Banning.IpBanning.AddNewBan(playerToBan.connection.Endpoint.Address.ToString());
                        playerManager.SendPacketToOtherPlayers(new Disconnect(playerToBan.Id), playerToBan);
                    }
                }

                Banning.IpBanning.AddNewBan(temp.ToString());
            }
        }
Exemple #5
0
        protected override void Execute(CallArgs args)
        {
            Player foundPlayer = args.Get <Player>(0);

            if (foundPlayer != null)
            {
                string message = $"[{args.SenderName} -> YOU]: {args.GetTillEnd(1)}";
                SendMessageToPlayer(foundPlayer, message);
            }
            else
            {
                SendMessage(args.Sender, "Unable to whisper, player not found.");
            }
        }
Exemple #6
0
        protected override void Execute(CallArgs args)
        {
            Player playerToKick = args.Get <Player>(0);

            playerToKick.SendPacket(new PlayerKicked(args.GetTillEnd(1)));
            playerManager.PlayerDisconnected(playerToKick.connection);

            List <SimulatedEntity> revokedEntities = entitySimulation.CalculateSimulationChangesFromPlayerDisconnect(playerToKick);

            if (revokedEntities.Count > 0)
            {
                SimulationOwnershipChange ownershipChange = new SimulationOwnershipChange(revokedEntities);
                playerManager.SendPacketToAllPlayers(ownershipChange);
            }

            playerManager.SendPacketToOtherPlayers(new Disconnect(playerToKick.Id), playerToKick);
            SendMessage(args.Sender, $"The player {playerToKick.Name} has been disconnected");
        }
Exemple #7
0
 protected override void Execute(CallArgs args)
 {
     SendMessageToAllPlayers(args.GetTillEnd());
 }