Skip to content

Commit

Permalink
Add warning when bungeecord settings mismatch between server and plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgH93 committed Dec 8, 2020
1 parent 865148f commit 4df0ea7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import at.pcgamingfreaks.Bukkit.Configuration;
import at.pcgamingfreaks.Bukkit.MCVersion;
import at.pcgamingfreaks.Bukkit.MinecraftMaterial;
import at.pcgamingfreaks.Bukkit.Util.Utils;
import at.pcgamingfreaks.ConsoleColor;
import at.pcgamingfreaks.Database.DatabaseConnectionConfiguration;
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
Expand Down Expand Up @@ -84,7 +85,7 @@ public int getAutoCleanupMaxInactiveDays()

public String getDatabaseType()
{
return getConfigE().getString("Database.Type", "sqlite");
return getConfigE().getString("Database.Type", "sqlite").toLowerCase(Locale.ENGLISH);
}

public void setDatabaseType(String type)
Expand Down Expand Up @@ -216,7 +217,17 @@ public String getUpdateChannel()

public boolean isBungeeCordModeEnabled()
{
return getConfigE().getBoolean("Misc.UseBungeeCord", false);
boolean useBungee = getConfigE().getBoolean("Misc.UseBungeeCord", false);
boolean spigotUsesBungee = Utils.detectBungeeCord();
if(useBungee && !spigotUsesBungee)
{
logger.warning("You have BungeeCord enabled, but it looks like you have not enabled it in your spigot.yml! You probably should check your configuration.");
}
else if(!useBungee && spigotUsesBungee && getDatabaseType().equals("mysql"))
{
logger.warning("Your server is running behind a BungeeCord server. If you are using the plugin please make sure to also enable the 'UseBungeeCord' config option.");
}
return useBungee;
}
//endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void close()
{
try
{
String dbType = plugin.getConfiguration().getDatabaseType().toLowerCase(Locale.ROOT);
String dbType = plugin.getConfiguration().getDatabaseType();
ConnectionProvider connectionProvider = null;
if(dbType.equals("shared") || dbType.equals("external") || dbType.equals("global"))
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<packaging>pom</packaging>

<properties>
<revision>2.3.21.1</revision>
<revision>2.3.21.2</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand Down

0 comments on commit 4df0ea7

Please sign in to comment.