Skip to content

Commit d44ab4e

Browse files
committed
Warn when unsupported plugins are detected
Floodgate 1.0 does not work with the current Bukkit implementation. ProtocolLib and Floodgate don' play along nicely when used with FastLogin Related issue: #493
1 parent b2b6153 commit d44ab4e

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@
4747
import java.util.concurrent.ConcurrentHashMap;
4848
import java.util.concurrent.ConcurrentMap;
4949

50+
import org.bukkit.Bukkit;
51+
import org.bukkit.Server.Spigot;
5052
import org.bukkit.command.CommandSender;
5153
import org.bukkit.entity.Player;
5254
import org.bukkit.plugin.PluginManager;
5355
import org.bukkit.plugin.java.JavaPlugin;
56+
import org.geysermc.floodgate.api.FloodgateApi;
5457
import org.slf4j.Logger;
5558

5659
/**
@@ -138,6 +141,8 @@ public void onEnable() {
138141
premiumPlaceholder = new PremiumPlaceholder(this);
139142
premiumPlaceholder.register();
140143
}
144+
145+
dependencyWarnings();
141146
}
142147

143148
@Override
@@ -265,7 +270,38 @@ private boolean isValidFloodgateConfigString(String key) {
265270
logger.error("Invalid value detected for {} in FastLogin/config.yml.", key);
266271
return false;
267272
}
268-
return true;
269-
273+
return true;
274+
}
275+
276+
/**
277+
* Checks if a plugin is installed on the server
278+
* @param name the name of the plugin
279+
* @return true if the plugin is installed
280+
*/
281+
private boolean isPluginInstalled(String name) {
282+
//the plugin may be enabled after FastLogin, so isPluginEnabled()
283+
//won't work here
284+
return Bukkit.getServer().getPluginManager().getPlugin(name) != null;
270285
}
286+
287+
/**
288+
* Send warning messages to log if incompatible plugins are used
289+
*/
290+
private void dependencyWarnings() {
291+
if (isPluginInstalled("floodgate-bukkit")) {
292+
logger.warn("We have detected that you are runnging Floodgate 1.0 which is not supported by the Bukkit "
293+
+ "version of FastLogin.");
294+
logger.warn("If you would like to use FastLogin with Floodgate, you can download developement builds of "
295+
+ "Floodgate 2.0 from https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/dev%252F2.0/");
296+
logger.warn("Don't forget to update Geyser to a supported version as well from "
297+
+ "https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/floodgate-2.0/");
298+
} else if (isPluginInstalled("floodgate") && isPluginInstalled("ProtocolLib")) {
299+
logger.warn("We have detected that you are runnging FastLogin alongside Floodgate and ProtocolLib.");
300+
logger.warn("Currently there is an issue with FastLogin that prevents Floodgate name prefixes from showing up "
301+
+ "when it is together used with ProtocolLib.");
302+
logger.warn("If you would like to use Floodgate name prefixes, you can replace ProtocolLib with ProtocolSupport "
303+
+ "which does not have this issue.");
304+
logger.warn("For more information visit https://github.com/games647/FastLogin/issues/493");
305+
}
306+
}
271307
}

0 commit comments

Comments
 (0)