Code householding + settings migration

- Migrate and remove unused properties in legacy Settings
- Add forgotten space in Register command
- Fix javadoc errors shown on Jenkins
This commit is contained in:
ljacqu 2016-04-15 15:17:58 +02:00
parent 71515f188a
commit 3674ac087c
7 changed files with 60 additions and 81 deletions

View File

@ -20,11 +20,8 @@ public class DataManager {
private final PluginHooks pluginHooks; private final PluginHooks pluginHooks;
private final BukkitService bukkitService; private final BukkitService bukkitService;
/** /*
* Constructor for DataManager. * Constructor.
*
* @param plugin The plugin instance
* @param pluginHooks Plugin hooks instance
*/ */
public DataManager(AuthMe plugin, PluginHooks pluginHooks, BukkitService bukkitService) { public DataManager(AuthMe plugin, PluginHooks pluginHooks, BukkitService bukkitService) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -58,7 +58,7 @@ public class RegisterCommand extends PlayerCommand {
if (commandService.getProperty(EmailSettings.MAIL_ACCOUNT).isEmpty()) { if (commandService.getProperty(EmailSettings.MAIL_ACCOUNT).isEmpty()) {
player.sendMessage("Cannot register: no email address is set for the server. " player.sendMessage("Cannot register: no email address is set for the server. "
+ "Please contact an administrator"); + "Please contact an administrator");
ConsoleLogger.showError("Cannot register player '" + player.getName() + "': no email is set" ConsoleLogger.showError("Cannot register player '" + player.getName() + "': no email is set "
+ "to send emails from. Please add one in your config at " + EmailSettings.MAIL_ACCOUNT.getPath()); + "to send emails from. Please add one in your config at " + EmailSettings.MAIL_ACCOUNT.getPath());
return; return;
} }

View File

@ -182,8 +182,7 @@ public class AsynchronousLogin implements Process {
// task, we schedule it in the end // task, we schedule it in the end
// so that we can be sure, and have not to care if it might be // so that we can be sure, and have not to care if it might be
// processed in other order. // processed in other order.
ProcessSyncPlayerLogin syncPlayerLogin = new ProcessSyncPlayerLogin( ProcessSyncPlayerLogin syncPlayerLogin = new ProcessSyncPlayerLogin(player, plugin, database, service);
player, plugin, database, service.getSettings());
if (syncPlayerLogin.getLimbo() != null) { if (syncPlayerLogin.getLimbo() != null) {
if (syncPlayerLogin.getLimbo().getTimeoutTask() != null) { if (syncPlayerLogin.getLimbo().getTimeoutTask() != null) {
syncPlayerLogin.getLimbo().getTimeoutTask().cancel(); syncPlayerLogin.getLimbo().getTimeoutTask().cancel();

View File

@ -1,22 +1,7 @@
package fr.xephi.authme.process.login; package fr.xephi.authme.process.login;
import fr.xephi.authme.settings.NewSetting;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.potion.PotionEffectType;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import org.apache.commons.lang.reflect.MethodUtils;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.backup.JsonCache;
@ -28,14 +13,26 @@ import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.events.SpawnTeleportEvent;
import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.listener.AuthMePlayerListener;
import fr.xephi.authme.process.Process;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.settings.Settings; 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.RestrictionSettings;
import fr.xephi.authme.util.Utils; import fr.xephi.authme.util.Utils;
import fr.xephi.authme.util.Utils.GroupType; import fr.xephi.authme.util.Utils.GroupType;
import org.apache.commons.lang.reflect.MethodUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.potion.PotionEffectType;
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
import static fr.xephi.authme.settings.properties.PluginSettings.KEEP_COLLISIONS_DISABLED; import static fr.xephi.authme.settings.properties.PluginSettings.KEEP_COLLISIONS_DISABLED;
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
public class ProcessSyncPlayerLogin implements Runnable { public class ProcessSyncPlayerLogin implements Process {
private final LimboPlayer limbo; private final LimboPlayer limbo;
private final Player player; private final Player player;
@ -44,7 +41,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
private final AuthMe plugin; private final AuthMe plugin;
private final PluginManager pm; private final PluginManager pm;
private final JsonCache playerCache; private final JsonCache playerCache;
private final NewSetting settings; private final ProcessService service;
private final boolean restoreCollisions = MethodUtils private final boolean restoreCollisions = MethodUtils
.getAccessibleMethod(LivingEntity.class, "setCollidable", new Class[]{}) != null; .getAccessibleMethod(LivingEntity.class, "setCollidable", new Class[]{}) != null;
@ -55,10 +52,9 @@ public class ProcessSyncPlayerLogin implements Runnable {
* @param player Player * @param player Player
* @param plugin AuthMe * @param plugin AuthMe
* @param database DataSource * @param database DataSource
* @param settings The plugin settings * @param service The process service
*/ */
public ProcessSyncPlayerLogin(Player player, AuthMe plugin, public ProcessSyncPlayerLogin(Player player, AuthMe plugin, DataSource database, ProcessService service) {
DataSource database, NewSetting settings) {
this.plugin = plugin; this.plugin = plugin;
this.pm = plugin.getServer().getPluginManager(); this.pm = plugin.getServer().getPluginManager();
this.player = player; this.player = player;
@ -66,7 +62,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
this.limbo = LimboCache.getInstance().getLimboPlayer(name); this.limbo = LimboCache.getInstance().getLimboPlayer(name);
this.auth = database.getAuth(name); this.auth = database.getAuth(name);
this.playerCache = new JsonCache(); this.playerCache = new JsonCache();
this.settings = settings; this.service = service;
} }
public LimboPlayer getLimbo() { public LimboPlayer getLimbo() {
@ -99,7 +95,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
} }
private void restoreSpeedEffects() { private void restoreSpeedEffects() {
if (!settings.getProperty(RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT) && settings.getProperty(RestrictionSettings.REMOVE_SPEED)) { if (!service.getProperty(RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT) && service.getProperty(RestrictionSettings.REMOVE_SPEED)) {
player.setWalkSpeed(0.2F); player.setWalkSpeed(0.2F);
player.setFlySpeed(0.1F); player.setFlySpeed(0.1F);
} }
@ -114,10 +110,10 @@ public class ProcessSyncPlayerLogin implements Runnable {
} }
private void forceCommands() { private void forceCommands() {
for (String command : Settings.forceCommands) { for (String command : service.getProperty(RegistrationSettings.FORCE_COMMANDS)) {
player.performCommand(command.replace("%p", player.getName())); player.performCommand(command.replace("%p", player.getName()));
} }
for (String command : Settings.forceCommandsAsConsole) { for (String command : service.getProperty(RegistrationSettings.FORCE_COMMANDS_AS_CONSOLE)) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), command.replace("%p", player.getName())); Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), command.replace("%p", player.getName()));
} }
} }
@ -155,15 +151,15 @@ public class ProcessSyncPlayerLogin implements Runnable {
} }
} }
if (restoreCollisions && !settings.getProperty(KEEP_COLLISIONS_DISABLED)) { if (restoreCollisions && !service.getProperty(KEEP_COLLISIONS_DISABLED)) {
player.setCollidable(true); player.setCollidable(true);
} }
if (settings.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) { if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
restoreInventory(); restoreInventory();
} }
if (settings.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && plugin.tablistHider != null) { if (service.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && plugin.tablistHider != null) {
plugin.tablistHider.sendTablist(player); plugin.tablistHider.sendTablist(player);
} }
@ -188,24 +184,24 @@ public class ProcessSyncPlayerLogin implements Runnable {
} }
restoreSpeedEffects(); restoreSpeedEffects();
if (settings.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
player.removePotionEffect(PotionEffectType.BLINDNESS); player.removePotionEffect(PotionEffectType.BLINDNESS);
} }
// The Login event now fires (as intended) after everything is processed // The Login event now fires (as intended) after everything is processed
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player)); Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player));
player.saveData(); player.saveData();
if (settings.getProperty(HooksSettings.BUNGEECORD)) { if (service.getProperty(HooksSettings.BUNGEECORD)) {
sendBungeeMessage(); sendBungeeMessage();
} }
// Login is done, display welcome message // Login is done, display welcome message
if (settings.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE)) { if (service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE)) {
if (settings.getProperty(RegistrationSettings.BROADCAST_WELCOME_MESSAGE)) { if (service.getProperty(RegistrationSettings.BROADCAST_WELCOME_MESSAGE)) {
for (String s : settings.getWelcomeMessage()) { for (String s : service.getSettings().getWelcomeMessage()) {
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player)); Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
} }
} else { } else {
for (String s : settings.getWelcomeMessage()) { for (String s : service.getSettings().getWelcomeMessage()) {
player.sendMessage(plugin.replaceAllInfo(s, player)); player.sendMessage(plugin.replaceAllInfo(s, player));
} }
} }
@ -218,10 +214,10 @@ public class ProcessSyncPlayerLogin implements Runnable {
} }
private void sendTo() { private void sendTo() {
if (!settings.getProperty(HooksSettings.BUNGEECORD_SERVER).isEmpty()) { if (!service.getProperty(HooksSettings.BUNGEECORD_SERVER).isEmpty()) {
ByteArrayDataOutput out = ByteStreams.newDataOutput(); ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect"); out.writeUTF("Connect");
out.writeUTF(settings.getProperty(HooksSettings.BUNGEECORD_SERVER)); out.writeUTF(service.getProperty(HooksSettings.BUNGEECORD_SERVER));
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
} }
} }

View File

@ -12,9 +12,11 @@ import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.process.Process; import fr.xephi.authme.process.Process;
import fr.xephi.authme.process.ProcessService; import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.HooksSettings; 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.settings.properties.SecuritySettings;
import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.MessageTask;
import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.task.TimeoutTask;
import fr.xephi.authme.util.Utils; import fr.xephi.authme.util.Utils;
@ -23,6 +25,9 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import static fr.xephi.authme.settings.properties.RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN;
import static fr.xephi.authme.util.BukkitService.TICKS_PER_SECOND;
/** /**
*/ */
public class ProcessSyncPasswordRegister implements Process { public class ProcessSyncPasswordRegister implements Process {
@ -49,10 +54,10 @@ public class ProcessSyncPasswordRegister implements Process {
} }
private void forceCommands() { private void forceCommands() {
for (String command : Settings.forceRegisterCommands) { for (String command : service.getProperty(RegistrationSettings.FORCE_REGISTER_COMMANDS)) {
player.performCommand(command.replace("%p", player.getName())); player.performCommand(command.replace("%p", player.getName()));
} }
for (String command : Settings.forceRegisterCommandsAsConsole) { for (String command : service.getProperty(RegistrationSettings.FORCE_REGISTER_COMMANDS_AS_CONSOLE)) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
command.replace("%p", player.getName())); command.replace("%p", player.getName()));
} }
@ -62,7 +67,7 @@ public class ProcessSyncPasswordRegister implements Process {
Utils.teleportToSpawn(player); Utils.teleportToSpawn(player);
LimboCache cache = LimboCache.getInstance(); LimboCache cache = LimboCache.getInstance();
cache.updateLimboPlayer(player); cache.updateLimboPlayer(player);
int delay = service.getProperty(RestrictionSettings.TIMEOUT) * 20; int delay = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
int interval = service.getProperty(RegistrationSettings.MESSAGE_INTERVAL); int interval = service.getProperty(RegistrationSettings.MESSAGE_INTERVAL);
BukkitTask task; BukkitTask task;
if (delay != 0) { if (delay != 0) {
@ -80,15 +85,15 @@ public class ProcessSyncPasswordRegister implements Process {
public void run() { public void run() {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
if (limbo != null) { if (limbo != null) {
if (Settings.hideTablistBeforeLogin && plugin.tablistHider != null) { if (service.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && plugin.tablistHider != null) {
plugin.tablistHider.sendTablist(player); plugin.tablistHider.sendTablist(player);
} }
Utils.teleportToSpawn(player); Utils.teleportToSpawn(player);
if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { if (service.getProperty(HIDE_TABLIST_BEFORE_LOGIN) && plugin.inventoryProtector != null) {
RestoreInventoryEvent event = new RestoreInventoryEvent(player); RestoreInventoryEvent event = new RestoreInventoryEvent(player);
Bukkit.getPluginManager().callEvent(event); service.callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
plugin.inventoryProtector.sendInventoryPacket(player); plugin.inventoryProtector.sendInventoryPacket(player);
} }
@ -103,7 +108,7 @@ public class ProcessSyncPasswordRegister implements Process {
service.send(player, MessageKey.REGISTER_SUCCESS); service.send(player, MessageKey.REGISTER_SUCCESS);
if (!Settings.getmailAccount.isEmpty()) { if (!service.getProperty(EmailSettings.MAIL_ACCOUNT).isEmpty()) {
service.send(player, MessageKey.ADD_EMAIL_MESSAGE); service.send(player, MessageKey.ADD_EMAIL_MESSAGE);
} }
@ -115,12 +120,12 @@ public class ProcessSyncPasswordRegister implements Process {
plugin.getServer().getPluginManager().callEvent(new LoginEvent(player)); plugin.getServer().getPluginManager().callEvent(new LoginEvent(player));
player.saveData(); player.saveData();
if (!Settings.noConsoleSpam) { if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
ConsoleLogger.info(player.getName() + " registered " + Utils.getPlayerIp(player)); ConsoleLogger.info(player.getName() + " registered " + Utils.getPlayerIp(player));
} }
// Kick Player after Registration is enabled, kick the player // Kick Player after Registration is enabled, kick the player
if (Settings.forceRegKick) { if (service.getProperty(RegistrationSettings.FORCE_KICK_AFTER_REGISTER)) {
player.kickPlayer(service.retrieveSingleMessage(MessageKey.REGISTER_SUCCESS)); player.kickPlayer(service.retrieveSingleMessage(MessageKey.REGISTER_SUCCESS));
return; return;
} }
@ -139,12 +144,12 @@ public class ProcessSyncPasswordRegister implements Process {
} }
// Request Login after Registration // Request Login after Registration
if (Settings.forceRegLogin) { if (service.getProperty(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER)) {
forceLogin(player); forceLogin(player);
return; return;
} }
if (Settings.bungee) { if (service.getProperty(HooksSettings.BUNGEECORD)) {
sendBungeeMessage(); sendBungeeMessage();
} }

View File

@ -3,7 +3,6 @@ package fr.xephi.authme.settings;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.domain.Property;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.HooksSettings; 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.RegistrationSettings; import fr.xephi.authme.settings.properties.RegistrationSettings;
@ -26,14 +25,10 @@ public final class Settings {
public static final File PLUGIN_FOLDER = Wrapper.getInstance().getDataFolder(); public static final File PLUGIN_FOLDER = Wrapper.getInstance().getDataFolder();
public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache"); public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache");
public static List<String> allowCommands; public static List<String> allowCommands;
public static List<String> getJoinPermissions;
public static List<String> getUnrestrictedName; public static List<String> getUnrestrictedName;
public static List<String> getRestrictedIp;
public static List<String> getForcedWorlds; public static List<String> getForcedWorlds;
public static List<String> countries; public static List<String> countries;
public static List<String> countriesBlacklist; public static List<String> countriesBlacklist;
public static List<String> forceCommands;
public static List<String> forceCommandsAsConsole;
public static List<String> forceRegisterCommands; public static List<String> forceRegisterCommands;
public static List<String> forceRegisterCommandsAsConsole; public static List<String> forceRegisterCommandsAsConsole;
public static HashAlgorithm getPasswordHash; public static HashAlgorithm getPasswordHash;
@ -44,7 +39,6 @@ public final class Settings {
isMovementAllowed, isKickNonRegisteredEnabled, isMovementAllowed, isKickNonRegisteredEnabled,
isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled, isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled,
isSaveQuitLocationEnabled, isForceSurvivalModeEnabled, isSaveQuitLocationEnabled, isForceSurvivalModeEnabled,
isKickOnWrongPasswordEnabled, enablePasswordConfirmation,
protectInventoryBeforeLogInEnabled, isStopEnabled, reloadSupport, protectInventoryBeforeLogInEnabled, isStopEnabled, reloadSupport,
rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts,
emailRegistration, multiverse, bungee, emailRegistration, multiverse, bungee,
@ -52,13 +46,12 @@ public final class Settings {
enableProtection, recallEmail, useWelcomeMessage, enableProtection, recallEmail, useWelcomeMessage,
broadcastWelcomeMessage, forceRegKick, forceRegLogin, broadcastWelcomeMessage, forceRegKick, forceRegLogin,
removeJoinMessage, removeLeaveMessage, delayJoinMessage, removeJoinMessage, removeLeaveMessage, delayJoinMessage,
noTeleport, hideTablistBeforeLogin, denyTabcompleteBeforeLogin, noTeleport, allowAllCommandsIfRegIsOptional,
kickPlayersBeforeStopping, allowAllCommandsIfRegIsOptional, isRemoveSpeedEnabled, preventOtherCase;
customAttributes, isRemoveSpeedEnabled, preventOtherCase, keepCollisionsDisabled;
public static String getNickRegex, getUnloggedinGroup, public static String getNickRegex, getUnloggedinGroup,
unRegisteredGroup, backupWindowsPath, getRegisteredGroup, unRegisteredGroup, backupWindowsPath, getRegisteredGroup,
rakamakUsers, rakamakUsersIp, getmailAccount, defaultWorld, rakamakUsers, rakamakUsersIp, defaultWorld,
spawnPriority, crazyloginFileName, sendPlayerTo; spawnPriority, crazyloginFileName;
public static int getWarnMessageInterval, getSessionTimeout, public static int getWarnMessageInterval, getSessionTimeout,
getRegistrationTimeout, getMaxNickLength, getMinNickLength, getRegistrationTimeout, getMaxNickLength, getMinNickLength,
getMovementRadius, getNonActivatedGroup, getMovementRadius, getNonActivatedGroup,
@ -90,12 +83,9 @@ public final class Settings {
getNickRegex = configFile.getString("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_?]*"); getNickRegex = configFile.getString("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_?]*");
nickPattern = Pattern.compile(getNickRegex); nickPattern = Pattern.compile(getNickRegex);
isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS); isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS);
getRestrictedIp = load(RestrictionSettings.ALLOWED_RESTRICTED_USERS);
isMovementAllowed = configFile.getBoolean("settings.restrictions.allowMovement", false); isMovementAllowed = configFile.getBoolean("settings.restrictions.allowMovement", false);
isRemoveSpeedEnabled = configFile.getBoolean("settings.restrictions.removeSpeed", true); isRemoveSpeedEnabled = configFile.getBoolean("settings.restrictions.removeSpeed", true);
getMovementRadius = configFile.getInt("settings.restrictions.allowedMovementRadius", 100); getMovementRadius = configFile.getInt("settings.restrictions.allowedMovementRadius", 100);
getJoinPermissions = configFile.getStringList("GroupOptions.Permissions.PermissionsOnJoin");
isKickOnWrongPasswordEnabled = configFile.getBoolean("settings.restrictions.kickOnWrongPassword", false);
isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false);
isForceSingleSessionEnabled = configFile.getBoolean("settings.restrictions.ForceSingleSession", true); isForceSingleSessionEnabled = configFile.getBoolean("settings.restrictions.ForceSingleSession", true);
isForceSpawnLocOnJoinEnabled = configFile.getBoolean("settings.restrictions.ForceSpawnLocOnJoinEnabled", false); isForceSpawnLocOnJoinEnabled = configFile.getBoolean("settings.restrictions.ForceSpawnLocOnJoinEnabled", false);
@ -112,12 +102,7 @@ public final class Settings {
} }
getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", ""); getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", "");
enablePasswordConfirmation = load(RestrictionSettings.ENABLE_PASSWORD_CONFIRMATION);
protectInventoryBeforeLogInEnabled = load(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN); protectInventoryBeforeLogInEnabled = load(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
denyTabcompleteBeforeLogin = load(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN);
hideTablistBeforeLogin = load(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN);
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
@ -137,7 +122,6 @@ public final class Settings {
rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false); rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false);
noConsoleSpam = load(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE); noConsoleSpam = load(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE);
removePassword = configFile.getBoolean("Security.console.removePassword", true); removePassword = configFile.getBoolean("Security.console.removePassword", true);
getmailAccount = load(EmailSettings.MAIL_ACCOUNT);
displayOtherAccounts = configFile.getBoolean("settings.restrictions.displayOtherAccounts", true); displayOtherAccounts = configFile.getBoolean("settings.restrictions.displayOtherAccounts", true);
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);
@ -153,8 +137,6 @@ public final class Settings {
defaultWorld = configFile.getString("Purge.defaultWorld", "world"); defaultWorld = configFile.getString("Purge.defaultWorld", "world");
enableProtection = configFile.getBoolean("Protection.enableProtection", false); enableProtection = configFile.getBoolean("Protection.enableProtection", false);
countries = configFile.getStringList("Protection.countries"); countries = configFile.getStringList("Protection.countries");
forceCommands = configFile.getStringList("settings.forceCommands");
forceCommandsAsConsole = configFile.getStringList("settings.forceCommandsAsConsole");
recallEmail = configFile.getBoolean("Email.recallPlayers", false); recallEmail = configFile.getBoolean("Email.recallPlayers", false);
useWelcomeMessage = load(RegistrationSettings.USE_WELCOME_MESSAGE); useWelcomeMessage = load(RegistrationSettings.USE_WELCOME_MESSAGE);
countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist"); countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist");
@ -171,11 +153,7 @@ public final class Settings {
crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db"); crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db");
forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands"); forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands");
forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole"); forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole");
customAttributes = configFile.getBoolean("Hooks.customAttributes");
preventOtherCase = configFile.getBoolean("settings.preventOtherCase", false); preventOtherCase = configFile.getBoolean("settings.preventOtherCase", false);
kickPlayersBeforeStopping = configFile.getBoolean("Security.stop.kickPlayersBeforeStopping", true);
sendPlayerTo = configFile.getString("Hooks.sendPlayerTo", "");
keepCollisionsDisabled = load(PluginSettings.KEEP_COLLISIONS_DISABLED);
} }
/** /**

View File

@ -264,6 +264,10 @@ public final class Utils {
/** /**
* Returns the IP of the given player. * Returns the IP of the given player.
*
* @param p The player to return the IP address for
*
* @return The player's IP address
*/ */
public static String getPlayerIp(Player p) { public static String getPlayerIp(Player p) {
return p.getAddress().getAddress().getHostAddress(); return p.getAddress().getAddress().getHostAddress();