mirror of
https://github.com/Shimeo98/DiscordWhitelisterSpigot.git
synced 2025-02-01 13:01:27 +01:00
Merge pull request #40 from dbwrush/master
Added compatibility with GeyserMC/Floodgate
This commit is contained in:
commit
d851de5474
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user