Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into command-perms-refactor
This commit is contained in:
@@ -61,15 +61,9 @@ public class AuthMe extends JavaPlugin {
|
||||
* Defines the name of the plugin.
|
||||
*/
|
||||
private static final String PLUGIN_NAME = "AuthMeReloaded";
|
||||
/**
|
||||
* Defines the current AuthMeReloaded version name.
|
||||
*/
|
||||
private static final String PLUGIN_VERSION_NAME = "5.1-SNAPSHOT";
|
||||
/**
|
||||
* Defines the current AuthMeReloaded version code.
|
||||
*/
|
||||
// TODO: increment this value manually
|
||||
private static final int PLUGIN_VERSION_CODE = 120;
|
||||
|
||||
private static String pluginVersion = "N/D";
|
||||
private static String pluginBuildNumber = "Unknown";
|
||||
|
||||
private static AuthMe plugin;
|
||||
private static Server server;
|
||||
@@ -130,8 +124,8 @@ public class AuthMe extends JavaPlugin {
|
||||
*
|
||||
* @return The version name of the currently installed AuthMeReloaded instance.
|
||||
*/
|
||||
public static String getVersionName() {
|
||||
return PLUGIN_VERSION_NAME;
|
||||
public static String getPluginVersion() {
|
||||
return pluginVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,8 +133,8 @@ public class AuthMe extends JavaPlugin {
|
||||
*
|
||||
* @return The version code of the currently installed AuthMeReloaded instance.
|
||||
*/
|
||||
public static int getVersionCode() {
|
||||
return PLUGIN_VERSION_CODE;
|
||||
public static String getPluginBuildNumber() {
|
||||
return pluginBuildNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,6 +183,20 @@ public class AuthMe extends JavaPlugin {
|
||||
this.canConnect = canConnect;
|
||||
}
|
||||
|
||||
// Get version and build number of the plugin
|
||||
// TODO: enhance this
|
||||
private void setupConstants() {
|
||||
String versionRaw = this.getDescription().getVersion();
|
||||
int index = versionRaw.lastIndexOf("-");
|
||||
if (index != -1) {
|
||||
pluginVersion = versionRaw.substring(0, index);
|
||||
pluginBuildNumber = versionRaw.substring(index + 1);
|
||||
if (pluginBuildNumber.startsWith("b")) {
|
||||
pluginBuildNumber = pluginBuildNumber.substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when the server enables the plugin.
|
||||
*
|
||||
@@ -199,6 +207,7 @@ public class AuthMe extends JavaPlugin {
|
||||
// Set various instances
|
||||
server = getServer();
|
||||
plugin = this;
|
||||
setupConstants();
|
||||
|
||||
// Set up the permissions manager
|
||||
setupPermissionsManager();
|
||||
|
||||
@@ -13,7 +13,7 @@ public class AuthMeCommand extends ExecutableCommand {
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Show some version info
|
||||
sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.getPluginName() + " v" + AuthMe.getVersionName() + "! " + ChatColor.RED + "<3");
|
||||
sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.getPluginName() + " v" + AuthMe.getPluginVersion() + " b" + AuthMe.getPluginBuildNumber()+ "! " + ChatColor.RED + "<3");
|
||||
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " help" + ChatColor.YELLOW + " to view help.");
|
||||
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " about" + ChatColor.YELLOW + " to view about.");
|
||||
return true;
|
||||
|
||||
@@ -3,6 +3,8 @@ package fr.xephi.authme.command.executable.authme;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -24,8 +26,8 @@ public class VersionCommand extends ExecutableCommand {
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Show some version info
|
||||
sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName().toUpperCase() + " ABOUT ]==========");
|
||||
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() + " v" + AuthMe.getVersionName() + ChatColor.GRAY + " (code: " + AuthMe.getVersionCode() + ")");
|
||||
sender.sendMessage(ChatColor.GOLD + "==========[ " + Settings.helpHeader.toUpperCase() + " ABOUT ]==========");
|
||||
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() + " v" + AuthMe.getPluginVersion() + ChatColor.GRAY + " (build: " + AuthMe.getPluginBuildNumber() + ")");
|
||||
sender.sendMessage(ChatColor.GOLD + "Developers:");
|
||||
printDeveloper(sender, "Xephi", "xephi59", "Lead Developer");
|
||||
printDeveloper(sender, "DNx5", "DNx5", "Developer");
|
||||
|
||||
@@ -4,6 +4,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandDescription;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.FoundCommandResult;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@@ -99,7 +101,7 @@ public class HelpProvider {
|
||||
}
|
||||
|
||||
// Print the help header
|
||||
sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName().toUpperCase() + " HELP ]==========");
|
||||
sender.sendMessage(ChatColor.GOLD + "==========[ " + Settings.helpHeader.toUpperCase() + " HELP ]==========");
|
||||
|
||||
// Print the command help information
|
||||
if (showCommand)
|
||||
|
||||
@@ -42,16 +42,16 @@ public class vAuthFileReader {
|
||||
String name = line.split(": ")[0];
|
||||
String password = line.split(": ")[1];
|
||||
PlayerAuth auth;
|
||||
if (isUUIDinstance(password)) {
|
||||
String playerName;
|
||||
if (isUuidInstance(password)) {
|
||||
String pname;
|
||||
try {
|
||||
playerName = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName();
|
||||
pname = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName();
|
||||
} catch (Exception | NoSuchMethodError e) {
|
||||
playerName = getName(UUID.fromString(name));
|
||||
pname = getName(UUID.fromString(name));
|
||||
}
|
||||
if (playerName == null)
|
||||
if (pname == null)
|
||||
continue;
|
||||
auth = new PlayerAuth(playerName.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", playerName);
|
||||
auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", pname);
|
||||
} else {
|
||||
auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name);
|
||||
}
|
||||
@@ -64,17 +64,8 @@ public class vAuthFileReader {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Method isUUIDinstance.
|
||||
*
|
||||
* @param s String
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean isUUIDinstance(String s) {
|
||||
if (String.valueOf(s.charAt(8)).equalsIgnoreCase("-"))
|
||||
return true;
|
||||
return true;
|
||||
private static boolean isUuidInstance(String s) {
|
||||
return s.length() > 8 && s.charAt(8) == '-';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,7 +69,7 @@ public final class Settings extends YamlConfiguration {
|
||||
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
|
||||
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
|
||||
customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite;
|
||||
public static String getNickRegex, getUnloggedinGroup, getMySQLHost,
|
||||
public static String helpHeader, getNickRegex, getUnloggedinGroup, getMySQLHost,
|
||||
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
|
||||
getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword,
|
||||
getMySQLColumnIp, getMySQLColumnLastLogin, getMySQLColumnSalt,
|
||||
@@ -129,6 +129,7 @@ public final class Settings extends YamlConfiguration {
|
||||
|
||||
|
||||
public static void loadVariables() {
|
||||
helpHeader = configFile.getString("settings.helpHeader", "AuthMeReloaded");
|
||||
messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase());
|
||||
isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false);
|
||||
isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true);
|
||||
@@ -551,6 +552,10 @@ public final class Settings extends YamlConfiguration {
|
||||
set("Protection.countriesBlacklist", countriesBlacklist);
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("settings.helpHeader")) {
|
||||
set("settings.helpHeader", "AuthMeReloaded");
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("settings.broadcastWelcomeMessage")) {
|
||||
set("settings.broadcastWelcomeMessage", false);
|
||||
changes = true;
|
||||
|
||||
Reference in New Issue
Block a user