mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-18 14:47:47 +01:00
Add forceRegisterCommand to force a command after a /register (passwords
only)
This commit is contained in:
parent
e869eae036
commit
0d8ce9e3d8
@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ public final class Settings extends YamlConfiguration {
|
||||
public static List<String> countriesBlacklist = null;
|
||||
public static List<String> forceCommands = null;
|
||||
public static List<String> forceCommandsAsConsole = null;
|
||||
public static List<String> forceRegisterCommands = null;
|
||||
public static List<String> 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<String>) configFile.getList("settings.forceRegisterCommands", new ArrayList<String>());
|
||||
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||
|
||||
// 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<String>) configFile.getList("settings.forceRegisterCommands", new ArrayList<String>());
|
||||
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||
|
||||
// Reload the welcome message
|
||||
getWelcomeMessage(AuthMe.getInstance());
|
||||
@ -564,6 +570,14 @@ public final class Settings extends YamlConfiguration {
|
||||
set("Email.emailWhitelisted", new ArrayList<String>());
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("settings.forceRegisterCommands")) {
|
||||
set("settings.forceRegisterCommands", new ArrayList<String>());
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("settings.forceRegisterCommandsAsConsole")) {
|
||||
set("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
plugin.getLogger().warning("Merge new Config Options - I'm not an error, please don't report me");
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user