Package com.nickuc.login.api
Interface nLoginAPI
public interface nLoginAPI
nLogin API interface.
Please have a look at the ImplementationType enum to understand the limitations of the API depending on the implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface used for internal nLogin calls. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchangePassword(Identity identity, String newPassword) Changes a player's password.default booleanchangePassword(String playerName, String newPassword) Deprecated.booleancomparePassword(AccountData account, String plainPassword) Checks that the password you provided is valid.default booleancomparePassword(String playerName, String plainPassword) Deprecated.UsecomparePassword(AccountData, String)instead.default booleanforceLogin(Identity identity) Forces a player's login.booleanforceLogin(Identity identity, boolean showMessages) Forces a player's login.default booleanforceLogin(String playerName) Deprecated.UseforceLogin(Identity)instead.default booleanforceLogin(String playerName, boolean showMessages) Deprecated.UseforceLogin(Identity, boolean)instead.getAccount(Identity identity) Returns a player's account.longReturns the count of all accounts stored in the database.Returns all accounts from nLogin.Returns all nLogin accounts by IP.default StringgetAddress(String playerName) Deprecated.UsegetAccount(Identity)instead.static nLoginAPIgetApi()Returns the nLogin api.intReturns the version of the api.Returns the type of database being used.default StringgetDiscord(String playerName) Deprecated.UsegetAccount(Identity)instead.default StringDeprecated.UsegetAccount(Identity)instead.default StringgetHashedPassword(String playerName) Deprecated.UsegetAccount(Identity)instead.Returns the type of implementation used.default StringgetLanguage(String playerName) Deprecated.UsegetAccount(Identity)instead.default InstantgetLastLogin(String playerName) Deprecated.UsegetAccount(Identity)instead.default longgetLastLoginUnix(String playerName) Deprecated.UsegetAccount(Identity)instead.default StringgetRealName(String playerName) Deprecated.UsegetAccount(Identity)instead.default InstantgetRegisterDate(String playerName) Deprecated.UsegetAccount(Identity)instead.default longgetRegisterDateUnix(String playerName) Deprecated.UsegetAccount(Identity)instead.intgetRemainingSeconds(Identity identity) Returns the remaining seconds to authenticate.default intgetRemainingSeconds(String playerName) Deprecated.UsegetRemainingSeconds(Identity)instead.getSpawnLocation(SpawnType type) Returns the location of a spawn.Returns the version of the plugin.default booleanhasDiscord(String playerName) Deprecated.UsegetAccount(Identity)instead.default booleanDeprecated.UsegetAccount(Identity)instead.internal()Returns the nLogin internal api.booleanisAuthenticated(Identity identity) Checks if a player is logged in.booleanisAuthenticated(String knownName) Checks if a player is logged in.booleanIt checks if the api is ready to be used.default booleanDeprecated.UsegetAccount(Identity)instead.default booleanDeprecated.UsegetAccount(Identity)instead.default booleanisRegistered(String playerName) Deprecated.UsegetAccount(Identity)instead.default booleanperformRegister(Identity identity, String plainPassword) Register a player.booleanperformRegister(Identity identity, String plainPassword, String ip) Register a player.default booleanperformRegister(String playerName, String plainPassword) Deprecated.UseperformRegister(Identity, String)instead.default booleanperformRegister(String playerName, String plainPassword, String ip) Deprecated.UseperformRegister(Identity, String, String)instead.booleanperformUnregister(Identity identity) Unregister a player.default booleanperformUnregister(String playerName) Deprecated.UseperformUnregister(Identity)instead.voidrequestLogin(Identity identity, Object plugin) Sends a login request.default voidrequestLogin(String playerName, Object plugin) Deprecated.UserequestLogin(Identity, Object)instead.booleansetDiscord(Identity identity, long newAccountId) Set a discord account for a certain player.default booleansetDiscord(String playerName, long newAccountId) Deprecated.UsesetDiscord(Identity, long)instead.booleanSet an email account for a certain player.default booleanDeprecated.UsesetEmail(Identity, String)instead.booleansetLanguage(Identity identity, String languageCode) Sets the language for a player.
-
Method Details
-
getApi
Returns the nLogin api.- Throws:
nLoginNotLoadedException- if the api has not yet been instantiated
-
isAvailable
boolean isAvailable()It checks if the api is ready to be used.- Since:
- API v1
-
getVersion
Returns the version of the plugin.- Since:
- API v1
-
getApiVersion
int getApiVersion()Returns the version of the api.- Since:
- API v1
-
getImplementationType
Returns the type of implementation used.- Since:
- API v1
-
getDatabaseType
Returns the type of database being used.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
getSpawnLocation
Returns the location of a spawn.- Parameters:
type- Spawn type.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v3
-
getAccount
Returns a player's account. READ ONLY.- Parameters:
identity- Player identity.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v3
-
getAccounts
Returns all accounts from nLogin.This method IS NOT AVAILABLE for
PROXYimplementations.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnsupportedException- if the implementation type does not support this method.- Since:
- API v1
- See Also:
-
getAccountCount
Returns the count of all accounts stored in the database.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v11
-
getAccountsByIp
Returns all nLogin accounts by IP.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
isAuthenticated
Checks if a player is logged in.- Parameters:
identity- Player identity.- Returns:
- true if the player is authenticated.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.- Since:
- API v1
-
isAuthenticated
Checks if a player is logged in.- Parameters:
knownName- Player name in server.- Returns:
- true if the player is authenticated.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.- Since:
- API v1
-
getRemainingSeconds
Returns the remaining seconds to authenticate.- Parameters:
identity- Player identity.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v3
-
getRemainingSeconds
Deprecated.UsegetRemainingSeconds(Identity)instead. -
getRealName
Deprecated.UsegetAccount(Identity)instead. -
getHashedPassword
Deprecated.UsegetAccount(Identity)instead. -
getAddress
Deprecated.UsegetAccount(Identity)instead. -
getLastLogin
Deprecated.UsegetAccount(Identity)instead. -
getLastLoginUnix
Deprecated.UsegetAccount(Identity)instead. -
getRegisterDate
Deprecated.UsegetAccount(Identity)instead. -
getRegisterDateUnix
Deprecated.UsegetAccount(Identity)instead. -
getEmail
Deprecated.UsegetAccount(Identity)instead. -
getDiscord
Deprecated.UsegetAccount(Identity)instead. -
hasEmail
Deprecated.UsegetAccount(Identity)instead. -
hasDiscord
Deprecated.UsegetAccount(Identity)instead. -
getLanguage
Deprecated.UsegetAccount(Identity)instead. -
comparePassword
Checks that the password you provided is valid.- Parameters:
account- Account data.plainPassword- Plain password to be compared (not hashed).- Returns:
- true if the password is valid.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v3
-
comparePassword
Deprecated.UsecomparePassword(AccountData, String)instead. -
isRegistered
Deprecated.UsegetAccount(Identity)instead. -
isPremium
Deprecated.UsegetAccount(Identity)instead. -
isBedrock
Deprecated.UsegetAccount(Identity)instead. -
requestLogin
Sends a login request. Note: It is not sent if a login request is already in progress.This method IS NOT AVAILABLE for
PROXYimplementations.- Parameters:
identity- Player identity.plugin- Plugin instance.- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnsupportedException- if the implementation type does not support this method.- Since:
- API v1
- See Also:
-
requestLogin
Deprecated.UserequestLogin(Identity, Object)instead. -
performRegister
@ProxyUnsafe default boolean performRegister(@Nonnull Identity identity, @Nonnull String plainPassword) Register a player.- Parameters:
identity- Player identity.plainPassword- Plain password to be used (not hashed).- Returns:
- true if the registration was successful. If the user is already registered or during a database failure, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
performRegister
@ProxyUnsafe boolean performRegister(@Nonnull Identity identity, @Nonnull String plainPassword, @Nullable String ip) Register a player.- Parameters:
identity- Player identity.plainPassword- Plain password to be used (not hashed).ip- IP address. Can be null.- Returns:
- true if the registration was successful. If the user is already registered or during a database failure, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
performRegister
@ProxyUnsafe default boolean performRegister(@Nonnull String playerName, @Nonnull String plainPassword) Deprecated.UseperformRegister(Identity, String)instead. -
performRegister
@ProxyUnsafe default boolean performRegister(@Nonnull String playerName, @Nonnull String plainPassword, @Nullable String ip) Deprecated.UseperformRegister(Identity, String, String)instead. -
performUnregister
Unregister a player.- Parameters:
identity- Player identity.- Returns:
- true if the operation was successful. If the user is not registered or during a database failure, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
performUnregister
Deprecated.UseperformUnregister(Identity)instead. -
changePassword
Changes a player's password.- Parameters:
identity- Player identity.newPassword- New password (not hashed).- Returns:
- true if the operation was successful. If the user is not registered or during a database failure, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
changePassword
@ProxyUnsafe default boolean changePassword(@Nonnull String playerName, @Nonnull String newPassword) Deprecated.UsechangePassword(Identity, String)instead. -
setEmail
Set an email account for a certain player.- Parameters:
identity- Player identity.newEmail- Full email.- Returns:
- true if the operation was successful. If the user is not registered, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v2
-
setEmail
Deprecated.UsesetEmail(Identity, String)instead. -
setDiscord
Set a discord account for a certain player.- Parameters:
identity- Player identity.newAccountId- Account id.- Returns:
- true if the operation was successful. If the user is not registered, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v2
-
setDiscord
Deprecated.UsesetDiscord(Identity, long)instead. -
setLanguage
Sets the language for a player.- Parameters:
identity- Player identity.languageCode- The language code (2 letters).- Returns:
- true if the operation was successful. If the user is not registered, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v9
-
forceLogin
Forces a player's login.- Parameters:
identity- Player identity.- Returns:
- true if the operation was successful. If the user is not registered, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
forceLogin
Forces a player's login.- Parameters:
identity- Player identity.showMessages- Sends login messages if the supplied value is true.- Returns:
- true if the operation was successful. If the user is not registered, returns false.
- Throws:
nLoginNotReadyException- if the plugin is not yet fully loaded.nLoginRequestUnavailableException- if the implementation type does not support this method at invocation time. @seeImplementationType- Since:
- API v1
-
forceLogin
Deprecated.UseforceLogin(Identity)instead. -
forceLogin
Deprecated.UseforceLogin(Identity, boolean)instead. -
internal
Returns the nLogin internal api.
-
changePassword(Identity, String)instead.