Add velocity and paper proxy online mode detection

This commit is contained in:
GeorgH93 2023-05-07 13:41:12 +02:00
parent fcfd96d242
commit ae52896d78
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 10 additions and 4 deletions

View File

@ -128,6 +128,12 @@ public boolean useOnlineUUIDs()
{ {
if(isBungeeCordModeEnabled()) if(isBungeeCordModeEnabled())
{ {
Boolean detectedOnlineMode = Utils.getBungeeOrVelocityOnlineMode();
if (detectedOnlineMode != null)
{
logger.info("Detected online mode in paper config: " + detectedOnlineMode);
return detectedOnlineMode;
}
logger.warning("When using BungeeCord please make sure to set the UUID_Type config option explicitly!"); logger.warning("When using BungeeCord please make sure to set the UUID_Type config option explicitly!");
} }
return Bukkit.getServer().getOnlineMode(); return Bukkit.getServer().getOnlineMode();
@ -222,13 +228,13 @@ public String getUpdateChannel()
public boolean isBungeeCordModeEnabled() public boolean isBungeeCordModeEnabled()
{ {
boolean useBungee = getConfigE().getBoolean("Misc.UseBungeeCord", false); boolean useBungee = getConfigE().getBoolean("Misc.UseBungeeCord", false);
boolean spigotUsesBungee = Utils.detectBungeeCord(); boolean runsProxy = Utils.detectBungeeCord() || Utils.detectVelocity();
boolean shareableDB = getDatabaseType().equals("mysql") || getDatabaseType().equals("global"); boolean shareableDB = getDatabaseType().equals("mysql") || getDatabaseType().equals("global");
if(useBungee && !spigotUsesBungee) if(useBungee && !runsProxy)
{ {
logger.warning("You have BungeeCord enabled for the plugin, but it looks like you have not enabled it in your spigot.yml! You probably should check your configuration."); logger.warning("You have BungeeCord enabled for the plugin, but it looks like you have not enabled it in your spigot.yml! You probably should check your configuration.");
} }
else if(!useBungee && spigotUsesBungee && shareableDB) else if(!useBungee && runsProxy && shareableDB)
{ {
logger.warning("Your server is running behind a BungeeCord server. If you are using the plugin on more than one server with a shared database, please make sure to also enable the 'UseBungeeCord' config option."); logger.warning("Your server is running behind a BungeeCord server. If you are using the plugin on more than one server with a shared database, please make sure to also enable the 'UseBungeeCord' config option.");
} }

View File

@ -7,7 +7,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<revision>2.4.18</revision> <revision>2.4.19</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>