This commit is contained in:
parent
18a9fbaa26
commit
bcc31afb90
@ -35,7 +35,6 @@ import fr.xephi.authme.permission.PermissionsSystemType;
|
|||||||
import fr.xephi.authme.process.Management;
|
import fr.xephi.authme.process.Management;
|
||||||
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;
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import fr.xephi.authme.settings.SettingsMigrationService;
|
import fr.xephi.authme.settings.SettingsMigrationService;
|
||||||
import fr.xephi.authme.settings.SpawnLoader;
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||||
@ -205,13 +204,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// Apply settings to the logger
|
// Apply settings to the logger
|
||||||
ConsoleLogger.setLoggingOptions(newSettings);
|
ConsoleLogger.setLoggingOptions(newSettings);
|
||||||
|
|
||||||
// Old settings manager
|
|
||||||
if (!loadSettings()) {
|
|
||||||
getServer().shutdown();
|
|
||||||
setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to the database and setup tables
|
// Connect to the database and setup tables
|
||||||
try {
|
try {
|
||||||
setupDatabase(newSettings);
|
setupDatabase(newSettings);
|
||||||
@ -373,22 +365,10 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the plugin's settings.
|
* Loads the plugin's settings.
|
||||||
*
|
*
|
||||||
* @return True on success, false on failure.
|
* @return The settings instance, or null if it could not be constructed
|
||||||
*/
|
*/
|
||||||
private boolean loadSettings() {
|
|
||||||
try {
|
|
||||||
new Settings(this);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
ConsoleLogger.logException("Can't load the configuration file... Something went wrong. "
|
|
||||||
+ "To avoid security issues the server will shut down!", e);
|
|
||||||
getServer().shutdown();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private NewSetting createNewSetting() {
|
private NewSetting createNewSetting() {
|
||||||
File configFile = new File(getDataFolder(), "config.yml");
|
File configFile = new File(getDataFolder(), "config.yml");
|
||||||
PropertyMap properties = SettingsFieldRetriever.getAllPropertyFields();
|
PropertyMap properties = SettingsFieldRetriever.getAllPropertyFields();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import fr.xephi.authme.cache.limbo.LimboCache;
|
|||||||
import fr.xephi.authme.cache.limbo.PlayerData;
|
import fr.xephi.authme.cache.limbo.PlayerData;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.settings.NewSetting;
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -116,8 +116,8 @@ public class AuthGroupHandler implements Reloadable {
|
|||||||
@Override
|
@Override
|
||||||
public void reload() {
|
public void reload() {
|
||||||
unloggedInGroup = settings.getProperty(SecuritySettings.UNLOGGEDIN_GROUP);
|
unloggedInGroup = settings.getProperty(SecuritySettings.UNLOGGEDIN_GROUP);
|
||||||
unregisteredGroup = Settings.unRegisteredGroup;
|
unregisteredGroup = settings.getProperty(HooksSettings.UNREGISTERED_GROUP);
|
||||||
registeredGroup = Settings.getRegisteredGroup;
|
registeredGroup = settings.getProperty(HooksSettings.REGISTERED_GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import fr.xephi.authme.output.MessageKey;
|
|||||||
import fr.xephi.authme.permission.AuthGroupType;
|
import fr.xephi.authme.permission.AuthGroupType;
|
||||||
import fr.xephi.authme.process.ProcessService;
|
import fr.xephi.authme.process.ProcessService;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -26,7 +26,7 @@ public class ProcessSyncEmailRegister implements SynchronousProcess {
|
|||||||
|
|
||||||
public void processEmailRegister(Player player) {
|
public void processEmailRegister(Player player) {
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
if (!service.getProperty(HooksSettings.REGISTERED_GROUP).isEmpty()) {
|
||||||
service.setGroup(player, AuthGroupType.REGISTERED);
|
service.setGroup(player, AuthGroupType.REGISTERED);
|
||||||
}
|
}
|
||||||
service.send(player, MessageKey.ACCOUNT_NOT_ACTIVATED);
|
service.send(player, MessageKey.ACCOUNT_NOT_ACTIVATED);
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import fr.xephi.authme.permission.AuthGroupType;
|
|||||||
import fr.xephi.authme.process.ProcessService;
|
import fr.xephi.authme.process.ProcessService;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import fr.xephi.authme.service.BungeeService;
|
import fr.xephi.authme.service.BungeeService;
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
@ -63,7 +63,7 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processPasswordRegister(Player player) {
|
public void processPasswordRegister(Player player) {
|
||||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
if (!service.getProperty(HooksSettings.REGISTERED_GROUP).isEmpty()) {
|
||||||
service.setGroup(player, AuthGroupType.REGISTERED);
|
service.setGroup(player, AuthGroupType.REGISTERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,13 +10,12 @@ import fr.xephi.authme.permission.AuthGroupType;
|
|||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
import fr.xephi.authme.process.AsynchronousProcess;
|
||||||
import fr.xephi.authme.process.ProcessService;
|
import fr.xephi.authme.process.ProcessService;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
import fr.xephi.authme.util.BukkitService;
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import fr.xephi.authme.util.TeleportationService;
|
import fr.xephi.authme.util.TeleportationService;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -67,7 +66,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
teleportationService.teleportOnJoin(player);
|
teleportationService.teleportOnJoin(player);
|
||||||
player.saveData();
|
player.saveData();
|
||||||
playerCache.removePlayer(player.getName().toLowerCase());
|
playerCache.removePlayer(player.getName().toLowerCase());
|
||||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
if (!service.getProperty(HooksSettings.REGISTERED_GROUP).isEmpty()) {
|
||||||
service.setGroup(player, AuthGroupType.UNREGISTERED);
|
service.setGroup(player, AuthGroupType.UNREGISTERED);
|
||||||
}
|
}
|
||||||
limboCache.deletePlayerData(player);
|
limboCache.deletePlayerData(player);
|
||||||
@ -79,7 +78,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
ConsoleLogger.info(player.getName() + " unregistered himself");
|
ConsoleLogger.info(player.getName() + " unregistered himself");
|
||||||
return; // TODO ljacqu 20160612: Why return here? No blind effect? Player not removed from PlayerCache?
|
return; // TODO ljacqu 20160612: Why return here? No blind effect? Player not removed from PlayerCache?
|
||||||
}
|
}
|
||||||
if (!Settings.unRegisteredGroup.isEmpty()) {
|
if (!service.getProperty(HooksSettings.UNREGISTERED_GROUP).isEmpty()) {
|
||||||
service.setGroup(player, AuthGroupType.UNREGISTERED);
|
service.setGroup(player, AuthGroupType.UNREGISTERED);
|
||||||
}
|
}
|
||||||
playerCache.removePlayer(name);
|
playerCache.removePlayer(name);
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
package fr.xephi.authme.settings;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Old settings manager. See {@link NewSetting} for the new manager.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final class Settings {
|
|
||||||
|
|
||||||
public static String unRegisteredGroup;
|
|
||||||
public static String getRegisteredGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for Settings.
|
|
||||||
*
|
|
||||||
* @param pl AuthMe
|
|
||||||
*/
|
|
||||||
public Settings(AuthMe pl) {
|
|
||||||
FileConfiguration configFile = pl.getConfig();
|
|
||||||
unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", "");
|
|
||||||
getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -67,7 +67,8 @@ public class SettingsMigrationService {
|
|||||||
String[] deprecatedProperties = {
|
String[] deprecatedProperties = {
|
||||||
"Converter.Rakamak.newPasswordHash", "Hooks.chestshop", "Hooks.legacyChestshop", "Hooks.notifications",
|
"Converter.Rakamak.newPasswordHash", "Hooks.chestshop", "Hooks.legacyChestshop", "Hooks.notifications",
|
||||||
"Passpartu", "Performances", "settings.restrictions.enablePasswordVerifier", "Xenoforo.predefinedSalt",
|
"Passpartu", "Performances", "settings.restrictions.enablePasswordVerifier", "Xenoforo.predefinedSalt",
|
||||||
"VeryGames", "settings.restrictions.allowAllCommandsIfRegistrationIsOptional"};
|
"VeryGames", "settings.restrictions.allowAllCommandsIfRegistrationIsOptional", "DataSource.mySQLWebsite",
|
||||||
|
"Hooks.customAttributes", "Security.stop.kickPlayersBeforeStopping"};
|
||||||
for (String deprecatedPath : deprecatedProperties) {
|
for (String deprecatedPath : deprecatedProperties) {
|
||||||
if (configuration.contains(deprecatedPath)) {
|
if (configuration.contains(deprecatedPath)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public class DatabaseSettings implements SettingsClass {
|
|||||||
public static final Property<String> MYSQL_COL_NAME =
|
public static final Property<String> MYSQL_COL_NAME =
|
||||||
newProperty("DataSource.mySQLColumnName", "username");
|
newProperty("DataSource.mySQLColumnName", "username");
|
||||||
|
|
||||||
@Comment("Column for storing or checking players RealName ")
|
@Comment("Column for storing or checking players RealName")
|
||||||
public static final Property<String> MYSQL_COL_REALNAME =
|
public static final Property<String> MYSQL_COL_REALNAME =
|
||||||
newProperty("DataSource.mySQLRealName", "realname");
|
newProperty("DataSource.mySQLRealName", "realname");
|
||||||
|
|
||||||
@ -98,10 +98,6 @@ public class DatabaseSettings implements SettingsClass {
|
|||||||
public static final Property<String> MYSQL_COL_GROUP =
|
public static final Property<String> MYSQL_COL_GROUP =
|
||||||
newProperty("ExternalBoardOptions.mySQLColumnGroup", "");
|
newProperty("ExternalBoardOptions.mySQLColumnGroup", "");
|
||||||
|
|
||||||
@Comment("Enable this when you allow registration through a website")
|
|
||||||
public static final Property<Boolean> MYSQL_WEBSITE =
|
|
||||||
newProperty("DataSource.mySQLWebsite", false);
|
|
||||||
|
|
||||||
private DatabaseSettings() {
|
private DatabaseSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,6 @@ public class HooksSettings implements SettingsClass {
|
|||||||
public static final Property<Boolean> USE_ESSENTIALS_MOTD =
|
public static final Property<Boolean> USE_ESSENTIALS_MOTD =
|
||||||
newProperty("Hooks.useEssentialsMotd", false);
|
newProperty("Hooks.useEssentialsMotd", false);
|
||||||
|
|
||||||
@Comment("Do we need to cache custom Attributes?")
|
|
||||||
public static final Property<Boolean> CACHE_CUSTOM_ATTRIBUTES =
|
|
||||||
newProperty("Hooks.customAttributes", false);
|
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"-1 means disabled. If you want that only activated players",
|
"-1 means disabled. If you want that only activated players",
|
||||||
"can log into your server, you can set here the group number",
|
"can log into your server, you can set here the group number",
|
||||||
@ -62,6 +58,14 @@ public class HooksSettings implements SettingsClass {
|
|||||||
public static final Property<String> WORDPRESS_TABLE_PREFIX =
|
public static final Property<String> WORDPRESS_TABLE_PREFIX =
|
||||||
newProperty("ExternalBoardOptions.wordpressTablePrefix", "wp_");
|
newProperty("ExternalBoardOptions.wordpressTablePrefix", "wp_");
|
||||||
|
|
||||||
|
@Comment("Unregistered permission group")
|
||||||
|
public static final Property<String> UNREGISTERED_GROUP =
|
||||||
|
newProperty("GroupOptions.UnregisteredPlayerGroup", "");
|
||||||
|
|
||||||
|
@Comment("Registered permission group")
|
||||||
|
public static final Property<String> REGISTERED_GROUP =
|
||||||
|
newProperty("GroupOptions.RegisteredPlayerGroup", "");
|
||||||
|
|
||||||
private HooksSettings() {
|
private HooksSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,11 +42,6 @@ public class SecuritySettings implements SettingsClass {
|
|||||||
public static final Property<Integer> CAPTCHA_LENGTH =
|
public static final Property<Integer> CAPTCHA_LENGTH =
|
||||||
newProperty("Security.captcha.captchaLength", 5);
|
newProperty("Security.captcha.captchaLength", 5);
|
||||||
|
|
||||||
@Comment({"Kick players before stopping the server, that allow us to save position of players",
|
|
||||||
"and all needed information correctly without any corruption."})
|
|
||||||
public static final Property<Boolean> KICK_PLAYERS_BEFORE_STOPPING =
|
|
||||||
newProperty("Security.stop.kickPlayersBeforeStopping", true);
|
|
||||||
|
|
||||||
@Comment("Minimum length of password")
|
@Comment("Minimum length of password")
|
||||||
public static final Property<Integer> MIN_PASSWORD_LENGTH =
|
public static final Property<Integer> MIN_PASSWORD_LENGTH =
|
||||||
newProperty("settings.security.minPasswordLength", 5);
|
newProperty("settings.security.minPasswordLength", 5);
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import fr.xephi.authme.settings.domain.Comment;
|
|||||||
import fr.xephi.authme.settings.domain.Property;
|
import fr.xephi.authme.settings.domain.Property;
|
||||||
import fr.xephi.authme.settings.domain.SettingsClass;
|
import fr.xephi.authme.settings.domain.SettingsClass;
|
||||||
import fr.xephi.authme.settings.propertymap.PropertyMap;
|
import fr.xephi.authme.settings.propertymap.PropertyMap;
|
||||||
import fr.xephi.authme.util.StringUtils;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
@ -67,7 +66,7 @@ public final class SettingsFieldRetriever {
|
|||||||
return (Property<?>) field.get(null);
|
return (Property<?>) field.get(null);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new IllegalStateException("Could not fetch field '" + field.getName() + "' from class '"
|
throw new IllegalStateException("Could not fetch field '" + field.getName() + "' from class '"
|
||||||
+ field.getDeclaringClass().getSimpleName() + "': " + StringUtils.formatException(e));
|
+ field.getDeclaringClass().getSimpleName() + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -40,8 +40,6 @@ DataSource:
|
|||||||
mySQLlastlocWorld: world
|
mySQLlastlocWorld: world
|
||||||
# Column for RealName
|
# Column for RealName
|
||||||
mySQLRealName: realname
|
mySQLRealName: realname
|
||||||
# Enable this when you allow registration through a website
|
|
||||||
mySQLWebsite: false
|
|
||||||
settings:
|
settings:
|
||||||
# The name shown in the help messages.
|
# The name shown in the help messages.
|
||||||
helpHeader: AuthMeReloaded
|
helpHeader: AuthMeReloaded
|
||||||
@ -326,10 +324,6 @@ Security:
|
|||||||
maxLoginTry: 5
|
maxLoginTry: 5
|
||||||
# Captcha length
|
# Captcha length
|
||||||
captchaLength: 5
|
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:
|
||||||
# Tempban a user's IP address if they enter the wrong password too many times
|
# Tempban a user's IP address if they enter the wrong password too many times
|
||||||
enableTempban: false
|
enableTempban: false
|
||||||
@ -390,8 +384,6 @@ Hooks:
|
|||||||
disableSocialSpy: true
|
disableSocialSpy: true
|
||||||
# Do we need to force /motd Essentials command on join?
|
# Do we need to force /motd Essentials command on join?
|
||||||
useEssentialsMotd: false
|
useEssentialsMotd: false
|
||||||
# Do we need to cache custom Attributes?
|
|
||||||
customAttributes: false
|
|
||||||
Purge:
|
Purge:
|
||||||
# If enabled, AuthMe automatically purges old, unused accounts
|
# If enabled, AuthMe automatically purges old, unused accounts
|
||||||
useAutoPurge: false
|
useAutoPurge: false
|
||||||
@ -429,3 +421,8 @@ Protection:
|
|||||||
antiBotSensibility: 10
|
antiBotSensibility: 10
|
||||||
# Duration in minutes of the antibot automatic system
|
# Duration in minutes of the antibot automatic system
|
||||||
antiBotDuration: 10
|
antiBotDuration: 10
|
||||||
|
GroupOptions:
|
||||||
|
# Registered permission group
|
||||||
|
RegisteredPlayerGroup: ''
|
||||||
|
# Unregistered permission group
|
||||||
|
UnregisteredPlayerGroup: ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user