mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Merge pull request #485 from PlaceholderAPI/fix/477-remove-gson
Remove Gson
This commit is contained in:
commit
3a31c5cb78
@ -18,7 +18,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
implementation "org.bstats:bstats-bukkit:1.5"
|
||||
|
||||
compileOnly "org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT"
|
||||
@ -60,7 +59,6 @@ shadowJar {
|
||||
archiveClassifier.set("")
|
||||
|
||||
relocate "org.bstats", "me.clip.placeholderapi.metrics"
|
||||
relocate "com.google.gson", "me.clip.placeholderapi.libs.gson"
|
||||
}
|
||||
|
||||
license {
|
||||
|
@ -21,7 +21,17 @@
|
||||
package me.clip.placeholderapi.commands.impl.local;
|
||||
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@ -41,20 +51,15 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
public final class CommandDump extends PlaceholderCommand {
|
||||
|
||||
@NotNull
|
||||
private static final String URL = "https://paste.helpch.at/";
|
||||
|
||||
@NotNull
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
@NotNull
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter
|
||||
.ofLocalizedDateTime(FormatStyle.LONG)
|
||||
@ -102,9 +107,8 @@ public final class CommandDump extends PlaceholderCommand {
|
||||
|
||||
try (final InputStream stream = connection.getInputStream()) {
|
||||
//noinspection UnstableApiUsage
|
||||
final String json = CharStreams
|
||||
.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
return JsonParser.parseString(json).getAsJsonObject().get("key").getAsString();
|
||||
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
|
||||
}
|
||||
} catch (final IOException ex) {
|
||||
throw new CompletionException(ex);
|
||||
|
Loading…
Reference in New Issue
Block a user