Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 007e01156b | |||
| d2ec62ac7f | |||
| da32bdec94 | |||
| 7d58e90557 | |||
| 08dabda7c7 | |||
| feea348ec3 | |||
| 67eb7dee0f | |||
| 6fb1d2855e | |||
| faa3d9320c | |||
| 497cd543fd | |||
| 71d5205df0 | |||
| bba90d93f1 | |||
| ab40b1b82d | |||
| 22a6cefbdc | |||
| 9ca3a24862 | |||
| 91f0dfa5c5 | |||
| f0e935a5d8 | |||
| f0fae0fce0 | |||
| 4c40ba36a6 | |||
| bd7a25560f |
@@ -454,6 +454,18 @@
|
|||||||
<pattern>com.alessiodp.libby</pattern>
|
<pattern>com.alessiodp.libby</pattern>
|
||||||
<shadedPattern>fr.xephi.authme.libs.com.alessiodp.libby</shadedPattern>
|
<shadedPattern>fr.xephi.authme.libs.com.alessiodp.libby</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.kyori.adventure</pattern>
|
||||||
|
<shadedPattern>fr.xephi.authme.libs.net.kyori.adventure</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.kyori.examination</pattern>
|
||||||
|
<shadedPattern>fr.xephi.authme.libs.net.kyori.examination</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>net.kyori.option</pattern>
|
||||||
|
<shadedPattern>fr.xephi.authme.libs.net.kyori.option</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
|
|
||||||
<filters>
|
<filters>
|
||||||
@@ -485,13 +497,13 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.3</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Deploy the jars as artifacts into the remote repository -->
|
<!-- Deploy the jars as artifacts into the remote repository -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.3</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Handle documentation generation, required by other plugins -->
|
<!-- Handle documentation generation, required by other plugins -->
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -886,11 +898,6 @@
|
|||||||
<artifactId>adventure-text-minimessage</artifactId>
|
<artifactId>adventure-text-minimessage</artifactId>
|
||||||
<version>4.17.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
|
||||||
<version>4.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- LuckPerms plugin -->
|
<!-- LuckPerms plugin -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -1125,7 +1132,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.checkerframework</groupId>
|
<groupId>org.checkerframework</groupId>
|
||||||
<artifactId>checker-qual</artifactId>
|
<artifactId>checker-qual</artifactId>
|
||||||
<version>3.45.0</version>
|
<version>3.46.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -1141,7 +1148,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.46.0.0</version>
|
<version>3.46.1.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import fr.xephi.authme.listener.ServerListener;
|
|||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.crypts.Sha256;
|
import fr.xephi.authme.security.crypts.Sha256;
|
||||||
import fr.xephi.authme.service.AdventureService;
|
|
||||||
import fr.xephi.authme.service.BackupService;
|
import fr.xephi.authme.service.BackupService;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.MigrationService;
|
import fr.xephi.authme.service.MigrationService;
|
||||||
@@ -77,12 +76,11 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// Version and build number values
|
// Version and build number values
|
||||||
private static String pluginVersion = "5.7.0-Fork";
|
private static String pluginVersion = "5.7.0-Fork";
|
||||||
private static final String pluginBuild = "b";
|
private static final String pluginBuild = "b";
|
||||||
private static String pluginBuildNumber = "52";
|
private static String pluginBuildNumber = "53";
|
||||||
// Private instances
|
// Private instances
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
private CommandHandler commandHandler;
|
private CommandHandler commandHandler;
|
||||||
private static TaskScheduler scheduler;
|
private static TaskScheduler scheduler;
|
||||||
private static AdventureService adventureService;
|
|
||||||
@Inject
|
@Inject
|
||||||
public static Settings settings;
|
public static Settings settings;
|
||||||
private DataSource database;
|
private DataSource database;
|
||||||
@@ -141,13 +139,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the AdventureService
|
|
||||||
*/
|
|
||||||
public static AdventureService getAdventureService() {
|
|
||||||
return adventureService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The library manager
|
* The library manager
|
||||||
*/
|
*/
|
||||||
@@ -162,8 +153,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
loadPluginInfo(getDescription().getVersion());
|
loadPluginInfo(getDescription().getVersion());
|
||||||
scheduler = UniversalScheduler.getScheduler(this);
|
scheduler = UniversalScheduler.getScheduler(this);
|
||||||
libraryManager = new BukkitLibraryManager(this);
|
libraryManager = new BukkitLibraryManager(this);
|
||||||
adventureService = new AdventureService(this);
|
|
||||||
adventureService.init();
|
|
||||||
|
|
||||||
// Set the Logger instance and log file path
|
// Set the Logger instance and log file path
|
||||||
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
||||||
@@ -414,11 +403,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// Wait for tasks and close data source
|
// Wait for tasks and close data source
|
||||||
new TaskCloser(database).run();
|
new TaskCloser(database).run();
|
||||||
|
|
||||||
// Close AdventureService
|
|
||||||
if (adventureService != null) {
|
|
||||||
adventureService.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disabled correctly
|
// Disabled correctly
|
||||||
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
||||||
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
|
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import fr.xephi.authme.service.BukkitService;
|
|||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.ValidationService;
|
import fr.xephi.authme.service.ValidationService;
|
||||||
import fr.xephi.authme.service.ValidationService.ValidationResult;
|
import fr.xephi.authme.service.ValidationService.ValidationResult;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -80,7 +79,7 @@ public class RegisterAdminCommand implements ExecutableCommand {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() ->
|
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() ->
|
||||||
// AuthMeReReloaded - Folia compatibility
|
// AuthMeReReloaded - Folia compatibility
|
||||||
bukkitService.runTaskIfFolia(player, () -> MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(commonService.retrieveSingleMessage(player, MessageKey.KICK_FOR_ADMIN_REGISTER)))));
|
bukkitService.runTaskIfFolia(player, () -> player.kickPlayer(commonService.retrieveSingleMessage(player, MessageKey.KICK_FOR_ADMIN_REGISTER))));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-5
@@ -8,6 +8,7 @@ import fr.xephi.authme.process.Management;
|
|||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.ValidationService;
|
import fr.xephi.authme.service.ValidationService;
|
||||||
import fr.xephi.authme.service.ValidationService.ValidationResult;
|
import fr.xephi.authme.service.ValidationService.ValidationResult;
|
||||||
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -42,11 +43,14 @@ public class ChangePasswordCommand extends PlayerCommand {
|
|||||||
commonService.send(player, MessageKey.NOT_LOGGED_IN);
|
commonService.send(player, MessageKey.NOT_LOGGED_IN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check if the user has been verified or not
|
|
||||||
if (codeManager.isVerificationRequired(player)) {
|
if (commonService.getProperty(SecuritySettings.CHANGE_PASSWORD_EMAIL_VERIFICATION_REQUIRED)) {
|
||||||
codeManager.codeExistOrGenerateNew(name);
|
// Check if the user has been verified or not
|
||||||
commonService.send(player, MessageKey.VERIFICATION_CODE_REQUIRED);
|
if (codeManager.isVerificationRequired(player)) {
|
||||||
return;
|
codeManager.codeExistOrGenerateNew(name);
|
||||||
|
commonService.send(player, MessageKey.VERIFICATION_CODE_REQUIRED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String oldPassword = arguments.get(0);
|
String oldPassword = arguments.get(0);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.expiring.TimedCounter;
|
import fr.xephi.authme.util.expiring.TimedCounter;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -107,7 +106,7 @@ public class TempbanManager implements SettingsDependent, HasCleanup {
|
|||||||
bukkitService.runTask(player,() -> { // AuthMeReReloaded - Folia compatibility
|
bukkitService.runTask(player,() -> { // AuthMeReReloaded - Folia compatibility
|
||||||
if (customCommand.isEmpty()) {
|
if (customCommand.isEmpty()) {
|
||||||
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
||||||
MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(reason));
|
player.kickPlayer(reason);
|
||||||
} else {
|
} else {
|
||||||
String command = customCommand
|
String command = customCommand
|
||||||
.replace("%player%", name)
|
.replace("%player%", name)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package fr.xephi.authme.listener;
|
|||||||
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -27,7 +26,7 @@ public class DoubleLoginFixListener implements Listener {
|
|||||||
HashSet<String> PlayerSet = new HashSet<String>();
|
HashSet<String> PlayerSet = new HashSet<String>();
|
||||||
for (Player ep : PlayerList) {
|
for (Player ep : PlayerList) {
|
||||||
if (PlayerSet.contains(ep.getName().toLowerCase())) {
|
if (PlayerSet.contains(ep.getName().toLowerCase())) {
|
||||||
MiniMessageUtils.kickPlayer(ep, MiniMessageUtils.parseMiniMessage(service.retrieveSingleMessage(ep.getPlayer(), MessageKey.DOUBLE_LOGIN_FIX)));
|
ep.kickPlayer(service.retrieveSingleMessage(ep.getPlayer(), MessageKey.DOUBLE_LOGIN_FIX));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PlayerSet.add(ep.getName().toLowerCase());
|
PlayerSet.add(ep.getName().toLowerCase());
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
|
|||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.util.StringUtils;
|
import fr.xephi.authme.util.StringUtils;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
@@ -141,7 +140,7 @@ public class OnJoinVerifier implements Reloadable {
|
|||||||
Player nonVipPlayer = generateKickPlayer(onlinePlayers);
|
Player nonVipPlayer = generateKickPlayer(onlinePlayers);
|
||||||
if (nonVipPlayer != null) {
|
if (nonVipPlayer != null) {
|
||||||
// AuthMeReReloaded - Folia compatibility
|
// AuthMeReReloaded - Folia compatibility
|
||||||
bukkitService.runTaskIfFolia(nonVipPlayer, () -> MiniMessageUtils.kickPlayer(nonVipPlayer, MiniMessageUtils.parseMiniMessage(messages.retrieveSingle(player, MessageKey.KICK_FOR_VIP))));
|
bukkitService.runTaskIfFolia(nonVipPlayer, () -> nonVipPlayer.kickPlayer(messages.retrieveSingle(player, MessageKey.KICK_FOR_VIP)));
|
||||||
event.allow();
|
event.allow();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
String customJoinMessage = settings.getProperty(RegistrationSettings.CUSTOM_JOIN_MESSAGE);
|
String customJoinMessage = settings.getProperty(RegistrationSettings.CUSTOM_JOIN_MESSAGE);
|
||||||
if (!customJoinMessage.isEmpty()) {
|
if (!customJoinMessage.isEmpty()) {
|
||||||
customJoinMessage = ChatColor.translateAlternateColorCodes('&', customJoinMessage);
|
customJoinMessage = ChatColor.translateAlternateColorCodes('&', MiniMessageUtils.parseMiniMessageToLegacy(customJoinMessage));
|
||||||
event.setJoinMessage(customJoinMessage
|
event.setJoinMessage(customJoinMessage
|
||||||
.replace("{PLAYERNAME}", player.getName())
|
.replace("{PLAYERNAME}", player.getName())
|
||||||
.replace("{DISPLAYNAME}", player.getDisplayName())
|
.replace("{DISPLAYNAME}", player.getDisplayName())
|
||||||
@@ -324,7 +324,7 @@ public class PlayerListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (!quickCommandsProtectionManager.isAllowed(player.getName())) {
|
if (!quickCommandsProtectionManager.isAllowed(player.getName())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
bukkitService.runTaskIfFolia(player, () -> MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(messages.retrieveSingle(player, MessageKey.QUICK_COMMAND_PROTECTION_KICK))));
|
bukkitService.runTaskIfFolia(player, () -> player.kickPlayer(messages.retrieveSingle(player, MessageKey.QUICK_COMMAND_PROTECTION_KICK)));
|
||||||
// AuthMeReReloaded - Folia compatibility
|
// AuthMeReReloaded - Folia compatibility
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package fr.xephi.authme.message;
|
package fr.xephi.authme.message;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.service.AdventureService;
|
|
||||||
import fr.xephi.authme.util.expiring.Duration;
|
import fr.xephi.authme.util.expiring.Duration;
|
||||||
import fr.xephi.authme.util.message.I18NUtils;
|
import fr.xephi.authme.util.message.I18NUtils;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
import fr.xephi.authme.util.message.MiniMessageUtils;
|
||||||
@@ -46,7 +44,6 @@ public class Messages {
|
|||||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(EmailService.class);
|
private final ConsoleLogger logger = ConsoleLoggerFactory.get(EmailService.class);
|
||||||
|
|
||||||
private MessagesFileHandler messagesFileHandler;
|
private MessagesFileHandler messagesFileHandler;
|
||||||
private static final AdventureService adventureService = AuthMe.getAdventureService();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -65,7 +62,7 @@ public class Messages {
|
|||||||
public void send(CommandSender sender, MessageKey key) {
|
public void send(CommandSender sender, MessageKey key) {
|
||||||
String[] lines = retrieve(key, sender);
|
String[] lines = retrieve(key, sender);
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
adventureService.send(sender, MiniMessageUtils.parseMiniMessage(line));
|
sender.sendMessage(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +78,7 @@ public class Messages {
|
|||||||
public void send(CommandSender sender, MessageKey key, String... replacements) {
|
public void send(CommandSender sender, MessageKey key, String... replacements) {
|
||||||
String message = retrieveSingle(sender, key, replacements);
|
String message = retrieveSingle(sender, key, replacements);
|
||||||
for (String line : message.split("\n")) {
|
for (String line : message.split("\n")) {
|
||||||
adventureService.send(sender, MiniMessageUtils.parseMiniMessage(line));
|
sender.sendMessage(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +131,7 @@ public class Messages {
|
|||||||
displayName = ((Player) sender).getDisplayName();
|
displayName = ((Player) sender).getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ChatColor.translateAlternateColorCodes('&', message)
|
return ChatColor.translateAlternateColorCodes('&', MiniMessageUtils.parseMiniMessageToLegacy(message))
|
||||||
.replace(NEWLINE_TAG, "\n")
|
.replace(NEWLINE_TAG, "\n")
|
||||||
.replace(USERNAME_TAG, sender.getName())
|
.replace(USERNAME_TAG, sender.getName())
|
||||||
.replace(DISPLAYNAME_TAG, displayName);
|
.replace(DISPLAYNAME_TAG, displayName);
|
||||||
@@ -150,7 +147,7 @@ public class Messages {
|
|||||||
private String retrieveMessage(MessageKey key, String name) {
|
private String retrieveMessage(MessageKey key, String name) {
|
||||||
String message = messagesFileHandler.getMessage(key.getKey());
|
String message = messagesFileHandler.getMessage(key.getKey());
|
||||||
|
|
||||||
return ChatColor.translateAlternateColorCodes('&', message)
|
return ChatColor.translateAlternateColorCodes('&', MiniMessageUtils.parseMiniMessageToLegacy(message))
|
||||||
.replace(NEWLINE_TAG, "\n")
|
.replace(NEWLINE_TAG, "\n")
|
||||||
.replace(USERNAME_TAG, name)
|
.replace(USERNAME_TAG, name)
|
||||||
.replace(DISPLAYNAME_TAG, name);
|
.replace(DISPLAYNAME_TAG, name);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
|
|||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.util.InternetProtocolUtils;
|
import fr.xephi.authme.util.InternetProtocolUtils;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -178,7 +177,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
|
|
||||||
private void handlePlayerWithUnmetNameRestriction(Player player, String ip) {
|
private void handlePlayerWithUnmetNameRestriction(Player player, String ip) {
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
||||||
MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(service.retrieveSingleMessage(player, MessageKey.NOT_OWNER_ERROR)));
|
player.kickPlayer(service.retrieveSingleMessage(player, MessageKey.NOT_OWNER_ERROR));
|
||||||
if (service.getProperty(RestrictionSettings.BAN_UNKNOWN_IP)) {
|
if (service.getProperty(RestrictionSettings.BAN_UNKNOWN_IP)) {
|
||||||
server.banIP(ip);
|
server.banIP(ip);
|
||||||
}
|
}
|
||||||
@@ -229,7 +228,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
&& countOnlinePlayersByIp(ip) > service.getProperty(RestrictionSettings.MAX_JOIN_PER_IP)) {
|
&& countOnlinePlayersByIp(ip) > service.getProperty(RestrictionSettings.MAX_JOIN_PER_IP)) {
|
||||||
|
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||||
() -> MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(service.retrieveSingleMessage(player, MessageKey.SAME_IP_ONLINE))));
|
() -> player.kickPlayer(service.retrieveSingleMessage(player, MessageKey.SAME_IP_ONLINE)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import fr.xephi.authme.settings.properties.RestrictionSettings;
|
|||||||
import fr.xephi.authme.util.InternetProtocolUtils;
|
import fr.xephi.authme.util.InternetProtocolUtils;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -250,7 +249,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
tempbanManager.tempbanPlayer(player);
|
tempbanManager.tempbanPlayer(player);
|
||||||
} else if (service.getProperty(RestrictionSettings.KICK_ON_WRONG_PASSWORD)) {
|
} else if (service.getProperty(RestrictionSettings.KICK_ON_WRONG_PASSWORD)) {
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||||
() -> MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(service.retrieveSingleMessage(player, MessageKey.WRONG_PASSWORD))));
|
() -> player.kickPlayer(service.retrieveSingleMessage(player, MessageKey.WRONG_PASSWORD)));
|
||||||
} else {
|
} else {
|
||||||
service.send(player, MessageKey.WRONG_PASSWORD);
|
service.send(player, MessageKey.WRONG_PASSWORD);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ProcessSyncPlayerQuit implements SynchronousProcess {
|
|||||||
} else {
|
} else {
|
||||||
limboService.restoreData(player);
|
limboService.restoreData(player);
|
||||||
if (!UniversalScheduler.isFolia) { // AuthMeReReloaded - Fix #146 (Very stupid solution, but works)
|
if (!UniversalScheduler.isFolia) { // AuthMeReReloaded - Fix #146 (Very stupid solution, but works)
|
||||||
player.saveData(); // #1238: Speed is sometimes not restored properly
|
// player.saveData(); // #1238: Speed is sometimes not restored properly
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.leaveVehicle();
|
player.leaveVehicle();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import fr.xephi.authme.settings.commandconfig.CommandManager;
|
|||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -78,7 +77,7 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
|
|
||||||
// Kick Player after Registration is enabled, kick the player
|
// Kick Player after Registration is enabled, kick the player
|
||||||
if (service.getProperty(RegistrationSettings.FORCE_KICK_AFTER_REGISTER)) {
|
if (service.getProperty(RegistrationSettings.FORCE_KICK_AFTER_REGISTER)) {
|
||||||
MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(service.retrieveSingleMessage(player, MessageKey.REGISTER_SUCCESS)));
|
player.kickPlayer(service.retrieveSingleMessage(player, MessageKey.REGISTER_SUCCESS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package fr.xephi.authme.service;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class AdventureService {
|
|
||||||
private final AuthMe plugin;
|
|
||||||
public BukkitAudiences adventure;
|
|
||||||
public AdventureService(AuthMe plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
adventure = BukkitAudiences.create(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
|
||||||
if (adventure != null) {
|
|
||||||
adventure.close();
|
|
||||||
adventure = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void send(CommandSender sender, Component component) {
|
|
||||||
adventure.sender(sender).sendMessage(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void send(Player player, Component component) {
|
|
||||||
adventure.player(player).sendMessage(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
*/
|
*/
|
||||||
public class AuthMeExpansion extends PlaceholderExpansion {
|
public class AuthMeExpansion extends PlaceholderExpansion {
|
||||||
private final Settings settings = AuthMe.settings;
|
private final Settings settings = AuthMe.settings;
|
||||||
private final AuthMeApi authMeApi = AuthMeApi.getInstance();
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getIdentifier() {
|
public @NotNull String getIdentifier() {
|
||||||
return "authme";
|
return "authme";
|
||||||
@@ -39,6 +38,8 @@ public class AuthMeExpansion extends PlaceholderExpansion {
|
|||||||
@Override
|
@Override
|
||||||
public String onRequest(OfflinePlayer player, @NotNull String params) {
|
public String onRequest(OfflinePlayer player, @NotNull String params) {
|
||||||
if (!settings.getProperty(HooksSettings.PLACEHOLDER_API)) return null;
|
if (!settings.getProperty(HooksSettings.PLACEHOLDER_API)) return null;
|
||||||
|
AuthMeApi authMeApi = AuthMeApi.getInstance();
|
||||||
|
if (authMeApi == null) return null;
|
||||||
if (params.equalsIgnoreCase("version")) {
|
if (params.equalsIgnoreCase("version")) {
|
||||||
return getVersion();
|
return getVersion();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Regex syntax for allowed chars in email.")
|
@Comment("Regex syntax for allowed chars in email.")
|
||||||
public static final Property<String> ALLOWED_EMAIL_REGEX =
|
public static final Property<String> ALLOWED_EMAIL_REGEX =
|
||||||
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9_.]{3,20}@(qq|outlook|163|gmail|icloud)\\.com$");
|
newProperty("settings.restrictions.allowedEmailCharacters", "^([a-zA-Z0-9_.+-]+)@([a-zA-Z0-9-]+)\\.([a-zA-Z]{2,})$");
|
||||||
|
|
||||||
|
|
||||||
@Comment("Force survival gamemode when player joins?")
|
@Comment("Force survival gamemode when player joins?")
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Integer> HAVE_I_BEEN_PWNED_LIMIT =
|
public static final Property<Integer> HAVE_I_BEEN_PWNED_LIMIT =
|
||||||
newProperty("Security.account.haveIBeenPwned.limit", 0);
|
newProperty("Security.account.haveIBeenPwned.limit", 0);
|
||||||
|
|
||||||
|
@Comment({"Require email verification when changing password if email feature enabled.",
|
||||||
|
"Original behavior is true"})
|
||||||
|
public static final Property<Boolean> CHANGE_PASSWORD_EMAIL_VERIFICATION_REQUIRED =
|
||||||
|
newProperty("Security.account.emailVerification.required", true);
|
||||||
|
|
||||||
@Comment("Enable captcha when a player uses wrong password too many times")
|
@Comment("Enable captcha when a player uses wrong password too many times")
|
||||||
public static final Property<Boolean> ENABLE_LOGIN_FAILURE_CAPTCHA =
|
public static final Property<Boolean> ENABLE_LOGIN_FAILURE_CAPTCHA =
|
||||||
newProperty("Security.captcha.useCaptcha", false);
|
newProperty("Security.captcha.useCaptcha", false);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package fr.xephi.authme.task;
|
package fr.xephi.authme.task;
|
||||||
|
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.util.message.MiniMessageUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +28,7 @@ public class TimeoutTask implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!playerCache.isAuthenticated(player.getName())) {
|
if (!playerCache.isAuthenticated(player.getName())) {
|
||||||
MiniMessageUtils.kickPlayer(player, MiniMessageUtils.parseMiniMessage(message));
|
player.kickPlayer(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,12 @@
|
|||||||
package fr.xephi.authme.util.message;
|
package fr.xephi.authme.util.message;
|
||||||
|
|
||||||
import fr.xephi.authme.util.Utils;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class MiniMessageUtils {
|
public class MiniMessageUtils {
|
||||||
private static final MiniMessage miniMessage = MiniMessage.miniMessage();
|
private static final MiniMessage miniMessage = MiniMessage.miniMessage();
|
||||||
private static final char SECTION_CHAR = '§';
|
|
||||||
private static final char AMPERSAND_CHAR = '&';
|
|
||||||
private static final boolean HEX_SUPPORTED = Utils.MAJOR_VERSION >= 16;
|
|
||||||
private static Method methodDisallow;
|
|
||||||
private static Method methodKick;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
methodDisallow = AsyncPlayerPreLoginEvent.class.getMethod("disallow", AsyncPlayerPreLoginEvent.Result.class, Component.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
methodDisallow = null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
methodKick = Player.class.getMethod("kick", Component.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
methodKick = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Parse a MiniMessage string into a legacy string.
|
* Parse a MiniMessage string into a legacy string.
|
||||||
*
|
*
|
||||||
@@ -41,98 +17,6 @@ public class MiniMessageUtils {
|
|||||||
Component component = miniMessage.deserialize(message);
|
Component component = miniMessage.deserialize(message);
|
||||||
return LegacyComponentSerializer.legacyAmpersand().serialize(component);
|
return LegacyComponentSerializer.legacyAmpersand().serialize(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse a MiniMessage string into a component.
|
|
||||||
*
|
|
||||||
* @param message The message to parse.
|
|
||||||
* @return The parsed message.
|
|
||||||
*/
|
|
||||||
public static Component parseMiniMessage(String message) {
|
|
||||||
return miniMessage.deserialize(convertLegacyToMiniMessage(message, false, SECTION_CHAR, HEX_SUPPORTED));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Kicks a player with the given message.
|
|
||||||
*
|
|
||||||
* @param player the player to kick
|
|
||||||
* @param message the message to send
|
|
||||||
*/
|
|
||||||
public static void kickPlayer(Player player, Component message) {
|
|
||||||
if (methodKick != null) {
|
|
||||||
try {
|
|
||||||
methodKick.invoke(player, message);
|
|
||||||
} catch (Exception e) {
|
|
||||||
player.kickPlayer(LegacyComponentSerializer.legacySection().serialize(message));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
player.kickPlayer(LegacyComponentSerializer.legacySection().serialize(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disallows the login event with the given result and reason.
|
|
||||||
*
|
|
||||||
* @param event the event
|
|
||||||
* @param result the event result to set
|
|
||||||
* @param message the denial message
|
|
||||||
*/
|
|
||||||
public static void disallowPreLoginEvent(AsyncPlayerPreLoginEvent event,
|
|
||||||
AsyncPlayerPreLoginEvent.Result result, Component message) {
|
|
||||||
if (methodDisallow != null) {
|
|
||||||
try {
|
|
||||||
methodDisallow.invoke(event, result, message);
|
|
||||||
} catch (Exception e) {
|
|
||||||
event.disallow(result, LegacyComponentSerializer.legacySection().serialize(message));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.disallow(result, LegacyComponentSerializer.legacySection().serialize(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
private static String convertLegacyToMiniMessage(String legacy, boolean concise, char charCode, boolean rgb) {
|
|
||||||
String miniMessage = legacy.replaceAll(Pattern.quote(String.valueOf(charCode)) + "0", "<black>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "1", "<dark_blue>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "2", "<dark_green>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "3", "<dark_aqua>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "4", "<dark_red>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "5", "<dark_purple>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "6", "<gold>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "7", "<gray>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "8", "<dark_gray>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "9", "<blue>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "a", "<green>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "b", "<aqua>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "c", "<red>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "d", "<light_purple>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "e", "<yellow>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "f", "<white>");
|
|
||||||
|
|
||||||
if (concise) {
|
|
||||||
miniMessage = miniMessage.replaceAll(Pattern.quote(String.valueOf(charCode)) + "n", "<u>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "m", "<st>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "k", "<obf>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "o", "<i>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "l", "<b>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "r", "<r>");
|
|
||||||
} else {
|
|
||||||
miniMessage = miniMessage.replaceAll(Pattern.quote(String.valueOf(charCode)) + "n", "<underlined>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "m", "<strikethrough>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "k", "<obfuscated>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "o", "<italic>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "l", "<bold>")
|
|
||||||
.replaceAll(Pattern.quote(String.valueOf(charCode)) + "r", "<reset>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rgb) {
|
|
||||||
Pattern pattern = Pattern.compile(Pattern.quote(String.valueOf(charCode)) + "#([0-9a-fA-F]{6})");
|
|
||||||
Matcher matcher = pattern.matcher(miniMessage);
|
|
||||||
miniMessage = matcher.replaceAll("<#$1>");
|
|
||||||
}
|
|
||||||
|
|
||||||
return miniMessage;
|
|
||||||
}
|
|
||||||
private MiniMessageUtils() {
|
private MiniMessageUtils() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ description: A fork of AuthMeReloaded that contains bug fixes
|
|||||||
# noinspection YAMLSchemaValidation
|
# noinspection YAMLSchemaValidation
|
||||||
main: ${pluginDescription.main}
|
main: ${pluginDescription.main}
|
||||||
folia-supported: true
|
folia-supported: true
|
||||||
version: 5.7.0-FORK-b52
|
version: 5.7.0-FORK-b53
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
|
|||||||
Reference in New Issue
Block a user