Add BungeeCord playerSendTo config

This commit is contained in:
Xephi59 2015-12-26 14:05:10 +01:00
parent 37918e845c
commit 625369db5a
4 changed files with 58 additions and 22 deletions

View File

@ -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());
}
}

View File

@ -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());
}
}

View File

@ -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");

View File

@ -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?