Remove guava dependency
This commit is contained in:
4 files changed
+9
-11
No files matched your search
@@ -22,7 +22,6 @@ dependencies {
|
||||
compileOnlyApi(libs.checkerQual)
|
||||
compileOnlyApi(libs.gson)
|
||||
testImplementation(libs.gson)
|
||||
compileOnlyApi(libs.guava)
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
*/
|
||||
package xyz.jpenilla.minimotd.common.config;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -109,10 +110,10 @@ public final class ConfigManager {
|
||||
}
|
||||
|
||||
private void createDefaultExtraConfigs(final @NonNull Path extraConfigsDir) throws ConfigurateException {
|
||||
final List<Pair<Path, MiniMOTDConfig.MOTD>> defaults = ImmutableList.of(
|
||||
final List<Pair<Path, MiniMOTDConfig.MOTD>> defaults = Collections.unmodifiableList(Arrays.asList(
|
||||
pair(extraConfigsDir.resolve("skyblock.conf"), new MiniMOTDConfig.MOTD("<green><italic>Skyblock</green>", "<bold><rainbow>MiniMOTD Skyblock Server")),
|
||||
pair(extraConfigsDir.resolve("survival.conf"), new MiniMOTDConfig.MOTD("<gradient:blue:red>Survival Mode Hardcore", "<green><bold>MiniMOTD Survival Server"))
|
||||
);
|
||||
));
|
||||
for (final Pair<Path, MiniMOTDConfig.MOTD> pair : defaults) {
|
||||
final ConfigLoader<MiniMOTDConfig> loader = new ConfigLoader<>(
|
||||
MiniMOTDConfig.class,
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
*/
|
||||
package xyz.jpenilla.minimotd.common.util;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonParser;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -45,7 +45,7 @@ public final class UpdateChecker {
|
||||
public @NonNull List<String> checkVersion() {
|
||||
final JsonArray result;
|
||||
final String url = String.format("https://api.github.com/repos/%s/%s/releases", Constants.PluginMetadata.GITHUB_USER, Constants.PluginMetadata.GITHUB_REPO);
|
||||
try (final InputStream is = new URL(url).openStream(); InputStreamReader reader = new InputStreamReader(is, Charsets.UTF_8)) {
|
||||
try (final InputStream is = new URL(url).openStream(); InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
|
||||
result = this.parser.parse(reader).getAsJsonArray();
|
||||
} catch (final IOException ex) {
|
||||
return Collections.singletonList("Cannot look for updates: " + ex.getMessage());
|
||||
@@ -58,13 +58,13 @@ public final class UpdateChecker {
|
||||
return Collections.emptyList(); // Up to date, do nothing
|
||||
}
|
||||
if (currentVersion.contains("SNAPSHOT")) {
|
||||
return ImmutableList.of(
|
||||
return Arrays.asList(
|
||||
"This server is running a development build of " + Constants.PluginMetadata.NAME + "! (" + currentVersion + ")",
|
||||
"The latest official release is " + versionList.get(0)
|
||||
);
|
||||
}
|
||||
final int versionsBehind = versionList.indexOf(currentVersion);
|
||||
return ImmutableList.of(
|
||||
return Arrays.asList(
|
||||
"There is an update available for " + Constants.PluginMetadata.NAME + "!",
|
||||
"This server is running version " + currentVersion + ", which is " + (versionsBehind == -1 ? "UNKNOWN" : versionsBehind) + " versions outdated.",
|
||||
"Download the latest version, " + versionList.get(0) + " from GitHub at the link below:",
|
||||
|
||||
@@ -19,7 +19,6 @@ configurate = "4.1.2"
|
||||
checkerQual = "3.38.0"
|
||||
slf4j = "1.7.32"
|
||||
gson = "2.8.0"
|
||||
guava = "21.0"
|
||||
bstats = "3.0.2"
|
||||
paperApi = "1.16.5-R0.1-SNAPSHOT"
|
||||
paperlib = "1.0.8-SNAPSHOT"
|
||||
@@ -50,7 +49,6 @@ slf4jApi = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
|
||||
slf4jJdk14 = { group = "org.slf4j", name = "slf4j-jdk14", version.ref = "slf4j" }
|
||||
|
||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||
|
||||
bstatsBukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" }
|
||||
bstatsBungeecord = { group = "org.bstats", name = "bstats-bungeecord", version.ref = "bstats" }
|
||||
|
||||
Reference in new issue
Block a user