English
nLogin
Search…
⌃K
Links
🖥

API Migration

The new nLogin v10 has a number of changes to components of its API. If you are a developer and want to add support for the new version, please follow the steps below.

Update the version of "nlogin-api" in your project

Make sure you use nlogin-api v10.0, like the example below:

Maven:

<repositories>
<repository>
<id>nickuc-repo</id>
<url>https://repo.nickuc.com/maven-releases/</url>
</repository>
</repositories>
​
<dependencies>
<dependency>
<groupId>com.nickuc.login</groupId>
<artifactId>nlogin-api</artifactId>
<version>10.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

Gradle:

repositories {
maven {
url = uri('https://repo.nickuc.com/maven-releases/')
}
}
​
dependencies {
compileOnly('com.nickuc.login:nlogin-api:10.0')
}

Check if the server is using the legacy version

Before using the nLogin api, check if the server is using the old version. See an example of how to do this below
public class MyPlugin extends JavaPlugin {
​
@Override
public void onEnable() {
try {
Class.forName("com.nickuc.login.api.nLoginAPIHolder"); // introduced in nLogin v10
// register your nLogin events
getServer().getPluginManager().registerEvents(new MyAuthListener(), this);
} catch (ClassNotFoundException e) {
getLogger().severe("You are using the old version of nLogin.");
getLogger().severe("Please upgrade to version 10.");
}
}
}
We recommend that you do NOT add support for older versions. If you want to support it anyway, we recommend that you replace the function with a generic event. For example, if you were using the AuthenticateEvent from version 9, change it to the PlayerJoinEvent from Bukkit for older versions.
Beware! All authentication events are now asynchronous.
You will not be able to access methods restricted to the Server thread, unless you run a synchronous task.

New API documentation

The API documentation is available via the website: https://jd.nickuc.com/nlogin/​
Beware! The new API has event classes with the same name, but from different software. For example, if you are using Bukkit, always import the events from the package "com.nickuc.login.api.event.bukkit".