mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add safe-usermap-names option to control usermap key sanitisation
This is necessary to stop players with Chinese characters in their username losing their balances.
This commit is contained in:
parent
e9833d1cd2
commit
c97918df24
@ -326,4 +326,6 @@ public interface ISettings extends IConf {
|
||||
boolean isForceEnableRecipe();
|
||||
|
||||
boolean allowOldIdSigns();
|
||||
|
||||
boolean isSafeUsermap();
|
||||
}
|
||||
|
@ -543,6 +543,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
itemDbType = _getItemDbType();
|
||||
forceEnableRecipe = _isForceEnableRecipe();
|
||||
allowOldIdSigns = _allowOldIdSigns();
|
||||
isSafeUsermap = _isSafeUsermap();
|
||||
}
|
||||
|
||||
void _lateLoadItemSpawnBlacklist() {
|
||||
@ -1540,4 +1541,15 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
public boolean allowOldIdSigns() {
|
||||
return allowOldIdSigns;
|
||||
}
|
||||
|
||||
private boolean isSafeUsermap;
|
||||
|
||||
private boolean _isSafeUsermap() {
|
||||
return config.getBoolean("safe-usermap-names", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSafeUsermap() {
|
||||
return isSafeUsermap;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf {
|
||||
if (uuid != null) {
|
||||
keys.add(uuid);
|
||||
if (name != null && name.length() > 0) {
|
||||
final String keyName = StringUtil.safeString(name);
|
||||
final String keyName = ess.getSettings().isSafeUsermap() ? StringUtil.safeString(name) : name;
|
||||
if (!names.containsKey(keyName)) {
|
||||
names.put(keyName, uuid);
|
||||
uuidMap.writeUUIDMap();
|
||||
|
@ -281,6 +281,12 @@ player-commands:
|
||||
- worth
|
||||
- xmpp
|
||||
|
||||
# Use this option to force superperms-based permissions handler regardless of detected installed perms plugin.
|
||||
# This is useful if you want superperms-based permissions (with wildcards) for custom permissions plugins.
|
||||
# If you wish to use EssentialsX's built-in permissions using the `player-commands` section above, set this to false.
|
||||
# Default is true.
|
||||
use-bukkit-permissions: true
|
||||
|
||||
# When this option is enabled, one-time use kits (ie. delay < 0) will be
|
||||
# removed from the /kit list when a player can no longer use it
|
||||
skip-used-one-time-kits-from-kit-list: false
|
||||
@ -553,6 +559,10 @@ allow-direct-hat: true
|
||||
# This doesn't affect running the command from the console, where a world is always required.
|
||||
allow-world-in-broadcastworld: true
|
||||
|
||||
# Should the usermap try to sanitise usernames before saving them?
|
||||
# You should only change this to false if you use Minecraft China.
|
||||
safe-usermap-names: true
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsHome | #
|
||||
@ -627,12 +637,6 @@ min-money: -10000
|
||||
# Enable this to log all interactions with trade/buy/sell signs and sell command.
|
||||
economy-log-enabled: false
|
||||
|
||||
# Use this option to force superperms-based permissions handler regardless of detected installed perms plugin.
|
||||
# This is useful if you want superperms-based permissions (with wildcards) for custom permissions plugins.
|
||||
# If you wish to use EssentialsX' built-in permissions using the `player-commands` section above, set this to false.
|
||||
# Default is true.
|
||||
use-bukkit-permissions: true
|
||||
|
||||
# Minimum acceptable amount to be used in /pay.
|
||||
minimum-pay-amount: 0.001
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user