public static List<String> lines(PlanPlugin plugin, String resource) throws IOException { List<String> lines = new ArrayList<>(); Scanner scanner = null; try (InputStream inputStream = plugin.getResource(resource)) { scanner = new Scanner(inputStream, "UTF-8"); while (scanner.hasNextLine()) { lines.add(scanner.nextLine()); } } catch (NullPointerException e) { plugin.getPluginLogger().log(L.INFO_COLOR, "§ea Resource was not found inside the jar (" + resource + "), Plan does not support /reload or updates using " + "Plugin Managers, restart the server and see if the error persists."); throw new FileNotFoundException("File not found inside jar: " + resource); } finally { MiscUtils.close(scanner); } return lines; }
public static PlanColorScheme create(PlanConfig config, PluginLogger logger) { try { String main = "§" + config.get(DisplaySettings.CMD_COLOR_MAIN).charAt(1); String secondary = "§" + config.get(DisplaySettings.CMD_COLOR_SECONDARY).charAt(1); String tertiary = "§" + config.get(DisplaySettings.CMD_COLOR_TERTIARY).charAt(1); return new PlanColorScheme(main, secondary, tertiary); } catch (Exception e) { logger.log(L.INFO_COLOR, "§cCustomization, Chat colors set-up wrong, using defaults."); return new PlanColorScheme("§2", "§7", "§f"); } }
@Override public void enable() { if (config.isFalse(PluginSettings.CHECK_FOR_UPDATES)) { return; } try { List<VersionInfo> versions = VersionInfoLoader.load(); if (config.isFalse(PluginSettings.NOTIFY_ABOUT_DEV_RELEASES)) { versions = versions.stream().filter(VersionInfo::isRelease).collect(Collectors.toList()); } VersionInfo newestVersion = versions.get(0); if (Version.isNewVersionAvailable(new Version(currentVersion), newestVersion.getVersion())) { newVersionAvailable = newestVersion; String notification = locale.getString( PluginLang.VERSION_AVAILABLE, newestVersion.getVersion().toString(), newestVersion.getChangeLogUrl() ) + (newestVersion.isRelease() ? "" : locale.getString(PluginLang.VERSION_AVAILABLE_DEV)); logger.log(L.INFO_COLOR, "§a----------------------------------------"); logger.log(L.INFO_COLOR, "§a" + notification); logger.log(L.INFO_COLOR, "§a----------------------------------------"); } else { logger.info(locale.getString(PluginLang.VERSION_NEWEST)); } } catch (IOException e) { logger.error(locale.getString(PluginLang.VERSION_FAIL_READ_VERSIONS)); } }
logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.WEB_SERVER_NOTIFY_HTTP_USER_AUTH)); server = HttpServer.create(new InetSocketAddress(config.get(WebserverSettings.INTERNAL_IP), port), 10); } else if (server == null) { logger.log(L.INFO_COLOR, "§eWebServer: Proxy HTTPS Override enabled. HTTP Server in use, make sure that your Proxy webserver is routing with HTTPS and AlternativeIP.Link points to the Proxy"); server = HttpServer.create(new InetSocketAddress(config.get(WebserverSettings.INTERNAL_IP), port), 10);
errorHandler.log(L.ERROR, this.getClass(), e); } catch (FileNotFoundException e) { logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.WEB_SERVER_NOTIFY_NO_CERT_FILE, keyStorePath)); logger.info(locale.getString(PluginLang.WEB_SERVER_NOTIFY_HTTP)); } catch (IOException e) {
@Override public void enable() { super.enable(); refreshServerMap(); boolean usingBungeeWebServer = isServerAvailable(); boolean usingAlternativeIP = config.isTrue(WebserverSettings.SHOW_ALTERNATIVE_IP); if (!usingAlternativeIP && serverInfo.getServerProperties().getIp().isEmpty()) { pluginLogger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.ENABLE_NOTIFY_EMPTY_IP)); } if (usingBungeeWebServer && usingAlternativeIP) { String webServerAddress = webServer.get().getAccessAddress(); pluginLogger.info(locale.getString(PluginLang.ENABLE_NOTIFY_ADDRESS_CONFIRMATION, webServerAddress)); } } }
@Override public void enable() throws EnableException { geolocationDB = files.getFileFromPluginFolder("GeoIP.dat"); if (config.isTrue(DataGatheringSettings.GEOLOCATIONS)) { try { checkDB(); } catch (UnknownHostException e) { logger.error(locale.getString(PluginLang.ENABLE_NOTIFY_GEOLOCATIONS_INTERNET_REQUIRED)); } catch (IOException e) { throw new EnableException(locale.getString(PluginLang.ENABLE_FAIL_GEODB_WRITE), e); } } else { logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.ENABLE_NOTIFY_GEOLOCATIONS_DISABLED)); } }