mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-08-01 11:44:44 +02:00
Call auth methods on connection
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.github.games647.fastlogin.bungee;
|
package com.github.games647.fastlogin.bungee;
|
||||||
|
|
||||||
|
import com.github.games647.fastlogin.bungee.hooks.BungeeAuthHook;
|
||||||
|
import com.github.games647.fastlogin.bungee.hooks.BungeeAuthPlugin;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -13,6 +15,7 @@ import net.md_5.bungee.api.plugin.Plugin;
|
|||||||
public class FastLoginBungee extends Plugin {
|
public class FastLoginBungee extends Plugin {
|
||||||
|
|
||||||
private final Set<String> enabledPremium = Sets.newConcurrentHashSet();
|
private final Set<String> enabledPremium = Sets.newConcurrentHashSet();
|
||||||
|
private BungeeAuthPlugin bungeeAuthPlugin;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@@ -21,6 +24,8 @@ public class FastLoginBungee extends Plugin {
|
|||||||
|
|
||||||
//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(getDescription().getName());
|
||||||
|
|
||||||
|
registerHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,4 +36,21 @@ public class FastLoginBungee extends Plugin {
|
|||||||
public Set<String> getEnabledPremium() {
|
public Set<String> getEnabledPremium() {
|
||||||
return enabledPremium;
|
return enabledPremium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the auth plugin hook for BungeeCord
|
||||||
|
*
|
||||||
|
* @return the auth hook for BungeeCord. null if none found
|
||||||
|
*/
|
||||||
|
public BungeeAuthPlugin getBungeeAuthPlugin() {
|
||||||
|
return bungeeAuthPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerHook() {
|
||||||
|
Plugin plugin = getProxy().getPluginManager().getPlugin("BungeeAuth");
|
||||||
|
if (plugin != null) {
|
||||||
|
bungeeAuthPlugin = new BungeeAuthHook();
|
||||||
|
getLogger().info("Hooked into BungeeAuth");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.github.games647.fastlogin.bungee;
|
package com.github.games647.fastlogin.bungee;
|
||||||
|
|
||||||
|
import com.github.games647.fastlogin.bungee.hooks.BungeeAuthPlugin;
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
@@ -62,6 +63,11 @@ public class PlayerConnectionListener implements Listener {
|
|||||||
dataOutput.writeLong(proxyId.getLeastSignificantBits());
|
dataOutput.writeLong(proxyId.getLeastSignificantBits());
|
||||||
|
|
||||||
server.sendData(plugin.getDescription().getName(), dataOutput.toByteArray());
|
server.sendData(plugin.getDescription().getName(), dataOutput.toByteArray());
|
||||||
|
|
||||||
|
BungeeAuthPlugin authPlugin = plugin.getBungeeAuthPlugin();
|
||||||
|
if (authPlugin != null) {
|
||||||
|
authPlugin.forceLogin(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,5 +8,9 @@ main: ${project.groupId}.${project.artifactId}.${project.name}
|
|||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
author: games647, http://github.com/games647/FastLogin/graphs/contributors
|
author: games647, http://github.com/games647/FastLogin/graphs/contributors
|
||||||
|
|
||||||
|
softdepends:
|
||||||
|
# BungeeCord auth plugins
|
||||||
|
- BungeeAuth
|
||||||
|
|
||||||
description: |
|
description: |
|
||||||
${project.description}
|
${project.description}
|
Reference in New Issue
Block a user