Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Properly acquire JUnit 4, drop json-simple
Dieser Commit ist enthalten in:
Ursprung
bcea78c701
Commit
e98b99edcd
@ -9,6 +9,7 @@ import org.gradle.api.tasks.javadoc.Javadoc
|
|||||||
import org.gradle.external.javadoc.CoreJavadocOptions
|
import org.gradle.external.javadoc.CoreJavadocOptions
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
import org.gradle.kotlin.dsl.get
|
import org.gradle.kotlin.dsl.get
|
||||||
import org.gradle.kotlin.dsl.getByName
|
import org.gradle.kotlin.dsl.getByName
|
||||||
import org.gradle.kotlin.dsl.named
|
import org.gradle.kotlin.dsl.named
|
||||||
@ -38,6 +39,10 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
toolVersion = "7.6.1"
|
toolVersion = "7.6.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"testImplementation"("junit:junit:4.12")
|
||||||
|
}
|
||||||
|
|
||||||
// Java 8 turns on doclint which we fail
|
// Java 8 turns on doclint which we fail
|
||||||
tasks.withType<Javadoc>().configureEach {
|
tasks.withType<Javadoc>().configureEach {
|
||||||
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
|
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
|
||||||
|
@ -20,7 +20,6 @@ dependencies {
|
|||||||
"compile"("com.google.guava:guava:21.0")
|
"compile"("com.google.guava:guava:21.0")
|
||||||
"compile"("com.google.code.findbugs:jsr305:1.3.9")
|
"compile"("com.google.code.findbugs:jsr305:1.3.9")
|
||||||
"compile"("com.google.code.gson:gson:2.8.0")
|
"compile"("com.google.code.gson:gson:2.8.0")
|
||||||
"compile"("com.googlecode.json-simple:json-simple:1.1.1")
|
|
||||||
"compile"("org.slf4j:slf4j-api:1.7.26")
|
"compile"("org.slf4j:slf4j-api:1.7.26")
|
||||||
|
|
||||||
"compileOnly"(project(":worldedit-libs:core:ap"))
|
"compileOnly"(project(":worldedit-libs:core:ap"))
|
||||||
|
@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util.paste;
|
package com.sk89q.worldedit.util.paste;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.sk89q.worldedit.util.net.HttpRequest;
|
import com.sk89q.worldedit.util.net.HttpRequest;
|
||||||
import org.json.simple.JSONValue;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -33,6 +34,8 @@ public class EngineHubPaste implements Paster {
|
|||||||
|
|
||||||
private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$");
|
private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$");
|
||||||
|
|
||||||
|
private static final Gson GSON = new Gson();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<URL> paste(String content) {
|
public Callable<URL> paste(String content) {
|
||||||
return new PasteTask(content);
|
return new PasteTask(content);
|
||||||
@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster {
|
|||||||
.returnContent()
|
.returnContent()
|
||||||
.asString("UTF-8").trim();
|
.asString("UTF-8").trim();
|
||||||
|
|
||||||
Object object = JSONValue.parse(result);
|
Map<Object, Object> object = GSON.fromJson(result, new TypeToken<Map<Object, Object>>() {
|
||||||
if (object instanceof Map) {
|
}.getType());
|
||||||
@SuppressWarnings("unchecked")
|
if (object != null) {
|
||||||
String urlString = String.valueOf(((Map<Object, Object>) object).get("url"));
|
String urlString = String.valueOf(object.get("url"));
|
||||||
Matcher m = URL_PATTERN.matcher(urlString);
|
Matcher m = URL_PATTERN.matcher(urlString);
|
||||||
|
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren