Array

Plugin Reload & API Docs

Avatar

By Stealth_^ 1 Apr 2016 07:10

Member · 55 comments

Adding in a reload function/command would be pretty beneficial, that way I don't need to restart the bot to test my plugin. Anyways, just an idea.

Edit: Grammar/Structure

==[Second Part]==

To coincide with the other part of the title, are there API docs anywhere? Theres a SprummlEventType but no documentation on the different types available. This is just an example and something I'm curious of.

Thanks!,
stealth_^

Last edited by Stealth_^ (20 Apr 2016 03:35)

Avatar

By Scrumplex 2 Apr 2016 16:44

Admin · 2,147,483,647 comments

First Part:
A reload command existed in version 0.3.7 and got removed in version 0.3.8, because it was very buggy. I need to implement a proper plugin unloading function. After that it would be implemented.

Second Part:
API Docs will be written. But I need a proper site for that, because a forum is not good for those things. I will leave this post opened until any API Docs are available.


The Developer of the Sprummlbot and the Admin of this forum.

Avatar

By Stealth_^ 2 Apr 2016 18:36

Member · 55 comments

Alright, Thank you!

Avatar

By Stealth_^ 5 Apr 2016 06:14

Member · 55 comments

If I want to do "notifycliententerview" (as that's an event within TheHolyWaffle) what would the SprummlEventType be?

Avatar

By Scrumplex 5 Apr 2016 18:20

Admin · 2,147,483,647 comments

SprummlEventType.CLIENT_JOIN ?


The Developer of the Sprummlbot and the Admin of this forum.

Avatar

By Scrumplex 5 Apr 2016 18:22

Admin · 2,147,483,647 comments

For explanation: The SprummlEventType enum defines which event was fired. So if you want to send everyone joining a message, you will have to check if arg1 of the onEvent method is SprummlEventType.CLIENT_JOIN. And if that is true it is a notifycliententerview event.


The Developer of the Sprummlbot and the Admin of this forum.

Avatar

By Stealth_^ 20 Apr 2016 03:34

Member · 55 comments

Alright just to save you and I me posting a million times, I'm just going to post it all here lol.

So I'm making a plugin that sets permissions based on the information returned in a JSON string by the established API we have already setup. I have the JSON decoder and what I need to decode but basically this is what I need from the bot itself.

Needed Calls:

  • OnClientJoin receive client DBID
  • After receiving the correct groups from the JSON string, assign that group to the client
  • OnClientJoin message client with commands they are able to use
  • Removing Groups from Client
  • Logging, is there a native logger for the SprummlBot? Something that will show up in the logs the bot outputs? Or do I need to use my own logger.

I think this is all I need at the moment, however, I will post again if I need to.

Avatar

By Scrumplex 23 Apr 2016 10:02

Admin · 2,147,483,647 comments

  • to receive the dbid of a client use clientJoinEvent.getClientDatabaseId()
  • to assign a group: getAPI().addClientToServerGroup(groupId, dbId)

proper use of the sprummlbot command system:

public void registerCommands() {
        ChatCommand command = getCommandManager().registerCommand("commandwithoutexclamationmark", "the usage of the command");
        getCommandManager().setCommandPermissionGroup(command, getPermissionGroups().get("custompermissiongrouphere"));
        command.setCommandHandler(this, new CommandHandler() {
            @Override
            public CommandResponse handleCommand(ClientInfo c, String[] args) {
                if (args.length == 1) {
                        getAPI().sendPrivateMessage(c.getId(), "you entered: " + args[0]);
                        return CommandResponse.SUCCESS;
                }
                // if you return CommandResponse.ERROR then you can send a custom error: getAPI().sendPrivateMessage(c.getId(), "custom error message");
                return CommandResponse.SYNTAX_ERROR; //sends the usage defined above
            }
        });
}

  • to remove a client: getAPI().removeClientFromServerGroup(groupId, dbId)
  • I do not have a logger but a custom outputstream. So if you do a system.out it will be formatted like all other console outputs.


The Developer of the Sprummlbot and the Admin of this forum.

Avatar

By Stealth_^ 25 Apr 2016 15:17

Member · 55 comments

I'm getting an Unknown Class when I use SprummlEventType.CLIENT_JOIN do you have a correct use of that as well? I can't seem to figure it out. I've been trying for days lol.

Avatar

By Scrumplex 25 Apr 2016 20:41

Admin · 2,147,483,647 comments

If you wait one more day, you can upgrade your plugins to 0.4.7. I deprecated the onEvent method and added a new EventManager where you can add a Listener for any event. Also it will contain many plugin loader bug fixes.
btw. If you are creating threads, timers etc., then please use the SprummlTasker. You can get the instance for your plugin using this.getTasker().

Kind regards
Sefa.


The Developer of the Sprummlbot and the Admin of this forum.

Array