Skip to content

Developer Documentation

Taylor Becker edited this page Jun 4, 2020 · 13 revisions

This document outlines various developer resources concerning NuVotifier.

For developers of vote listeners

Special note for Bukkit developers

NuVotifier is API-compatible with Votifier 1.9. NuVotifier includes additional APIs on top of those already supplied with Votifier. When you depend on NuVotifier, you will depend on Votifier. This preserves backwards compatibility with existing listeners.

If you are not writing a Bukkit listener, you'll depend on NuVotifier normally. For BungeeCord, you'll depend on NuVotifier, and for Sponge and Velocity you'll depend on nuvotifier.

Developing a vote listener

As NuVotifier implements the same API and logic as the original Votifier, you should consult https://github.com/vexsoftware/votifier/wiki/Vote-Listeners-and-VotifierEvent for further details on how to develop a vote listener. The only difference is that NuVotifier also supports other platforms such as BungeeCord, Sponge, and Velocity.

Adding NuVotifier as a dependency to your build system

ParallelBlock now maintains an independent Maven repository for free use by the community. Builds are automatically published by a CI operated by ParallelBlock.

Maven

You can have your project depend on NuVotifier as a dependency through the following code snippets:

<project>
...
    <repositories>
        <repository>
            <id>bintray-repo</id>
            <url>https://dl.bintray.com/ichbinjoe/public/</url>
        </repository>
        ...
    </repositories>
...
    <dependencies>
        <dependency>
            <groupId>com.vexsoftware</groupId>
            <artifactId>nuvotifier-universal</artifactId>
            <version>2.6.0</version>
            <scope>provided</scope>
        </dependency>
        ...
    </dependencies>
...
</project>

Gradle

You can include NuVotifier into your gradle project using the following lines:

...
repositories {
    maven {
        url 'https://dl.bintray.com/ichbinjoe/public/'
    }
    ...
}
...
dependencies {
    compileOnly "com.vexsoftware:nuvotifier-universal:version"
    ...
}
...

Vote Listeners and VotifierEvent

Read more about this here: https://github.com/vexsoftware/votifier/wiki/Vote-Listeners-and-VotifierEvent

Contributing

NuVotifier is an open source GNU GPLv3 licensed project. We accept contributions through pull requests, and will make sure to credit you for your gracious contribution.

Building NuVotifier

NuVotifier can be built by running the following: ./gradlew build or ./gradlew.bat build on Windows. The resultant universal jar is built and written to universal/build/libs/nuvotifier-{version}.jar.

The build directories can be cleaned instead using the ./gradlew clean (and ./gradlew.bat build) command.

Implementing NuVotifier v2 protocol in a server list

NuVotifier provides production ready reference implementations for interacting with NuVotifier servers. These libraries are available below:

V2 Protocol Documentation

The Votifier V2 protocol includes a number of security and utility improvements over V1. The protocol is:

  1. Open a connection to Votifier

  2. Votifier sends its greeting line

    VOTIFIER <version> <challenge>
    

    Note the addition of a challenge in the greeting. You will need this in creating the vote payload.

  3. Serverlist sends the vote The Vote sent to the server is constructed as:

    type value
    short MAGIC
    short Length of message
    byte[] message

    ...where the magic value is 0x733A.

    The message is a JSON payload:

    {
        "signature": "<Base64 encoded HmacSHA256 signature of the payload>",
        "payload": "<Vote JSON>"
    }

    The Vote JSON is:

    {
        "serviceName": "<serverlist name>",
        "username": "<player name>",
        "address": "<player's IP address>",
        "timestamp": "timestamp of the vote (in millis)",
        "challenge": "<challenge string from the greeting>"
    }
  4. Votifier responds with status information in the form of a JSON Object:

    {
        "status": "<status text>",
        "cause": "<cause>",
        "error": "<error>"
    }

    If successful, the status should be ok

Clone this wiki locally