Stuff from the common floobits workspace
Author: AuthMe-Team <AuthMeTeam@123NoEmail.com>
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
package fr.xephi.authme.api;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -24,6 +23,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Constructor for API.
|
||||
*
|
||||
* @param instance AuthMe
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -34,8 +34,8 @@ public class API {
|
||||
/**
|
||||
* Hook into AuthMe
|
||||
*
|
||||
|
||||
* @return AuthMe instance */
|
||||
* @return AuthMe instance
|
||||
*/
|
||||
@Deprecated
|
||||
public static AuthMe hookAuthMe() {
|
||||
if (instance != null)
|
||||
@@ -49,49 +49,18 @@ public class API {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getPlugin.
|
||||
|
||||
* @return AuthMe */
|
||||
@Deprecated
|
||||
public AuthMe getPlugin() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if player is authenticate */
|
||||
* @return true if player is authenticate
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isAuthenticated(Player player) {
|
||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if player is a npc */
|
||||
@Deprecated
|
||||
public boolean isaNPC(Player player) {
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if player is a npc */
|
||||
@Deprecated
|
||||
public boolean isNPC(Player player) {
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if the player is unrestricted */
|
||||
* @return true if the player is unrestricted
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isUnrestricted(Player player) {
|
||||
return Utils.isUnrestricted(player);
|
||||
@@ -99,9 +68,10 @@ public class API {
|
||||
|
||||
/**
|
||||
* Method getLastLocation.
|
||||
*
|
||||
* @param player Player
|
||||
|
||||
* @return Location */
|
||||
* @return Location
|
||||
*/
|
||||
@Deprecated
|
||||
public static Location getLastLocation(Player player) {
|
||||
try {
|
||||
@@ -121,13 +91,14 @@ public class API {
|
||||
|
||||
/**
|
||||
* Method setPlayerInventory.
|
||||
* @param player Player
|
||||
*
|
||||
* @param player Player
|
||||
* @param content ItemStack[]
|
||||
* @param armor ItemStack[]
|
||||
* @param armor ItemStack[]
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setPlayerInventory(Player player, ItemStack[] content,
|
||||
ItemStack[] armor) {
|
||||
ItemStack[] armor) {
|
||||
try {
|
||||
player.getInventory().setContents(content);
|
||||
player.getInventory().setArmorContents(armor);
|
||||
@@ -136,10 +107,9 @@ public class API {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param playerName
|
||||
|
||||
* @return true if player is registered */
|
||||
* @return true if player is registered
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isRegistered(String playerName) {
|
||||
String player = playerName.toLowerCase();
|
||||
@@ -147,14 +117,13 @@ public class API {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @param playerName String
|
||||
* @param playerName String
|
||||
* @param passwordToCheck String
|
||||
* @return true if the password is correct , false else */
|
||||
* @return true if the password is correct , false else
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean checkPassword(String playerName,
|
||||
String passwordToCheck) {
|
||||
String passwordToCheck) {
|
||||
if (!isRegistered(playerName))
|
||||
return false;
|
||||
String player = playerName.toLowerCase();
|
||||
@@ -169,11 +138,10 @@ public class API {
|
||||
/**
|
||||
* Register a player
|
||||
*
|
||||
|
||||
|
||||
* @param playerName String
|
||||
* @param password String
|
||||
* @return true if the player is register correctly */
|
||||
* @param password String
|
||||
* @return true if the player is register correctly
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean registerPlayer(String playerName, String password) {
|
||||
try {
|
||||
@@ -195,7 +163,6 @@ public class API {
|
||||
/**
|
||||
* Force a player to login
|
||||
*
|
||||
|
||||
* @param player * player
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -203,4 +170,32 @@ public class API {
|
||||
instance.management.performLogin(player, "dontneed", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getPlugin.
|
||||
*
|
||||
* @return AuthMe
|
||||
*/
|
||||
@Deprecated
|
||||
public AuthMe getPlugin() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @return true if player is a npc
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isaNPC(Player player) {
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @return true if player is a npc
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isNPC(Player player) {
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
package fr.xephi.authme.api;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class NewAPI {
|
||||
|
||||
public static final String newline = System.getProperty("line.separator");
|
||||
public static NewAPI singleton;
|
||||
public AuthMe plugin;
|
||||
|
||||
/**
|
||||
* Constructor for NewAPI.
|
||||
*
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public NewAPI(AuthMe plugin) {
|
||||
@@ -33,6 +32,7 @@ public class NewAPI {
|
||||
|
||||
/**
|
||||
* Constructor for NewAPI.
|
||||
*
|
||||
* @param serv Server
|
||||
*/
|
||||
public NewAPI(Server serv) {
|
||||
@@ -42,8 +42,8 @@ public class NewAPI {
|
||||
/**
|
||||
* Hook into AuthMe
|
||||
*
|
||||
|
||||
* @return AuthMe plugin */
|
||||
* @return AuthMe plugin
|
||||
*/
|
||||
public static NewAPI getInstance() {
|
||||
if (singleton != null)
|
||||
return singleton;
|
||||
@@ -58,44 +58,43 @@ public class NewAPI {
|
||||
|
||||
/**
|
||||
* Method getPlugin.
|
||||
|
||||
* @return AuthMe */
|
||||
*
|
||||
* @return AuthMe
|
||||
*/
|
||||
public AuthMe getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if player is authenticate */
|
||||
* @return true if player is authenticate
|
||||
*/
|
||||
public boolean isAuthenticated(Player player) {
|
||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if player is a npc */
|
||||
* @return true if player is a npc
|
||||
*/
|
||||
public boolean isNPC(Player player) {
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
|
||||
* @return true if the player is unrestricted */
|
||||
* @return true if the player is unrestricted
|
||||
*/
|
||||
public boolean isUnrestricted(Player player) {
|
||||
return Utils.isUnrestricted(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getLastLocation.
|
||||
*
|
||||
* @param player Player
|
||||
|
||||
* @return Location */
|
||||
* @return Location
|
||||
*/
|
||||
public Location getLastLocation(Player player) {
|
||||
try {
|
||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
||||
@@ -112,21 +111,19 @@ public class NewAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param playerName
|
||||
|
||||
* @return true if player is registered */
|
||||
* @return true if player is registered
|
||||
*/
|
||||
public boolean isRegistered(String playerName) {
|
||||
String player = playerName.toLowerCase();
|
||||
return plugin.database.isAuthAvailable(player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
|
||||
* @param playerName String
|
||||
* @param playerName String
|
||||
* @param passwordToCheck String
|
||||
* @return true if the password is correct , false else */
|
||||
* @return true if the password is correct , false else
|
||||
*/
|
||||
public boolean checkPassword(String playerName, String passwordToCheck) {
|
||||
if (!isRegistered(playerName))
|
||||
return false;
|
||||
@@ -142,11 +139,10 @@ public class NewAPI {
|
||||
/**
|
||||
* Register a player
|
||||
*
|
||||
|
||||
|
||||
* @param playerName String
|
||||
* @param password String
|
||||
* @return true if the player is register correctly */
|
||||
* @param password String
|
||||
* @return true if the player is register correctly
|
||||
*/
|
||||
public boolean registerPlayer(String playerName, String password) {
|
||||
try {
|
||||
String name = playerName.toLowerCase();
|
||||
@@ -164,7 +160,6 @@ public class NewAPI {
|
||||
/**
|
||||
* Force a player to login
|
||||
*
|
||||
|
||||
* @param player * player
|
||||
*/
|
||||
public void forceLogin(Player player) {
|
||||
@@ -174,35 +169,28 @@ public class NewAPI {
|
||||
/**
|
||||
* Force a player to logout
|
||||
*
|
||||
|
||||
* @param player * player
|
||||
*/
|
||||
public void forceLogout(Player player)
|
||||
{
|
||||
plugin.management.performLogout(player);
|
||||
public void forceLogout(Player player) {
|
||||
plugin.management.performLogout(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force a player to register
|
||||
*
|
||||
|
||||
|
||||
* @param player * player
|
||||
* @param player * player
|
||||
* @param password String
|
||||
*/
|
||||
public void forceRegister(Player player, String password)
|
||||
{
|
||||
plugin.management.performRegister(player, password, null);
|
||||
public void forceRegister(Player player, String password) {
|
||||
plugin.management.performRegister(player, password, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force a player to unregister
|
||||
*
|
||||
|
||||
* @param player * player
|
||||
*/
|
||||
public void forceUnregister(Player player)
|
||||
{
|
||||
plugin.management.performUnregister(player, "", true);
|
||||
public void forceUnregister(Player player) {
|
||||
plugin.management.performUnregister(player, "", true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user