Skip to content

Commit

Permalink
more config mismatch checks
Browse files Browse the repository at this point in the history
  • Loading branch information
weaondara committed Aug 23, 2019
1 parent 946789d commit 58ddbff
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/net/alpenblock/bungeeperms/Lang.java
Expand Up @@ -182,11 +182,17 @@ public static enum MessageType
MISCONFIG_BUNGEE_BACKEND("warning.misconfig.bungee.backend", "Server {0}: The backend types of the BungeePerms configs do not match."),
MISCONFIG_BUNGEE_UUIDPLAYERDB("warning.misconfig.bungee.uuidplayerdb", "Server {0}: The uuidplayerdb types of the BungeePerms configs do not match."),
MISCONFIG_BUNGEE_USEUUID("warning.misconfig.bungee.useuuid", "Server {0}: The useuuids options of the BungeePerms configs do not match."),
MISCONFIG_BUNGEE_RESOLVINGMODE("warning.misconfig.bungee.resolvingmode", "Server {0}: The resolving mode options of the BungeePerms configs do not match."),
MISCONFIG_BUNGEE_GROUPPERMISSION("warning.misconfig.bungee.grouppermission", "Server {0}: The group permission options of the BungeePerms configs do not match."),
MISCONFIG_BUNGEE_REGEXPERMISSIONS("warning.misconfig.bungee.regexpermissions", "Server {0}: The regex permission options of the BungeePerms configs do not match."),
MISCONFIG_BUKKIT_STANDALONE("warning.misconfig.bukkit.standalone", "Received a plugin message from Bungeecord but BungeePerms is in standalone mode. Ignoring it ..."),
MISCONFIG_BUKKIT_SERVERNAME("warning.misconfig.bukkit.servername", "The server names of the Bungeecord config and BungeePerms config do not match."),
MISCONFIG_BUKKIT_BACKEND("warning.misconfig.bukkit.backend", "The backend types of the BungeePerms configs do not match."),
MISCONFIG_BUKKIT_UUIDPLAYERDB("warning.misconfig.bukkit.uuidplayerdb", "The uuidplayerdb types of the BungeePerms configs do not match."),
MISCONFIG_BUKKIT_USEUUID("warning.misconfig.bukkit.useuuid", "The useuuids options of the BungeePerms configs do not match."),
MISCONFIG_BUKKIT_RESOLVINGMODE("warning.misconfig.bukkit.resolvingmode", "The resolving mode options of the BungeePerms configs do not match."),
MISCONFIG_BUKKIT_GROUPPERMISSION("warning.misconfig.bukkit.grouppermission", "The group permission options of the BungeePerms configs do not match."),
MISCONFIG_BUKKIT_REGEXPERMISSIONS("warning.misconfig.bukkit.regexpermisions", "The regex permission options of the BungeePerms configs do not match."),
MISCONFIG_BUNGEECORD_BUKKIT_CONFIG("warning.misconfig.bungee-bukkit-config", "UUIDs on Bungeecord and Bukkit/Spigot differ. Check your Spigot/Bukkit and Bungeecord config!"),
MISCONFIG_USEUUID_NONE_UUID_DB("warning.misconfig.useuuid-none-uuiddb", "The useUUIDs option is enabled but the uuidplayerdb is set to none!"),
//help
Expand Down
Expand Up @@ -9,6 +9,7 @@
import net.alpenblock.bungeeperms.Group;
import net.alpenblock.bungeeperms.Lang;
import net.alpenblock.bungeeperms.PermissionsManager;
import net.alpenblock.bungeeperms.PermissionsResolver;
import net.alpenblock.bungeeperms.Statics;
import net.alpenblock.bungeeperms.User;
import net.alpenblock.bungeeperms.io.BackEndType;
Expand Down Expand Up @@ -263,6 +264,9 @@ else if (cmd.equalsIgnoreCase("configcheck"))
String servername = data.get(1);
BackEndType backend = BackEndType.getByName(data.get(2));
boolean useuuid = Boolean.parseBoolean(data.get(3));
PermissionsResolver.ResolvingMode resolvingmode = PermissionsResolver.ResolvingMode.valueOf(data.get(4));
boolean groupperm = Boolean.parseBoolean(data.get(5));
boolean regexperm = Boolean.parseBoolean(data.get(6));
if (!config.getServername().equals(servername))
{
config.setServerName(servername);
Expand All @@ -276,6 +280,18 @@ else if (cmd.equalsIgnoreCase("configcheck"))
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUKKIT_USEUUID));
}
if (config.getResolvingMode() != resolvingmode)
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUKKIT_RESOLVINGMODE));
}
if (config.isGroupPermission() != groupperm)
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUKKIT_GROUPPERMISSION));
}
if (config.isUseRegexPerms() != regexperm)
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUKKIT_REGEXPERMISSIONS));
}
}
else if (cmd.equalsIgnoreCase("uuidcheck"))
{
Expand Down
Expand Up @@ -202,7 +202,13 @@ private void sendConfig(Player p)
if (lastConfigUpdate + 5 * 60 * 1000 < now)
{
lastConfigUpdate = now;
p.sendPluginMessage(BukkitPlugin.getInstance(), BungeePerms.CHANNEL, ("configcheck;" + config.getServername() + ";" + config.getBackendType() + ";" + config.isUseUUIDs()).getBytes());
p.sendPluginMessage(BukkitPlugin.getInstance(), BungeePerms.CHANNEL, ("configcheck"
+ ";" + config.getServername()
+ ";" + config.getBackendType()
+ ";" + config.isUseUUIDs()
+ ";" + config.getResolvingMode()
+ ";" + config.isGroupPermission()
+ ";" + config.isUseRegexPerms()).getBytes());
}
}
}
Expand Down
Expand Up @@ -10,6 +10,7 @@
import net.alpenblock.bungeeperms.Group;
import net.alpenblock.bungeeperms.Lang;
import net.alpenblock.bungeeperms.PermissionsManager;
import net.alpenblock.bungeeperms.PermissionsResolver;
import net.alpenblock.bungeeperms.Statics;
import net.alpenblock.bungeeperms.User;
import net.alpenblock.bungeeperms.io.BackEndType;
Expand Down Expand Up @@ -309,6 +310,9 @@ else if (cmd.equalsIgnoreCase("configcheck"))
String servername = data.get(1);
BackEndType backend = BackEndType.getByName(data.get(2));
boolean useuuid = Boolean.parseBoolean(data.get(3));
PermissionsResolver.ResolvingMode resolvingmode = PermissionsResolver.ResolvingMode.valueOf(data.get(4));
boolean groupperm = Boolean.parseBoolean(data.get(5));
boolean regexperm = Boolean.parseBoolean(data.get(6));
if (!scon.getInfo().getName().equals(servername))
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUNGEE_SERVERNAME, scon.getInfo().getName()));
Expand All @@ -321,6 +325,18 @@ else if (cmd.equalsIgnoreCase("configcheck"))
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUNGEE_USEUUID, scon.getInfo().getName()));
}
if (config.getResolvingMode() != resolvingmode)
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUNGEE_RESOLVINGMODE, scon.getInfo().getName()));
}
if (config.isGroupPermission() != groupperm)
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUNGEE_GROUPPERMISSION, scon.getInfo().getName()));
}
if (config.isUseRegexPerms() != regexperm)
{
BungeePerms.getLogger().warning(Lang.translate(Lang.MessageType.MISCONFIGURATION) + ": " + Lang.translate(Lang.MessageType.MISCONFIG_BUNGEE_REGEXPERMISSIONS, scon.getInfo().getName()));
}
}

e.setCancelled(true);
Expand Down
Expand Up @@ -196,7 +196,13 @@ private void sendConfig(ServerInfo info)
if (lastConfigUpdate + 5 * 60 * 1000 < now)
{
lastConfigUpdate = now;
info.sendData(BungeePerms.CHANNEL, ("configcheck;" + info.getName() + ";" + config.getBackendType() + ";" + config.isUseUUIDs()).getBytes());
info.sendData(BungeePerms.CHANNEL, ("configcheck"
+ ";" + info.getName()
+ ";" + config.getBackendType()
+ ";" + config.isUseUUIDs()
+ ";" + config.getResolvingMode()
+ ";" + config.isGroupPermission()
+ ";" + config.isUseRegexPerms()).getBytes());
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/lang/de-DE.yml
Expand Up @@ -167,12 +167,18 @@ warning:
backend: 'Server {0}: Die backend Typen der BungeePermskonfigurationen stimmen nicht überein.'
uuidplayerdb: 'Server {0}: The uuidplayerdb Typen der BungeePermskonfigurationen stimmen nicht ueberein.'
useuuid: 'Server {0}: Die useuuids Option der BungeePermskonfigurationen stimmen nicht ueberein.'
resolvingmode: 'Server {0}: Die resolving mode Option der BungeePermskonfigurationen stimmen nicht ueberein.'
grouppermission: 'Server {0}: Die group permission Option der BungeePermskonfigurationen stimmen nicht ueberein.'
regexpermissions: 'Server {0}: Die regex permission Option der BungeePermskonfigurationen stimmen nicht ueberein.'
bukkit:
standalone: Pluginachricht von Bungeecord erhalten aber BungeePerms ist im Standalonemodus. Ignoriere Nachricht ...
servername: Der Servername der Bungeecordkonfiguration und der BungeePermskonfigurationen stimmen nicht ueberein.
backend: Die backend Typen der BungeePermskonfigurationen stimmen nicht überein.
uuidplayerdb: The uuidplayerdb Typen der BungeePermskonfigurationen stimmen nicht ueberein.
useuuid: Die useuuids Option der BungeePermskonfigurationen stimmen nicht ueberein.
resolvingmode: Die resolving mode Option der BungeePermskonfigurationen stimmen nicht ueberein.
grouppermission: Die group permission Option der BungeePermskonfigurationen stimmen nicht ueberein.
regexpermissions: Die regex permission Option der BungeePermskonfigurationen stimmen nicht ueberein.
bungee-bukkit-config: UUIDs auf Bungeecord und Bukkit/Spigot unterscheiden sich. Checke deine Spigot/Bukkit und Bungeecord Konfiguration!
useuuid-none-uuiddb: The useUUIDs option is enabled but the uuidplayerdb is set to none!
help:
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/lang/en-GB.yml
Expand Up @@ -167,12 +167,18 @@ warning:
backend: 'Server {0}: The backend types of the BungeePerms configs do not match.'
uuidplayerdb: 'Server {0}: The uuidplayerdb types of the BungeePerms configs do not match.'
useuuid: 'Server {0}: The useuuids options of the BungeePerms configs do not match.'
resolvingmode: 'Server {0}: The resolving mode options of the BungeePerms configs do not match.'
grouppermission: 'Server {0}: The group permission options of the BungeePerms configs do not match.'
regexpermissions: 'Server {0}: The regex permission options of the BungeePerms configs do not match.'
bukkit:
standalone: Received a plugin message from Bungeecord but BungeePerms is in standalone mode. Ignoring it ...
servername: The server names of the Bungeecord config and BungeePerms config do not match.
backend: The backend types of the BungeePerms configs do not match.
uuidplayerdb: The uuidplayerdb types of the BungeePerms configs do not match.
useuuid: The useuuids options of the BungeePerms configs do not match.
resolvingmode: The resolving mode options of the BungeePerms configs do not match.
grouppermission: The group permission options of the BungeePerms configs do not match.
regexpermissions: The regex permission options of the BungeePerms configs do not match.
bungee-bukkit-config: UUIDs on Bungeecord and Bukkit/Spigot differ. Check your Spigot/Bukkit and Bungeecord config!
useuuid-none-uuiddb: The useUUIDs option is enabled, but the uuidplayerdb is set to none!
help:
Expand Down

0 comments on commit 58ddbff

Please sign in to comment.