[DEV] [NEED TEST] BungeeCord
Add a way to send player login on other AuthMe instance through BungeeCord plugin channel
This commit is contained in:
@@ -3,6 +3,9 @@ package fr.xephi.authme.hooks;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
@@ -43,6 +46,30 @@ public class BungeeCordMessage implements PluginMessageListener {
|
||||
// Put the IP (only the ip not the port) in the hashMap
|
||||
plugin.realIp.put(player.getName().toLowerCase(), ip);
|
||||
}
|
||||
if (subChannel.equals("Forward"))
|
||||
{
|
||||
String str = in.readUTF();
|
||||
if (!str.startsWith("AuthMe"))
|
||||
return;
|
||||
String[] args = str.split(";");
|
||||
try {
|
||||
String name = args[2];
|
||||
PlayerAuth auth = plugin.database.getAuth(name);
|
||||
if (auth == null)
|
||||
return;
|
||||
if (args[1].equalsIgnoreCase("login"))
|
||||
{
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
plugin.database.setLogged(name);
|
||||
}
|
||||
else if (args[1].equalsIgnoreCase("logout"))
|
||||
{
|
||||
PlayerCache.getInstance().removePlayer(name);
|
||||
plugin.database.setUnlogged(name);
|
||||
}
|
||||
} catch (Exception e)
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user