예제 #1
0
        /// <inheritdoc />
        public override char GetNextChar()
        {
            char ch = Buffer.FirstOrDefault();

            if (Buffer.Any())
            {
                Buffer = new ArraySegment <char>(Buffer.Array, Buffer.Offset + 1, Buffer.Count - 1);
            }
            return(ch);
        }
예제 #2
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string respone)
        {
            if (sender.GetPlayer() == Server.Host)
            {
                respone = "Nope the Console cant use this!";
                return(false);
            }

            if (arguments.Count < 1)
            {
                respone = "Use .key sync in order to sync your binds and use all Features of the Plugins!";
                return(false);
            }

            switch (arguments.FirstOrDefault().ToUpper())
            {
            case "SYNC":
                var component = sender.GetPlayer().ClassManager;
                foreach (var key in (KeyCode[])Enum.GetValues(typeof(KeyCode)))
                {
                    component.TargetChangeCmdBinding(component.connectionToClient, key, $".key send {(int)key}");
                }

                respone = "All Keys was synced!";
                return(true);

            case "SEND":
                if (!Enum.TryParse <KeyCode>(arguments.ElementAt(1), out var key2))
                {
                    respone = "Invalid KeyBind! If they are binded by Synapse please report this!";
                    return(false);
                }

                try
                {
                    Events.Events.InvokeKeyPressEvent(sender.GetPlayer(), key2);
                }
                catch (Exception e)
                {
                    Log.Error($"KeyPressEvent Error: {e} ");
                }
                respone = "Key was accepted";
                return(true);

            default:
                respone = "Use .key sync in order to sync your binds and use all Features of the Plugins!";
                return(false);
            }
        }
예제 #3
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string respone)
        {
            if (arguments.Count < 1)
            {
                respone = "You also have to enter a plugin name: plugin ExamplePlugin";
                return(false);
            }

            foreach (var plugin in Synapse.Plugins)
            {
                if (plugin.Name.ToLower().Contains(arguments.FirstOrDefault().ToLower()))
                {
                    respone = $"The Plugin {plugin.Name} Version {plugin.Version} was created by {plugin.Author} and was made for Synapse v.{plugin.SynapseMajor}.{plugin.SynapseMinor}.{plugin.SynapsePatch}" +
                              $"\nPlugin Description: {plugin.Description}";
                    return(true);
                }
            }

            respone = "No Plugin with such a name was found!";
            return(false);
        }