Add useless banners & Code cleanup
This commit is contained in:
parent
971f0f7683
commit
a35a277b32
@ -126,7 +126,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
// Load the plugin version data from the plugin description file
|
// Load the plugin version data from the plugin description file
|
||||||
loadPluginInfo(getDescription().getVersion());
|
loadPluginInfo(getDescription().getVersion());
|
||||||
|
|
||||||
@ -134,19 +133,29 @@ public class AuthMe extends JavaPlugin {
|
|||||||
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
||||||
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
||||||
logger.info("You are running an unofficial fork version of AuthMe!");
|
logger.info("You are running an unofficial fork version of AuthMe!");
|
||||||
|
if(settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
|
||||||
|
logger.info("\n" + "|\\ __ \\|\\ \\|\\ \\|\\___ ___\\\\ \\|\\ \\|\\ _ \\ _ \\|\\ ___ \\ \n" +
|
||||||
|
"\\ \\ \\|\\ \\ \\ \\\\\\ \\|___ \\ \\_\\ \\ \\\\\\ \\ \\ \\\\\\__\\ \\ \\ \\ __/| \n" +
|
||||||
|
" \\ \\ __ \\ \\ \\\\\\ \\ \\ \\ \\ \\ \\ __ \\ \\ \\\\|__| \\ \\ \\ \\_|/__ \n" +
|
||||||
|
" \\ \\ \\ \\ \\ \\ \\\\\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\_|\\ \\ \n" +
|
||||||
|
" \\ \\__\\ \\__\\ \\_______\\ \\ \\__\\ \\ \\__\\ \\__\\ \\__\\ \\ \\__\\ \\_______\\\n" +
|
||||||
|
" \\|__|\\|__|\\|_______| \\|__| \\|__|\\|__|\\|__| \\|__|\\|_______|\n" +
|
||||||
|
" ");
|
||||||
|
}
|
||||||
|
|
||||||
// Check server version
|
// Check server version
|
||||||
if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")
|
if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")
|
||||||
|| !isClassLoaded("org.bukkit.event.player.PlayerInteractAtEntityEvent")) {
|
|| !isClassLoaded("org.bukkit.event.player.PlayerInteractAtEntityEvent")) {
|
||||||
logger.warning("你正在运行不受支持的服务器版本 (" + getServerNameVersionSafe() + "). "
|
logger.warning("You are running an unsupported server version (" + getServerNameVersionSafe() + "). "
|
||||||
+ "AuthMe 仅支持Spigot 1.9及之后的版本!");
|
+ "AuthMe requires Spigot 1.8.X or later!");
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent running AuthMeBridge due to major exploit issues
|
// Prevent running AuthMeBridge due to major exploit issues
|
||||||
if (getServer().getPluginManager().isPluginEnabled("AuthMeBridge")) {
|
if (getServer().getPluginManager().isPluginEnabled("AuthMeBridge")) {
|
||||||
logger.warning("检测到 AuthMeBridge被加载, 对AuthMeBridge的支持已经停止 "
|
logger.warning("Detected AuthMeBridge, support for it has been dropped as it was "
|
||||||
+ "且可能会造成严重漏洞! 已中止加载!");
|
+ "causing exploit issues, please use AuthMeBungee instead! Aborting!");
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -157,11 +166,11 @@ public class AuthMe extends JavaPlugin {
|
|||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
YamlParseException yamlParseException = ExceptionUtils.findThrowableInCause(YamlParseException.class, th);
|
YamlParseException yamlParseException = ExceptionUtils.findThrowableInCause(YamlParseException.class, th);
|
||||||
if (yamlParseException == null) {
|
if (yamlParseException == null) {
|
||||||
logger.logException("已中止AuthMeReReloaded的初始化,原因:", th);
|
logger.logException("Aborting initialization of AuthMe:", th);
|
||||||
th.printStackTrace();
|
th.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
logger.logException("文件 '" + yamlParseException.getFile() + "' 包含YAML语法错误. "
|
logger.logException("File '" + yamlParseException.getFile() + "' contains invalid YAML. "
|
||||||
+ "请尝试在 https://yamllint.com 中检查文件内容", yamlParseException);
|
+ "Please run its contents through http://yamllint.com", yamlParseException);
|
||||||
}
|
}
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -38,11 +39,12 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
//define AuthMeApi
|
//define AuthMeApi
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
//define global enabled
|
|
||||||
|
|
||||||
//define timesLeft
|
//define timesLeft
|
||||||
public int timesLeft = 3;
|
public int timesLeft = 3;
|
||||||
//Use ConcurrentHashMap to store player and their close reason
|
//Use ConcurrentHashMap to store player and their close reason
|
||||||
|
/* We used many async tasks so there is concurrent**/
|
||||||
protected static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
|
protected static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
|
||||||
//define randomStringSet
|
//define randomStringSet
|
||||||
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
||||||
@ -50,6 +52,7 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
Random randomItemSet = new Random();
|
Random randomItemSet = new Random();
|
||||||
Random howManyRandom = new Random();
|
Random howManyRandom = new Random();
|
||||||
|
|
||||||
|
|
||||||
// public int tryTimesReset(){
|
// public int tryTimesReset(){
|
||||||
// int tmp = 1;
|
// int tmp = 1;
|
||||||
// if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_MAX_TRY) < 1){
|
// if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_MAX_TRY) < 1){
|
||||||
|
|||||||
@ -73,6 +73,10 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> CHECK_FOR_UPDATES =
|
public static final Property<Boolean> CHECK_FOR_UPDATES =
|
||||||
newProperty("Plugin.updates.checkForUpdates", true);
|
newProperty("Plugin.updates.checkForUpdates", true);
|
||||||
|
|
||||||
|
@Comment("Should we show the Authme banner on startup?")
|
||||||
|
public static final Property<Boolean> SHOW_STARTUP_BANNER =
|
||||||
|
newProperty("Plugin.updates.showBanners", true);
|
||||||
|
|
||||||
@Comment("Max allowed tries before a captcha is required")
|
@Comment("Max allowed tries before a captcha is required")
|
||||||
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
||||||
newProperty("Security.captcha.maxLoginTry", 8);
|
newProperty("Security.captcha.maxLoginTry", 8);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user