Giter Site home page Giter Site logo

crabgameserverutils's Introduction

CrabGameServerUtils

Examples

Command Example

public class Say
{
    [Command("say", permission: Permission.Admin)]
    public static void SayCommand(CommandContext ctx)
    {
        if (ctx.Parameters.Length == 0)
        {
            ctx.Send("Correct usage: /say <message>");
            return;
        }
        Server.Broadcast(System.String.Join(" ", ctx.Parameters));
    }
}

public class Msg
{
    [Command("msg")]
    public static void MessageCommand(CommandContext ctx)
    {
        if (ctx.Parameters.Length < 2)
        {
            ctx.Send("Correct usage: /msg <player> <message>");
            return;
        }

        try
        {
            Player player = new Player(ctx.Parameters[0]);
            
            Server.SendMessageBy(
                player.ID,
                ctx.Author.ID,
                $"[You -> {player.PlayerManager.username}]",
                String.Join(" ", ctx.Parameters[1..])
            );
            
            Server.SendMessageBy(
                ctx.Author.ID,
                player.ID,
                $"[{ctx.Author.PlayerManager.username} -> You]",
                String.Join(" ", ctx.Parameters[1..])
                );
        }
        catch (PlayerNotFoundError e)
        {
            ctx.Send(e.Message);
        }
    }
}

crabgameserverutils's People

Contributors

akex06 avatar

Stargazers

Runi4 avatar

Watchers

 avatar

crabgameserverutils's Issues

Help Command Doesnt Work

when i say /help it doesnt show the commands it gives me a help message instead could you fix this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.