Remove bungeecord messaging hook
It was the cause of many issues, as temp replacement server owners can use AuthMeBridge.
This commit is contained in:
@@ -3,13 +3,9 @@ package fr.xephi.authme.service;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.hooks.BungeeCordMessage;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.Messenger;
|
||||
|
||||
@@ -21,8 +17,6 @@ import javax.inject.Inject;
|
||||
public class BungeeService implements SettingsDependent {
|
||||
|
||||
private AuthMe plugin;
|
||||
private BukkitService bukkitService;
|
||||
private BungeeCordMessage bungeeCordMessage;
|
||||
|
||||
private boolean isEnabled;
|
||||
private String bungeeServer;
|
||||
@@ -31,59 +25,11 @@ public class BungeeService implements SettingsDependent {
|
||||
* Constructor.
|
||||
*/
|
||||
@Inject
|
||||
BungeeService(AuthMe plugin, BukkitService bukkitService, Settings settings, BungeeCordMessage bungeeCordMessage) {
|
||||
BungeeService(AuthMe plugin, Settings settings) {
|
||||
this.plugin = plugin;
|
||||
this.bukkitService = bukkitService;
|
||||
this.bungeeCordMessage = bungeeCordMessage;
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Bungee message to a player, e.g. login.
|
||||
*
|
||||
* @param player The player to send the message to.
|
||||
* @param action The action to send, e.g. login.
|
||||
*/
|
||||
public void sendBungeeMessage(Player player, String action) {
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Forward");
|
||||
out.writeUTF("ALL");
|
||||
out.writeUTF("AuthMe");
|
||||
out.writeUTF(action + ";" + player.getName());
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Bungee message for a password change.
|
||||
*
|
||||
* @param player The player who's password is changed.
|
||||
* @param password The new password.
|
||||
*/
|
||||
public void sendPasswordChanged(final Player player, HashedPassword password) {
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String hash = password.getHash();
|
||||
final String salt = password.getSalt();
|
||||
|
||||
bukkitService.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Forward");
|
||||
out.writeUTF("ALL");
|
||||
out.writeUTF("AuthMe");
|
||||
out.writeUTF("changepassword;" + player.getName() + ";" + hash + ";" + salt);
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a player to a specified server. If no server is configured, this will
|
||||
* do nothing.
|
||||
@@ -109,9 +55,6 @@ public class BungeeService implements SettingsDependent {
|
||||
if (!this.isEnabled) {
|
||||
return;
|
||||
}
|
||||
if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
|
||||
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", bungeeCordMessage);
|
||||
}
|
||||
if (!messenger.isOutgoingChannelRegistered(plugin, "BungeeCord")) {
|
||||
messenger.registerOutgoingPluginChannel(plugin, "BungeeCord");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user