mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-03 09:10:01 +01:00
parent
0472b2b318
commit
eb7487ca84
@ -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;
|
||||
@ -65,7 +63,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;
|
||||
|
||||
@ -244,9 +241,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();
|
||||
|
||||
@ -360,17 +354,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.
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
@ -19,20 +22,19 @@ public class BungeeService implements SettingsDependent {
|
||||
|
||||
private AuthMe plugin;
|
||||
private BukkitService bukkitService;
|
||||
private BungeeCordMessage bungeeCordMessage;
|
||||
|
||||
private boolean isEnabled;
|
||||
private String bungeeServer;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor.
|
||||
*
|
||||
* @param plugin AuthMe plugin.
|
||||
* @param settings AuthMe settings.
|
||||
*/
|
||||
@Inject
|
||||
BungeeService(AuthMe plugin, BukkitService bukkitService, Settings settings) {
|
||||
BungeeService(AuthMe plugin, BukkitService bukkitService, Settings settings, BungeeCordMessage bungeeCordMessage) {
|
||||
this.plugin = plugin;
|
||||
this.bukkitService = bukkitService;
|
||||
this.bungeeCordMessage = bungeeCordMessage;
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
@ -103,5 +105,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user