public interface nLoginAPI
Please have a look at the ImplementationType
enum to understand the limitations of the API depending on the implementation.
Modifier and Type | Interface and Description |
---|---|
static interface |
nLoginAPI.nLoginInternal
Interface used for internal nLogin calls.
|
Modifier and Type | Method and Description |
---|---|
boolean |
changePassword(Identity identity,
java.lang.String newPassword)
Changes a player's password.
|
default boolean |
changePassword(java.lang.String playerName,
java.lang.String newPassword)
Deprecated.
Use
changePassword(Identity, String) instead. |
boolean |
comparePassword(AccountData account,
java.lang.String plainPassword)
Checks that the password you provided is valid.
|
default boolean |
comparePassword(java.lang.String playerName,
java.lang.String plainPassword)
Deprecated.
Use
comparePassword(AccountData, String) instead. |
default boolean |
forceLogin(Identity identity)
Forces a player's login.
|
boolean |
forceLogin(Identity identity,
boolean showMessages)
Forces a player's login.
|
default boolean |
forceLogin(java.lang.String playerName)
Deprecated.
Use
forceLogin(Identity) instead. |
default boolean |
forceLogin(java.lang.String playerName,
boolean showMessages)
Deprecated.
Use
forceLogin(Identity, boolean) instead. |
java.util.Optional<AccountData> |
getAccount(Identity identity)
Returns a player's account.
|
java.util.Iterator<AccountData> |
getAccounts()
Returns all accounts from nLogin.
|
java.util.List<AccountData> |
getAccountsByIp(java.lang.String ip)
Returns all nLogin accounts by IP.
|
default java.lang.String |
getAddress(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
static nLoginAPI |
getApi()
Returns the nLogin api.
|
int |
getApiVersion()
Returns the version of the api.
|
DatabaseType |
getDatabaseType()
Returns the type of database being used.
|
default java.lang.String |
getDiscord(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default java.lang.String |
getEmail(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default java.lang.String |
getHashedPassword(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
ImplementationType |
getImplementationType()
Returns the type of implementation used.
|
default java.lang.String |
getLanguage(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default java.time.Instant |
getLastLogin(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default long |
getLastLoginUnix(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default java.lang.String |
getRealName(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default java.time.Instant |
getRegisterDate(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default long |
getRegisterDateUnix(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
int |
getRemainingSeconds(Identity identity)
Returns the remaining seconds to authenticate.
|
default int |
getRemainingSeconds(java.lang.String playerName)
Deprecated.
Use
getRemainingSeconds(Identity) instead. |
java.util.Optional<Location> |
getSpawnLocation(SpawnType type)
Returns the location of a spawn.
|
java.lang.String |
getVersion()
Returns the version of the plugin.
|
default boolean |
hasDiscord(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default boolean |
hasEmail(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
nLoginAPI.nLoginInternal |
internal()
Returns the nLogin internal api.
|
boolean |
isAuthenticated(Identity identity)
Checks if a player is logged in.
|
boolean |
isAuthenticated(java.lang.String knownName)
Checks if a player is logged in.
|
boolean |
isAvailable()
It checks if the api is ready to be used.
|
default boolean |
isBedrock(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default boolean |
isPremium(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default boolean |
isRegistered(java.lang.String playerName)
Deprecated.
Use
getAccount(Identity) instead. |
default boolean |
performRegister(Identity identity,
java.lang.String plainPassword)
Register a player.
|
boolean |
performRegister(Identity identity,
java.lang.String plainPassword,
java.lang.String ip)
Register a player.
|
default boolean |
performRegister(java.lang.String playerName,
java.lang.String plainPassword)
Deprecated.
Use
performRegister(Identity, String) instead. |
default boolean |
performRegister(java.lang.String playerName,
java.lang.String plainPassword,
java.lang.String ip)
Deprecated.
Use
performRegister(Identity, String, String) instead. |
boolean |
performUnregister(Identity identity)
Unregister a player.
|
default boolean |
performUnregister(java.lang.String playerName)
Deprecated.
Use
performUnregister(Identity) instead. |
void |
requestLogin(Identity identity,
java.lang.Object plugin)
Sends a login request.
|
default void |
requestLogin(java.lang.String playerName,
java.lang.Object plugin)
Deprecated.
Use
requestLogin(Identity, Object) instead. |
boolean |
setDiscord(Identity identity,
long newAccountId)
Set a discord account for a certain player.
|
default boolean |
setDiscord(java.lang.String playerName,
long newAccountId)
Deprecated.
Use
setDiscord(Identity, long) instead. |
boolean |
setEmail(Identity identity,
java.lang.String newEmail)
Set an email account for a certain player.
|
default boolean |
setEmail(java.lang.String playerName,
java.lang.String newEmail)
Deprecated.
Use
setEmail(Identity, String) instead. |
@Nonnull static nLoginAPI getApi()
nLoginNotLoadedException
- if the api has not yet been instantiatedboolean isAvailable()
@Nonnull java.lang.String getVersion()
int getApiVersion()
@Nonnull ImplementationType getImplementationType()
@ProxyUnsafe DatabaseType getDatabaseType()
nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe java.util.Optional<Location> getSpawnLocation(@Nonnull SpawnType type)
type
- Spawn type.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe java.util.Optional<AccountData> getAccount(@Nonnull Identity identity)
identity
- Player identity.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsupported @Nonnull java.util.Iterator<AccountData> getAccounts()
This method IS NOT AVAILABLE for PROXY
implementations.
nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnsupportedException
- if the implementation type does not support this method.ImplementationType
@ProxyUnsafe @Nonnull java.util.List<AccountData> getAccountsByIp(@Nonnull java.lang.String ip)
nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
boolean isAuthenticated(@Nonnull Identity identity)
identity
- Player identity.nLoginNotReadyException
- if the plugin is not yet fully loaded.boolean isAuthenticated(@Nonnull java.lang.String knownName)
knownName
- Player name in server.nLoginNotReadyException
- if the plugin is not yet fully loaded.@ProxyUnsafe int getRemainingSeconds(@Nonnull Identity identity)
identity
- Player identity.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default int getRemainingSeconds(@Nonnull java.lang.String playerName)
getRemainingSeconds(Identity)
instead.@ProxyUnsafe @Nullable default java.lang.String getRealName(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nullable default java.lang.String getHashedPassword(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nullable default java.lang.String getAddress(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nonnull default java.time.Instant getLastLogin(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe default long getLastLoginUnix(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nonnull default java.time.Instant getRegisterDate(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe default long getRegisterDateUnix(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nullable default java.lang.String getEmail(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nullable default java.lang.String getDiscord(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe default boolean hasEmail(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe default boolean hasDiscord(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe @Nonnull default java.lang.String getLanguage(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.boolean comparePassword(AccountData account, java.lang.String plainPassword)
account
- Account data.plainPassword
- Plain password to be compared (not hashed).nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean comparePassword(java.lang.String playerName, java.lang.String plainPassword)
comparePassword(AccountData, String)
instead.@ProxyUnsafe default boolean isRegistered(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe default boolean isPremium(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsafe default boolean isBedrock(@Nonnull java.lang.String playerName)
getAccount(Identity)
instead.@ProxyUnsupported void requestLogin(@Nonnull Identity identity, @Nonnull java.lang.Object plugin)
This method IS NOT AVAILABLE for PROXY
implementations.
identity
- Player identity.plugin
- Plugin instance.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnsupportedException
- if the implementation type does not support this method.ImplementationType
@ProxyUnsupported default void requestLogin(@Nonnull java.lang.String playerName, @Nonnull java.lang.Object plugin)
requestLogin(Identity, Object)
instead.@ProxyUnsafe default boolean performRegister(@Nonnull Identity identity, @Nonnull java.lang.String plainPassword)
identity
- Player identity.plainPassword
- Plain password to be used (not hashed).nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe boolean performRegister(@Nonnull Identity identity, @Nonnull java.lang.String plainPassword, @Nullable java.lang.String ip)
identity
- Player identity.plainPassword
- Plain password to be used (not hashed).ip
- IP address. Can be null.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean performRegister(@Nonnull java.lang.String playerName, @Nonnull java.lang.String plainPassword)
performRegister(Identity, String)
instead.@ProxyUnsafe default boolean performRegister(@Nonnull java.lang.String playerName, @Nonnull java.lang.String plainPassword, @Nullable java.lang.String ip)
performRegister(Identity, String, String)
instead.@ProxyUnsafe boolean performUnregister(@Nonnull Identity identity)
identity
- Player identity.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean performUnregister(@Nonnull java.lang.String playerName)
performUnregister(Identity)
instead.@ProxyUnsafe boolean changePassword(@Nonnull Identity identity, @Nonnull java.lang.String newPassword)
identity
- Player identity.newPassword
- New password (not hashed).nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean changePassword(@Nonnull java.lang.String playerName, @Nonnull java.lang.String newPassword)
changePassword(Identity, String)
instead.@ProxyUnsafe boolean setEmail(@Nonnull Identity identity, @Nullable java.lang.String newEmail)
identity
- Player identity.newEmail
- Full email.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean setEmail(@Nonnull java.lang.String playerName, @Nullable java.lang.String newEmail)
setEmail(Identity, String)
instead.@ProxyUnsafe boolean setDiscord(@Nonnull Identity identity, long newAccountId)
identity
- Player identity.newAccountId
- Account id.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean setDiscord(@Nonnull java.lang.String playerName, long newAccountId)
setDiscord(Identity, long)
instead.@ProxyUnsafe default boolean forceLogin(@Nonnull Identity identity)
identity
- Player identity.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe boolean forceLogin(@Nonnull Identity identity, boolean showMessages)
identity
- Player identity.showMessages
- Sends login messages if the supplied value is true.nLoginNotReadyException
- if the plugin is not yet fully loaded.nLoginRequestUnavailableException
- if the implementation type does not support this method at invocation time. @see ImplementationType
@ProxyUnsafe default boolean forceLogin(@Nonnull java.lang.String playerName)
forceLogin(Identity)
instead.@ProxyUnsafe default boolean forceLogin(@Nonnull java.lang.String playerName, boolean showMessages)
forceLogin(Identity, boolean)
instead.@Nonnull nLoginAPI.nLoginInternal internal()