mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-28 05:05:14 +01:00
commit
bbff450225
@ -39,7 +39,7 @@ public class SendMailSSL {
|
|||||||
public void main(final PlayerAuth auth, final String newPass) {
|
public void main(final PlayerAuth auth, final String newPass) {
|
||||||
String sendername;
|
String sendername;
|
||||||
|
|
||||||
if (Settings.getmailSenderName.isEmpty() || Settings.getmailSenderName == null) {
|
if (Settings.getmailSenderName == null || Settings.getmailSenderName.isEmpty()) {
|
||||||
sendername = Settings.getmailAccount;
|
sendername = Settings.getmailAccount;
|
||||||
} else {
|
} else {
|
||||||
sendername = Settings.getmailSenderName;
|
sendername = Settings.getmailSenderName;
|
||||||
|
@ -31,11 +31,14 @@ public class API {
|
|||||||
* @return AuthMe instance
|
* @return AuthMe instance
|
||||||
*/
|
*/
|
||||||
public static AuthMe hookAuthMe() {
|
public static AuthMe hookAuthMe() {
|
||||||
|
if (instance != null)
|
||||||
|
return instance;
|
||||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
||||||
if (plugin == null || !(plugin instanceof AuthMe)) {
|
if (plugin == null || !(plugin instanceof AuthMe)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (AuthMe) plugin;
|
instance = (AuthMe) plugin;
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthMe getPlugin() {
|
public AuthMe getPlugin() {
|
||||||
|
@ -4,7 +4,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class PlayerCache {
|
public class PlayerCache {
|
||||||
|
|
||||||
private static PlayerCache singleton = null;
|
private volatile static PlayerCache singleton = null;
|
||||||
private ConcurrentHashMap<String, PlayerAuth> cache;
|
private ConcurrentHashMap<String, PlayerAuth> cache;
|
||||||
|
|
||||||
private PlayerCache() {
|
private PlayerCache() {
|
||||||
|
@ -546,9 +546,9 @@ public class FileCache {
|
|||||||
file = new File("cache/" + player.getName().toLowerCase() + ".cache");
|
file = new File("cache/" + player.getName().toLowerCase() + ".cache");
|
||||||
}
|
}
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory() && file.listFiles() != null) {
|
||||||
for (File f : file.listFiles()) {
|
for (File f : file.listFiles()) {
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory() && f.listFiles() != null) {
|
||||||
for (File a : f.listFiles()) {
|
for (File a : f.listFiles()) {
|
||||||
a.delete();
|
a.delete();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
|
|
||||||
public class LimboCache {
|
public class LimboCache {
|
||||||
|
|
||||||
private static LimboCache singleton = null;
|
private volatile static LimboCache singleton = null;
|
||||||
public ConcurrentHashMap<String, LimboPlayer> cache;
|
public ConcurrentHashMap<String, LimboPlayer> cache;
|
||||||
private FileCache playerData;
|
private FileCache playerData;
|
||||||
public AuthMe plugin;
|
public AuthMe plugin;
|
||||||
|
@ -8,8 +8,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -20,7 +18,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
@ -85,13 +82,13 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) {
|
if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) {
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
System.out.println("[AuthMe] command usage: /authme passpartutoken");
|
ConsoleLogger.info("[AuthMe] command usage: /authme passpartutoken");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Utils.getInstance().obtainToken()) {
|
if (Utils.getInstance().obtainToken()) {
|
||||||
System.out.println("[AuthMe] You have 30s to insert this token ingame with /passpartu <token>");
|
ConsoleLogger.info("[AuthMe] You have 30s to insert this token ingame with /passpartu <token>");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[AuthMe] Security error on passpartu token, please redo the command.");
|
ConsoleLogger.info("[AuthMe] Security error on passpartu token, please redo the command.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -144,7 +141,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
fos.write(buf, 0, i);
|
fos.write(buf, 0, i);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Failed to load config from JAR");
|
ConsoleLogger.showError("Failed to load config from JAR");
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (fis != null) {
|
if (fis != null) {
|
||||||
@ -213,7 +210,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> accountList = plugin.database.getAllAuthsByName(auth);
|
List<String> accountList = plugin.database.getAllAuthsByName(auth);
|
||||||
if (accountList.isEmpty() || accountList == null) {
|
if (accountList == null || accountList.isEmpty()) {
|
||||||
m.send(fSender, "user_unknown");
|
m.send(fSender, "user_unknown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -249,7 +246,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> accountList = plugin.database.getAllAuthsByIp(arguments[1]);
|
List<String> accountList = plugin.database.getAllAuthsByIp(arguments[1]);
|
||||||
if (accountList.isEmpty() || accountList == null) {
|
if (accountList == null || accountList.isEmpty()) {
|
||||||
fSender.sendMessage("[AuthMe] This IP does not exist in the database");
|
fSender.sendMessage("[AuthMe] This IP does not exist in the database");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class EmailCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
PlayerCache.getInstance().updatePlayer(auth);
|
PlayerCache.getInstance().updatePlayer(auth);
|
||||||
m.send(player, "email_changed");
|
m.send(player, "email_changed");
|
||||||
player.sendMessage(m.send("email_defined") + auth.getEmail());
|
player.sendMessage(m.send("email_defined").toString() + auth.getEmail());
|
||||||
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
|
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||||
m.send(player, "email_confirm");
|
m.send(player, "email_confirm");
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,7 +73,7 @@ public class FlatToSql implements Converter {
|
|||||||
else if (args.length == 9)
|
else if (args.length == 9)
|
||||||
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "', 0);";
|
newline = "INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + lastlocX + "," + lastlocY + "," + lastlocZ + "," + lastlocWorld + "," + columnEmail + "," + columnLogged + ") VALUES ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "', 0);";
|
||||||
else newline = "";
|
else newline = "";
|
||||||
if (newline != "")
|
if (!newline.equals(""))
|
||||||
sql.write(newline);
|
sql.write(newline);
|
||||||
}
|
}
|
||||||
sql.close();
|
sql.close();
|
||||||
|
@ -86,7 +86,7 @@ public class FlatToSqlite implements Converter {
|
|||||||
else if (args.length == 9)
|
else if (args.length == 9)
|
||||||
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "');";
|
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", " + args[4] + ", " + args[5] + ", " + args[6] + ", '" + args[7] + "', '" + args[8] + "');";
|
||||||
else newline = "";
|
else newline = "";
|
||||||
if (newline != "")
|
if (!newline.equals(""))
|
||||||
saveAuth(newline);
|
saveAuth(newline);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
@ -104,8 +104,8 @@ public class FlatToSqlite implements Converter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized static void connect() throws ClassNotFoundException,
|
private synchronized static void connect()
|
||||||
SQLException {
|
throws ClassNotFoundException, SQLException {
|
||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC");
|
||||||
ConsoleLogger.info("SQLite driver loaded");
|
ConsoleLogger.info("SQLite driver loaded");
|
||||||
con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
|
con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
|
||||||
|
@ -152,8 +152,10 @@ public class FlatFile implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeAuth(auth.getNickname());
|
if (newAuth != null) {
|
||||||
saveAuth(newAuth);
|
removeAuth(auth.getNickname());
|
||||||
|
saveAuth(newAuth);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,8 +211,10 @@ public class FlatFile implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeAuth(auth.getNickname());
|
if (newAuth != null) {
|
||||||
saveAuth(newAuth);
|
removeAuth(auth.getNickname());
|
||||||
|
saveAuth(newAuth);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +249,10 @@ public class FlatFile implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeAuth(auth.getNickname());
|
if (newAuth != null) {
|
||||||
saveAuth(newAuth);
|
removeAuth(auth.getNickname());
|
||||||
|
saveAuth(newAuth);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,8 +503,10 @@ public class FlatFile implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeAuth(auth.getNickname());
|
if (newAuth != null) {
|
||||||
saveAuth(newAuth);
|
removeAuth(auth.getNickname());
|
||||||
|
saveAuth(newAuth);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.events;
|
package fr.xephi.authme.events;
|
||||||
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -13,7 +12,6 @@ public class CustomEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
private boolean isCancelled;
|
private boolean isCancelled;
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private static Server s;
|
|
||||||
|
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
@ -31,8 +29,4 @@ public class CustomEvent extends Event implements Cancellable {
|
|||||||
this.isCancelled = cancelled;
|
this.isCancelled = cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Server getServer() {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@ public class AuthMeBlockListener implements Listener {
|
|||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ public class AuthMeBlockListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ public class AuthMeChestShopListener implements Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPreTransaction(PreTransactionEvent event) {
|
public void onPreTransaction(PreTransactionEvent event) {
|
||||||
if (event.isCancelled() || event.getClient() == null || event == null) {
|
if (event.getClient() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,11 +26,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
if (!(entity instanceof Player)) {
|
if (!(entity instanceof Player)) {
|
||||||
@ -64,11 +61,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (event.getTarget() == null)
|
if (event.getTarget() == null)
|
||||||
return;
|
return;
|
||||||
Entity entity = event.getTarget();
|
Entity entity = event.getTarget();
|
||||||
@ -95,12 +89,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onDmg(EntityDamageByEntityEvent event) {
|
public void onDmg(EntityDamageByEntityEvent event) {
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity entity = event.getDamager();
|
Entity entity = event.getDamager();
|
||||||
|
|
||||||
if (entity == null || !(entity instanceof Player)) {
|
if (entity == null || !(entity instanceof Player)) {
|
||||||
@ -123,12 +113,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (!(entity instanceof Player)) {
|
if (!(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
@ -154,12 +140,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void EntityRegainHealthEvent(EntityRegainHealthEvent event) {
|
public void EntityRegainHealthEvent(EntityRegainHealthEvent event) {
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (!(entity instanceof Player)) {
|
if (!(entity instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
@ -185,12 +167,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onEntityInteract(EntityInteractEvent event) {
|
public void onEntityInteract(EntityInteractEvent event) {
|
||||||
if (event.isCancelled() || event == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof Player)) {
|
if (!(event.getEntity() instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -217,12 +195,8 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onLowestEntityInteract(EntityInteractEvent event) {
|
public void onLowestEntityInteract(EntityInteractEvent event) {
|
||||||
if (event.isCancelled() || event == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof Player)) {
|
if (!(event.getEntity() instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -94,9 +94,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
|
||||||
public void onPlayerNormalChat(AsyncPlayerChatEvent event) {
|
public void onPlayerNormalChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@ -131,9 +131,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
|
||||||
public void onPlayerHighChat(AsyncPlayerChatEvent event) {
|
public void onPlayerHighChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@ -168,9 +168,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@ -205,9 +205,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerHighestChat(AsyncPlayerChatEvent event) {
|
public void onPlayerHighestChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@ -242,9 +242,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerEarlyChat(final AsyncPlayerChatEvent event) {
|
public void onPlayerEarlyChat(final AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@ -280,9 +280,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
|
||||||
public void onPlayerLowChat(AsyncPlayerChatEvent event) {
|
public void onPlayerLowChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@ -315,9 +315,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,14 +574,11 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setQuitMessage(null);
|
event.setQuitMessage(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
public void onPlayerKick(PlayerKickEvent event) {
|
public void onPlayerKick(PlayerKickEvent event) {
|
||||||
if (event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
@ -593,9 +590,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
plugin.management.performQuit(player, true);
|
plugin.management.performQuit(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,9 +619,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -652,9 +649,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
Player player = (Player) event.getPlayer();
|
Player player = (Player) event.getPlayer();
|
||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
@ -679,9 +676,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInventoryClick(InventoryClickEvent event) {
|
public void onPlayerInventoryClick(InventoryClickEvent event) {
|
||||||
if (event.isCancelled() || event.getWhoClicked() == null)
|
if (event.getWhoClicked() == null)
|
||||||
return;
|
return;
|
||||||
if (!(event.getWhoClicked() instanceof Player))
|
if (!(event.getWhoClicked() instanceof Player))
|
||||||
return;
|
return;
|
||||||
@ -708,9 +705,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,9 +730,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -760,9 +757,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -784,9 +781,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onSignChange(SignChangeEvent event) {
|
public void onSignChange(SignChangeEvent event) {
|
||||||
if (event.isCancelled() || event.getPlayer() == null || event == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -807,7 +804,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
if (event.getPlayer() == null || event == null) {
|
if (event.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,11 +836,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setRespawnLocation(spawn);
|
event.setRespawnLocation(spawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
||||||
if (event.isCancelled())
|
if (event.getPlayer() == null)
|
||||||
return;
|
|
||||||
if (event.getPlayer() == null || event == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
@ -28,7 +28,7 @@ public class EssSpawn extends CustomConfiguration {
|
|||||||
try {
|
try {
|
||||||
if (!this.contains("spawns.default.world"))
|
if (!this.contains("spawns.default.world"))
|
||||||
return null;
|
return null;
|
||||||
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world") == "")
|
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world").equals(""))
|
||||||
return null;
|
return null;
|
||||||
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
|
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
|
||||||
return location;
|
return location;
|
||||||
|
@ -209,7 +209,7 @@ public class AsyncronousLogin {
|
|||||||
List<String> auths = this.database.getAllAuthsByName(auth);
|
List<String> auths = this.database.getAllAuthsByName(auth);
|
||||||
// List<String> uuidlist =
|
// List<String> uuidlist =
|
||||||
// plugin.otherAccounts.getAllPlayersByUUID(player.getUniqueId());
|
// plugin.otherAccounts.getAllPlayersByUUID(player.getUniqueId());
|
||||||
if (auths.isEmpty() || auths == null) {
|
if (auths.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (auths.size() == 1) {
|
if (auths.size() == 1) {
|
||||||
|
@ -94,7 +94,7 @@ public class AsyncronousRegister {
|
|||||||
preRegister();
|
preRegister();
|
||||||
if (!allowRegister)
|
if (!allowRegister)
|
||||||
return;
|
return;
|
||||||
if (!email.isEmpty() && email != "") {
|
if (!email.isEmpty() && !email.equals("")) {
|
||||||
if (Settings.getmaxRegPerEmail > 0) {
|
if (Settings.getmaxRegPerEmail > 0) {
|
||||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||||
m.send(player, "max_reg");
|
m.send(player, "max_reg");
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
package fr.xephi.authme.security.crypts;
|
package fr.xephi.authme.security.crypts;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
@ -141,7 +140,7 @@ public class BCRYPT implements EncryptionMethod {
|
|||||||
* @return the decoded value of x
|
* @return the decoded value of x
|
||||||
*/
|
*/
|
||||||
private static byte char64(char x) {
|
private static byte char64(char x) {
|
||||||
if ((int) x < 0 || (int) x > index_64.length)
|
if ((int) x > index_64.length)
|
||||||
return -1;
|
return -1;
|
||||||
return index_64[(int) x];
|
return index_64[(int) x];
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class CryptPBKDF2 implements EncryptionMethod {
|
|||||||
PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000);
|
PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000);
|
||||||
PBKDF2Engine engine = new PBKDF2Engine(params);
|
PBKDF2Engine engine = new PBKDF2Engine(params);
|
||||||
|
|
||||||
return result + engine.deriveKey(password, 64).toString();
|
return result + String.valueOf(engine.deriveKey(password, 64));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,9 +60,9 @@ import java.security.SecureRandom;
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* For Details, see <a
|
* For Details, see
|
||||||
* href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
|
* <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" >http://www.
|
||||||
* >http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
|
* gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898</a>
|
* @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898</a>
|
||||||
@ -319,8 +319,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws NoSuchAlgorithmException
|
* @throws NoSuchAlgorithmException
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws IOException,
|
public static void main(String[] args)
|
||||||
NoSuchAlgorithmException {
|
throws IOException, NoSuchAlgorithmException {
|
||||||
String password = "password";
|
String password = "password";
|
||||||
String candidate = null;
|
String candidate = null;
|
||||||
PBKDF2Formatter formatter = new PBKDF2HexFormatter();
|
PBKDF2Formatter formatter = new PBKDF2HexFormatter();
|
||||||
@ -341,7 +341,6 @@ public class PBKDF2Engine implements PBKDF2 {
|
|||||||
PBKDF2Engine e = new PBKDF2Engine(p);
|
PBKDF2Engine e = new PBKDF2Engine(p);
|
||||||
p.setDerivedKey(e.deriveKey(password));
|
p.setDerivedKey(e.deriveKey(password));
|
||||||
candidate = formatter.toString(p);
|
candidate = formatter.toString(p);
|
||||||
System.out.println(candidate);
|
|
||||||
} else {
|
} else {
|
||||||
// Verification mode
|
// Verification mode
|
||||||
PBKDF2Parameters p = new PBKDF2Parameters();
|
PBKDF2Parameters p = new PBKDF2Parameters();
|
||||||
@ -352,7 +351,6 @@ public class PBKDF2Engine implements PBKDF2 {
|
|||||||
}
|
}
|
||||||
PBKDF2Engine e = new PBKDF2Engine(p);
|
PBKDF2Engine e = new PBKDF2Engine(p);
|
||||||
boolean verifyOK = e.verifyKey(password);
|
boolean verifyOK = e.verifyKey(password);
|
||||||
System.out.println(verifyOK ? "OK" : "FAIL");
|
|
||||||
System.exit(verifyOK ? 0 : 1);
|
System.exit(verifyOK ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package fr.xephi.authme.settings;
|
package fr.xephi.authme.settings;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ public class Spawn extends CustomConfiguration {
|
|||||||
|
|
||||||
public Location getSpawn() {
|
public Location getSpawn() {
|
||||||
try {
|
try {
|
||||||
if (this.getString("spawn.world").isEmpty() || this.getString("spawn.world") == "")
|
if (this.getString("spawn.world").isEmpty() || this.getString("spawn.world").equals(""))
|
||||||
return null;
|
return null;
|
||||||
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
|
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
|
||||||
return location;
|
return location;
|
||||||
@ -98,7 +99,7 @@ public class Spawn extends CustomConfiguration {
|
|||||||
|
|
||||||
public Location getFirstSpawn() {
|
public Location getFirstSpawn() {
|
||||||
try {
|
try {
|
||||||
if (this.getString("firstspawn.world").isEmpty() || this.getString("firstspawn.world") == "")
|
if (this.getString("firstspawn.world").isEmpty() || this.getString("firstspawn.world").equals(""))
|
||||||
return null;
|
return null;
|
||||||
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
|
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
|
||||||
return location;
|
return location;
|
||||||
|
Loading…
Reference in New Issue
Block a user