Add a way to handle a player logout in playerquit into bungeecord

This commit is contained in:
Xephi 2015-12-30 14:40:19 +01:00
parent bf6ef0f4a0
commit a3a3907586

View File

@ -1,8 +1,13 @@
package fr.xephi.authme.process.quit;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.settings.Settings;
import org.bukkit.entity.Player;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
/**
*/
public class ProcessSyncronousPlayerQuit implements Runnable {
@ -28,6 +33,15 @@ public class ProcessSyncronousPlayerQuit implements Runnable {
this.needToChange = needToChange;
}
protected void sendBungeeMessage() {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Forward");
out.writeUTF("ALL");
out.writeUTF("AuthMe");
out.writeUTF("logout;" + player.getName().toLowerCase());
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
/**
* Method run.
*
@ -42,5 +56,7 @@ public class ProcessSyncronousPlayerQuit implements Runnable {
player.getVehicle().eject();
} catch (Exception ignored) {
}
if (!Settings.isSessionsEnabled && Settings.bungee)
sendBungeeMessage();
}
}