Fix conflicts

This commit is contained in:
Gabriele C 2015-10-20 22:05:19 +02:00
commit 38832fc2ce
5 changed files with 30 additions and 20 deletions

View File

@ -145,7 +145,7 @@ public class DataManager {
} }
public synchronized void purgePermissions(List<String> cleared, public synchronized void purgePermissions(List<String> cleared,
Permission permission) { Permission permission) {
int i = 0; int i = 0;
for (String name : cleared) { for (String name : cleared) {
try { try {
@ -165,6 +165,7 @@ public class DataManager {
return true; return true;
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
Future<Boolean> result = executor.submit(new Callable<Boolean>() { Future<Boolean> result = executor.submit(new Callable<Boolean>() {
@Override @Override
public synchronized Boolean call() throws Exception { public synchronized Boolean call() throws Exception {
for (OfflinePlayer op : Utils.getOnlinePlayers()) for (OfflinePlayer op : Utils.getOnlinePlayers())
@ -182,4 +183,13 @@ public class DataManager {
executor.shutdown(); executor.shutdown();
} }
} }
public Player getOnlinePlayerLower(String name) {
name = name.toLowerCase();
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equalsIgnoreCase(name))
return player;
}
return null;
}
} }

View File

@ -102,7 +102,7 @@ public class SendMailSSL {
try { try {
transport.connect(smtp, acc, password); transport.connect(smtp, acc, password);
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recorvery email to " + mail); ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recovery email to " + mail);
if (file != null) if (file != null)
file.delete(); file.delete();
return; return;

View File

@ -209,6 +209,7 @@ public class AuthMePlayerListener implements Listener {
// Shedule login task so works after the prelogin // Shedule login task so works after the prelogin
// (Fix found by Koolaid5000) // (Fix found by Koolaid5000)
Bukkit.getScheduler().runTask(plugin, new Runnable() { Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -225,28 +226,27 @@ public class AuthMePlayerListener implements Listener {
}); });
} }
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onPreLogin(AsyncPlayerPreLoginEvent event) { public void onPreLogin(AsyncPlayerPreLoginEvent event) {
final String name = event.getName().toLowerCase(); final String name = event.getName().toLowerCase();
final Player player = Bukkit.getServer().getPlayer(name); final Player player = plugin.dataManager.getOnlinePlayerLower(name);
if (player == null) if (player == null)
return; return;
// Check if forceSingleSession is set to true, so kick player that has // Check if forceSingleSession is set to true, so kick player that has
// joined with same nick of online player // joined with same nick of online player
if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) { if (Settings.isForceSingleSessionEnabled) {
event.setKickMessage(m.send("same_nick")[0]); event.setKickMessage(m.getString("same_nick"));
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
if (LimboCache.getInstance().hasLimboPlayer(name)) if (LimboCache.getInstance().hasLimboPlayer(name))
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { if (limbo != null && PlayerCache.getInstance().isAuthenticated(name)) {
Utils.addNormal(player, limbo.getGroup()); Utils.addNormal(player, limbo.getGroup());
LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); LimboCache.getInstance().deleteLimboPlayer(name);
} }
} }
}); });
@ -268,8 +268,7 @@ public class AuthMePlayerListener implements Listener {
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) if (event.getResult() != PlayerLoginEvent.Result.ALLOWED)
return; return;
if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable && !plugin.authmePermissible(player, "authme.bypassantibot")) {
&& !plugin.authmePermissible(player, "authme.bypassantibot")) {
String code = Utils.getCountryCode(event.getAddress().getHostAddress()); String code = Utils.getCountryCode(event.getAddress().getHostAddress());
if (((code == null) || Settings.countriesBlacklist.contains(code))) { if (((code == null) || Settings.countriesBlacklist.contains(code))) {
event.setKickMessage(m.send("country_banned")[0]); event.setKickMessage(m.send("country_banned")[0]);
@ -277,8 +276,7 @@ public class AuthMePlayerListener implements Listener {
return; return;
} }
} }
if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable && !plugin.authmePermissible(player, "authme.bypassantibot")) {
&& !plugin.authmePermissible(player, "authme.bypassantibot")) {
String code = Utils.getCountryCode(event.getAddress().getHostAddress()); String code = Utils.getCountryCode(event.getAddress().getHostAddress());
if (((code == null) || !Settings.countries.contains(code))) { if (((code == null) || !Settings.countries.contains(code))) {
event.setKickMessage(m.send("country_banned")[0]); event.setKickMessage(m.send("country_banned")[0]);

View File

@ -280,7 +280,7 @@ public final class Settings extends YamlConfiguration {
forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands"); forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands");
forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole"); forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole");
customAttributes = configFile.getBoolean("Hooks.customAttributes"); customAttributes = configFile.getBoolean("Hooks.customAttributes");
generateImage = configFile.getBoolean("Email.generateImage", true); generateImage = configFile.getBoolean("Email.generateImage", false);
isMySQLWebsite = configFile.getBoolean("DataSource.mySQLWebsite", false); isMySQLWebsite = configFile.getBoolean("DataSource.mySQLWebsite", false);
// Load the welcome message // Load the welcome message
@ -476,7 +476,7 @@ public final class Settings extends YamlConfiguration {
changes = true; changes = true;
} }
if (!contains("Email.generateImage")) { if (!contains("Email.generateImage")) {
set("Email.generateImage", true); set("Email.generateImage", false);
changes = true; changes = true;
} }
if (!contains("DataSource.mySQLRealName")) { if (!contains("DataSource.mySQLRealName")) {

View File

@ -352,6 +352,8 @@ Email:
- 10minutemail.com - 10minutemail.com
# WhiteList only these domains for emails # WhiteList only these domains for emails
emailWhitelisted: [] emailWhitelisted: []
# Do we need to send new password draw in an image ?
generateImage: false
Hooks: Hooks:
# Do we need to hook with multiverse for spawn checking? # Do we need to hook with multiverse for spawn checking?
multiverse: true multiverse: true