mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 01:57:48 +01:00
Minor - Add datasource test, minor code householding
This commit is contained in:
parent
b916c9b2be
commit
5fce849ce7
@ -351,8 +351,9 @@ public class SQLite implements DataSource {
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
try {
|
||||
if (con != null && !con.isClosed())
|
||||
con.close();
|
||||
if (con != null && !con.isClosed()) {
|
||||
con.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logSqlException(ex);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called when a player uses the /login command with correct credentials.
|
||||
* {@link #setCanLogin(boolean) <code>event.setCanLogin(false)</code>} prevents the player from logging in.
|
||||
* {@link #setCanLogin(boolean) event.setCanLogin(false)} prevents the player from logging in.
|
||||
*/
|
||||
public class AuthMeAsyncPreLoginEvent extends CustomEvent {
|
||||
|
||||
|
@ -211,7 +211,7 @@ public final class Settings {
|
||||
countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist");
|
||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
||||
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
||||
forceRegLogin = load(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER);
|
||||
spawnPriority = load(RestrictionSettings.SPAWN_PRIORITY);
|
||||
getMaxLoginPerIp = configFile.getInt("settings.restrictions.maxLoginPerIp", 0);
|
||||
getMaxJoinPerIp = configFile.getInt("settings.restrictions.maxJoinPerIp", 0);
|
||||
|
@ -39,7 +39,7 @@ public class RegistrationSettings implements SettingsClass {
|
||||
newProperty("settings.registration.doubleEmailCheck", false);
|
||||
|
||||
@Comment({
|
||||
"Do we force kicking player after a successful registration?",
|
||||
"Do we force kick a player after a successful registration?",
|
||||
"Do not use with login feature below"})
|
||||
public static final Property<Boolean> FORCE_KICK_AFTER_REGISTER =
|
||||
newProperty("settings.registration.forceKickAfterRegister", false);
|
||||
|
@ -286,4 +286,18 @@ public abstract class AbstractDataSourceIntegrationTest {
|
||||
assertThat(updatedList, hasItem(equalTo("test-1")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldUpdateRealName() {
|
||||
// given
|
||||
DataSource dataSource = getDataSource();
|
||||
|
||||
// when
|
||||
boolean response1 = dataSource.updateRealName("bobby", "BOBBY");
|
||||
boolean response2 = dataSource.updateRealName("notExists", "NOTEXISTS");
|
||||
|
||||
// then
|
||||
assertThat(response1 && response2, equalTo(true));
|
||||
assertThat(dataSource.getAuth("bobby"), hasAuthBasicData("bobby", "BOBBY", "your@email.com", "123.45.67.89"));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user