diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index f3de0de59..1782ac622 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -35,13 +35,16 @@ public class ProcessSyncronousPasswordRegister implements Runnable { this.plugin = plugin; } - protected void forceCommands(Player player) { - for (String command : Settings.forceCommands) { + protected void forceCommands() { + for (String command : Settings.forceRegisterCommands) { try { player.performCommand(command.replace("%p", player.getName())); } catch (Exception e) { } } + for (String command : Settings.forceRegisterCommandsAsConsole) { + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), command.replace("%p", player.getName())); + } } protected void forceLogin(Player player) { @@ -144,7 +147,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable { } // Register is now finish , we can force all commands - forceCommands(player); + forceCommands(); } } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 94cb12eda..5cd854658 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -38,6 +38,8 @@ public final class Settings extends YamlConfiguration { public static List countriesBlacklist = null; public static List forceCommands = null; public static List forceCommandsAsConsole = null; + public static List forceRegisterCommands = null; + public static List forceRegisterCommandsAsConsole = null; private AuthMe plugin; private final File file; public static DataSourceType getDataSource; @@ -265,6 +267,8 @@ public final class Settings extends YamlConfiguration { applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false); emailBlacklist = configFile.getStringList("Email.emailBlacklisted"); emailWhitelist = configFile.getStringList("Email.emailWhitelisted"); + forceRegisterCommands = (List) configFile.getList("settings.forceRegisterCommands", new ArrayList()); + forceRegisterCommandsAsConsole = (List) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList()); // Load the welcome message getWelcomeMessage(plugin); @@ -430,6 +434,8 @@ public final class Settings extends YamlConfiguration { applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false); emailBlacklist = configFile.getStringList("Email.emailBlacklisted"); emailWhitelist = configFile.getStringList("Email.emailWhitelisted"); + forceRegisterCommands = (List) configFile.getList("settings.forceRegisterCommands", new ArrayList()); + forceRegisterCommandsAsConsole = (List) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList()); // Reload the welcome message getWelcomeMessage(AuthMe.getInstance()); @@ -564,6 +570,14 @@ public final class Settings extends YamlConfiguration { set("Email.emailWhitelisted", new ArrayList()); changes = true; } + if (!contains("settings.forceRegisterCommands")) { + set("settings.forceRegisterCommands", new ArrayList()); + changes = true; + } + if (!contains("settings.forceRegisterCommandsAsConsole")) { + set("settings.forceRegisterCommandsAsConsole", new ArrayList()); + changes = true; + } if (changes) { plugin.getLogger().warning("Merge 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 0c322d60a..8523b0afc 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -250,6 +250,10 @@ settings: forceCommands: [] # Force these commands after /login as a server console, without any '/', use %p for replace with player name forceCommandsAsConsole: [] + # Force these commands after /register, without any '/', use %p for replace with player name + forceRegisterCommands: [] + # Force these commands after /register as a server console, without any '/', use %p for replace with player name + forceRegisterCommandsAsConsole: [] # Do we need to display the welcome message (welcome.txt) after a register or a login? # You can use colors in this welcome.txt + some replaced strings : # {PLAYER} : player name, {ONLINE} : display number of online players, {MAXPLAYERS} : display server slots,