Ejemplo n.º 1
0
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator)
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_PERM);
                return;
            }

            var targetPlayerName = cmd.Arguments?.Trim();

            if (string.IsNullOrEmpty(targetPlayerName))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_NO_USER);
                return;
            }

            var targetPlayer = playerProvider.Get(targetPlayerName);
            await game.KickAsync(targetPlayer);
        }
Ejemplo n.º 2
0
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Send(cmd.Sender.Username,
                                 //broadcaster.Broadcast(
                                 Localization.GAME_NOT_STARTED);
                return;
            }

            if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator)
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 "You do not have permission to kick a player from the game.");
                return;
            }

            var targetPlayerName = cmd.Arguments?.Trim();

            if (string.IsNullOrEmpty(targetPlayerName))
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 "You are kicking who? Provide a username");
                return;
            }

            var targetPlayer = playerProvider.Get(targetPlayerName);
            await game.KickAsync(targetPlayer);
        }