remove speed option + config description enhancements

This commit is contained in:
Gabriele C 2015-09-20 13:41:06 +02:00
parent 23e16bb717
commit d826777701
7 changed files with 65 additions and 55 deletions

View File

@ -486,7 +486,7 @@ public class AdminCommand implements CommandExecutor {
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval))); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
if (!Settings.isMovementAllowed) { if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) {
target.setWalkSpeed(0.0f); target.setWalkSpeed(0.0f);
target.setFlySpeed(0.0f); target.setFlySpeed(0.0f);
} }

View File

@ -109,7 +109,7 @@ public class UnregisterCommand implements CommandExecutor {
} }
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
if (!Settings.isMovementAllowed) { if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) {
player.setWalkSpeed(0.0f); player.setWalkSpeed(0.0f);
player.setFlySpeed(0.0f); player.setFlySpeed(0.0f);
} }

View File

@ -186,7 +186,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
player.removePotionEffect(PotionEffectType.BLINDNESS); player.removePotionEffect(PotionEffectType.BLINDNESS);
if (!Settings.isMovementAllowed) { if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) {
player.setWalkSpeed(0.2f); player.setWalkSpeed(0.2f);
player.setFlySpeed(0.1f); player.setFlySpeed(0.1f);
} }

View File

@ -54,8 +54,10 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
if (!Settings.isMovementAllowed) { if (!Settings.isMovementAllowed) {
player.setAllowFlight(true); player.setAllowFlight(true);
player.setFlying(true); player.setFlying(true);
player.setFlySpeed(0.0f); if (Settings.isRemoveSpeedEnabled) {
player.setWalkSpeed(0.0f); player.setFlySpeed(0.0f);
player.setWalkSpeed(0.0f);
}
} }
// Player is now logout... Time to fire event ! // Player is now logout... Time to fire event !
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));

View File

@ -116,7 +116,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
} }
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
player.removePotionEffect(PotionEffectType.BLINDNESS); player.removePotionEffect(PotionEffectType.BLINDNESS);
if (!Settings.isMovementAllowed) { if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) {
player.setWalkSpeed(0.2f); player.setWalkSpeed(0.2f);
player.setFlySpeed(0.1f); player.setFlySpeed(0.1f);
} }

View File

@ -67,7 +67,7 @@ public final class Settings extends YamlConfiguration {
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
broadcastWelcomeMessage, forceRegKick, forceRegLogin, broadcastWelcomeMessage, forceRegKick, forceRegLogin,
checkVeryGames, delayJoinMessage, noTeleport, applyBlindEffect, checkVeryGames, delayJoinMessage, noTeleport, applyBlindEffect,
customAttributes, generateImage; customAttributes, generateImage, isRemoveSpeedEnabled;
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, public static String getNickRegex, getUnloggedinGroup, getMySQLHost,
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
@ -136,6 +136,7 @@ public final class Settings extends YamlConfiguration {
isAllowRestrictedIp = configFile.getBoolean("settings.restrictions.AllowRestrictedUser", false); isAllowRestrictedIp = configFile.getBoolean("settings.restrictions.AllowRestrictedUser", false);
getRestrictedIp = configFile.getStringList("settings.restrictions.AllowedRestrictedUser"); getRestrictedIp = configFile.getStringList("settings.restrictions.AllowedRestrictedUser");
isMovementAllowed = configFile.getBoolean("settings.restrictions.allowMovement", false); isMovementAllowed = configFile.getBoolean("settings.restrictions.allowMovement", false);
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"); getJoinPermissions = configFile.getStringList("GroupOptions.Permissions.PermissionsOnJoin");
isKickOnWrongPasswordEnabled = configFile.getBoolean("settings.restrictions.kickOnWrongPassword", false); isKickOnWrongPasswordEnabled = configFile.getBoolean("settings.restrictions.kickOnWrongPassword", false);
@ -225,7 +226,7 @@ public final class Settings extends YamlConfiguration {
getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds");
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false); doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false); sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", true);
useLogging = configFile.getBoolean("Security.console.logConsole", false); useLogging = configFile.getBoolean("Security.console.logConsole", false);
disableSocialSpy = configFile.getBoolean("Hooks.disableSocialSpy", true); disableSocialSpy = configFile.getBoolean("Hooks.disableSocialSpy", true);
bCryptLog2Rounds = configFile.getInt("ExternalBoardOptions.bCryptLog2Round", 10); bCryptLog2Rounds = configFile.getInt("ExternalBoardOptions.bCryptLog2Round", 10);
@ -294,6 +295,10 @@ public final class Settings extends YamlConfiguration {
set("Protection.enableProtection", false); set("Protection.enableProtection", false);
changes = true; changes = true;
} }
if (!contains("settings.restrictions.removeSpeed")) {
set("settings.restrictions.removeSpeed", true);
changes = true;
}
if (!contains("DataSource.mySQLMaxConections")) { if (!contains("DataSource.mySQLMaxConections")) {
set("DataSource.mySQLMaxConections", 25); set("DataSource.mySQLMaxConections", 25);
changes = true; changes = true;

View File

@ -1,6 +1,7 @@
DataSource: DataSource:
# What type of database do you want to use?
# Can be set to: sqlite, sqlitehikari, mysql # Can be set to: sqlite, sqlitehikari, mysql
# sqlitehikari should be more fast than normal sqlite but it's an experimental feature! # (sqlitehikari should be more fast than normal sqlite but it's an experimental feature!)
backend: sqlite backend: sqlite
# Enable database caching # Enable database caching
caching: true caching: true
@ -44,24 +45,28 @@ DataSource:
mySQLRealName: realname mySQLRealName: realname
settings: settings:
sessions: sessions:
# Do you want to enable session? When enabled # Do you want to enable the session feature?
# the ip of a player will be bound to the nickname # If enabled, when a player authenticates successfully,
# of the player on login. As long as neither of those # his IP and his nickname is saved.
# two change players don't have to login on a reconnect # 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 enabled: false
# After how many minutes a session should timeout? # After how many minutes a session should expire?
# 0 for unlimitted sessions, use 0 at your own risk! # 0 for unlimited time (Very dangerous, use it at your own risk!)
# consider that session will end only after timeout, and # Consider that session will end only after the timeout time, and
# if player's ip is changed but the timeout treshould isent # if the player's ip has changed but the timeout hasn't expired,
# ended, player will kick out of sever for invalidSession! # player will be kicked out of sever due to invalidSession!
timeout: 10 timeout: 10
# Do we need to timeout the session if the player is offline # Should the session expire if the player try to login with an
# And try to login with an another IP Address? # another IP Address?
sessionExpireOnIpChange: false sessionExpireOnIpChange: true
restrictions: restrictions:
# Can unregistered/unlogged players chat and see chat, care , that block all commands except followers # 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 allowChat: false
# Commands allowed when a player is unlogged # Commands allowed when a player is not authenticated
allowCommands: allowCommands:
- /login - /login
- /register - /register
@ -69,54 +74,52 @@ settings:
- /reg - /reg
- /email - /email
- /captcha - /captcha
# Maximum Registration per IP default: 1 # Max number of allowed registrations per IP (default: 1)
maxRegPerIp: 1 maxRegPerIp: 1
# Max allowed nick length # Max allowed username length
maxNicknameLength: 16 maxNicknameLength: 16
# Player that is online arent # When this setting is enabled, online players can't be kicked out
# kick out for "logged in from another # due to "Logged in from another Location"
# Location", this options will prevent players that would exploit # This setting will prevent potetial security exploits.
# your account when you are playing
ForceSingleSession: true ForceSingleSession: true
# Teleport every time player join at World Spawn location, # If enabled, every player will be teleported to the world spawnpoint
# even if they loggedin successfully, # after successful authentication.
# all quit and previus location will # The quit location of the player will be overwritten.
# overwrite with World Spawn. Different From # This is different from "teleportUnAuthedToSpawn" that teleport player
# "teleportUnAuthedToSpawn" # back to his quit location after the authentication.
# that teleport player back to his quit or kick position,
# when he loggedin
ForceSpawnLocOnJoinEnabled: false ForceSpawnLocOnJoinEnabled: false
# This will prevent all lost of quit position, when player # This option will save the quit location of the players.
# isent loggedin
SaveQuitLocation: false SaveQuitLocation: false
# For activate Restricted user by ip u need # To activate the restricted user feature you need
# to set True this option and configure the field # to enable this option and configure the
# AllowedRestrctedUser as show below # AllowedRestrctedUser field.
AllowRestrictedUser: false AllowRestrictedUser: false
# Restricted user will kick players that # The restricted user feature will kick players listed below
# is listed below and they dont # if they dont match of the defined ip address.
# meet the match of username;ip # Example:
# Example playername;127.0.0.1 , if playername # AllowedRestrictedUser:
# hasent 127.0.0.1 as ip address # - playername;127.0.0.1
# he will not be allowed to join the server
AllowedRestrictedUser: AllowedRestrictedUser:
- playername;127.0.0.1 - playername;127.0.0.1
# Should unregistered players be kicked immediatly? # Should unregistered players be kicked immediatly?
kickNonRegistered: false kickNonRegistered: false
# Should fail password players be kicked immediatly? # Should players be kicked on wrong password?
kickOnWrongPassword: false kickOnWrongPassword: false
# should not loged in players be teleported to spawn? # Should not logged in players be teleported to the spawn?
# On login they will be teleported back to their normal # After the authentication they will be teleported back to
# position # their normal position.
teleportUnAuthedToSpawn: false teleportUnAuthedToSpawn: false
# min allowed nick length # Minimum allowed nick length
minNicknameLength: 4 minNicknameLength: 4
# Can unregistered players walk around? # Can unregistered players walk around?
allowMovement: false allowMovement: false
# After what time players who fail to login or register # Should not authenticated players have speed = 0?
# should be kicked. Set to 0 to disable. # 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 timeout: 30
# Regex sintax for allowed Char in player name. # Regex sintax of allowed characters in the player name.
allowedNicknameCharacters: '[a-zA-Z0-9_]*' allowedNicknameCharacters: '[a-zA-Z0-9_]*'
# How far can unregistered players walk? Set to 0 # How far can unregistered players walk? Set to 0
# for unlimited radius # for unlimited radius