diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 48831fb72..c4562d506 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -1,7 +1,14 @@ package fr.xephi.authme.process.login; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.potion.PotionEffectType; + import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.backup.JsonCache; @@ -16,11 +23,6 @@ import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.Utils; import fr.xephi.authme.util.Utils.GroupType; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.bukkit.potion.PotionEffectType; /** */ @@ -197,6 +199,16 @@ public class ProcessSyncronousPlayerLogin implements Runnable { // Login is now finish , we can force all commands forceCommands(); + + sendTo(); } + private void sendTo() { + if (Settings.sendPlayerTo.isEmpty()) + return; + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("Connect"); + out.writeUTF(Settings.sendPlayerTo); + player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); + } } diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java index 2793047ff..1b4b0555e 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncPasswordRegister.java @@ -1,7 +1,14 @@ package fr.xephi.authme.process.register; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.limbo.LimboCache; @@ -14,11 +21,6 @@ import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.util.Utils; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; /** */ @@ -161,5 +163,16 @@ public class ProcessSyncPasswordRegister implements Runnable { // Register is now finish , we can force all commands forceCommands(); + + sendTo(); + } + + private void sendTo() { + if (Settings.sendPlayerTo.isEmpty()) + return; + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("Connect"); + out.writeUTF(Settings.sendPlayerTo); + player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); } } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 6094bd7e0..f4943a53d 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -1,15 +1,5 @@ package fr.xephi.authme.settings; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.datasource.DataSource; -import fr.xephi.authme.datasource.DataSource.DataSourceType; -import fr.xephi.authme.security.HashAlgorithm; -import fr.xephi.authme.util.Wrapper; -import org.bukkit.configuration.file.YamlConfiguration; - import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -25,6 +15,18 @@ import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; +import org.bukkit.configuration.file.YamlConfiguration; + +import com.google.common.base.Charsets; +import com.google.common.io.Files; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.datasource.DataSource; +import fr.xephi.authme.datasource.DataSource.DataSourceType; +import fr.xephi.authme.security.HashAlgorithm; +import fr.xephi.authme.util.Wrapper; + /** */ public final class Settings { @@ -93,7 +95,7 @@ public final class Settings { getMailSubject, getMailText, getMySQLlastlocWorld, defaultWorld, getPhpbbPrefix, getWordPressPrefix, getMySQLColumnLogged, spawnPriority, crazyloginFileName, getPassRegex, - getMySQLColumnRealName, emailOauth2Token; + getMySQLColumnRealName, emailOauth2Token, sendPlayerTo; public static int getWarnMessageInterval, getSessionTimeout, getRegistrationTimeout, getMaxNickLength, getMinNickLength, getPasswordMinLen, getMovementRadius, getmaxRegPerIp, @@ -301,6 +303,7 @@ public final class Settings { preventOtherCase = configFile.getBoolean("settings.preventOtherCase", false); kickPlayersBeforeStopping = configFile.getBoolean("Security.stop.kickPlayersBeforeStopping", true); emailOauth2Token = configFile.getString("Email.emailOauth2Token", ""); + sendPlayerTo = configFile.getString("Hooks.sendPlayerTo", ""); // Load the welcome message getWelcomeMessage(); @@ -743,6 +746,12 @@ public final class Settings { if (!contains("Email.emailOauth2Token")) set("Email.emailOauth2Token", ""); + + if (!contains("Hook.sendPlayerTo")) + { + set("Hooks.sendPlayerTo", ""); + changes = true; + } if (changes) { plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me"); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 4c3ac885b..435bd1e4d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -359,8 +359,10 @@ Email: Hooks: # Do we need to hook with multiverse for spawn checking? multiverse: true - # Do we need to hook with BungeeCord for get the real Player ip? + # Do we need to hook with BungeeCord ? bungeecord: false + # Send player to this BungeeCord server after register/login + sendPlayerTo: '' # Do we need to disable Essentials SocialSpy on join? disableSocialSpy: true # Do we need to force /motd Essentials command on join?