예제 #1
0
        protected override void Execute(CallArgs args)
        {
            Int3          batchId  = new Int3(args.Get <int>(0), args.Get <int>(1), args.Get <int>(2));
            List <Entity> entities = batchEntitySpawner.LoadUnspawnedEntities(batchId);

            SendMessage(args.Sender, $"Loaded {entities.Count} entities from batch {batchId}");
        }
예제 #2
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);
            Perms  permissions  = args.Get <Perms>(1);

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

            //Allows a bounded permission hierarchy
            if (args.IsConsole || permissions < args.Sender.Value.Permissions)
            {
                targetPlayer.Permissions = permissions;

                // TODO: Send a packet to the player to acknowledge the permision level change
                SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to {permissions}");
                SendMessageToPlayer(targetPlayer, $"You've been promoted to {permissions}");
            }
            else
            {
                SendMessage(args.Sender, $"You're not allowed to update {targetPlayer.Name}\'s permissions");
            }
        }
예제 #3
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);
            string playerName   = args.Get(0);

            targetPlayer.Permissions = Perms.PLAYER;

            SendMessage(args.Sender, $"Updated {playerName}\'s permissions to PLAYER");
        }
예제 #4
0
        protected override void Execute(CallArgs args)
        {
            Validate.IsTrue(args.Sender.HasValue, "This command can't be used by CONSOLE");

            Vector3 position = new Vector3(args.Get <int>(0), args.Get <int>(1), args.Get <int>(2));

            args.Sender.Value.Teleport(position);

            SendMessage(args.Sender, $"Teleported to {position}");
        }
예제 #5
0
 protected override void Execute(CallArgs args)
 {
     System.Net.IPAddress temp;
     if (!System.Net.IPAddress.TryParse(args.Get(0), out temp))
     {
         Player player = args.Get <Player>(0);
         Banning.IpBanning.RemoveBan(player.connection.Endpoint.Address.ToString());
         SendMessage(args.Sender, $"The player {player.Name} has been unbanned");
     }
     else
     {
         Banning.IpBanning.RemoveBan(temp.ToString());
     }
 }
예제 #6
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

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

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

            if (targetPlayer.IsMuted)
            {
                SendMessage(args.Sender, $"{targetPlayer.Name} is already muted");
                return;
            }

            targetPlayer.IsMuted = true;
            // TODO: Send a packet to all players to acknowledge the muted player
            SendMessage(targetPlayer, "You're now muted");
            SendMessage(args.Sender, $"Muted {targetPlayer.Name}");
        }
예제 #7
0
        protected override void Execute(CallArgs args)
        {
            Player foundPlayer = args.Get <Player>(0);
            string message     = $"[{args.SenderName} -> YOU]: {args.GetTillEnd(1)}";

            SendMessageToPlayer(foundPlayer, message);
        }
예제 #8
0
        protected override void Execute(CallArgs args)
        {
            ServerGameMode sgm = args.Get <ServerGameMode>(0);

            serverConfig.GameModeEnum = sgm;
            SendMessage(args.Sender, $"Server gamemode changed to \"{sgm}\" by {args.SenderName}");
        }
예제 #9
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");
        }
예제 #10
0
파일: OpCommand.cs 프로젝트: EmidioMata/1.2
        protected override void Execute(CallArgs args)
        {
            Player receivingPlayer = args.Get <Player>(0);
            string playerName      = receivingPlayer.Name;

            receivingPlayer.Permissions = Perms.ADMIN;
            SendMessage(args.Sender, $"Updated {playerName}\'s permissions to admin");
        }
예제 #11
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            targetPlayer.Permissions = Perms.ADMIN;

            SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to ADMIN");
        }
예제 #12
0
        protected override void Execute(CallArgs args)
        {
            string password = args.Get(0) ?? string.Empty;

            serverConfig.ServerPassword = password;

            Log.Info($"Server password changed to \"{password}\" by {args.SenderName}");
            SendMessageToPlayer(args.Sender, "Server password changed");
        }
        protected override void Execute(CallArgs args)
        {
            string password = args.Get(0) ?? string.Empty;

            serverConfig.ServerPassword = password;

            Log.InfoSensitive("Server password changed to {password} by {playername}", password, args.SenderName);
            SendMessageToPlayer(args.Sender, "Server password changed");
        }
예제 #14
0
        protected override void Execute(CallArgs args)
        {
            ServerGameMode sgm = args.Get <ServerGameMode>(0);

            serverConfig.GameModeEnum = sgm;
            playerManager.SendPacketToAllPlayers(new GameModeChanged(sgm));

            SendMessageToAllPlayers($"Server gamemode changed to \"{sgm}\" by {args.SenderName}");
        }
예제 #15
0
        protected override void Execute(CallArgs args)
        {
            string newPassword = args.Get(0);

            serverConfig.AdminPassword = newPassword;

            Log.Info($"Admin password changed to \"{newPassword}\" by {args.SenderName}");
            SendMessageToPlayer(args.Sender, "Admin password changed");
        }
예제 #16
0
        protected override void Execute(CallArgs args)
        {
            string newPassword = args.Get(0);

            serverConfig.AdminPassword = newPassword;

            Log.InfoSensitive("Admin password changed to {password} by {playername}", newPassword, args.SenderName);
            SendMessageToPlayer(args.Sender, "Admin password changed");
        }
예제 #17
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());
            }
        }
예제 #18
0
        protected override void Execute(CallArgs args)
        {
            Validate.IsTrue(args.Sender.HasValue, "This command can't be used by CONSOLE");

            Player otherPlayer = args.Get <Player>(0);

            args.Sender.Value.Teleport(otherPlayer.Position);

            SendMessage(args.Sender, $"Teleported to {otherPlayer.Name}");
        }
예제 #19
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            targetPlayer.Permissions = Perms.PLAYER;

            // Need to notify him so that he no longer shows admin stuff on client (which would in any way stop working)
            // TODO: Send a packet to the player to acknowledge the permision level change
            SendMessage(targetPlayer, "You were demoted to PLAYER");
            SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to PLAYER");
        }
예제 #20
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            targetPlayer.Permissions = Perms.ADMIN;

            // We need to notify this player that he can show all the admin-related stuff
            // TODO: Send a packet to the player to acknowledge the permision level change
            SendMessage(targetPlayer, "You were promoted to ADMIN");
            SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to ADMIN");
        }
예제 #21
0
        protected override void Execute(CallArgs args)
        {
            Player destination;
            Player sender;

            if (args.IsValid(1))
            {
                destination = args.Get <Player>(1);
                sender      = args.Get <Player>(0);
            }
            else
            {
                Validate.IsTrue(args.Sender.HasValue, "This command can't be used by CONSOLE");
                destination = args.Get <Player>(0);
                sender      = args.Sender.Value;
            }

            sender.Teleport(destination.Position, destination.SubRootId);
            SendMessage(sender, $"Teleported to {destination.Name}");
        }
예제 #22
0
        protected override void Execute(CallArgs args)
        {
            string password = args.Get(0) ?? string.Empty;

            ServerConfig serverConfig = NitroxConfig.Deserialize <ServerConfig>();

            serverConfig.ServerPassword = password;
            NitroxConfig.Serialize(serverConfig);

            Log.InfoSensitive("Server password changed to {password} by {playername}", password, args.SenderName);
            SendMessageToPlayer(args.Sender, "Server password changed. In order to take effect pls restart the server.");
        }
예제 #23
0
 protected override void Execute(CallArgs args)
 {
     if (args.Get <string>(0) == serverConfig.AdminPassword)
     {
         args.Sender.Value.Permissions = Perms.ADMIN;
         SendMessage(args.Sender, $"Updated permissions to ADMIN for {args.SenderName}");
     }
     else
     {
         SendMessage(args.Sender, "Incorrect Password");
     }
 }
예제 #24
0
        protected override void Execute(CallArgs args)
        {
            Validate.IsTrue(args.Sender.HasValue, "This command can't be used by CONSOLE");

            if (args.Get(0) == serverConfig.AdminPassword)
            {
                args.Sender.Value.Permissions = Perms.ADMIN;
                SendMessage(args.Sender, $"Updated permissions to admin for {args.SenderName}");
            }
            else
            {
                SendMessage(args.Sender, "Incorrect Password");
            }
        }
예제 #25
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.");
            }
        }
예제 #26
0
        protected override void Execute(CallArgs args)
        {
            Player player = args.Get <Player>(0);

            StringBuilder info = new StringBuilder($"==== {player.Name} ====\n");

            info.AppendLine($"ID: {player.Id}");
            info.AppendLine($"Role: {player.Permissions}");
            info.AppendLine($"Position: {player.Position.X}, {player.Position.Y}, {player.Position.Z}");
            info.AppendLine($"Oxygen: {player.Stats.Oxygen}/{player.Stats.MaxOxygen}");
            info.AppendLine($"Food: {player.Stats.Food}");
            info.AppendLine($"Water: {player.Stats.Water}");
            info.AppendLine($"Infection: {player.Stats.InfectionAmount}");

            SendMessage(args.Sender, info.ToString());
        }
예제 #27
0
        protected override void Execute(CallArgs args)
        {
            bool toggle = args.Get <bool>(0);

            if (toggle)
            {
                serverConfig.DisableAutoSave = false;
                Server.Instance.EnablePeriodicSaving();
                SendMessage(args.Sender, "Enabled periodical saving");
            }
            else
            {
                serverConfig.DisableAutoSave = true;
                Server.Instance.DisablePeriodicSaving();
                SendMessage(args.Sender, "Disabled periodical saving");
            }
        }
예제 #28
0
        protected override void Execute(CallArgs args)
        {
            Player playerToKick = args.Get <Player>(0);

            playerToKick.SendPacket(new PlayerKicked($"You were kicked from the server ! \n Reason : {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");
        }
예제 #29
0
        protected override void Execute(CallArgs args)
        {
            ServerSerializerMode serializerMode = args.Get <ServerSerializerMode>(0);

            serverConfig.Update(c =>
            {
                if (serializerMode != c.SerializerMode)
                {
                    c.SerializerMode = serializerMode;

                    worldPersistence.UpdateSerializer(serializerMode);
                    SendMessage(args.Sender, $"Server save format swapped to {c.SerializerMode}");
                }
                else
                {
                    SendMessage(args.Sender, "Server is already using this save format");
                }
            });
        }
예제 #30
0
        protected override void Execute(CallArgs args)
        {
            string message = "Can't update permissions";

            if (args.Sender.HasValue)
            {
                if (args.Get(0) == serverConfig.AdminPassword)
                {
                    args.Sender.Value.Permissions = Perms.ADMIN;
                    message = $"Updated permissions to admin for {args.SenderName}";
                }
                else
                {
                    message = "Incorrect Password";
                }
            }

            SendMessage(args.Sender, message);
        }