Apostrophes are no longer necessary in config.yml

This commit is contained in:
Smart123s
2021-05-08 14:20:56 +02:00
parent 85a1abfaac
commit 75750f8417
4 changed files with 10 additions and 12 deletions

View File

@ -229,8 +229,8 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
* @return <b>true</b> if the entry's value is "true", "false", or "linked"
*/
private boolean isValidFloodgateConfigString(String key) {
String value = core.getConfig().getString(key);
if (!value.equalsIgnoreCase("true") && !value.equalsIgnoreCase("linked") && !value.equalsIgnoreCase("false")) {
String value = core.getConfig().get(key).toString().toLowerCase();
if (!value.equals("true") && !value.equals("linked") && !value.equals("false")) {
logger.error("Invalid value detected for {} in FastLogin/config.yml.", key);
return false;
}

View File

@ -46,7 +46,7 @@ public class NameCheckTask extends JoinManagement<Player, CommandSender, Protoco
public void run() {
try {
// check if the player is connecting through Geyser
if (!plugin.getCore().getConfig().getString("allowFloodgateNameConflict").equalsIgnoreCase("false")
if (!plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().equalsIgnoreCase("false")
&& getFloodgatePlayer(username) != null) {
plugin.getLog().info("Skipping name conflict checking for player {}", username);
return;

View File

@ -26,10 +26,10 @@ public class FloodgateAuthTask implements Runnable {
plugin.getLog().info(
"Player {} is connecting through Geyser Floodgate.",
player.getName());
String allowNameConflict = plugin.getCore().getConfig().getString("allowFloodgateNameConflict");
String allowNameConflict = plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
// check if the Bedrock player is linked to a Java account
boolean isLinked = floodgatePlayer.getLinkedPlayer() != null;
if (allowNameConflict.equalsIgnoreCase("linked") && !isLinked) {
if (allowNameConflict.equals("linked") && !isLinked) {
plugin.getLog().info(
"Bedrock Player {}'s name conflits an existing Java Premium Player's name",
player.getName());
@ -47,7 +47,7 @@ public class FloodgateAuthTask implements Runnable {
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
String autoLoginFloodgate = plugin.getCore().getConfig().getString("autoLoginFloodgate");
String autoLoginFloodgate = plugin.getCore().getConfig().get("autoLoginFloodgate").toString().toLowerCase();
boolean autoRegisterFloodgate = plugin.getCore().getConfig().getBoolean("autoRegisterFloodgate");
boolean isRegistered;
@ -75,8 +75,8 @@ public class FloodgateAuthTask implements Runnable {
BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered, profile);
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
session.setVerified(autoLoginFloodgate.equalsIgnoreCase("true")
|| (autoLoginFloodgate.equalsIgnoreCase("linked") && isLinked));
session.setVerified(autoLoginFloodgate.equals("true")
|| (autoLoginFloodgate.equals("linked") && isLinked));
// run login task
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);

View File

@ -196,10 +196,9 @@ autoLogin: true
# This enables auto login for every player connecting through Floodgate.
# Possible values: false, true, linked
# Linked means that only Bedrock accounts linked to a Java account will be logged in automatically
# !!! DO NOT REMOVE THE APOSTROPHE !!!
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# Enabling this might lead to people gaining unauthorized access to other's accounts!
autoLoginFloodgate: 'false'
autoLoginFloodgate: false
# This enables Floodgate players to join the server, even if autoRegister is true and there's an existing
# Java **PREMIUM** account with the same name
@ -219,10 +218,9 @@ autoLoginFloodgate: 'false'
# 'autoRegister' must be 'true' for this to work
# true: Bypass 'autoRegister's name conflict checking
# linked: Bedrock accounts linked to a Java account will be allowed to join with conflicting names
# !!! DO NOT REMOVE THE APOSTROPHE !!!
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# Enabling this might lead to people gaining unauthorized access to other's accounts!
allowFloodgateNameConflict: 'false'
allowFloodgateNameConflict: false
# This enables auto registering every player connecting through Floodgate.
# autoLoginFloodgate must be 'true' for this to work