mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-22 18:25:27 +01:00
Fix BCRYPT, Add WBB3 crypt, FIX CombatTag
This commit is contained in:
parent
d699f86cc7
commit
bca506b2d5
@ -129,8 +129,7 @@ public class Utils {
|
||||
final Location locat = new Location(world, x, y + 0.6D, z);
|
||||
final Location loc = locat.getBlock().getLocation();
|
||||
|
||||
Bukkit.getScheduler().runTask(AuthMe.getInstance(), new Runnable() {
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc);
|
||||
@ -141,7 +140,6 @@ public class Utils {
|
||||
pl.teleport(tpEvent.getTo());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
id = Bukkit.getScheduler().runTaskTimer(AuthMe.authme, new Runnable()
|
||||
@ -155,7 +153,7 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
}, 1L, 20L);
|
||||
Bukkit.getScheduler().runTaskLater(AuthMe.authme, new Runnable()
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AuthMe.authme, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -49,7 +49,7 @@ public class API {
|
||||
* @return true if player is authenticate
|
||||
*/
|
||||
public static boolean isAuthenticated(Player player) {
|
||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||
return PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,7 @@ import uk.org.whoami.authme.AuthMe;
|
||||
import uk.org.whoami.authme.Utils;
|
||||
import uk.org.whoami.authme.cache.auth.PlayerCache;
|
||||
import uk.org.whoami.authme.datasource.DataSource;
|
||||
import uk.org.whoami.authme.plugin.manager.CombatTagComunicator;
|
||||
import uk.org.whoami.authme.settings.Settings;
|
||||
|
||||
public class AuthMeEntityListener implements Listener{
|
||||
@ -61,6 +62,9 @@ public class AuthMeEntityListener implements Listener{
|
||||
Player player = (Player) entity;
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if(CombatTagComunicator.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
return;
|
||||
}
|
||||
@ -169,7 +173,7 @@ public class AuthMeEntityListener implements Listener{
|
||||
Player player = (Player) event.getEntity();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -198,7 +202,7 @@ public class AuthMeEntityListener implements Listener{
|
||||
Player player = (Player) event.getEntity();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1080,7 +1080,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player))
|
||||
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
|
@ -90,10 +90,15 @@ public class PasswordSecurity {
|
||||
return getMD5(getMD5(salt) + getMD5(message));
|
||||
}
|
||||
|
||||
private static String getBCrypt(String message, String salt) {
|
||||
private static String getBCrypt(String message, String salt) throws NoSuchAlgorithmException {
|
||||
return BCrypt.hashpw(message, salt);
|
||||
}
|
||||
|
||||
private static String getWBB3(String message, String salt) throws NoSuchAlgorithmException {
|
||||
|
||||
return getSHA1(salt.concat(getSHA1(salt.concat(getSHA1(message)))));
|
||||
}
|
||||
|
||||
private static String createSalt(int length) throws NoSuchAlgorithmException {
|
||||
byte[] msg = new byte[40];
|
||||
rnd.nextBytes(msg);
|
||||
@ -198,6 +203,18 @@ public class PasswordSecurity {
|
||||
userSalt.put(name, saltbcrypt);
|
||||
}
|
||||
return getBCrypt(password, saltbcrypt);
|
||||
case WBB3:
|
||||
String saltwbb = "";
|
||||
try {
|
||||
saltbcrypt = AuthMe.getInstance().database.getAuth(name).getSalt();
|
||||
} catch (NullPointerException npe) {
|
||||
} catch (ArrayIndexOutOfBoundsException aioobe) {
|
||||
}
|
||||
if(saltwbb.isEmpty() || saltwbb == null) {
|
||||
saltwbb = createSalt(40);
|
||||
userSalt.put(name, saltwbb);
|
||||
}
|
||||
return getWBB3(password, saltwbb);
|
||||
default:
|
||||
throw new NoSuchAlgorithmException("Unknown hash algorithm");
|
||||
}
|
||||
@ -208,6 +225,10 @@ public class PasswordSecurity {
|
||||
PhpBB checkHash = new PhpBB();
|
||||
return checkHash.phpbb_check_hash(password, hash);
|
||||
}
|
||||
if(!Settings.getMySQLColumnSalt.isEmpty() && Settings.getPasswordHash == HashAlgorithm.WBB3) {
|
||||
String saltwbb3 = AuthMe.getInstance().database.getAuth(playername).getSalt();
|
||||
return hash.equals(getWBB3(password, saltwbb3));
|
||||
}
|
||||
if(!Settings.getMySQLColumnSalt.isEmpty() && Settings.getPasswordHash == HashAlgorithm.IPB3) {
|
||||
String saltipb = AuthMe.getInstance().database.getAuth(playername).getSalt();
|
||||
return hash.equals(getSaltedIPB3(password, saltipb));
|
||||
@ -305,7 +326,8 @@ public class PasswordSecurity {
|
||||
|
||||
public enum HashAlgorithm {
|
||||
|
||||
MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB, PLAINTEXT, MYBB, IPB3, PHPFUSION, SMF, XFSHA1, XFSHA256, SALTED2MD5, JOOMLA, BCRYPT
|
||||
MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB, PLAINTEXT, MYBB, IPB3, PHPFUSION, SMF, XFSHA1,
|
||||
XFSHA256, SALTED2MD5, JOOMLA, BCRYPT, WBB3
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ password_error: '&cHesla se neshoduji!'
|
||||
pass_len: '&cVase heslo nedosahuje minimalni delky (4).'
|
||||
vb_nonActiv: '&cVas ucet neni aktivaovany, zkontrolujte si vas E-mail.'
|
||||
usage_changepassword: '&cPouziti: "/changepassword stareHeslo noveHeslo".'
|
||||
name_len: '&cYour nickname is too Short or too long'
|
||||
regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX'
|
||||
add_email: '&cPlease add your email with : /email add yourEmail confirmEmail'
|
||||
bad_database_email: '[AuthMe] This /email command only available with MySQL and SQLite, contact an Admin'
|
||||
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
|
||||
usage_captcha: '&cUsage: /captcha <theCaptcha>'
|
||||
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
|
||||
valid_captcha: '&cYour captcha is valid !'
|
||||
kick_forvip: '&cA VIP Player join the full server!'
|
||||
kick_fullserver: '&cThe server is actually full, Sorry!'
|
||||
name_len: '&cTvuj nick je priliz kratky, nebo priliz dlouhy'
|
||||
regex: '&cTvuj nick obsahuje nepovolene znaky. Pripustne znaky jsou: REG_EX'
|
||||
add_email: '&cPridej prosim svuj email pomoci : /email add TvujEmail TvujEmail'
|
||||
bad_database_email: '[AuthMe] Prikaz /email je mozno pouzit jen s MySQL a SQLite, kontaktuj Admina'
|
||||
recovery_email: '&cZapomels heslo? Zadej: /email recovery <TvujEmail>'
|
||||
usage_captcha: '&cPouzij: /captcha <Captcha_text>'
|
||||
wrong_captcha: '&cSpatne opsana Captcha, pouzij prosim: /captcha CAPTCHA_TEXT'
|
||||
valid_captcha: '&cZadana captcha je OK !'
|
||||
kick_forvip: '&cA VIP Hrac se pripojil na plny server!'
|
||||
kick_fullserver: '&cServer je plne obsazen, zkus to pozdeji prosim !'
|
||||
|
@ -1,43 +1,42 @@
|
||||
unknown_user: '&fBenutzer ist nicht in der Datenbank'
|
||||
unsafe_spawn: '&fDeine Logoutposition war unsicher, du wurdest zum Spawn teleportiert'
|
||||
not_logged_in: '&cNicht eingelogt!'
|
||||
reg_voluntarily: '&fDu kannst dich mit folgendem Befehl registrieren
|
||||
"/register passwort"'
|
||||
usage_log: '&cBenutze: /login passwort'
|
||||
not_logged_in: '&cNicht eingeloggt!'
|
||||
reg_voluntarily: '&fDu kannst dich mit folgendem Befehl registrieren "/register <passwort> <passwortBestätigen>"'
|
||||
usage_log: '&cBenutze: /login <passwort>'
|
||||
wrong_pwd: '&cFalsches Passwort'
|
||||
unregistered: '&cErfolgreich unregistriert!'
|
||||
unregistered: '&cBenutzerkonto erfolgreich gelöscht!'
|
||||
reg_disabled: '&cRegistrierungen sind deaktiviert'
|
||||
valid_session: '&cErfolgreich eingelogt'
|
||||
login: '&cErfolgreich eingelogt!'
|
||||
vb_nonActiv: '&fDein Account ist noch nicht aktiviert, bitte pruefe deine E-Mails!'
|
||||
user_regged: '&cBenutzername wurde schon registriert'
|
||||
usage_reg: '&cBenutze: /register passwort'
|
||||
valid_session: '&cErfolgreich eingeloggt'
|
||||
login: '&cErfolgreich eingeloggt!'
|
||||
vb_nonActiv: '&fDein Account wurde noch nicht aktiviert. Bitte prüfe Deine E-Mails!'
|
||||
user_regged: '&cBenutzername ist schon vergeben'
|
||||
usage_reg: '&cBenutze: /register <passwort> <passwortBestätigen>'
|
||||
max_reg: '&fDu hast die maximale Anzahl an Accounts erreicht'
|
||||
no_perm: '&cKeine Rechte'
|
||||
error: '&fEin Fehler ist unterlaufen, bitte kontaktiere einen Admin'
|
||||
login_msg: '&cBitte logge dich ein mit "/login passwort"'
|
||||
reg_msg: '&cBitte registriere dich mit "/register passwort"'
|
||||
usage_unreg: '&cBenutze: /unregister passwort'
|
||||
pwd_changed: '&cPasswort geaendert!'
|
||||
error: '&fEin Fehler ist aufgetreten. Bitte kontaktiere einen Admin'
|
||||
login_msg: '&cBitte logge dich ein mit "/login <passwort>"'
|
||||
reg_msg: '&cBitte registriere dich mit "/register <passwort> <passwortBestätigen>"'
|
||||
usage_unreg: '&cBenutze: /unregister <passwort>'
|
||||
pwd_changed: '&cPasswort geändert!'
|
||||
user_unknown: '&cBenutzername nicht registriert'
|
||||
password_error: '&fPasswort falsch'
|
||||
unvalid_session: '&fPerioden login Fehler, bitte warte...'
|
||||
unvalid_session: '&fUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist'
|
||||
reg_only: '&fNur registrierte Spieler! Bitte besuche http://example.com zum registrieren'
|
||||
logged_in: '&cSchon eingelogt!'
|
||||
logout: '&cErfolgreich ausgelogt'
|
||||
logged_in: '&cBereits eingeloggt!'
|
||||
logout: '&cErfolgreich ausgeloggt'
|
||||
same_nick: '&fSelber Name spielt bereits'
|
||||
registered: '&cErfolgreich registriert!'
|
||||
pass_len: '&fIhr Passwort erreicht nicht die minimale Laenge oder überschreitet die maximale Laenge'
|
||||
pass_len: '&fDein Passwort ist zu kurz oder zu langg'
|
||||
reload: '&fKonfiguration und Datenbank neu geladen'
|
||||
timeout: '&fLogin dauerte zu lange'
|
||||
usage_changepassword: '&fBenutze: /changepassword altesPasswort neuesPasswort'
|
||||
name_len: '&cYour nickname is too Short or too long'
|
||||
regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX'
|
||||
add_email: '&cPlease add your email with : /email add yourEmail confirmEmail'
|
||||
bad_database_email: '[AuthMe] This /email command only available with MySQL and SQLite, contact an Admin'
|
||||
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
|
||||
usage_captcha: '&cUsage: /captcha <theCaptcha>'
|
||||
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
|
||||
valid_captcha: '&cYour captcha is valid !'
|
||||
kick_forvip: '&cA VIP Player join the full server!'
|
||||
kick_fullserver: '&cThe server is actually full, Sorry!'
|
||||
timeout: '&fZeitüberschreitung beim Login'
|
||||
usage_changepassword: '&fBenutze: /changepassword <altesPasswort> <neuesPasswort>'
|
||||
name_len: '&cDein Nickname ist zu kurz oder zu lang'
|
||||
regex: '&cDein Nichname enthält nicht erlaubte Zeichen. Zulässige Zeichen: REG_EX'
|
||||
add_email: '&cBitte hinterlege Deine E-Mail Adresse: /email add <deineEmail> <emailBestätigen>'
|
||||
bad_database_email: '[AuthMe] Der /email Befehl ist nur mit MySQL und SQLite kompatibel. Bitte kontaktieren einen Admin'
|
||||
recovery_email: '&cPasswort vergessen? Nutze "/email recovery <yourEmail>" für ein neues Passwort'
|
||||
usage_captcha: '&cBenutze: /captcha <dasCaptcha>'
|
||||
wrong_captcha: '&cFalsches Captcha, bitte nutze: /captcha <dasCaptcha>'
|
||||
valid_captcha: '&cDas Captcha ist korrekt!'
|
||||
kick_forvip: '&cEin VIP Spieler hat den vollen Server betreten!'
|
||||
kick_fullserver: '&cDer Server ist momentan voll, Sorry!'
|
7
src/main/resources/spawn.yml
Normal file
7
src/main/resources/spawn.yml
Normal file
@ -0,0 +1,7 @@
|
||||
spawn:
|
||||
world: ''
|
||||
x: ''
|
||||
y: ''
|
||||
z: ''
|
||||
yaw: ''
|
||||
pitch: ''
|
12
src/main/resources/spout.yml
Normal file
12
src/main/resources/spout.yml
Normal file
@ -0,0 +1,12 @@
|
||||
Spout GUI enabled: true
|
||||
LoginScreen:
|
||||
enabled: true
|
||||
exit button: Quit
|
||||
exit message: Good Bye
|
||||
login button: Login
|
||||
title: LOGIN
|
||||
text:
|
||||
- Sample text
|
||||
- Change this at spout.yml
|
||||
- '--- AuthMe Reloaded by ---'
|
||||
- d4rkwarriors and Xephi59
|
Loading…
Reference in New Issue
Block a user