mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-29 20:17:36 +01:00
Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into 761-permission-groups
This commit is contained in:
commit
f6c560cbbe
33
pom.xml
33
pom.xml
@ -108,10 +108,6 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>junit</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<groupId>javax.persistence</groupId>
|
||||
@ -146,10 +142,6 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>junit</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<groupId>javax.persistence</groupId>
|
||||
@ -276,11 +268,6 @@
|
||||
<pattern>javax.inject</pattern>
|
||||
<shadedPattern>fr.xephi.authme.libs.javax.inject</shadedPattern>
|
||||
</relocation>
|
||||
<!-- MCStats.org metrics -->
|
||||
<relocation>
|
||||
<pattern>org.mcstats</pattern>
|
||||
<shadedPattern>fr.xephi.authme</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<outputFile>target/${project.finalName}-spigot.jar</outputFile>
|
||||
</configuration>
|
||||
@ -331,11 +318,6 @@
|
||||
<pattern>javax.inject</pattern>
|
||||
<shadedPattern>fr.xephi.authme.libs.javax.inject</shadedPattern>
|
||||
</relocation>
|
||||
<!-- MCStats.org metrics -->
|
||||
<relocation>
|
||||
<pattern>org.mcstats</pattern>
|
||||
<shadedPattern>fr.xephi.authme</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<outputFile>target/${project.finalName}-legacy.jar</outputFile>
|
||||
</configuration>
|
||||
@ -544,21 +526,6 @@
|
||||
|
||||
<!-- Bukkit Libraries -->
|
||||
|
||||
<!-- Metrics API -->
|
||||
<dependency>
|
||||
<groupId>org.mcstats.bukkit</groupId>
|
||||
<artifactId>metrics</artifactId>
|
||||
<version>R8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- ProtocolLib -->
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.data.limbo;
|
||||
|
||||
import fr.xephi.authme.data.backup.LimboPlayerStorage;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.data.backup;
|
||||
package fr.xephi.authme.data.limbo;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
@ -10,11 +10,10 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.data.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.util.FileUtils;
|
||||
import fr.xephi.authme.util.PlayerUtils;
|
||||
import org.bukkit.Location;
|
@ -2,7 +2,7 @@ package fr.xephi.authme.initialization;
|
||||
|
||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.data.backup.LimboPlayerStorage;
|
||||
import fr.xephi.authme.data.limbo.LimboPlayerStorage;
|
||||
import fr.xephi.authme.data.limbo.LimboCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.service.PluginHookService;
|
||||
|
@ -6,6 +6,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.metrics.Metrics;
|
||||
import fr.xephi.authme.output.ConsoleFilter;
|
||||
import fr.xephi.authme.output.Log4JFilter;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
@ -18,10 +19,8 @@ import fr.xephi.authme.util.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcstats.Metrics;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
||||
@ -45,40 +44,28 @@ public class OnStartupTasks {
|
||||
}
|
||||
|
||||
public static void sendMetrics(AuthMe plugin, Settings settings) {
|
||||
try {
|
||||
final Metrics metrics = new Metrics(plugin);
|
||||
final Metrics metrics = new Metrics(plugin);
|
||||
|
||||
final Metrics.Graph languageGraph = metrics.createGraph("Messages Language");
|
||||
final String messagesLanguage = settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
|
||||
languageGraph.addPlotter(new Metrics.Plotter(messagesLanguage) {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new Metrics.SimplePie("messages_language") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
|
||||
}
|
||||
});
|
||||
|
||||
final Metrics.Graph databaseBackend = metrics.createGraph("Database Backend");
|
||||
final String dataSource = settings.getProperty(DatabaseSettings.BACKEND).toString();
|
||||
databaseBackend.addPlotter(new Metrics.Plotter(dataSource) {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
// Submit metrics
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
// Failed to submit the metrics data
|
||||
ConsoleLogger.logException("Can't send Metrics data! The plugin will work anyway...", e);
|
||||
}
|
||||
metrics.addCustomChart(new Metrics.SimplePie("database_backend") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return settings.getProperty(DatabaseSettings.BACKEND).toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the console filter if enabled.
|
||||
*
|
||||
* @param settings the settings
|
||||
* @param logger the plugin logger
|
||||
* @param logger the plugin logger
|
||||
*/
|
||||
public static void setupConsoleFilter(Settings settings, Logger logger) {
|
||||
if (!settings.getProperty(SecuritySettings.REMOVE_PASSWORD_FROM_CONSOLE)) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.message;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.util.FileUtils;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@ -16,6 +17,7 @@ public class MessageFileHandler {
|
||||
// regular file
|
||||
private final String filename;
|
||||
private final FileConfiguration configuration;
|
||||
private final String updateAddition;
|
||||
// default file
|
||||
private final String defaultFile;
|
||||
private FileConfiguration defaultConfiguration;
|
||||
@ -25,11 +27,15 @@ public class MessageFileHandler {
|
||||
*
|
||||
* @param file the file to use for messages
|
||||
* @param defaultFile the default file from the JAR to use if no message is found
|
||||
* @param updateCommand command to update the messages file (nullable) to show in error messages
|
||||
*/
|
||||
public MessageFileHandler(File file, String defaultFile) {
|
||||
public MessageFileHandler(File file, String defaultFile, String updateCommand) {
|
||||
this.filename = file.getName();
|
||||
this.configuration = YamlConfiguration.loadConfiguration(file);
|
||||
this.defaultFile = defaultFile;
|
||||
this.updateAddition = updateCommand == null
|
||||
? ""
|
||||
: " (or run " + updateCommand + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +59,7 @@ public class MessageFileHandler {
|
||||
|
||||
if (message == null) {
|
||||
ConsoleLogger.warning("Error getting message with key '" + key + "'. "
|
||||
+ "Please update your config file '" + filename + "' (or run /authme messages)");
|
||||
+ "Please update your config file '" + filename + "'" + updateAddition);
|
||||
return getDefault(key);
|
||||
}
|
||||
return message;
|
||||
@ -78,7 +84,7 @@ public class MessageFileHandler {
|
||||
*/
|
||||
private String getDefault(String key) {
|
||||
if (defaultConfiguration == null) {
|
||||
InputStream stream = MessageFileHandler.class.getClassLoader().getResourceAsStream(defaultFile);
|
||||
InputStream stream = FileUtils.getResourceFromJar(defaultFile);
|
||||
defaultConfiguration = YamlConfiguration.loadConfiguration(new InputStreamReader(stream));
|
||||
}
|
||||
String message = defaultConfiguration.getString(key);
|
||||
|
@ -36,10 +36,23 @@ public class MessageFileHandlerProvider {
|
||||
* @return the message file handler
|
||||
*/
|
||||
public MessageFileHandler initializeHandler(Function<String, String> pathBuilder) {
|
||||
return initializeHandler(pathBuilder, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a message file handler with the messages file of the configured language.
|
||||
* Ensures beforehand that the messages file exists or creates it otherwise.
|
||||
*
|
||||
* @param pathBuilder function taking the configured language code as argument and returning the messages file
|
||||
* @param updateCommand command to run to update the languages file (nullable)
|
||||
* @return the message file handler
|
||||
*/
|
||||
public MessageFileHandler initializeHandler(Function<String, String> pathBuilder, String updateCommand) {
|
||||
String language = settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
|
||||
return new MessageFileHandler(
|
||||
initializeFile(language, pathBuilder),
|
||||
pathBuilder.apply(DEFAULT_LANGUAGE));
|
||||
pathBuilder.apply(DEFAULT_LANGUAGE),
|
||||
updateCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +66,8 @@ public class MessageFileHandlerProvider {
|
||||
File initializeFile(String language, Function<String, String> pathBuilder) {
|
||||
String filePath = pathBuilder.apply(language);
|
||||
File file = new File(dataFolder, filePath);
|
||||
if (FileUtils.copyFileFromResource(file, filePath)) {
|
||||
// Check that JAR file exists to avoid logging an error
|
||||
if (FileUtils.getResourceFromJar(filePath) != null && FileUtils.copyFileFromResource(file, filePath)) {
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public enum MessageKey {
|
||||
/** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */
|
||||
KICK_ANTIBOT("kick_antibot"),
|
||||
|
||||
/** Can't find the requested user in the database! */
|
||||
/** This user isn't registered! */
|
||||
UNKNOWN_USER("unknown_user"),
|
||||
|
||||
/** Your quit location was unsafe, you have been teleported to the world's spawnpoint. */
|
||||
@ -26,7 +26,7 @@ public enum MessageKey {
|
||||
/** You're not logged in! */
|
||||
NOT_LOGGED_IN("not_logged_in"),
|
||||
|
||||
/** Usage: /login <password> */
|
||||
/** Usage: /login <password> */
|
||||
USAGE_LOGIN("usage_log"),
|
||||
|
||||
/** Wrong password! */
|
||||
@ -56,19 +56,19 @@ public enum MessageKey {
|
||||
/** An unexpected error occurred, please contact an administrator! */
|
||||
ERROR("error"),
|
||||
|
||||
/** Please, login with the command "/login <password>" */
|
||||
/** Please, login with the command: /login <password> */
|
||||
LOGIN_MESSAGE("login_msg"),
|
||||
|
||||
/** Please, register to the server with the command "/register <password> <ConfirmPassword>" */
|
||||
/** Please, register to the server with the command: /register <password> <ConfirmPassword> */
|
||||
REGISTER_MESSAGE("reg_msg"),
|
||||
|
||||
/** You have exceeded the maximum number of registrations (%reg_count/%max_acc %reg_names) for your connection! */
|
||||
MAX_REGISTER_EXCEEDED("max_reg", "%max_acc", "%reg_count", "%reg_names"),
|
||||
|
||||
/** Usage: /register <password> <ConfirmPassword> */
|
||||
/** Usage: /register <password> <ConfirmPassword> */
|
||||
USAGE_REGISTER("usage_reg"),
|
||||
|
||||
/** Usage: /unregister <password> */
|
||||
/** Usage: /unregister <password> */
|
||||
USAGE_UNREGISTER("usage_unreg"),
|
||||
|
||||
/** Password changed successfully! */
|
||||
@ -95,7 +95,7 @@ public enum MessageKey {
|
||||
/** You're already logged in! */
|
||||
ALREADY_LOGGED_IN_ERROR("logged_in"),
|
||||
|
||||
/** Logged-out successfully! */
|
||||
/** Logged out successfully! */
|
||||
LOGOUT_SUCCESS("logout"),
|
||||
|
||||
/** The same username is already playing on the server! */
|
||||
@ -113,7 +113,7 @@ public enum MessageKey {
|
||||
/** Login timeout exceeded, you have been kicked from the server, please try again! */
|
||||
LOGIN_TIMEOUT_ERROR("timeout"),
|
||||
|
||||
/** Usage: /changepassword <oldPassword> <newPassword> */
|
||||
/** Usage: /changepassword <oldPassword> <newPassword> */
|
||||
USAGE_CHANGE_PASSWORD("usage_changepassword"),
|
||||
|
||||
/** Your username is either too short or too long! */
|
||||
@ -122,13 +122,13 @@ public enum MessageKey {
|
||||
/** Your username contains illegal characters. Allowed chars: REG_EX */
|
||||
INVALID_NAME_CHARACTERS("regex", "REG_EX"),
|
||||
|
||||
/** Please add your email to your account with the command "/email add <yourEmail> <confirmEmail>" */
|
||||
/** Please add your email to your account with the command: /email add <yourEmail> <confirmEmail> */
|
||||
ADD_EMAIL_MESSAGE("add_email"),
|
||||
|
||||
/** Forgot your password? Please use the command "/email recovery <yourEmail>" */
|
||||
/** Forgot your password? Please use the command: /email recovery <yourEmail> */
|
||||
FORGOT_PASSWORD_MESSAGE("recovery_email"),
|
||||
|
||||
/** To login you have to solve a captcha code, please use the command "/captcha <theCaptcha>" */
|
||||
/** To login you have to solve a captcha code, please use the command: /captcha <theCaptcha> */
|
||||
USAGE_CAPTCHA("usage_captcha", "<theCaptcha>"),
|
||||
|
||||
/** Wrong captcha, please type "/captcha THE_CAPTCHA" into the chat! */
|
||||
@ -143,13 +143,13 @@ public enum MessageKey {
|
||||
/** The server is full, try again later! */
|
||||
KICK_FULL_SERVER("kick_fullserver"),
|
||||
|
||||
/** Usage: /email add <email> <confirmEmail> */
|
||||
/** Usage: /email add <email> <confirmEmail> */
|
||||
USAGE_ADD_EMAIL("usage_email_add"),
|
||||
|
||||
/** Usage: /email change <oldEmail> <newEmail> */
|
||||
/** Usage: /email change <oldEmail> <newEmail> */
|
||||
USAGE_CHANGE_EMAIL("usage_email_change"),
|
||||
|
||||
/** Usage: /email recovery <Email> */
|
||||
/** Usage: /email recovery <Email> */
|
||||
USAGE_RECOVER_EMAIL("usage_email_recovery"),
|
||||
|
||||
/** Invalid new email, try again! */
|
||||
@ -224,7 +224,7 @@ public enum MessageKey {
|
||||
/** A recovery code to reset your password has been sent to your email. */
|
||||
RECOVERY_CODE_SENT("recovery_code_sent"),
|
||||
|
||||
/** The recovery code is not correct! Use /email recovery [email] to generate a new one */
|
||||
/** The recovery code is not correct! Use "/email recovery [email]" to generate a new one */
|
||||
INCORRECT_RECOVERY_CODE("recovery_code_incorrect");
|
||||
|
||||
private String key;
|
||||
|
@ -107,7 +107,7 @@ public class Messages implements Reloadable {
|
||||
@Override
|
||||
public void reload() {
|
||||
this.messageFileHandler = messageFileHandlerProvider
|
||||
.initializeHandler(lang -> "messages/messages_" + lang + ".yml");
|
||||
.initializeHandler(lang -> "messages/messages_" + lang + ".yml", "/authme messages");
|
||||
}
|
||||
|
||||
private static String formatMessage(String message) {
|
||||
|
1031
src/main/java/fr/xephi/authme/metrics/Metrics.java
Normal file
1031
src/main/java/fr/xephi/authme/metrics/Metrics.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
package fr.xephi.authme.process.quit;
|
||||
|
||||
import fr.xephi.authme.data.backup.LimboPlayerStorage;
|
||||
import fr.xephi.authme.data.limbo.LimboPlayerStorage;
|
||||
import fr.xephi.authme.data.limbo.LimboCache;
|
||||
import fr.xephi.authme.process.SynchronousProcess;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -30,7 +30,6 @@ public class AntiBotService implements SettingsDependent {
|
||||
// Settings
|
||||
private int duration;
|
||||
private int sensibility;
|
||||
private int delay;
|
||||
private int interval;
|
||||
// Service status
|
||||
private AntiBotStatus antiBotStatus;
|
||||
@ -60,7 +59,6 @@ public class AntiBotService implements SettingsDependent {
|
||||
// Load settings
|
||||
duration = settings.getProperty(ProtectionSettings.ANTIBOT_DURATION);
|
||||
sensibility = settings.getProperty(ProtectionSettings.ANTIBOT_SENSIBILITY);
|
||||
delay = settings.getProperty(ProtectionSettings.ANTIBOT_DELAY);
|
||||
interval = settings.getProperty(ProtectionSettings.ANTIBOT_INTERVAL);
|
||||
|
||||
// Stop existing protection
|
||||
@ -77,6 +75,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
|
||||
// Delay the schedule on first start
|
||||
if (startup) {
|
||||
int delay = settings.getProperty(ProtectionSettings.ANTIBOT_DELAY);
|
||||
bukkitService.scheduleSyncDelayedTask(enableTask, delay * TICKS_PER_SECOND);
|
||||
startup = false;
|
||||
} else {
|
||||
|
@ -1,10 +1,9 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.service.PluginHookService;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.service.PluginHookService;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.util.FileUtils;
|
||||
@ -43,11 +42,9 @@ public class SpawnLoader implements Reloadable {
|
||||
* @param pluginFolder The AuthMe data folder
|
||||
* @param settings The setting instance
|
||||
* @param pluginHookService The plugin hooks instance
|
||||
* @param dataSource The plugin auth database instance
|
||||
*/
|
||||
@Inject
|
||||
SpawnLoader(@DataFolder File pluginFolder, Settings settings, PluginHookService pluginHookService,
|
||||
DataSource dataSource) {
|
||||
SpawnLoader(@DataFolder File pluginFolder, Settings settings, PluginHookService pluginHookService) {
|
||||
// TODO ljacqu 20160312: Check if resource could be copied and handle the case if not
|
||||
File spawnFile = new File(pluginFolder, "spawn.yml");
|
||||
FileUtils.copyFileFromResource(spawnFile, "spawn.yml");
|
||||
|
@ -28,7 +28,7 @@ public class WrappedTagReplacer<T, A> {
|
||||
* @param allTags all available tags
|
||||
* @param items the items to apply the replacements on
|
||||
* @param stringGetter getter of the String property to adapt on the items
|
||||
* @param itemCreator a function of signature (T, String) -> T: the original item and the adapted String are passed
|
||||
* @param itemCreator a function taking (T, String): the original item and the adapted String, returning a new item
|
||||
*/
|
||||
public WrappedTagReplacer(Collection<Tag<A>> allTags,
|
||||
Collection<T> items,
|
||||
|
@ -4,6 +4,7 @@
|
||||
# -------------------------------------------------------
|
||||
# Lista de textos usados na seção de ajuda:
|
||||
common:
|
||||
header: '==========[ Ajuda AuthMeReloaded ]=========='
|
||||
optional: 'Opcional'
|
||||
hasPermission: 'Você tem permissão'
|
||||
noPermission: 'Sem Permissão'
|
||||
|
@ -1,4 +1,5 @@
|
||||
common:
|
||||
header: '==========[ AuthMeReloaded Hilfe ]=========='
|
||||
optional: 'Optional'
|
||||
hasPermission: 'Du hast Berechtigung'
|
||||
noPermission: 'Keine Berechtigung'
|
||||
|
45
src/main/resources/messages/help_ru.yml
Normal file
45
src/main/resources/messages/help_ru.yml
Normal file
@ -0,0 +1,45 @@
|
||||
# Translation config for the AuthMe help, e.g. when /authme help or /authme help register is called
|
||||
|
||||
# -------------------------------------------------------
|
||||
# List of texts used in the help section
|
||||
common:
|
||||
header: '==========[ AuthMeReloaded Справка ]=========='
|
||||
optional: 'Опционально'
|
||||
hasPermission: 'У вас есть такие права'
|
||||
noPermission: 'Нет прав'
|
||||
default: 'По-умолчанию'
|
||||
result: 'Результат'
|
||||
defaultPermissions:
|
||||
notAllowed: 'Нет прав'
|
||||
opOnly: 'Только Операторы'
|
||||
allowed: 'Разрешено всем'
|
||||
|
||||
# -------------------------------------------------------
|
||||
# Titles of the individual help sections
|
||||
# Set the translation text to empty text to disable the section, e.g. to hide alternatives:
|
||||
# alternatives: ''
|
||||
section:
|
||||
command: 'Команда'
|
||||
description: 'Краткое описание'
|
||||
detailedDescription: 'Детальное описание'
|
||||
arguments: 'Аргументы'
|
||||
permissions: 'Разрешения'
|
||||
alternatives: 'Альтернативы'
|
||||
children: 'Команды'
|
||||
|
||||
# -------------------------------------------------------
|
||||
# You can translate the data for all commands using the below pattern.
|
||||
# For example to translate /authme reload, create a section "authme.reload", or "login" for /login
|
||||
# If the command has arguments, you can use arg1 as below to translate the first argument, and so forth
|
||||
# Translations don't need to be complete; any missing section will be taken from the default silently
|
||||
# Important: Put main commands like "authme" before their children (e.g. "authme.reload")
|
||||
commands:
|
||||
authme.register:
|
||||
description: 'Регистрация новго игрока'
|
||||
detailedDescription: 'Регистрация игрока с указанным именем и паролем.'
|
||||
arg1:
|
||||
label: 'player'
|
||||
description: 'Имя игрока'
|
||||
arg2:
|
||||
label: 'password'
|
||||
description: 'Пароль'
|
@ -2,7 +2,7 @@
|
||||
reg_msg: '&8[&6玩家系统&8] &c请输入“/register <密码> <再输入一次以确定密码>”以注册'
|
||||
usage_reg: '&8[&6玩家系统&8] &c正确用法:“/register <密码> <再输入一次以确定密码>”'
|
||||
reg_only: '&8[&6玩家系统&8] &f只允许注册过的玩家进服!请到 https://example.cn 注册'
|
||||
# TODO kicked_admin_registered: 'An admin just registered you; please log in again'
|
||||
kicked_admin_registered: '有一位管理员刚刚为您完成了注册,请重新登录'
|
||||
registered: '&8[&6玩家系统&8] &c已成功注册!'
|
||||
reg_disabled: '&8[&6玩家系统&8] &c目前服务器暂时禁止注册,请到服务器论坛以得到更多资讯'
|
||||
user_regged: '&8[&6玩家系统&8] &c此用户已经在此服务器注册过'
|
||||
@ -11,7 +11,7 @@ user_regged: '&8[&6玩家系统&8] &c此用户已经在此服务器注册过'
|
||||
password_error: '&8[&6玩家系统&8] &f密码不相同'
|
||||
password_error_nick: '&8[&6玩家系统&8] &f你不能使用你的名字作为密码。 '
|
||||
password_error_unsafe: '&8[&6玩家系统&8] &f你不能使用安全性过低的码。 '
|
||||
# TODO password_error_chars: '&4Your password contains illegal characters. Allowed chars: REG_EX'
|
||||
password_error_chars: '&4您的密码包含了非法字符。可使用的字符: REG_EX'
|
||||
pass_len: '&8[&6玩家系统&8] &你的密码没有达到要求!'
|
||||
|
||||
# Login
|
||||
@ -23,10 +23,10 @@ timeout: '&8[&6玩家系统&8] &f给你登录的时间已经过了'
|
||||
|
||||
# Errors
|
||||
unknown_user: '&8[&6玩家系统&8] &c此用户名还未注册过'
|
||||
# TODO denied_command: '&cIn order to use this command you must be authenticated!'
|
||||
# TODO denied_chat: '&cIn order to chat you must be authenticated!'
|
||||
denied_command: '&c您需要先通过验证才能使用该命令!'
|
||||
denied_chat: '&c您需要先通过验证才能聊天!'
|
||||
not_logged_in: '&8[&6玩家系统&8] &c你还未登录!'
|
||||
# TODO tempban_max_logins: '&cYou have been temporarily banned for failing to log in too many times.'
|
||||
tempban_max_logins: '&c由于您登录失败次数过多,已被暂时禁止登录。'
|
||||
# TODO: Missing tags %reg_count, %max_acc, %reg_names
|
||||
max_reg: '&8[&6玩家系统&8] &f你不允许再为你的IP在服务器注册更多用户了!'
|
||||
no_perm: '&8[&6玩家系统&8] &c没有权限'
|
||||
@ -41,11 +41,11 @@ antibot_auto_disabled: '&8[&6玩家系统&8] &f防机器人程序由于异常连
|
||||
|
||||
# Other messages
|
||||
unregistered: '&8[&6玩家系统&8] &c成功删除此用户!'
|
||||
# TODO accounts_owned_self: 'You own %count accounts:'
|
||||
# TODO accounts_owned_other: 'The player %name has %count accounts:'
|
||||
accounts_owned_self: '您拥有 %count 个账户:'
|
||||
accounts_owned_other: '玩家 %name 拥有 %count 个账户:'
|
||||
two_factor_create: '&8[&6玩家系统&8] &2你的代码是 %code,你可以使用 %url 来扫描'
|
||||
# TODO recovery_code_sent: 'A recovery code to reset your password has been sent to your email.'
|
||||
# TODO recovery_code_incorrect: 'The recovery code is not correct! Use /email recovery [email] to generate a new one'
|
||||
recovery_code_sent: '一个用于重置您的密码的验证码已发到您的邮箱'
|
||||
recovery_code_incorrect: '验证码不正确! 使用 /email recovery [email] 以生成新的验证码'
|
||||
vb_nonActiv: '&8[&6玩家系统&8] &f你的帐号还未激活,请查看你的邮箱!'
|
||||
usage_unreg: '&8[&6玩家系统&8] &c正确用法:“/unregister <密码>”'
|
||||
pwd_changed: '&8[&6玩家系统&8] &c密码已成功修改!'
|
||||
@ -66,7 +66,7 @@ not_owner_error: '&8[&6玩家系统&8] &4警告! &c你并不是此帐户持有
|
||||
kick_fullserver: '&8[&6玩家系统&8] &c抱歉,服务器已满!'
|
||||
same_nick: '&8[&6玩家系统&8] &f同样的用户名现在在线且已经登录了!'
|
||||
invalid_name_case: '&8[&6玩家系统&8] &c你应该使用「%valid」而并非「%invalid」登入游戏。 '
|
||||
# TODO same_ip_online: 'A player with the same IP is already in game!'
|
||||
same_ip_online: '已有一个同IP玩家在游戏中了!'
|
||||
|
||||
# Email
|
||||
usage_email_add: '&8[&6玩家系统&8] &f用法: /email add <邮箱> <确认电子邮件> '
|
||||
@ -80,11 +80,11 @@ email_confirm: '&8[&6玩家系统&8] &f确认你的邮箱 !'
|
||||
email_changed: '&8[&6玩家系统&8] &f邮箱已改变 !'
|
||||
email_send: '&8[&6玩家系统&8] &f恢复邮件已发送 !'
|
||||
email_exists: '&8[&6玩家系统&8] &c恢复邮件已发送 ! 你可以丢弃它然後使用以下的指令来发送新的邮件:'
|
||||
# TODO email_show: '&2Your current email address is: &f%email'
|
||||
# TODO incomplete_email_settings: 'Error: not all required settings are set for sending emails. Please contact an admin.'
|
||||
email_show: '&2您当前的电子邮件地址为: &f%email'
|
||||
incomplete_email_settings: '错误:并非所有发送邮件需要的设置都已被设置,请联系管理员'
|
||||
email_already_used: '&8[&6玩家系统&8] &4邮箱已被使用'
|
||||
# TODO email_send_failure: 'The email could not be sent. Please contact an administrator.'
|
||||
# TODO show_no_email: '&2You currently don''t have email address associated with this account.'
|
||||
email_send_failure: '邮件发送失败,请联系管理员'
|
||||
show_no_email: '&2您当前并没有任何邮箱与该账号绑定'
|
||||
add_email: '&8[&6玩家系统&8] &c请输入“/email add <你的邮箱> <再输入一次以确认>”以把你的邮箱添加到此帐号'
|
||||
recovery_email: '&8[&6玩家系统&8] &c忘了你的密码?请输入:“/email recovery <你的邮箱>”'
|
||||
|
||||
|
@ -39,10 +39,10 @@ public class HelpMessagesServiceTest {
|
||||
@Mock
|
||||
private MessageFileHandlerProvider messageFileHandlerProvider;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BeforeInjecting
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initializeHandler() {
|
||||
MessageFileHandler handler = new MessageFileHandler(getJarFile(TEST_FILE), "messages/messages_en.yml");
|
||||
MessageFileHandler handler = new MessageFileHandler(getJarFile(TEST_FILE), "messages/messages_en.yml", null);
|
||||
given(messageFileHandlerProvider.initializeHandler(any(Function.class))).willReturn(handler);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package fr.xephi.authme.data.limbo;
|
||||
|
||||
import fr.xephi.authme.ReflectionTestUtils;
|
||||
import fr.xephi.authme.data.backup.LimboPlayerStorage;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
|
@ -1,14 +1,13 @@
|
||||
package fr.xephi.authme.data.backup;
|
||||
package fr.xephi.authme.data.limbo;
|
||||
|
||||
import ch.jalu.injector.testing.BeforeInjecting;
|
||||
import ch.jalu.injector.testing.DelayedInjectionRunner;
|
||||
import ch.jalu.injector.testing.InjectDelayed;
|
||||
import fr.xephi.authme.TestHelper;
|
||||
import fr.xephi.authme.data.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.util.FileUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
@ -0,0 +1,93 @@
|
||||
package fr.xephi.authme.message;
|
||||
|
||||
import fr.xephi.authme.TestHelper;
|
||||
import fr.xephi.authme.command.help.HelpMessage;
|
||||
import fr.xephi.authme.command.help.HelpSection;
|
||||
import fr.xephi.authme.permission.DefaultPermission;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.hamcrest.Matchers.both;
|
||||
import static org.hamcrest.Matchers.emptyString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* Tests that all help_xx.yml files contain all entries for
|
||||
* {@link HelpSection}, {@link HelpMessage} and {@link DefaultPermission}.
|
||||
*/
|
||||
public class HelpMessageConsistencyTest {
|
||||
|
||||
private static final String MESSAGES_FOLDER = "/messages";
|
||||
private static final Pattern HELP_MESSAGES_FILE = Pattern.compile("help_[a-z]+\\.yml");
|
||||
|
||||
private List<File> helpFiles;
|
||||
|
||||
@Before
|
||||
public void findHelpMessagesFiles() {
|
||||
File folder = TestHelper.getJarFile(MESSAGES_FOLDER);
|
||||
File[] files = folder.listFiles();
|
||||
if (files == null || files.length == 0) {
|
||||
throw new IllegalStateException("Could not get files from '" + MESSAGES_FOLDER + "'");
|
||||
}
|
||||
helpFiles = Arrays.stream(files)
|
||||
.filter(file -> HELP_MESSAGES_FILE.matcher(file.getName()).matches())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveRequiredEntries() {
|
||||
for (File file : helpFiles) {
|
||||
// given
|
||||
FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
// when / then
|
||||
assertHasAllHelpSectionEntries(file.getName(), configuration);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertHasAllHelpSectionEntries(String filename, FileConfiguration configuration) {
|
||||
for (HelpSection section : HelpSection.values()) {
|
||||
assertThat(filename + " should have entry for HelpSection '" + section + "'",
|
||||
configuration.getString(section.getKey()), notEmptyString());
|
||||
}
|
||||
|
||||
for (HelpMessage message : HelpMessage.values()) {
|
||||
assertThat(filename + " should have entry for HelpMessage '" + message + "'",
|
||||
configuration.getString(message.getKey()), notEmptyString());
|
||||
}
|
||||
|
||||
for (DefaultPermission defaultPermission : DefaultPermission.values()) {
|
||||
assertThat(filename + " should have entry for DefaultPermission '" + defaultPermission + "'",
|
||||
configuration.getString(getPathForDefaultPermission(defaultPermission)), notEmptyString());
|
||||
}
|
||||
}
|
||||
|
||||
private static String getPathForDefaultPermission(DefaultPermission defaultPermission) {
|
||||
String path = "common.defaultPermissions.";
|
||||
switch (defaultPermission) {
|
||||
case ALLOWED:
|
||||
return path + "allowed";
|
||||
case NOT_ALLOWED:
|
||||
return path + "notAllowed";
|
||||
case OP_ONLY:
|
||||
return path + "opOnly";
|
||||
default:
|
||||
throw new IllegalStateException("Unknown default permission '" + defaultPermission + "'");
|
||||
}
|
||||
}
|
||||
|
||||
private static Matcher<String> notEmptyString() {
|
||||
return both(not(emptyString())).and(not(nullValue()));
|
||||
}
|
||||
}
|
@ -233,8 +233,8 @@ public class MessagesIntegrationTest {
|
||||
@SuppressWarnings("unchecked")
|
||||
private static MessageFileHandlerProvider providerReturning(File file, String defaultFile) {
|
||||
MessageFileHandlerProvider handler = mock(MessageFileHandlerProvider.class);
|
||||
given(handler.initializeHandler(any(Function.class)))
|
||||
.willReturn(new MessageFileHandler(file, defaultFile));
|
||||
given(handler.initializeHandler(any(Function.class), anyString()))
|
||||
.willReturn(new MessageFileHandler(file, defaultFile, "/authme messages"));
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ import ch.jalu.injector.testing.DelayedInjectionRunner;
|
||||
import ch.jalu.injector.testing.InjectDelayed;
|
||||
import com.google.common.io.Files;
|
||||
import fr.xephi.authme.TestHelper;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.service.PluginHookService;
|
||||
import fr.xephi.authme.initialization.DataFolder;
|
||||
import fr.xephi.authme.service.PluginHookService;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -38,9 +37,6 @@ public class SpawnLoaderTest {
|
||||
@Mock
|
||||
private Settings settings;
|
||||
|
||||
@Mock
|
||||
private DataSource dataSource;
|
||||
|
||||
@Mock
|
||||
private PluginHookService pluginHookService;
|
||||
|
||||
|
@ -45,6 +45,7 @@ public class AddJavaDocToMessageEnumTask implements AutoToolTask {
|
||||
return configuration.getString(key.getKey())
|
||||
.replaceAll("&[0-9a-f]", "")
|
||||
.replace("&", "&")
|
||||
.replace("<", "<");
|
||||
.replace("<", "<")
|
||||
.replace(">", ">");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user