@ljacqu please check
This commit is contained in:
Gabriele C 2016-08-07 23:38:52 +02:00
parent 306ebe3631
commit 4518c1bb9b
2 changed files with 16 additions and 17 deletions

View File

@ -16,7 +16,6 @@ import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.datasource.FlatFile;
import fr.xephi.authme.datasource.MySQL;
import fr.xephi.authme.datasource.SQLite;
import fr.xephi.authme.hooks.BungeeCordMessage;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.initialization.MetricsStarter;
@ -39,7 +38,6 @@ import fr.xephi.authme.settings.SettingsMigrationService;
import fr.xephi.authme.settings.SpawnLoader;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
@ -64,7 +62,6 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitWorker;
@ -242,9 +239,6 @@ public class AuthMe extends JavaPlugin {
// TODO: maybe create a backup manager?
new PerformBackup(this, settings).doBackup(PerformBackup.BackupCause.START);
// Set up the BungeeCord hook
setupBungeeCordHook();
// Reload support hook
reloadSupportHook();
@ -353,17 +347,6 @@ public class AuthMe extends JavaPlugin {
}
}
/**
* Set up the BungeeCord hook.
*/
private void setupBungeeCordHook() {
if (settings.getProperty(HooksSettings.BUNGEECORD)) {
Messenger messenger = Bukkit.getMessenger();
messenger.registerOutgoingPluginChannel(this, "BungeeCord");
messenger.registerIncomingPluginChannel(this, "BungeeCord", injector.getSingleton(BungeeCordMessage.class));
}
}
/**
* Loads the plugin's settings.
*

View File

@ -3,12 +3,15 @@ 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;
import javax.inject.Inject;
@ -20,6 +23,9 @@ public class BungeeService implements SettingsDependent {
private AuthMe plugin;
private BukkitService bukkitService;
@Inject
private BungeeCordMessage bungeeCordMessage;
private boolean isEnabled;
private String bungeeServer;
@ -103,5 +109,15 @@ public class BungeeService implements SettingsDependent {
public void reload(Settings settings) {
this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);
this.bungeeServer = settings.getProperty(HooksSettings.BUNGEECORD_SERVER);
Messenger messenger = plugin.getServer().getMessenger();
if(!this.isEnabled) {
return;
}
if(!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", bungeeCordMessage);
}
if(!messenger.isOutgoingChannelRegistered(plugin, "BungeeCord")) {
messenger.registerOutgoingPluginChannel(plugin, "BungeeCord");
}
}
}