mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 18:17:34 +01:00
commit
a537ad7543
@ -35,6 +35,7 @@ import com.maxmind.geoip.LookupService;
|
|||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
|
import fr.xephi.authme.api.NewAPI;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.cache.backup.FileCache;
|
import fr.xephi.authme.cache.backup.FileCache;
|
||||||
@ -92,7 +93,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public double ChestShop = 0;
|
public double ChestShop = 0;
|
||||||
public boolean BungeeCord = false;
|
public boolean BungeeCord = false;
|
||||||
public Essentials ess;
|
public Essentials ess;
|
||||||
public API api;
|
public NewAPI api;
|
||||||
public Management management;
|
public Management management;
|
||||||
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<String, Integer>();
|
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<String, Integer>();
|
||||||
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<String, String>();
|
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<String, String>();
|
||||||
@ -206,7 +207,8 @@ public class AuthMe extends JavaPlugin {
|
|||||||
dataManager = new DataManager(this);
|
dataManager = new DataManager(this);
|
||||||
|
|
||||||
// Setup API
|
// Setup API
|
||||||
api = new API(this);
|
api = new NewAPI(this);
|
||||||
|
new API(this);
|
||||||
|
|
||||||
// Setup Management
|
// Setup Management
|
||||||
management = new Management(this);
|
management = new Management(this);
|
||||||
|
@ -4,7 +4,6 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -20,38 +19,27 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
public class API {
|
public class API {
|
||||||
|
|
||||||
public static final String newline = System.getProperty("line.separator");
|
public static final String newline = System.getProperty("line.separator");
|
||||||
public static API singleton;
|
public static AuthMe instance;
|
||||||
public AuthMe plugin;
|
|
||||||
|
|
||||||
public API(AuthMe plugin) {
|
public API(AuthMe instance) {
|
||||||
this.plugin = plugin;
|
API.instance = instance;
|
||||||
}
|
|
||||||
|
|
||||||
public API(Server serv) {
|
|
||||||
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook into AuthMe
|
* Hook into AuthMe
|
||||||
*
|
*
|
||||||
* @return
|
* @return AuthMe instance
|
||||||
*
|
|
||||||
* @return AuthMe plugin
|
|
||||||
*/
|
*/
|
||||||
public static API getInstance() {
|
public static AuthMe hookAuthMe() {
|
||||||
if (singleton != null)
|
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
||||||
return singleton;
|
if (plugin == null || !(plugin instanceof AuthMe)) {
|
||||||
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
|
||||||
if (p == null || !(p instanceof AuthMe)) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AuthMe authme = (AuthMe) p;
|
return (AuthMe) plugin;
|
||||||
singleton = (new API(authme));
|
|
||||||
return singleton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthMe getPlugin() {
|
public AuthMe getPlugin() {
|
||||||
return plugin;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,17 +47,29 @@ public class API {
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if player is authenticate
|
* @return true if player is authenticate
|
||||||
*/
|
*/
|
||||||
public boolean isAuthenticated(Player player) {
|
public static boolean isAuthenticated(Player player) {
|
||||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @return true if player is a npc
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public boolean isaNPC(Player player) {
|
||||||
|
if (instance.getCitizensCommunicator().isNPC(player))
|
||||||
|
return true;
|
||||||
|
return CombatTagComunicator.isNPC(player);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if player is a npc
|
* @return true if player is a npc
|
||||||
*/
|
*/
|
||||||
public boolean isNPC(Player player) {
|
public boolean isNPC(Player player) {
|
||||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
if (instance.getCitizensCommunicator().isNPC(player))
|
||||||
return true;
|
return true;
|
||||||
return CombatTagComunicator.isNPC(player);
|
return CombatTagComunicator.isNPC(player);
|
||||||
}
|
}
|
||||||
@ -79,11 +79,11 @@ public class API {
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if the player is unrestricted
|
* @return true if the player is unrestricted
|
||||||
*/
|
*/
|
||||||
public boolean isUnrestricted(Player player) {
|
public static boolean isUnrestricted(Player player) {
|
||||||
return Utils.getInstance().isUnrestricted(player);
|
return Utils.getInstance().isUnrestricted(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getLastLocation(Player player) {
|
public static Location getLastLocation(Player player) {
|
||||||
try {
|
try {
|
||||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class API {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerInventory(Player player, ItemStack[] content,
|
public static void setPlayerInventory(Player player, ItemStack[] content,
|
||||||
ItemStack[] armor) {
|
ItemStack[] armor) {
|
||||||
try {
|
try {
|
||||||
player.getInventory().setContents(content);
|
player.getInventory().setContents(content);
|
||||||
@ -113,9 +113,9 @@ public class API {
|
|||||||
* @param playerName
|
* @param playerName
|
||||||
* @return true if player is registered
|
* @return true if player is registered
|
||||||
*/
|
*/
|
||||||
public boolean isRegistered(String playerName) {
|
public static boolean isRegistered(String playerName) {
|
||||||
String player = playerName.toLowerCase();
|
String player = playerName.toLowerCase();
|
||||||
return plugin.database.isAuthAvailable(player);
|
return instance.database.isAuthAvailable(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,11 +123,12 @@ public class API {
|
|||||||
* playerName, String passwordToCheck
|
* playerName, String passwordToCheck
|
||||||
* @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) {
|
public static boolean checkPassword(String playerName,
|
||||||
|
String passwordToCheck) {
|
||||||
if (!isRegistered(playerName))
|
if (!isRegistered(playerName))
|
||||||
return false;
|
return false;
|
||||||
String player = playerName.toLowerCase();
|
String player = playerName.toLowerCase();
|
||||||
PlayerAuth auth = plugin.database.getAuth(player);
|
PlayerAuth auth = instance.database.getAuth(player);
|
||||||
try {
|
try {
|
||||||
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
@ -142,15 +143,15 @@ public class API {
|
|||||||
* playerName, String password
|
* playerName, String password
|
||||||
* @return true if the player is register correctly
|
* @return true if the player is register correctly
|
||||||
*/
|
*/
|
||||||
public boolean registerPlayer(String playerName, String password) {
|
public static boolean registerPlayer(String playerName, String password) {
|
||||||
try {
|
try {
|
||||||
String name = playerName.toLowerCase();
|
String name = playerName.toLowerCase();
|
||||||
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||||
if (isRegistered(name)) {
|
if (isRegistered(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com");
|
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com");
|
||||||
if (!plugin.database.saveAuth(auth)) {
|
if (!instance.database.saveAuth(auth)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -165,8 +166,8 @@ public class API {
|
|||||||
* @param Player
|
* @param Player
|
||||||
* player
|
* player
|
||||||
*/
|
*/
|
||||||
public void forceLogin(Player player) {
|
public static void forceLogin(Player player) {
|
||||||
plugin.management.performLogin(player, "dontneed", true);
|
instance.management.performLogin(player, "dontneed", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
174
src/main/java/fr/xephi/authme/api/NewAPI.java
Normal file
174
src/main/java/fr/xephi/authme/api/NewAPI.java
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
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.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
|
import fr.xephi.authme.Utils;
|
||||||
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
|
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||||
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
|
public class NewAPI {
|
||||||
|
|
||||||
|
public static final String newline = System.getProperty("line.separator");
|
||||||
|
public static NewAPI singleton;
|
||||||
|
public AuthMe plugin;
|
||||||
|
|
||||||
|
public NewAPI(AuthMe plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewAPI(Server serv) {
|
||||||
|
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook into AuthMe
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* @return AuthMe plugin
|
||||||
|
*/
|
||||||
|
public static NewAPI getInstance() {
|
||||||
|
if (singleton != null)
|
||||||
|
return singleton;
|
||||||
|
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
||||||
|
if (p == null || !(p instanceof AuthMe)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
AuthMe authme = (AuthMe) p;
|
||||||
|
singleton = (new NewAPI(authme));
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthMe getPlugin() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
public boolean isNPC(Player player) {
|
||||||
|
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||||
|
return true;
|
||||||
|
return CombatTagComunicator.isNPC(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @return true if the player is unrestricted
|
||||||
|
*/
|
||||||
|
public boolean isUnrestricted(Player player) {
|
||||||
|
return Utils.getInstance().isUnrestricted(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLastLocation(Player player) {
|
||||||
|
try {
|
||||||
|
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
||||||
|
|
||||||
|
if (auth != null) {
|
||||||
|
Location loc = new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ());
|
||||||
|
return loc;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NullPointerException ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayerInventory(Player player, ItemStack[] content,
|
||||||
|
ItemStack[] armor) {
|
||||||
|
try {
|
||||||
|
player.getInventory().setContents(content);
|
||||||
|
player.getInventory().setArmorContents(armor);
|
||||||
|
} catch (Exception npe) {
|
||||||
|
ConsoleLogger.showError("Some error appear while trying to set inventory for " + player.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param playerName
|
||||||
|
* @return true if player is registered
|
||||||
|
*/
|
||||||
|
public boolean isRegistered(String playerName) {
|
||||||
|
String player = playerName.toLowerCase();
|
||||||
|
return plugin.database.isAuthAvailable(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param String
|
||||||
|
* playerName, String passwordToCheck
|
||||||
|
* @return true if the password is correct , false else
|
||||||
|
*/
|
||||||
|
public boolean checkPassword(String playerName, String passwordToCheck) {
|
||||||
|
if (!isRegistered(playerName))
|
||||||
|
return false;
|
||||||
|
String player = playerName.toLowerCase();
|
||||||
|
PlayerAuth auth = plugin.database.getAuth(player);
|
||||||
|
try {
|
||||||
|
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a player
|
||||||
|
*
|
||||||
|
* @param String
|
||||||
|
* playerName, String password
|
||||||
|
* @return true if the player is register correctly
|
||||||
|
*/
|
||||||
|
public boolean registerPlayer(String playerName, String password) {
|
||||||
|
try {
|
||||||
|
String name = playerName.toLowerCase();
|
||||||
|
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||||
|
if (isRegistered(name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com");
|
||||||
|
if (!plugin.database.saveAuth(auth)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force a player to login
|
||||||
|
*
|
||||||
|
* @param Player
|
||||||
|
* player
|
||||||
|
*/
|
||||||
|
public void forceLogin(Player player) {
|
||||||
|
plugin.management.performLogin(player, "dontneed", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -203,7 +202,7 @@ public class FileCache {
|
|||||||
path = player.getName();
|
path = player.getName();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + ".playerdatas.cache");
|
File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache");
|
||||||
String playername = player.getName().toLowerCase();
|
String playername = player.getName().toLowerCase();
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
// OLD METHOD
|
// OLD METHOD
|
||||||
@ -357,7 +356,7 @@ public class FileCache {
|
|||||||
for (int i = 0; i < inv.length; i++) {
|
for (int i = 0; i < inv.length; i++) {
|
||||||
reader = new Scanner(new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "inventory" + File.separator + i + ".cache"));
|
reader = new Scanner(new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "inventory" + File.separator + i + ".cache"));
|
||||||
ItemStack item = new ItemStack(Material.AIR);
|
ItemStack item = new ItemStack(Material.AIR);
|
||||||
ItemMeta meta = null;
|
ItemMeta meta = item.getItemMeta();
|
||||||
Attributes attributes = null;
|
Attributes attributes = null;
|
||||||
count = 1;
|
count = 1;
|
||||||
boolean v = true;
|
boolean v = true;
|
||||||
@ -365,22 +364,24 @@ public class FileCache {
|
|||||||
String line = reader.nextLine();
|
String line = reader.nextLine();
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 1:
|
case 1:
|
||||||
item.setType(Material.getMaterial(line));
|
item = new ItemStack(Material.getMaterial(line));
|
||||||
if (item.getType() == Material.AIR)
|
if (item.getType() == Material.AIR)
|
||||||
v = false;
|
v = false;
|
||||||
|
meta = item.getItemMeta();
|
||||||
|
count++;
|
||||||
continue;
|
continue;
|
||||||
case 2:
|
case 2:
|
||||||
item.setDurability(Short.parseShort(line));
|
item.setDurability((short) Integer.parseInt(line));
|
||||||
|
count++;
|
||||||
continue;
|
continue;
|
||||||
case 3:
|
case 3:
|
||||||
item.setAmount(Integer.parseInt(line));
|
item.setAmount(Integer.parseInt(line));
|
||||||
|
count++;
|
||||||
continue;
|
continue;
|
||||||
case 4:
|
|
||||||
meta = Bukkit.getItemFactory().getItemMeta(item.getType());
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
meta = item.getItemMeta();
|
||||||
if (line.startsWith("name=")) {
|
if (line.startsWith("name=")) {
|
||||||
line = line.substring(5);
|
line = line.substring(5);
|
||||||
meta.setDisplayName(line);
|
meta.setDisplayName(line);
|
||||||
@ -399,6 +400,7 @@ public class FileCache {
|
|||||||
if (line.startsWith("enchant=")) {
|
if (line.startsWith("enchant=")) {
|
||||||
line = line.substring(8);
|
line = line.substring(8);
|
||||||
item.addEnchantment(Enchantment.getByName(line.split(":")[0]), Integer.parseInt(line.split(":")[1]));
|
item.addEnchantment(Enchantment.getByName(line.split(":")[0]), Integer.parseInt(line.split(":")[1]));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (Settings.customAttributes) {
|
if (Settings.customAttributes) {
|
||||||
if (line.startsWith("attribute=")) {
|
if (line.startsWith("attribute=")) {
|
||||||
@ -429,7 +431,7 @@ public class FileCache {
|
|||||||
}
|
}
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
reader.close();
|
reader.close();
|
||||||
if (attributes != null)
|
if (Settings.customAttributes && attributes != null)
|
||||||
inv[i] = attributes.getStack();
|
inv[i] = attributes.getStack();
|
||||||
else inv[i] = item;
|
else inv[i] = item;
|
||||||
}
|
}
|
||||||
@ -444,22 +446,24 @@ public class FileCache {
|
|||||||
String line = reader.nextLine();
|
String line = reader.nextLine();
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 1:
|
case 1:
|
||||||
item.setType(Material.getMaterial(line));
|
item = new ItemStack(Material.getMaterial(line));
|
||||||
if (item.getType() == Material.AIR)
|
if (item.getType() == Material.AIR)
|
||||||
v = false;
|
v = false;
|
||||||
|
meta = item.getItemMeta();
|
||||||
|
count++;
|
||||||
continue;
|
continue;
|
||||||
case 2:
|
case 2:
|
||||||
item.setDurability(Short.parseShort(line));
|
item.setDurability((short) Integer.parseInt(line));
|
||||||
|
count++;
|
||||||
continue;
|
continue;
|
||||||
case 3:
|
case 3:
|
||||||
item.setAmount(Integer.parseInt(line));
|
item.setAmount(Integer.parseInt(line));
|
||||||
|
count++;
|
||||||
continue;
|
continue;
|
||||||
case 4:
|
|
||||||
meta = Bukkit.getItemFactory().getItemMeta(item.getType());
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
meta = item.getItemMeta();
|
||||||
if (line.startsWith("name=")) {
|
if (line.startsWith("name=")) {
|
||||||
line = line.substring(5);
|
line = line.substring(5);
|
||||||
meta.setDisplayName(line);
|
meta.setDisplayName(line);
|
||||||
@ -573,10 +577,7 @@ public class FileCache {
|
|||||||
file = new File("cache/" + player.getName().toLowerCase() + ".cache");
|
file = new File("cache/" + player.getName().toLowerCase() + ".cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.exists()) {
|
return file.exists();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,6 @@ public class AsyncronousQuit {
|
|||||||
if (limbo.getMessageTaskId() != null)
|
if (limbo.getMessageTaskId() != null)
|
||||||
limbo.getMessageTaskId().cancel();
|
limbo.getMessageTaskId().cancel();
|
||||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||||
if (playerBackup.doesCacheExist(player)) {
|
|
||||||
playerBackup.removeCache(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (Settings.isSessionsEnabled && !isKick) {
|
if (Settings.isSessionsEnabled && !isKick) {
|
||||||
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||||
|
@ -218,7 +218,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
multiverse = configFile.getBoolean("Hooks.multiverse", true);
|
multiverse = configFile.getBoolean("Hooks.multiverse", true);
|
||||||
chestshop = configFile.getBoolean("Hooks.chestshop", true);
|
chestshop = configFile.getBoolean("Hooks.chestshop", true);
|
||||||
bungee = configFile.getBoolean("Hooks.bungeecord", false);
|
bungee = configFile.getBoolean("Hooks.bungeecord", false);
|
||||||
getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds", new ArrayList<String>());
|
getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds");
|
||||||
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
|
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
|
||||||
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
|
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
|
||||||
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
|
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
|
||||||
@ -240,17 +240,17 @@ public final class Settings extends YamlConfiguration {
|
|||||||
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
||||||
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
||||||
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
||||||
countries = (List<String>) configFile.getList("Protection.countries", new ArrayList<String>());
|
countries = configFile.getStringList("Protection.countries");
|
||||||
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
|
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
|
||||||
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
|
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
|
||||||
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
|
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
|
||||||
forceCommands = (List<String>) configFile.getList("settings.forceCommands", new ArrayList<String>());
|
forceCommands = configFile.getStringList("settings.forceCommands");
|
||||||
forceCommandsAsConsole = (List<String>) configFile.getList("settings.forceCommandsAsConsole", new ArrayList<String>());
|
forceCommandsAsConsole = configFile.getStringList("settings.forceCommandsAsConsole");
|
||||||
recallEmail = configFile.getBoolean("Email.recallPlayers", false);
|
recallEmail = configFile.getBoolean("Email.recallPlayers", false);
|
||||||
delayRecall = configFile.getInt("Email.delayRecall", 5);
|
delayRecall = configFile.getInt("Email.delayRecall", 5);
|
||||||
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
||||||
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
unsafePasswords = configFile.getStringList("settings.security.unsafePasswords");
|
||||||
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist");
|
||||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||||
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
||||||
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
||||||
@ -266,7 +266,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
||||||
emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
|
emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
|
||||||
emailWhitelist = configFile.getStringList("Email.emailWhitelisted");
|
emailWhitelist = configFile.getStringList("Email.emailWhitelisted");
|
||||||
forceRegisterCommands = (List<String>) configFile.getList("settings.forceRegisterCommands", new ArrayList<String>());
|
forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands");
|
||||||
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||||
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
||||||
generateImage = configFile.getBoolean("Email.generateImage", true);
|
generateImage = configFile.getBoolean("Email.generateImage", true);
|
||||||
@ -323,12 +323,12 @@ public final class Settings extends YamlConfiguration {
|
|||||||
getMySQLColumnPassword = configFile.getString("DataSource.mySQLColumnPassword", "password");
|
getMySQLColumnPassword = configFile.getString("DataSource.mySQLColumnPassword", "password");
|
||||||
getMySQLColumnIp = configFile.getString("DataSource.mySQLColumnIp", "ip");
|
getMySQLColumnIp = configFile.getString("DataSource.mySQLColumnIp", "ip");
|
||||||
getMySQLColumnLastLogin = configFile.getString("DataSource.mySQLColumnLastLogin", "lastlogin");
|
getMySQLColumnLastLogin = configFile.getString("DataSource.mySQLColumnLastLogin", "lastlogin");
|
||||||
|
getMySQLColumnSalt = configFile.getString("ExternalBoardOptions.mySQLColumnSalt");
|
||||||
|
getMySQLColumnGroup = configFile.getString("ExternalBoardOptions.mySQLColumnGroup", "");
|
||||||
getMySQLlastlocX = configFile.getString("DataSource.mySQLlastlocX", "x");
|
getMySQLlastlocX = configFile.getString("DataSource.mySQLlastlocX", "x");
|
||||||
getMySQLlastlocY = configFile.getString("DataSource.mySQLlastlocY", "y");
|
getMySQLlastlocY = configFile.getString("DataSource.mySQLlastlocY", "y");
|
||||||
getMySQLlastlocZ = configFile.getString("DataSource.mySQLlastlocZ", "z");
|
getMySQLlastlocZ = configFile.getString("DataSource.mySQLlastlocZ", "z");
|
||||||
getMySQLlastlocWorld = configFile.getString("DataSource.mySQLlastlocWorld", "world");
|
getMySQLlastlocWorld = configFile.getString("DataSource.mySQLlastlocWorld", "world");
|
||||||
getMySQLColumnSalt = configFile.getString("ExternalBoardOptions.mySQLColumnSalt", "");
|
|
||||||
getMySQLColumnGroup = configFile.getString("ExternalBoardOptions.mySQLColumnGroup", "");
|
|
||||||
getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1);
|
getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1);
|
||||||
unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", "");
|
unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", "");
|
||||||
getUnrestrictedName = configFile.getStringList("settings.unrestrictions.UnrestrictedName");
|
getUnrestrictedName = configFile.getStringList("settings.unrestrictions.UnrestrictedName");
|
||||||
@ -385,7 +385,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
multiverse = configFile.getBoolean("Hooks.multiverse", true);
|
multiverse = configFile.getBoolean("Hooks.multiverse", true);
|
||||||
chestshop = configFile.getBoolean("Hooks.chestshop", true);
|
chestshop = configFile.getBoolean("Hooks.chestshop", true);
|
||||||
bungee = configFile.getBoolean("Hooks.bungeecord", false);
|
bungee = configFile.getBoolean("Hooks.bungeecord", false);
|
||||||
getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds");
|
getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds");
|
||||||
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
|
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
|
||||||
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
|
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
|
||||||
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
|
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
|
||||||
@ -407,17 +407,17 @@ public final class Settings extends YamlConfiguration {
|
|||||||
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
||||||
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
||||||
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
||||||
countries = (List<String>) configFile.getList("Protection.countries");
|
countries = configFile.getStringList("Protection.countries");
|
||||||
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
|
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
|
||||||
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
|
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
|
||||||
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
|
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
|
||||||
forceCommands = (List<String>) configFile.getList("settings.forceCommands", new ArrayList<String>());
|
forceCommands = configFile.getStringList("settings.forceCommands");
|
||||||
forceCommandsAsConsole = (List<String>) configFile.getList("settings.forceCommandsAsConsole", new ArrayList<String>());
|
forceCommandsAsConsole = configFile.getStringList("settings.forceCommandsAsConsole");
|
||||||
recallEmail = configFile.getBoolean("Email.recallPlayers", false);
|
recallEmail = configFile.getBoolean("Email.recallPlayers", false);
|
||||||
delayRecall = configFile.getInt("Email.delayRecall", 5);
|
delayRecall = configFile.getInt("Email.delayRecall", 5);
|
||||||
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
||||||
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
unsafePasswords = configFile.getStringList("settings.security.unsafePasswords");
|
||||||
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist");
|
||||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||||
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
||||||
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
||||||
@ -433,7 +433,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
||||||
emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
|
emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
|
||||||
emailWhitelist = configFile.getStringList("Email.emailWhitelisted");
|
emailWhitelist = configFile.getStringList("Email.emailWhitelisted");
|
||||||
forceRegisterCommands = (List<String>) configFile.getList("settings.forceRegisterCommands", new ArrayList<String>());
|
forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands");
|
||||||
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||||
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
||||||
generateImage = configFile.getBoolean("Email.generateImage", true);
|
generateImage = configFile.getBoolean("Email.generateImage", true);
|
||||||
|
Loading…
Reference in New Issue
Block a user