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) 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal 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 * Github: https://github.com/ST-DDT/CrazyLogin
* * <p>
* Project page: * Project page:
* * <p>
* Bukkit: https://dev.bukkit.org/server-mods/crazylogin/ * Bukkit: https://dev.bukkit.org/server-mods/crazylogin/
*/ */
public class CrazyLoginHook implements AuthPlugin<Player> { public class CrazyLoginHook implements AuthPlugin<Player> {

View File

@ -13,9 +13,11 @@ import org.bukkit.entity.Player;
/** /**
* Github: https://github.com/XziomekX/LogIt * Github: https://github.com/XziomekX/LogIt
* <p>
* Project page: * Project page:
* * <p>
* Bukkit: Unknown * Bukkit: Unknown
* <p>
* Spigot: Unknown * Spigot: Unknown
*/ */
public class LogItHook implements AuthPlugin<Player> { 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: * Github: https://github.com/lenis0012/LoginSecurity-2 Project page:
* * <p>
* Bukkit: https://dev.bukkit.org/bukkit-plugins/loginsecurity/ * Bukkit: https://dev.bukkit.org/bukkit-plugins/loginsecurity/
* <p>
* Spigot: https://www.spigotmc.org/resources/loginsecurity.19362/ * Spigot: https://www.spigotmc.org/resources/loginsecurity.19362/
*/ */
public class LoginSecurityHook implements AuthPlugin<Player> { public class LoginSecurityHook implements AuthPlugin<Player> {

View File

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

View File

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

View File

@ -26,7 +26,7 @@ public class DelayedAuthHook implements Runnable {
@Override @Override
public void run() { public void run() {
boolean hookFound = plugin.getCore().getAuthPluginHook() != null || registerHooks(); boolean hookFound = isHookFound();
if (plugin.isBungeeCord()) { if (plugin.isBungeeCord()) {
plugin.getLog().info("BungeeCord setting detected. No auth plugin is required"); plugin.getLog().info("BungeeCord setting detected. No auth plugin is required");
} else if (!hookFound) { } else if (!hookFound) {
@ -41,6 +41,10 @@ public class DelayedAuthHook implements Runnable {
} }
} }
private boolean isHookFound() {
return plugin.getCore().getAuthPluginHook() != null || registerHooks();
}
private boolean registerHooks() { private boolean registerHooks() {
AuthPlugin<Player> authPluginHook = getAuthHook(); AuthPlugin<Player> authPluginHook = getAuthHook();
if (authPluginHook == null) { if (authPluginHook == null) {
@ -82,10 +86,10 @@ public class DelayedAuthHook implements Runnable {
private AuthPlugin<Player> newInstance(Class<? extends AuthPlugin<Player>> clazz) private AuthPlugin<Player> newInstance(Class<? extends AuthPlugin<Player>> clazz)
throws ReflectiveOperationException { throws ReflectiveOperationException {
try { try {
Constructor<? extends AuthPlugin<Player>> cons = clazz.getConstructor(FastLoginBukkit.class); Constructor<? extends AuthPlugin<Player>> cons = clazz.getDeclaredConstructor(FastLoginBukkit.class);
return cons.newInstance(plugin); return cons.newInstance(plugin);
} catch (NoSuchMethodException noMethodEx) { } 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)); getProxy().getPluginManager().registerListener(this, new MessageListener(this));
//this is required to listen to messages from the server //this is required to listen to messages from the server
getProxy().registerChannel(getDescription().getName()); getProxy().registerChannel(getName());
registerHook(); registerHook();
} }

View File

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

View File

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