mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2026-06-29 19:05:55 +02:00
Merge branch 'master' into master
This commit is contained in:
@@ -22,7 +22,6 @@ package me.clip.placeholderapi.replacer;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.scheduler.scheduling.schedulers.TaskScheduler;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
@@ -66,7 +66,7 @@ public class UpdateChecker implements Listener {
|
||||
try {
|
||||
HttpsURLConnection con = (HttpsURLConnection) new URL(MODRINTH_URL).openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
final JsonElement json = JsonParser.parseReader(new BufferedReader(new InputStreamReader(con.getInputStream())));
|
||||
final JsonElement json = new Gson().fromJson(new BufferedReader(new InputStreamReader(con.getInputStream())), JsonElement.class);
|
||||
modrinthVersion = json.getAsJsonArray().get(0).getAsJsonObject().get("version_number").getAsString();
|
||||
} catch (Exception ex) {
|
||||
plugin.getLogger().info("Failed to check for updates on modrinth.");
|
||||
|
||||
@@ -55,9 +55,18 @@ public final class ExpansionSafetyCheck {
|
||||
}
|
||||
|
||||
final Set<String> maliciousPaths = new HashSet<>();
|
||||
final File[] files = expansionsFolder.listFiles();
|
||||
|
||||
for (File file : expansionsFolder.listFiles()) {
|
||||
if (files == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (File file : files) {
|
||||
try {
|
||||
if (!file.isFile()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String hash = Hashing.sha256().hashBytes(Files.asByteSource(file).read()).toString();
|
||||
|
||||
if (knownMaliciousExpansions.contains(hash)) {
|
||||
|
||||
Reference in New Issue
Block a user