DoubleCheck Library: Confirmation Requests made simple

Action Confirmation Library for Sponge Plugins

There are many commands and actions that should be confirmed before the execution, for example a world deletion command, a money transfer, a ban command, or when a player is about to enter a PvP world.

Every plugin has it’s own command for this. The results are long command names and name conflicts. It is also a lot of work to write the code for the confirmation command.

DoubleCheck solves the problem: The DoubleCheck confirmation service listens for the command, but does not block it permanently for other plugins or other instances of DoubleCheck.

This is a typical request that was sent using DoubleCheck:

Are you sure that you want to send 2.000.000.000$ to Notch?
You have 15 seconds to /confirm or /deny the action.

It is possible to customize the messages and confirmation commands.


Learning Resources


Maven

The DoubleCheck artifacts can be found in my Maven repository:

Repo URL: http://homepage.rub.de/Felix.Schmidt-c2n/maven/
GroupId: com.github.boformer
ArtifactId: doublecheck
Latest version: 1.0.1 (for SpongeAPI 2.0)


Links

2 Likes

I thought you had already make a thread about this?

1 Like

Looks useful, might help for a couple projects I should have planned. :wink:

1 Like

@DotDash Now this is purely a library and not a standalone plugin.

Also, I can not edit the old post :frowning:

2 Likes

Could you add the possibility of clicking on chat in order to confirm?

You can do that by customizing the message.

This looks very interesting!

I highly suggest adding the ability to “click” accept or deny. It is much more user-friendly than using the commands.


Request | Do you wish to send $200,000 to Notch?
        |         Accept         Deny

If you implement something like that, consider giving each request a unique id, and change the command to /confirm [uuid].

That way, you can set the click event to send the command with the UUID of the request. This allows someone to receive multiple requests.

It should be mentioned that the time before the request is automatically denied is default to about 1 minute, but still keep this configurable, maybe only by the use of method instead of the constructor? maybe something like Service#setExpiry(int seconds)?

Side note: If you implement the prefix Request like I have, maybe allow people to specify a prefix along with each request? similar to how they can provide a message.

Maybe just scrap the idea of a constructor, and use the builder pattern to build a request.

8 Likes

Nice idea. Wanna help?

Sure, but not right now. I have a lot of work to do. I’ll make some PRs when I’m not so busy :smiley:

1 Like