Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into command-perms-refactor

This commit is contained in:
ljacqu 2015-12-04 19:35:57 +01:00
commit 0c1589f93a
9 changed files with 84 additions and 10 deletions

View File

@ -285,7 +285,7 @@
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>2.4.1</version> <version>2.4.2</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -298,7 +298,7 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId> <artifactId>slf4j-jdk14</artifactId>
<version>1.7.12</version> <version>1.7.13</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@ -502,6 +502,10 @@
<artifactId>AllPay</artifactId> <artifactId>AllPay</artifactId>
<groupId>com.fernferret.allpay</groupId> <groupId>com.fernferret.allpay</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>Vault</artifactId>
<groupId>net.milkbowl.vault</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>VaultAPI</artifactId> <artifactId>VaultAPI</artifactId>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>

View File

@ -48,7 +48,7 @@ public class SendMailSSL {
final String subject = Settings.getMailSubject; final String subject = Settings.getMailSubject;
final String smtp = Settings.getmailSMTP; final String smtp = Settings.getmailSMTP;
final String password = Settings.getmailPassword; final String password = Settings.getmailPassword;
final String mailText = Settings.getMailText.replace("<playername>", auth.getNickname()).replace("<servername>", plugin.getServer().getServerName()).replace("<generatedpass>", newPass); final String mailText = Settings.getMailText.replace("%playername%", auth.getNickname()).replace("%servername%", plugin.getServer().getServerName()).replace("%generatedpass%", newPass);
final String mail = auth.getEmail(); final String mail = auth.getEmail();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@ -76,7 +76,7 @@ public class SendMailSSL {
ImageIO.write(gen.generateImage(), "jpg", file); ImageIO.write(gen.generateImage(), "jpg", file);
DataSource source = new FileDataSource(file); DataSource source = new FileDataSource(file);
String tag = email.embed(source, auth.getNickname() + "_new_pass.jpg"); String tag = email.embed(source, auth.getNickname() + "_new_pass.jpg");
content = content.replace("<image>", "<img src=\"cid:" + tag + "\">"); content = content.replace("%image%", "<img src=\"cid:" + tag + "\">");
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail);
} }

View File

@ -117,6 +117,8 @@ public class LimboCache {
* @param name String * @param name String
*/ */
public void deleteLimboPlayer(String name) { public void deleteLimboPlayer(String name) {
if (name == null)
return;
cache.remove(name); cache.remove(name);
} }
@ -128,6 +130,8 @@ public class LimboCache {
* @return LimboPlayer * @return LimboPlayer
*/ */
public LimboPlayer getLimboPlayer(String name) { public LimboPlayer getLimboPlayer(String name) {
if (name == null)
return null;
return cache.get(name); return cache.get(name);
} }
@ -139,6 +143,8 @@ public class LimboCache {
* @return boolean * @return boolean
*/ */
public boolean hasLimboPlayer(String name) { public boolean hasLimboPlayer(String name) {
if (name == null)
return false;
return cache.containsKey(name); return cache.containsKey(name);
} }

View File

@ -55,7 +55,7 @@ public class RegisterCommand extends ExecutableCommand {
} }
if (commandArguments.getCount() > 1 && Settings.getEnablePasswordVerifier) { if (commandArguments.getCount() > 1 && Settings.getEnablePasswordVerifier) {
if (!commandArguments.get(0).equals(commandArguments.get(1))) { if (!commandArguments.get(0).equals(commandArguments.get(1))) {
m.send(player, MessageKey.PASSWORD_IS_USERNAME_ERROR); m.send(player, MessageKey.PASSWORD_MATCH_ERROR);
return true; return true;
} }
} }

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.datasource; package fr.xephi.authme.datasource;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.pool.PoolInitializationException; import com.zaxxer.hikari.pool.HikariPool.PoolInitializationException;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;

View File

@ -253,8 +253,11 @@ public class AsynchronousJoin {
? m.retrieve(MessageKey.REGISTER_EMAIL_MESSAGE) ? m.retrieve(MessageKey.REGISTER_EMAIL_MESSAGE)
: m.retrieve(MessageKey.REGISTER_MESSAGE); : m.retrieve(MessageKey.REGISTER_MESSAGE);
} }
BukkitTask msgTask = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval)); if (LimboCache.getInstance().getLimboPlayer(name) != null)
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgTask); {
BukkitTask msgTask = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgTask);
}
} }
private boolean needFirstSpawn() { private boolean needFirstSpawn() {

View File

@ -8,7 +8,11 @@ import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.util.Wrapper; import fr.xephi.authme.util.Wrapper;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import java.io.*; import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
@ -23,6 +27,7 @@ public final class Settings {
public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules"); public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules");
public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache");
public static final File AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db"); public static final File AUTH_FILE = new File(PLUGIN_FOLDER, "auths.db");
public static final File EMAIL_FILE = new File(PLUGIN_FOLDER, "email.html");
public static final File SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml"); public static final File SETTINGS_FILE = new File(PLUGIN_FOLDER, "config.yml");
public static final File LOG_FILE = new File(PLUGIN_FOLDER, "authme.log"); public static final File LOG_FILE = new File(PLUGIN_FOLDER, "authme.log");
// This is not an option! // This is not an option!
@ -221,7 +226,7 @@ public final class Settings {
maxLoginTry = configFile.getInt("Security.captcha.maxLoginTry", 5); maxLoginTry = configFile.getInt("Security.captcha.maxLoginTry", 5);
captchaLength = configFile.getInt("Security.captcha.captchaLength", 5); captchaLength = configFile.getInt("Security.captcha.captchaLength", 5);
getMailSubject = configFile.getString("Email.mailSubject", "Your new AuthMe Password"); getMailSubject = configFile.getString("Email.mailSubject", "Your new AuthMe Password");
getMailText = configFile.getString("Email.mailText", "Dear <playername>, <br /><br /> This is your new AuthMe password for the server <br /><br /> <servername> : <br /><br /> <generatedpass><br /><br />Do not forget to change password after login! <br /> /changepassword <generatedpass> newPassword"); getMailText = loadEmailText();
emailRegistration = configFile.getBoolean("settings.registration.enableEmailRegistrationSystem", false); emailRegistration = configFile.getBoolean("settings.registration.enableEmailRegistrationSystem", false);
saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8); saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8);
getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1); getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1);
@ -285,7 +290,40 @@ public final class Settings {
} }
public static void setValue(String key, Object value) { private static String loadEmailText() {
if (!EMAIL_FILE.exists())
saveDefaultEmailText();
StringBuilder str = new StringBuilder();
try {
BufferedReader in = new BufferedReader(new FileReader(EMAIL_FILE));
String s;
while ((s = in.readLine()) != null)
str.append(s);
in.close();
} catch(IOException e)
{
}
return str.toString();
}
private static void saveDefaultEmailText() {
InputStream file = plugin.getResource("email.html");
StringBuilder str = new StringBuilder();
try {
BufferedReader in = new BufferedReader(new InputStreamReader(file, Charset.forName("utf-8")));
String s;
while ((s = in.readLine()) != null)
str.append(s);
in.close();
Files.touch(EMAIL_FILE);
Files.write(str.toString(), EMAIL_FILE, Charsets.UTF_8);
}
catch(Exception e)
{
}
}
public static void setValue(String key, Object value) {
instance.set(key, value); instance.set(key, value);
save(); save();
} }
@ -636,6 +674,12 @@ public final class Settings {
changes = true; changes = true;
} }
if (contains("Email.mailText"))
{
set("Email.mailText", null);
ConsoleLogger.showError("Remove Email.mailText from config, we now use the email.html file");
}
if (changes) { if (changes) {
plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me"); plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me");
plugin.getLogger().warning("Please check your config.yml file for new configs!"); plugin.getLogger().warning("Please check your config.yml file for new configs!");

View File

@ -393,6 +393,7 @@ Protection:
- 'US' - 'US'
- 'GB' - 'GB'
# Countries blacklisted automatically ( without any needed to enable protection ) # Countries blacklisted automatically ( without any needed to enable protection )
# PLEASE USE QUOTES!
countriesBlacklist: countriesBlacklist:
- 'A1' - 'A1'
# Do we need to enable automatic antibot system? # Do we need to enable automatic antibot system?

View File

@ -0,0 +1,16 @@
<h1>
Dear %playername%,
</h1>
<p>
This is your new AuthMe password for the server %servername%:
%generatedpass%
%image%
Do not forget to change password after login!
/changepassword %generatedpass% newPassword'
See you on %servername%!
</p>