Relocate HikariCP and slf4j too to prevent conflicts

This commit is contained in:
games647
2018-02-08 13:24:42 +01:00
parent e5e815a885
commit 8cbdb66625
10 changed files with 29 additions and 14 deletions

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015-17
Copyright (c) 2015-2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -20,9 +20,9 @@ import org.bukkit.entity.Player;
/**
* Github: https://github.com/ST-DDT/CrazyLogin
*
* <p>
* Project page:
*
* <p>
* Bukkit: https://dev.bukkit.org/server-mods/crazylogin/
*/
public class CrazyLoginHook implements AuthPlugin<Player> {

View File

@ -13,9 +13,11 @@ import org.bukkit.entity.Player;
/**
* Github: https://github.com/XziomekX/LogIt
* <p>
* Project page:
*
* <p>
* Bukkit: Unknown
* <p>
* Spigot: Unknown
*/
public class LogItHook implements AuthPlugin<Player> {

View File

@ -12,8 +12,9 @@ import org.bukkit.entity.Player;
/**
* Github: https://github.com/lenis0012/LoginSecurity-2 Project page:
*
* <p>
* Bukkit: https://dev.bukkit.org/bukkit-plugins/loginsecurity/
* <p>
* Spigot: https://www.spigotmc.org/resources/loginsecurity.19362/
*/
public class LoginSecurityHook implements AuthPlugin<Player> {

View File

@ -16,9 +16,9 @@ import ultraauth.managers.PlayerManager;
/**
* Project page:
*
* <p>
* Bukkit: https://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
*
* <p>
* Spigot: https://www.spigotmc.org/resources/ultraauth.17044/
*/
public class UltraAuthHook implements AuthPlugin<Player> {

View File

@ -15,9 +15,9 @@ import org.bukkit.entity.Player;
/**
* Github: https://github.com/LycanDevelopment/xAuth/
*
* <p>
* Project page:
*
* <p>
* Bukkit: https://dev.bukkit.org/bukkit-plugins/xauth/
*/
public class xAuthHook implements AuthPlugin<Player> {

View File

@ -26,7 +26,7 @@ public class DelayedAuthHook implements Runnable {
@Override
public void run() {
boolean hookFound = plugin.getCore().getAuthPluginHook() != null || registerHooks();
boolean hookFound = isHookFound();
if (plugin.isBungeeCord()) {
plugin.getLog().info("BungeeCord setting detected. No auth plugin is required");
} else if (!hookFound) {
@ -41,6 +41,10 @@ public class DelayedAuthHook implements Runnable {
}
}
private boolean isHookFound() {
return plugin.getCore().getAuthPluginHook() != null || registerHooks();
}
private boolean registerHooks() {
AuthPlugin<Player> authPluginHook = getAuthHook();
if (authPluginHook == null) {
@ -82,10 +86,10 @@ public class DelayedAuthHook implements Runnable {
private AuthPlugin<Player> newInstance(Class<? extends AuthPlugin<Player>> clazz)
throws ReflectiveOperationException {
try {
Constructor<? extends AuthPlugin<Player>> cons = clazz.getConstructor(FastLoginBukkit.class);
Constructor<? extends AuthPlugin<Player>> cons = clazz.getDeclaredConstructor(FastLoginBukkit.class);
return cons.newInstance(plugin);
} catch (NoSuchMethodException noMethodEx) {
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
}
}
}

View File

@ -50,7 +50,7 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
getProxy().getPluginManager().registerListener(this, new MessageListener(this));
//this is required to listen to messages from the server
getProxy().registerChannel(getDescription().getName());
getProxy().registerChannel(getName());
registerHook();
}

View File

@ -30,7 +30,7 @@ public class MessageListener implements Listener {
@EventHandler
public void onPluginMessage(PluginMessageEvent pluginMessageEvent) {
String channel = pluginMessageEvent.getTag();
if (pluginMessageEvent.isCancelled() || !plugin.getDescription().getName().equals(channel)) {
if (pluginMessageEvent.isCancelled() || !plugin.getName().equals(channel)) {
return;
}

View File

@ -41,6 +41,14 @@
<pattern>com.google.gson</pattern>
<shadedPattern>fastlogin.gson</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>fastlogin.slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>fastlogin.hikari</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>