mirror of
https://github.com/Minestom/Minestom.git
synced 2024-10-04 01:18:18 +02:00
Remove commons-codec dependency
This commit is contained in:
parent
eff0239258
commit
dbfb3f7ff4
@ -124,9 +124,6 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
||||||
api 'com.google.code.gson:gson:2.8.6'
|
api 'com.google.code.gson:gson:2.8.6'
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/commons-codec/commons-codec
|
|
||||||
api 'commons-codec:commons-codec:1.15'
|
|
||||||
|
|
||||||
// Noise library for terrain generation
|
// Noise library for terrain generation
|
||||||
// https://jitpack.io/#Articdive/Jnoise
|
// https://jitpack.io/#Articdive/Jnoise
|
||||||
api 'com.github.Articdive:Jnoise:1.0.0'
|
api 'com.github.Articdive:Jnoise:1.0.0'
|
||||||
|
@ -3,8 +3,8 @@ package net.minestom.server.entity.metadata.animal;
|
|||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Metadata;
|
import net.minestom.server.entity.Metadata;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FoxMeta extends AnimalMeta {
|
public class FoxMeta extends AnimalMeta {
|
||||||
|
@ -5,16 +5,27 @@ import com.google.gson.JsonArray;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
|
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.*;
|
import java.nio.file.FileVisitResult;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.SimpleFileVisitor;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for making sure Minestom has the necessary files to run (notably registry files)
|
* Responsible for making sure Minestom has the necessary files to run (notably registry files)
|
||||||
@ -177,13 +188,19 @@ public class ResourceGatherer {
|
|||||||
}
|
}
|
||||||
// Verify checksum
|
// Verify checksum
|
||||||
try (FileInputStream fis = new FileInputStream(target)) {
|
try (FileInputStream fis = new FileInputStream(target)) {
|
||||||
String sha1Target = DigestUtils.sha1Hex(fis);
|
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
|
||||||
|
messageDigest.reset();
|
||||||
|
// This just converts the sha1 back into a readable string.
|
||||||
|
String sha1Target = new BigInteger(1, messageDigest.digest(fis.readAllBytes())).toString(16);
|
||||||
if (!sha1Target.equals(sha1Source)) {
|
if (!sha1Target.equals(sha1Source)) {
|
||||||
LOGGER.debug("The checksum test failed after downloading the Minecraft server jar.");
|
LOGGER.error("The checksum test failed after downloading the Minecraft server jar.");
|
||||||
LOGGER.debug("The expected checksum was: {}.", sha1Source);
|
LOGGER.error("The expected checksum was: {}.", sha1Source);
|
||||||
LOGGER.debug("The calculated checksum was: {}.", sha1Target);
|
LOGGER.error("The calculated checksum was: {}.", sha1Target);
|
||||||
throw new IOException("Failed to download Minecraft server jar.");
|
throw new IOException("Failed to download Minecraft server jar.");
|
||||||
}
|
}
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
LOGGER.error("Failed to find SHA-1 hashing algorithm in Java Environment.");
|
||||||
|
throw new IOException("Failed to download Minecraft server jar.");
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user