mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 12:45:57 +01:00
#769 Create integration test for service initialization in onEnable()
- Test that services can be instantiated (e.g. no circular dependencies) - Instantiate Messages via injection instead of manually
This commit is contained in:
parent
2bdd2504df
commit
4b3ab4b116
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme;
|
package fr.xephi.authme;
|
||||||
|
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.api.NewAPI;
|
import fr.xephi.authme.api.NewAPI;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
@ -36,7 +37,6 @@ import fr.xephi.authme.output.Messages;
|
|||||||
import fr.xephi.authme.permission.PermissionsManager;
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
import fr.xephi.authme.permission.PermissionsSystemType;
|
import fr.xephi.authme.permission.PermissionsSystemType;
|
||||||
import fr.xephi.authme.process.Management;
|
import fr.xephi.authme.process.Management;
|
||||||
import fr.xephi.authme.task.PurgeService;
|
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.crypts.SHA256;
|
import fr.xephi.authme.security.crypts.SHA256;
|
||||||
import fr.xephi.authme.settings.NewSetting;
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
@ -51,6 +51,7 @@ import fr.xephi.authme.settings.properties.RestrictionSettings;
|
|||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.settings.properties.SettingsFieldRetriever;
|
import fr.xephi.authme.settings.properties.SettingsFieldRetriever;
|
||||||
import fr.xephi.authme.settings.propertymap.PropertyMap;
|
import fr.xephi.authme.settings.propertymap.PropertyMap;
|
||||||
|
import fr.xephi.authme.task.PurgeService;
|
||||||
import fr.xephi.authme.util.BukkitService;
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import fr.xephi.authme.util.FileUtils;
|
import fr.xephi.authme.util.FileUtils;
|
||||||
import fr.xephi.authme.util.GeoLiteAPI;
|
import fr.xephi.authme.util.GeoLiteAPI;
|
||||||
@ -64,6 +65,8 @@ import org.bukkit.Server;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
@ -127,6 +130,22 @@ public class AuthMe extends JavaPlugin {
|
|||||||
private BukkitService bukkitService;
|
private BukkitService bukkitService;
|
||||||
private AuthMeServiceInitializer initializer;
|
private AuthMeServiceInitializer initializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public AuthMe() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constructor for unit testing.
|
||||||
|
*/
|
||||||
|
@VisibleForTesting
|
||||||
|
@SuppressWarnings("deprecation") // the super constructor is deprecated to mark it for unit testing only
|
||||||
|
protected AuthMe(final PluginLoader loader, final Server server, final PluginDescriptionFile description,
|
||||||
|
final File dataFolder, final File file) {
|
||||||
|
super(loader, server, description, dataFolder, file);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plugin's instance.
|
* Get the plugin's instance.
|
||||||
*
|
*
|
||||||
@ -204,8 +223,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
messages = new Messages(newSettings.getMessagesFile(), newSettings.getDefaultMessagesFile());
|
|
||||||
|
|
||||||
// Connect to the database and setup tables
|
// Connect to the database and setup tables
|
||||||
try {
|
try {
|
||||||
setupDatabase(newSettings);
|
setupDatabase(newSettings);
|
||||||
@ -228,21 +245,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
// Register elements we instantiate manually
|
// Register elements we instantiate manually
|
||||||
initializer.register(NewSetting.class, newSettings);
|
initializer.register(NewSetting.class, newSettings);
|
||||||
initializer.register(Messages.class, messages);
|
|
||||||
initializer.register(DataSource.class, database);
|
initializer.register(DataSource.class, database);
|
||||||
|
|
||||||
// Some statically injected things
|
instantiateServices(initializer);
|
||||||
initializer.register(PlayerCache.class, PlayerCache.getInstance());
|
|
||||||
|
|
||||||
permsMan = initializer.get(PermissionsManager.class);
|
|
||||||
bukkitService = initializer.get(BukkitService.class);
|
|
||||||
pluginHooks = initializer.get(PluginHooks.class);
|
|
||||||
passwordSecurity = initializer.get(PasswordSecurity.class);
|
|
||||||
spawnLoader = initializer.get(SpawnLoader.class);
|
|
||||||
commandHandler = initializer.get(CommandHandler.class);
|
|
||||||
api = initializer.get(NewAPI.class);
|
|
||||||
management = initializer.get(Management.class);
|
|
||||||
initializer.get(API.class);
|
|
||||||
|
|
||||||
// Set up Metrics
|
// Set up Metrics
|
||||||
MetricsStarter.setupMetrics(this, newSettings);
|
MetricsStarter.setupMetrics(this, newSettings);
|
||||||
@ -300,6 +305,22 @@ public class AuthMe extends JavaPlugin {
|
|||||||
purgeService.runAutoPurge();
|
purgeService.runAutoPurge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void instantiateServices(AuthMeServiceInitializer initializer) {
|
||||||
|
// Some statically injected things
|
||||||
|
initializer.register(PlayerCache.class, PlayerCache.getInstance());
|
||||||
|
|
||||||
|
messages = initializer.get(Messages.class);
|
||||||
|
permsMan = initializer.get(PermissionsManager.class);
|
||||||
|
bukkitService = initializer.get(BukkitService.class);
|
||||||
|
pluginHooks = initializer.get(PluginHooks.class);
|
||||||
|
passwordSecurity = initializer.get(PasswordSecurity.class);
|
||||||
|
spawnLoader = initializer.get(SpawnLoader.class);
|
||||||
|
commandHandler = initializer.get(CommandHandler.class);
|
||||||
|
api = initializer.get(NewAPI.class);
|
||||||
|
management = initializer.get(Management.class);
|
||||||
|
initializer.get(API.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the mail API, if enabled.
|
* Set up the mail API, if enabled.
|
||||||
*/
|
*/
|
||||||
@ -329,7 +350,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Register all event listeners.
|
* Register all event listeners.
|
||||||
*/
|
*/
|
||||||
private void registerEventListeners(AuthMeServiceInitializer initializer) {
|
protected void registerEventListeners(AuthMeServiceInitializer initializer) {
|
||||||
// Get the plugin manager instance
|
// Get the plugin manager instance
|
||||||
PluginManager pluginManager = getServer().getPluginManager();
|
PluginManager pluginManager = getServer().getPluginManager();
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@ -26,12 +27,12 @@ public class Messages implements SettingsDependent {
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param messageFile The messages file to use
|
* @param settings The settings
|
||||||
* @param defaultFile The file with messages to use as default if missing
|
|
||||||
*/
|
*/
|
||||||
public Messages(File messageFile, String defaultFile) {
|
@Inject
|
||||||
initializeFile(messageFile);
|
Messages(NewSetting settings) {
|
||||||
this.defaultFile = defaultFile;
|
loadSettings(settings);
|
||||||
|
this.defaultFile = settings.getDefaultMessagesFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,10 +119,7 @@ public class Messages implements SettingsDependent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadSettings(NewSetting settings) {
|
public void loadSettings(NewSetting settings) {
|
||||||
initializeFile(settings.getMessagesFile());
|
File messageFile = settings.getMessagesFile();
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeFile(File messageFile) {
|
|
||||||
this.configuration = YamlConfiguration.loadConfiguration(messageFile);
|
this.configuration = YamlConfiguration.loadConfiguration(messageFile);
|
||||||
this.fileName = messageFile.getName();
|
this.fileName = messageFile.getName();
|
||||||
}
|
}
|
||||||
|
127
src/test/java/fr/xephi/authme/AuthMeInitializationTest.java
Normal file
127
src/test/java/fr/xephi/authme/AuthMeInitializationTest.java
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
package fr.xephi.authme;
|
||||||
|
|
||||||
|
import com.google.common.io.Files;
|
||||||
|
import fr.xephi.authme.api.NewAPI;
|
||||||
|
import fr.xephi.authme.command.CommandHandler;
|
||||||
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
import fr.xephi.authme.initialization.AuthMeServiceInitializer;
|
||||||
|
import fr.xephi.authme.initialization.DataFolder;
|
||||||
|
import fr.xephi.authme.listener.AuthMeBlockListener;
|
||||||
|
import fr.xephi.authme.output.Messages;
|
||||||
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
|
import fr.xephi.authme.process.Management;
|
||||||
|
import fr.xephi.authme.process.login.ProcessSyncPlayerLogin;
|
||||||
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
|
import fr.xephi.authme.task.PurgeService;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import static fr.xephi.authme.settings.TestSettingsMigrationServices.alwaysFulfilled;
|
||||||
|
import static fr.xephi.authme.settings.properties.SettingsFieldRetriever.getAllPropertyFields;
|
||||||
|
import static org.hamcrest.Matchers.not;
|
||||||
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.mockito.BDDMockito.given;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integration test verifying that all services can be initialized in {@link AuthMe}
|
||||||
|
* with the {@link AuthMeServiceInitializer}.
|
||||||
|
*/
|
||||||
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
public class AuthMeInitializationTest {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private PluginLoader pluginLoader;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private Server server;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private PluginManager pluginManager;
|
||||||
|
|
||||||
|
private AuthMe authMe;
|
||||||
|
private File dataFolder;
|
||||||
|
private File settingsFile;
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpLogger() {
|
||||||
|
TestHelper.setupLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void initAuthMe() throws IOException {
|
||||||
|
dataFolder = temporaryFolder.newFolder();
|
||||||
|
settingsFile = new File(dataFolder, "config.yml");
|
||||||
|
Files.copy(TestHelper.getJarFile("/initialization/config.test.yml"), settingsFile);
|
||||||
|
|
||||||
|
// Mock / wire various Bukkit components
|
||||||
|
given(server.getLogger()).willReturn(mock(Logger.class));
|
||||||
|
ReflectionTestUtils.setField(Bukkit.class, null, "server", server);
|
||||||
|
given(server.getScheduler()).willReturn(mock(BukkitScheduler.class));
|
||||||
|
given(server.getPluginManager()).willReturn(pluginManager);
|
||||||
|
|
||||||
|
// PluginDescriptionFile is final: need to create a sample one
|
||||||
|
PluginDescriptionFile descriptionFile = new PluginDescriptionFile(
|
||||||
|
"AuthMe", "N/A", AuthMe.class.getCanonicalName());
|
||||||
|
|
||||||
|
// Initialize AuthMe
|
||||||
|
authMe = new AuthMe(pluginLoader, server, descriptionFile, dataFolder, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldInitializeAllServices() {
|
||||||
|
// given
|
||||||
|
NewSetting settings = new NewSetting(settingsFile, dataFolder, getAllPropertyFields(), alwaysFulfilled());
|
||||||
|
|
||||||
|
// TODO ljacqu 20160619: At some point setting the "plugin" field should not longer be necessary
|
||||||
|
// We only require it right now because of usages of AuthMe#getInstance()
|
||||||
|
ReflectionTestUtils.setField(AuthMe.class, null, "plugin", authMe);
|
||||||
|
|
||||||
|
AuthMeServiceInitializer initializer = new AuthMeServiceInitializer("fr.xephi.authme");
|
||||||
|
initializer.provide(DataFolder.class, dataFolder);
|
||||||
|
initializer.register(Server.class, server);
|
||||||
|
initializer.register(PluginManager.class, pluginManager);
|
||||||
|
|
||||||
|
initializer.register(AuthMe.class, authMe);
|
||||||
|
initializer.register(NewSetting.class, settings);
|
||||||
|
initializer.register(DataSource.class, mock(DataSource.class));
|
||||||
|
initializer.register(Messages.class, mock(Messages.class));
|
||||||
|
|
||||||
|
// when
|
||||||
|
authMe.instantiateServices(initializer);
|
||||||
|
authMe.registerEventListeners(initializer);
|
||||||
|
|
||||||
|
// then
|
||||||
|
// Take a few samples and ensure that they are not null
|
||||||
|
assertThat(initializer.getIfAvailable(AuthMeBlockListener.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(CommandHandler.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(Management.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(NewAPI.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(PasswordSecurity.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(PermissionsManager.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(ProcessSyncPlayerLogin.class), not(nullValue()));
|
||||||
|
assertThat(initializer.getIfAvailable(PurgeService.class), not(nullValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -53,7 +53,10 @@ public class MessagesIntegrationTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUpMessages() {
|
public void setUpMessages() {
|
||||||
File testFile = TestHelper.getJarFile(YML_TEST_FILE);
|
File testFile = TestHelper.getJarFile(YML_TEST_FILE);
|
||||||
messages = new Messages(testFile, YML_DEFAULT_TEST_FILE);
|
NewSetting settings = mock(NewSetting.class);
|
||||||
|
given(settings.getMessagesFile()).willReturn(testFile);
|
||||||
|
given(settings.getDefaultMessagesFile()).willReturn(YML_DEFAULT_TEST_FILE);
|
||||||
|
messages = new Messages(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -232,7 +235,9 @@ public class MessagesIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void shouldAllowNullAsDefaultFile() {
|
public void shouldAllowNullAsDefaultFile() {
|
||||||
// given
|
// given
|
||||||
Messages testMessages = new Messages(TestHelper.getJarFile(YML_TEST_FILE), null);
|
NewSetting settings = mock(NewSetting.class);
|
||||||
|
given(settings.getMessagesFile()).willReturn(TestHelper.getJarFile(YML_TEST_FILE));
|
||||||
|
Messages testMessages = new Messages(settings);
|
||||||
// Key not present in test file
|
// Key not present in test file
|
||||||
MessageKey key = MessageKey.TWO_FACTOR_CREATE;
|
MessageKey key = MessageKey.TWO_FACTOR_CREATE;
|
||||||
|
|
||||||
|
389
src/test/resources/initialization/config.test.yml
Normal file
389
src/test/resources/initialization/config.test.yml
Normal file
@ -0,0 +1,389 @@
|
|||||||
|
# Copy of config.yml for integration testing the initialization of AuthMe components
|
||||||
|
# Removed DataSource section: DataSource is not concretely instantiated so they should be largely unused
|
||||||
|
|
||||||
|
settings:
|
||||||
|
# The name shown in the help messages.
|
||||||
|
helpHeader: AuthMeReloaded
|
||||||
|
sessions:
|
||||||
|
# Do you want to enable the session feature?
|
||||||
|
# If enabled, when a player authenticates successfully,
|
||||||
|
# his IP and his nickname is saved.
|
||||||
|
# The next time the player joins the server, if his IP
|
||||||
|
# is the same of the last time, and the timeout time
|
||||||
|
# hasn't expired, he will not need to authenticate.
|
||||||
|
enabled: false
|
||||||
|
# After how many minutes a session should expire?
|
||||||
|
# 0 for unlimited time (Very dangerous, use it at your own risk!)
|
||||||
|
# Consider that session will end only after the timeout time, and
|
||||||
|
# if the player's ip has changed but the timeout hasn't expired,
|
||||||
|
# player will be kicked out of sever due to invalidSession!
|
||||||
|
timeout: 10
|
||||||
|
# Should the session expire if the player try to login with an
|
||||||
|
# another IP Address?
|
||||||
|
sessionExpireOnIpChange: true
|
||||||
|
restrictions:
|
||||||
|
# Can not authenticated players chat and see the chat log?
|
||||||
|
# Care that this feature blocks also all the commands not
|
||||||
|
# listed in the list below.
|
||||||
|
allowChat: false
|
||||||
|
# Can not authenticated players see the chat log?
|
||||||
|
hideChat: false
|
||||||
|
# Commands allowed when a player is not authenticated
|
||||||
|
allowCommands:
|
||||||
|
- /login
|
||||||
|
- /register
|
||||||
|
- /l
|
||||||
|
- /reg
|
||||||
|
- /email
|
||||||
|
- /captcha
|
||||||
|
# Max number of allowed registrations per IP (default: 1)
|
||||||
|
maxRegPerIp: 1
|
||||||
|
# Max allowed username length
|
||||||
|
maxNicknameLength: 16
|
||||||
|
# When this setting is enabled, online players can't be kicked out
|
||||||
|
# due to "Logged in from another Location"
|
||||||
|
# This setting will prevent potetial security exploits.
|
||||||
|
ForceSingleSession: true
|
||||||
|
ForceSpawnLocOnJoin:
|
||||||
|
# If enabled, every player will be teleported to the world spawnpoint
|
||||||
|
# after successful authentication.
|
||||||
|
# The quit location of the player will be overwritten.
|
||||||
|
# This is different from "teleportUnAuthedToSpawn" that teleport player
|
||||||
|
# back to his quit location after the authentication.
|
||||||
|
enabled: false
|
||||||
|
# WorldNames where we need to force the spawn location
|
||||||
|
# Case-sensitive!
|
||||||
|
worlds:
|
||||||
|
- 'world'
|
||||||
|
- 'world_nether'
|
||||||
|
- 'world_the_end'
|
||||||
|
# This option will save the quit location of the players.
|
||||||
|
SaveQuitLocation: false
|
||||||
|
# To activate the restricted user feature you need
|
||||||
|
# to enable this option and configure the
|
||||||
|
# AllowedRestrctedUser field.
|
||||||
|
AllowRestrictedUser: false
|
||||||
|
# The restricted user feature will kick players listed below
|
||||||
|
# if they don't match of the defined ip address.
|
||||||
|
# Example:
|
||||||
|
# AllowedRestrictedUser:
|
||||||
|
# - playername;127.0.0.1
|
||||||
|
AllowedRestrictedUser: []
|
||||||
|
# Should unregistered players be kicked immediately?
|
||||||
|
kickNonRegistered: false
|
||||||
|
# Should players be kicked on wrong password?
|
||||||
|
kickOnWrongPassword: false
|
||||||
|
# Should not logged in players be teleported to the spawn?
|
||||||
|
# After the authentication they will be teleported back to
|
||||||
|
# their normal position.
|
||||||
|
teleportUnAuthedToSpawn: false
|
||||||
|
# Minimum allowed nick length
|
||||||
|
minNicknameLength: 4
|
||||||
|
# Can unregistered players walk around?
|
||||||
|
allowMovement: false
|
||||||
|
# Should not authenticated players have speed = 0?
|
||||||
|
# This will reset the fly/walk speed to default value after the login.
|
||||||
|
removeSpeed: true
|
||||||
|
# After how many time players who fail to login or register
|
||||||
|
# should be kicked? Set to 0 to disable.
|
||||||
|
timeout: 30
|
||||||
|
# Regex sintax of allowed characters in the player name.
|
||||||
|
allowedNicknameCharacters: '[a-zA-Z0-9_]*'
|
||||||
|
# How far can unregistered players walk? Set to 0
|
||||||
|
# for unlimited radius
|
||||||
|
allowedMovementRadius: 100
|
||||||
|
# Enable double check of password when you register
|
||||||
|
# when it's true, registration require that kind of command:
|
||||||
|
# /register <password> <confirmPassword>
|
||||||
|
enablePasswordConfirmation: true
|
||||||
|
# Should we protect the player inventory before logging in? Requires ProtocolLib.
|
||||||
|
ProtectInventoryBeforeLogIn: true
|
||||||
|
# Should we deny the tabcomplete feature before logging in? Requires ProtocolLib.
|
||||||
|
DenyTabCompleteBeforeLogin: true
|
||||||
|
# Should we hide the tablist before logging in? Requires ProtocolLib.
|
||||||
|
HideTablistBeforeLogin: true
|
||||||
|
# Should we display all other accounts from a player when he joins?
|
||||||
|
# permission: /authme.admin.accounts
|
||||||
|
displayOtherAccounts: true
|
||||||
|
# Ban ip when the ip is not the ip registered in database
|
||||||
|
banUnsafedIP: false
|
||||||
|
# Spawn Priority, Values : authme, essentials, multiverse, default
|
||||||
|
spawnPriority: authme,essentials,multiverse,default
|
||||||
|
# Maximum Login authorized by IP
|
||||||
|
maxLoginPerIp: 0
|
||||||
|
# Maximum Join authorized by IP
|
||||||
|
maxJoinPerIp: 0
|
||||||
|
# AuthMe will NEVER teleport players !
|
||||||
|
noTeleport: false
|
||||||
|
# Regex syntax for allowed Chars in passwords.
|
||||||
|
allowedPasswordCharacters: '[\x21-\x7E]*'
|
||||||
|
# Keeps collisions disabled for logged players
|
||||||
|
# Works only with MC 1.9
|
||||||
|
keepCollisionsDisabled: false
|
||||||
|
GameMode:
|
||||||
|
# ForceSurvivalMode to player when join ?
|
||||||
|
ForceSurvivalMode: false
|
||||||
|
security:
|
||||||
|
# Minimum length of password
|
||||||
|
minPasswordLength: 5
|
||||||
|
# Maximum length of password
|
||||||
|
passwordMaxLength: 30
|
||||||
|
# this is very important options,
|
||||||
|
# every time player join the server,
|
||||||
|
# if they are registered, AuthMe will switch him
|
||||||
|
# to unLoggedInGroup, this
|
||||||
|
# should prevent all major exploit.
|
||||||
|
# So you can set up on your Permission Plugin
|
||||||
|
# this special group with 0 permissions, or permissions to chat,
|
||||||
|
# or permission to
|
||||||
|
# send private message or all other perms that you want,
|
||||||
|
# the better way is to set up
|
||||||
|
# this group with few permissions,
|
||||||
|
# so if player try to exploit some account,
|
||||||
|
# they can
|
||||||
|
# do anything except what you set in perm Group.
|
||||||
|
# After a correct logged-in player will be
|
||||||
|
# moved to his correct permissions group!
|
||||||
|
# Pay attention group name is case sensitive,
|
||||||
|
# so Admin is different from admin,
|
||||||
|
# otherwise your group will be wiped,
|
||||||
|
# and player join in default group []!
|
||||||
|
# Example unLoggedinGroup: NotLogged
|
||||||
|
unLoggedinGroup: unLoggedinGroup
|
||||||
|
# possible values: MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB,
|
||||||
|
# MYBB, IPB3, IPB4, PHPFUSION, SMF, XENFORO, SALTED2MD5, JOOMLA, BCRYPT, WBB3, SHA512,
|
||||||
|
# DOUBLEMD5, PBKDF2, PBKDF2DJANGO, WORDPRESS, ROYALAUTH, CUSTOM(for developpers only)
|
||||||
|
passwordHash: SHA256
|
||||||
|
# salt length for the SALTED2MD5 MD5(MD5(password)+salt)
|
||||||
|
doubleMD5SaltLength: 8
|
||||||
|
# If password checking return false, do we need to check with all
|
||||||
|
# other password algorithm to check an old password?
|
||||||
|
# AuthMe will update the password to the new passwordHash!
|
||||||
|
supportOldPasswordHash: false
|
||||||
|
# Cancel unsafe passwords for being used, put them on lowercase!
|
||||||
|
#unsafePasswords:
|
||||||
|
#- '123456'
|
||||||
|
#- 'password'
|
||||||
|
unsafePasswords:
|
||||||
|
- '123456'
|
||||||
|
- 'password'
|
||||||
|
- 'qwerty'
|
||||||
|
- '12345'
|
||||||
|
- '54321'
|
||||||
|
registration:
|
||||||
|
# enable registration on the server?
|
||||||
|
enabled: true
|
||||||
|
# Send every X seconds a message to a player to
|
||||||
|
# remind him that he has to login/register
|
||||||
|
messageInterval: 5
|
||||||
|
# Only registered and logged in players can play.
|
||||||
|
# See restrictions for exceptions
|
||||||
|
force: true
|
||||||
|
# Do we replace password registration by an email registration method?
|
||||||
|
enableEmailRegistrationSystem: false
|
||||||
|
# Enable double check of email when you register
|
||||||
|
# when it's true, registration require that kind of command:
|
||||||
|
# /register <email> <confirmEmail>
|
||||||
|
doubleEmailCheck: false
|
||||||
|
# Do we force kicking player after a successful registration?
|
||||||
|
# Do not use with login feature below
|
||||||
|
forceKickAfterRegister: false
|
||||||
|
# Does AuthMe need to enforce a /login after a successful registration?
|
||||||
|
forceLoginAfterRegister: false
|
||||||
|
unrestrictions:
|
||||||
|
# below you can list all account names that
|
||||||
|
# AuthMe will ignore for registration or login, configure it
|
||||||
|
# at your own risk!! Remember that if you are going to add
|
||||||
|
# nickname with [], you have to delimit name with ' '.
|
||||||
|
# this option add compatibility with BuildCraft and some
|
||||||
|
# other mods.
|
||||||
|
# It is CaseSensitive!
|
||||||
|
UnrestrictedName: []
|
||||||
|
# Message language, available : en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt
|
||||||
|
messagesLanguage: en
|
||||||
|
# Force these commands after /login, without any '/', use %p for replace with player name
|
||||||
|
forceCommands: []
|
||||||
|
# Force these commands after /login as a server console, without any '/', use %p for replace with player name
|
||||||
|
forceCommandsAsConsole: []
|
||||||
|
# Force these commands after /register, without any '/', use %p for replace with player name
|
||||||
|
forceRegisterCommands: []
|
||||||
|
# Force these commands after /register as a server console, without any '/', use %p for replace with player name
|
||||||
|
forceRegisterCommandsAsConsole: []
|
||||||
|
# Do we need to display the welcome message (welcome.txt) after a login?
|
||||||
|
# You can use colors in this welcome.txt + some replaced strings:
|
||||||
|
# {PLAYER}: player name, {ONLINE}: display number of online players, {MAXPLAYERS}: display server slots,
|
||||||
|
# {IP}: player ip, {LOGINS}: number of players logged, {WORLD}: player current world, {SERVER}: server name
|
||||||
|
# {VERSION}: get current bukkit version, {COUNTRY}: player country
|
||||||
|
useWelcomeMessage: true
|
||||||
|
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
|
||||||
|
broadcastWelcomeMessage: false
|
||||||
|
# Should we delay the join message and display it once the player has logged in?
|
||||||
|
delayJoinMessage: false
|
||||||
|
# Should we remove join messages altogether?
|
||||||
|
removeJoinMessage: false
|
||||||
|
# Should we remove leave messages?
|
||||||
|
removeLeaveMessage: false
|
||||||
|
# Do we need to add potion effect Blinding before login/register?
|
||||||
|
applyBlindEffect: false
|
||||||
|
# Do we need to prevent people to login with another case?
|
||||||
|
# If Xephi is registered, then Xephi can login, but not XEPHI/xephi/XePhI
|
||||||
|
preventOtherCase: false
|
||||||
|
ExternalBoardOptions:
|
||||||
|
# MySQL column for the salt, needed for some forum/cms support
|
||||||
|
mySQLColumnSalt: ''
|
||||||
|
# MySQL column for the group, needed for some forum/cms support
|
||||||
|
mySQLColumnGroup: ''
|
||||||
|
# -1 mean disabled. If u want that only
|
||||||
|
# activated player can login in your server
|
||||||
|
# u can put in this options the group number
|
||||||
|
# of unactivated user, needed for some forum/cms support
|
||||||
|
nonActivedUserGroup: -1
|
||||||
|
# Other MySQL columns where we need to put the Username (case sensitive)
|
||||||
|
mySQLOtherUsernameColumns: []
|
||||||
|
# How much Log to Round needed in BCrypt(do not change it if you do not know what's your doing)
|
||||||
|
bCryptLog2Round: 10
|
||||||
|
# phpBB prefix defined during phpbb installation process
|
||||||
|
phpbbTablePrefix: 'phpbb_'
|
||||||
|
# phpBB activated group id, 2 is default registered group defined by phpbb
|
||||||
|
phpbbActivatedGroupId: 2
|
||||||
|
# WordPress prefix defined during WordPress installation process
|
||||||
|
wordpressTablePrefix: 'wp_'
|
||||||
|
permission:
|
||||||
|
# Take care with this options, if you dont want
|
||||||
|
# to use Vault and Group Switching of
|
||||||
|
# AuthMe for unloggedIn players put true
|
||||||
|
# below, default is false.
|
||||||
|
EnablePermissionCheck: false
|
||||||
|
BackupSystem:
|
||||||
|
# Enable or Disable Automatic Backup
|
||||||
|
ActivateBackup: false
|
||||||
|
# set Backup at every start of Server
|
||||||
|
OnServerStart: false
|
||||||
|
# set Backup at every stop of Server
|
||||||
|
OnServerStop: true
|
||||||
|
# Windows only mysql installation Path
|
||||||
|
MysqlWindowsPath: 'C:\Program Files\MySQL\MySQL Server 5.1\'
|
||||||
|
Security:
|
||||||
|
SQLProblem:
|
||||||
|
# Stop the server if we can't contact the sql database
|
||||||
|
# Take care with this, if you set that to false,
|
||||||
|
# AuthMe automatically disable and the server is not protected!
|
||||||
|
stopServer: true
|
||||||
|
ReloadCommand:
|
||||||
|
# /reload support
|
||||||
|
useReloadCommandSupport: true
|
||||||
|
console:
|
||||||
|
# Remove spam console
|
||||||
|
noConsoleSpam: false
|
||||||
|
# Replace passwords in the console when player type a command like /login
|
||||||
|
removePassword: true
|
||||||
|
# Copy AuthMe log output in a separate file as well?
|
||||||
|
logConsole: true
|
||||||
|
captcha:
|
||||||
|
# Enable captcha when a player uses wrong password too many times
|
||||||
|
useCaptcha: false
|
||||||
|
# Max allowed tries before a captcha is required
|
||||||
|
maxLoginTry: 5
|
||||||
|
# Captcha length
|
||||||
|
captchaLength: 5
|
||||||
|
stop:
|
||||||
|
# Kick players before stopping the server, that allow us to save position of players, and all needed
|
||||||
|
# information correctly without any corruption.
|
||||||
|
kickPlayersBeforeStopping: true
|
||||||
|
tempban:
|
||||||
|
# Tempban a user's IP address if they enter the wrong password too many times
|
||||||
|
enableTempban: false
|
||||||
|
# How many times a user can attempt to login before their IP being tempbanned
|
||||||
|
maxLoginTries: 10
|
||||||
|
# The length of time a IP address will be tempbanned in minutes
|
||||||
|
# Default: 480 minutes, or 8 hours
|
||||||
|
tempbanLength: 480
|
||||||
|
Converter:
|
||||||
|
Rakamak:
|
||||||
|
# Rakamak file name
|
||||||
|
fileName: users.rak
|
||||||
|
# Rakamak use ip ?
|
||||||
|
useIP: false
|
||||||
|
# IP file name for rakamak
|
||||||
|
ipFileName: UsersIp.rak
|
||||||
|
CrazyLogin:
|
||||||
|
# CrazyLogin database file
|
||||||
|
fileName: accounts.db
|
||||||
|
Email:
|
||||||
|
# Email SMTP server host
|
||||||
|
mailSMTP: smtp.gmail.com
|
||||||
|
# Email SMTP server port
|
||||||
|
mailPort: 465
|
||||||
|
# Email account that send the mail
|
||||||
|
mailAccount: ''
|
||||||
|
# Email account password
|
||||||
|
mailPassword: ''
|
||||||
|
# Custom SenderName, that replace the mailAccount name in the email
|
||||||
|
mailSenderName: ''
|
||||||
|
# Random password length
|
||||||
|
RecoveryPasswordLength: 8
|
||||||
|
# Email subject of password get
|
||||||
|
mailSubject: 'Your new AuthMe password'
|
||||||
|
# Like maxRegPerIp but with email
|
||||||
|
maxRegPerEmail: 1
|
||||||
|
# Recall players to add an email?
|
||||||
|
recallPlayers: false
|
||||||
|
# Delay in minute for the recall scheduler
|
||||||
|
delayRecall: 5
|
||||||
|
# Blacklist these domains for emails
|
||||||
|
emailBlacklisted:
|
||||||
|
- 10minutemail.com
|
||||||
|
# WhiteList only these domains for emails
|
||||||
|
emailWhitelisted: []
|
||||||
|
# Do we need to send new password draw in an image?
|
||||||
|
generateImage: false
|
||||||
|
# The email OAuth 2 token (leave empty if not used)
|
||||||
|
emailOauth2Token: ''
|
||||||
|
Hooks:
|
||||||
|
# Do we need to hook with multiverse for spawn checking?
|
||||||
|
multiverse: true
|
||||||
|
# Do we need to hook with BungeeCord ?
|
||||||
|
bungeecord: false
|
||||||
|
# Send player to this BungeeCord server after register/login
|
||||||
|
sendPlayerTo: ''
|
||||||
|
# Do we need to disable Essentials SocialSpy on join?
|
||||||
|
disableSocialSpy: true
|
||||||
|
# Do we need to force /motd Essentials command on join?
|
||||||
|
useEssentialsMotd: false
|
||||||
|
# Do we need to cache custom Attributes?
|
||||||
|
customAttributes: false
|
||||||
|
Purge:
|
||||||
|
# If enabled, AuthMe automatically purges old, unused accounts
|
||||||
|
useAutoPurge: false
|
||||||
|
# Number of Days an account become Unused
|
||||||
|
daysBeforeRemovePlayer: 60
|
||||||
|
# Do we need to remove the player.dat file during purge process?
|
||||||
|
removePlayerDat: false
|
||||||
|
# Do we need to remove the Essentials/users/player.yml file during purge process?
|
||||||
|
removeEssentialsFile: false
|
||||||
|
# World where are players.dat stores
|
||||||
|
defaultWorld: 'world'
|
||||||
|
# Do we need to remove LimitedCreative/inventories/player.yml, player_creative.yml files during purge process ?
|
||||||
|
removeLimitedCreativesInventories: false
|
||||||
|
# Do we need to remove the AntiXRayData/PlayerData/player file during purge process?
|
||||||
|
removeAntiXRayFile: false
|
||||||
|
# Do we need to remove permissions?
|
||||||
|
removePermissions: false
|
||||||
|
Protection:
|
||||||
|
# Enable some servers protection ( country based login, antibot )
|
||||||
|
enableProtection: false
|
||||||
|
# Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes
|
||||||
|
# PLEASE USE QUOTES!
|
||||||
|
countries:
|
||||||
|
- 'US'
|
||||||
|
- 'GB'
|
||||||
|
# Countries blacklisted automatically (without any needed to enable protection)
|
||||||
|
# PLEASE USE QUOTES!
|
||||||
|
countriesBlacklist:
|
||||||
|
- 'A1'
|
||||||
|
# Do we need to enable automatic antibot system?
|
||||||
|
enableAntiBot: true
|
||||||
|
# Max number of player allowed to login in 5 secs before enable AntiBot system automatically
|
||||||
|
antiBotSensibility: 10
|
||||||
|
# Duration in minutes of the antibot automatic system
|
||||||
|
antiBotDuration: 10
|
Loading…
Reference in New Issue
Block a user