删除 wecome 提醒
This commit is contained in:
parent
2d4b2381ff
commit
4ca879b08a
@ -304,13 +304,6 @@ settings:
|
||||
forceKickAfterRegister: false
|
||||
# Does AuthMe need to enforce a /login after a successful registration?
|
||||
forceLoginAfterRegister: false
|
||||
# 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
|
||||
# {VERSION}: get current bukkit version, {COUNTRY}: player country
|
||||
useWelcomeMessage: true
|
||||
# Broadcast the welcome message to the server or only to the player?
|
||||
# set true for server or false for player
|
||||
broadcastWelcomeMessage: false
|
||||
|
||||
@ -412,12 +412,6 @@ 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
|
||||
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
|
||||
# Do we need to delay the join/leave message to be displayed only when the player is authenticated ?
|
||||
|
||||
@ -17,7 +17,6 @@ import fr.xephi.authme.service.SessionService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import fr.xephi.authme.settings.WelcomeMessageConfiguration;
|
||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
@ -71,9 +70,6 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
@Inject
|
||||
private ValidationService validationService;
|
||||
|
||||
@Inject
|
||||
private WelcomeMessageConfiguration welcomeMessageConfiguration;
|
||||
|
||||
@Inject
|
||||
private SessionService sessionService;
|
||||
|
||||
@ -150,9 +146,6 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
return;
|
||||
}
|
||||
} else if (!service.getProperty(RegistrationSettings.FORCE)) {
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
||||
welcomeMessageConfiguration.sendWelcomeMessage(player);
|
||||
});
|
||||
|
||||
// Skip if registration is optional
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.JoinMessageService;
|
||||
import fr.xephi.authme.service.TeleportationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.settings.WelcomeMessageConfiguration;
|
||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -49,9 +48,6 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
||||
@Inject
|
||||
private CommonService commonService;
|
||||
|
||||
@Inject
|
||||
private WelcomeMessageConfiguration welcomeMessageConfiguration;
|
||||
|
||||
@Inject
|
||||
private JoinMessageService joinMessageService;
|
||||
|
||||
@ -102,9 +98,6 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
||||
// The Login event now fires (as intended) after everything is processed
|
||||
bukkitService.callEvent(new LoginEvent(player));
|
||||
|
||||
// Login is done, display welcome message
|
||||
welcomeMessageConfiguration.sendWelcomeMessage(player);
|
||||
|
||||
// Login is now finished; we can force all commands
|
||||
if (isFirstLogin) {
|
||||
commandManager.runCommandsOnFirstLogin(player, authsWithSameIp);
|
||||
|
||||
@ -1,109 +0,0 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.GeoIpService;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.util.PlayerUtils;
|
||||
import fr.xephi.authme.util.lazytags.Tag;
|
||||
import fr.xephi.authme.util.lazytags.TagReplacer;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.util.lazytags.TagBuilder.createTag;
|
||||
|
||||
/**
|
||||
* Configuration for the welcome message (welcome.txt).
|
||||
*/
|
||||
public class WelcomeMessageConfiguration implements Reloadable {
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(WelcomeMessageConfiguration.class);
|
||||
|
||||
@DataFolder
|
||||
@Inject
|
||||
private File pluginFolder;
|
||||
|
||||
@Inject
|
||||
private Server server;
|
||||
|
||||
@Inject
|
||||
private GeoIpService geoIpService;
|
||||
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
|
||||
@Inject
|
||||
private PlayerCache playerCache;
|
||||
|
||||
@Inject
|
||||
private CommonService service;
|
||||
|
||||
/** List of all supported tags for the welcome message. */
|
||||
private final List<Tag<Player>> availableTags = Arrays.asList(
|
||||
createTag("&", () -> String.valueOf(ChatColor.COLOR_CHAR)),
|
||||
createTag("{PLAYER}", HumanEntity::getName),
|
||||
createTag("{DISPLAYNAME}", Player::getDisplayName),
|
||||
createTag("{DISPLAYNAMENOCOLOR}", Player::getDisplayName),
|
||||
createTag("{ONLINE}", () -> Integer.toString(bukkitService.getOnlinePlayers().size())),
|
||||
createTag("{MAXPLAYERS}", () -> Integer.toString(server.getMaxPlayers())),
|
||||
createTag("{IP}", PlayerUtils::getPlayerIp),
|
||||
createTag("{LOGINS}", () -> Integer.toString(playerCache.getLogged())),
|
||||
createTag("{WORLD}", pl -> pl.getWorld().getName()),
|
||||
createTag("{SERVER}", () -> service.getProperty(PluginSettings.SERVER_NAME)),
|
||||
createTag("{VERSION}", () -> server.getBukkitVersion()),
|
||||
createTag("{COUNTRY}", pl -> geoIpService.getCountryName(PlayerUtils.getPlayerIp(pl))));
|
||||
|
||||
private TagReplacer<Player> messageSupplier;
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public void reload() {
|
||||
if (!(service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE))) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> welcomeMessage = new ArrayList<>();
|
||||
messageSupplier = TagReplacer.newReplacer(availableTags, welcomeMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the welcome message for the given player.
|
||||
*
|
||||
* @param player the player for whom the welcome message should be prepared
|
||||
* @return the welcome message
|
||||
*/
|
||||
public List<String> getWelcomeMessage(Player player) {
|
||||
return messageSupplier.getAdaptedMessages(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the welcome message accordingly to the configuration
|
||||
*
|
||||
* @param player the player for whom the welcome message should be prepared
|
||||
*/
|
||||
public void sendWelcomeMessage(Player player) {
|
||||
if (service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE)) {
|
||||
List<String> welcomeMessage = getWelcomeMessage(player);
|
||||
if (service.getProperty(RegistrationSettings.BROADCAST_WELCOME_MESSAGE)) {
|
||||
welcomeMessage.forEach(bukkitService::broadcastMessage);
|
||||
} else {
|
||||
welcomeMessage.forEach(player::sendMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,16 +56,6 @@ public final class RegistrationSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> FORCE_LOGIN_AFTER_REGISTER =
|
||||
newProperty("settings.registration.forceLoginAfterRegister", false);
|
||||
|
||||
@Comment({
|
||||
"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",
|
||||
"{VERSION}: get current bukkit version, {COUNTRY}: player country"})
|
||||
public static final Property<Boolean> USE_WELCOME_MESSAGE =
|
||||
newProperty("settings.useWelcomeMessage", true);
|
||||
|
||||
@Comment({
|
||||
"Broadcast the welcome message to the server or only to the player?",
|
||||
"set true for server or false for player"})
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Welcome {PLAYER} on {SERVER} server
|
||||
|
||||
This server uses AuthMeReloaded protection!
|
||||
Loading…
x
Reference in New Issue
Block a user