#550 Show welcome message only after login

- Never send welcome message just after registration (with no subsequent login)
- Always run force command options upon registration
This commit is contained in:
ljacqu 2016-04-29 21:16:42 +02:00
parent 59d3bc95c0
commit 077cb242f0
3 changed files with 16 additions and 24 deletions

View File

@ -63,7 +63,12 @@ public class ProcessSyncPasswordRegister implements Process {
}
}
private void forceLogin(Player player) {
/**
* Request that the player log in.
*
* @param player the player
*/
private void requestLogin(Player player) {
Utils.teleportToSpawn(player);
LimboCache cache = LimboCache.getInstance();
cache.updateLimboPlayer(player);
@ -131,22 +136,12 @@ public class ProcessSyncPasswordRegister implements Process {
return;
}
// Register is finish and player is logged, display welcome message
if (service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE)) {
if (service.getProperty(RegistrationSettings.BROADCAST_WELCOME_MESSAGE)) {
for (String s : service.getSettings().getWelcomeMessage()) {
plugin.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
}
} else {
for (String s : service.getSettings().getWelcomeMessage()) {
player.sendMessage(plugin.replaceAllInfo(s, player));
}
}
}
// Register is now finished; we can force all commands
forceCommands();
// Request Login after Registration
// Request login after registration
if (service.getProperty(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER)) {
forceLogin(player);
requestLogin(player);
return;
}
@ -154,9 +149,6 @@ public class ProcessSyncPasswordRegister implements Process {
sendBungeeMessage();
}
// Register is now finished; we can force all commands
forceCommands();
sendTo();
}

View File

@ -67,7 +67,7 @@ public class RegistrationSettings implements SettingsClass {
newListProperty("settings.forceRegisterCommandsAsConsole");
@Comment({
"Enable to display the welcome message (welcome.txt) after a registration or a login",
"Enable to display the welcome message (welcome.txt) after 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,",
"{IP}: player ip, {LOGINS}: number of players logged, {WORLD}: player current world, {SERVER}: server name",

View File

@ -253,11 +253,11 @@ settings:
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,
# {IP} : player ip, {LOGINS} : number of players logged, {WORLD} : player current world, {SERVER} : server name
# {VERSION} : get current bukkit version, {COUNTRY} : player country
# Do we need to display the welcome message (welcome.txt) after 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,
# {IP}: player ip, {LOGINS}: number of players logged, {WORLD}: player current world, {SERVER}: server name
# {VERSION}: get current bukkit version, {COUNTRY}: player country
useWelcomeMessage: true
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
broadcastWelcomeMessage: false