Added compatibility with GeyserMC/Floodgate

This commit is contained in:
BuildTools 2021-03-05 14:58:54 -06:00
parent 0d6ad6705d
commit d54cd63fb9
2 changed files with 19 additions and 0 deletions

View File

@ -473,6 +473,9 @@ public class CommandAdd
if (!WhitelistedPlayers.usingEasyWhitelist && authorPermissions.isUserCanUseCommand())
DiscordClient.ExecuteServerCommand("whitelist add " + finalNameToAdd);
if(MainConfig.getMainConfig().getBoolean("use-geyser/floodgate-compatibility")) {
addBedrockUser(finalNameToAdd);
}
// have to use !invalidMinecraftName else the easy whitelist plugin will add the name regardless of whether it is valid on not
if (WhitelistedPlayers.usingEasyWhitelist && !invalidMinecraftName && authorPermissions.isUserCanUseCommand())
@ -615,4 +618,16 @@ public class CommandAdd
}
}
}
private static void addBedrockUser(String finalNameToAdd) {
String bedrockPrefix = MainConfig.getMainConfig().getString("geyser/floodgate prefix");
String bedrockName = bedrockPrefix + finalNameToAdd;
if(bedrockName.length() > 16) {
bedrockName = bedrockName.substring(0, 16);
}
//check if we actually NEED to add
if(finalNameToAdd.length() < bedrockPrefix.length() || !finalNameToAdd.substring(0, bedrockPrefix.length() - 1).equals(bedrockPrefix)) {
DiscordClient.ExecuteServerCommand("whitelist add " + bedrockName);
}
}
}

View File

@ -157,6 +157,10 @@ public class MainConfig
CheckEntry("use-crafatar-for-avatars", false);
CheckEntry("use-geyser/floodgate-compatibility", false);
CheckEntry("geyser/floodgate prefix", "SetThisToWhateverPrefixYouUse");
// Remove old role entry if found, move role to new array (for people with v1.3.6 or below)
if(whitelisterBotConfig.get("whitelisted-role") != null)
{