mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
It runs! And it's small!
This commit is contained in:
parent
c198305b5e
commit
e15b5a07fb
@ -49,6 +49,7 @@ dependencies {
|
||||
// Plugins
|
||||
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT") {
|
||||
exclude(group = "org.bukkit")
|
||||
exclude(group = "org.spigotmc")
|
||||
}
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
||||
exclude(group = "org.bukkit")
|
||||
@ -60,61 +61,36 @@ dependencies {
|
||||
compileOnly("be.maximvdw:MVdWPlaceholderAPI:3.1.1") { isTransitive = false }
|
||||
|
||||
// Other libraries
|
||||
compileOnly("com.sk89q:squirrelid:1.0.0-SNAPSHOT") { isTransitive = false }
|
||||
implementation("com.sk89q:squirrelid:1.0.0-SNAPSHOT") { isTransitive = false }
|
||||
|
||||
// Adventure
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
tasks.processResources {
|
||||
filesMatching("plugin.yml") {
|
||||
expand("version" to project.version)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Get this to be not ugly...
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
dependencies {
|
||||
include(dependency(":PlotSquared-Core"))
|
||||
include(dependency("io.papermc:paperlib"))
|
||||
include(dependency("net.kyori:adventure-platform-bukkit"))
|
||||
include(dependency("net.kyori:adventure-text-minimessage"))
|
||||
include(dependency("net.kyori:adventure-text-serializer-bungeecord"))
|
||||
include(dependency("net.kyori:adventure-text-serializer-legacy"))
|
||||
include(dependency("net.kyori:adventure-text-serializer-gson"))
|
||||
include(dependency("net.kyori:adventure-api"))
|
||||
include(dependency("net.kyori:adventure-platform-api"))
|
||||
include(dependency("net.kyori:adventure-platform-common"))
|
||||
include(dependency("net.kyori:adventure-platform-viaversion"))
|
||||
include(dependency("net.kyori:adventure-nbt"))
|
||||
include(dependency("net.kyori:examination-api"))
|
||||
include(dependency("net.kyori:examination-string"))
|
||||
include(dependency("org.bstats:bstats-bukkit"))
|
||||
include(dependency("org.khelekore:prtree"))
|
||||
include(dependency("com.sk89q:squirrelid"))
|
||||
include(dependency("com.google.inject:guice"))
|
||||
include(dependency("com.google.inject.extensions:guice-assistedinject"))
|
||||
include(dependency("javax.annotation:javax-annotation-api"))
|
||||
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
|
||||
include(dependency("org.slf4j:slf4j-api"))
|
||||
include(dependency("javax.inject:javax.inject"))
|
||||
include(dependency("aopalliance:aopalliance"))
|
||||
include(dependency("com.intellectualsites:Pipeline"))
|
||||
|
||||
relocate("net.kyori.adventure", "com.plotsquared.core.configuration.adventure")
|
||||
relocate("net.kyori.examination", "com.plotsquared.core.configuration.examination")
|
||||
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||
relocate("org.bstats", "com.plotsquared.metrics")
|
||||
relocate("com.sk89q.squirrelid", "com.plotsquared.squirrelid")
|
||||
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
|
||||
relocate("org.apache.logging.slf4j", "com.plotsquared.logging.apache")
|
||||
relocate("org.slf4j", "com.plotsquared.logging.slf4j")
|
||||
relocate("com.google.inject", "com.plotsquared.google")
|
||||
relocate("javax.inject", "com.plotsquared.core.inject.javax")
|
||||
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
||||
relocate("com.intellectualsites.services", "com.plotsquared.core.services")
|
||||
relocate("org.json", "com.plotsquared.json") {
|
||||
exclude("org/json/simple/**")
|
||||
}
|
||||
exclude(dependency("org.checkerframework:"))
|
||||
}
|
||||
|
||||
relocate("net.kyori.adventure", "com.plotsquared.core.configuration.adventure")
|
||||
relocate("net.kyori.examination", "com.plotsquared.core.configuration.examination")
|
||||
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||
relocate("org.bstats", "com.plotsquared.metrics")
|
||||
relocate("com.sk89q.squirrelid", "com.plotsquared.squirrelid")
|
||||
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
|
||||
relocate("org.apache.logging.slf4j", "com.plotsquared.logging.apache")
|
||||
relocate("org.slf4j", "com.plotsquared.logging.slf4j")
|
||||
relocate("com.google.inject", "com.plotsquared.google")
|
||||
relocate("javax.inject", "com.plotsquared.core.inject.javax")
|
||||
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
||||
relocate("com.intellectualsites.services", "com.plotsquared.core.services")
|
||||
|
||||
// Get rid of all the libs which are 100% unused.
|
||||
minimize()
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
dependencies {
|
||||
// Expected everywhere.
|
||||
api("org.json:json:20200518")
|
||||
api("javax.annotation:javax.annotation-api:1.3.2")
|
||||
compileOnlyApi("javax.annotation:javax.annotation-api:1.3.2")
|
||||
|
||||
// Minecraft expectations
|
||||
compileOnlyApi("com.google.guava:guava:21.0") // Minecraft uses v21.0
|
||||
compileOnlyApi("com.google.code.gson:gson:2.8.0") // Minecraft uses v2.8.0
|
||||
api("org.slf4j:slf4j-api:1.7.25") // Minecraft uses v1.7.25
|
||||
|
||||
// Platform expectations
|
||||
compileOnlyApi("org.yaml:snakeyaml:1.26") // Some platforms provide this
|
||||
@ -15,16 +17,40 @@ dependencies {
|
||||
api("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT")
|
||||
|
||||
// Guice
|
||||
api("com.google.inject:guice:4.2.3")
|
||||
api("com.google.inject.extensions:guice-assistedinject:4.2.3")
|
||||
api("com.google.inject:guice:4.2.3") {
|
||||
exclude(group = "com.google.guava")
|
||||
}
|
||||
api("com.google.inject.extensions:guice-assistedinject:4.2.3") {
|
||||
exclude("com.google.inject", "guice")
|
||||
}
|
||||
compileOnlyApi("com.google.code.findbugs:annotations:3.0.1")
|
||||
compileOnlyApi("javax.inject:javax.inject:1")
|
||||
|
||||
// Logging
|
||||
api("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
||||
// Plugins
|
||||
compileOnlyApi("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT") {
|
||||
exclude(group = "bukkit-classloader-check")
|
||||
exclude(group = "mockito-core")
|
||||
exclude(group = "dummypermscompat")
|
||||
}
|
||||
testImplementation("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT")
|
||||
|
||||
// Other libraries
|
||||
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
api("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
||||
api("aopalliance:aopalliance:1.0")
|
||||
api("com.intellectualsites:Pipeline:1.4.0-SNAPSHOT")
|
||||
api("com.intellectualsites:Pipeline:1.4.0-SNAPSHOT") {
|
||||
exclude(group = "com.google.guava")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
filesMatching("plugin.properties") {
|
||||
expand(
|
||||
"version" to project.version.toString(),
|
||||
"commit" to rootProject.grgit.head().abbreviatedId,
|
||||
"date" to rootProject.grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.generator.ClassicPlotWorld;
|
||||
@ -60,8 +63,6 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -106,6 +107,7 @@ import java.util.zip.GZIPOutputStream;
|
||||
public abstract class SchematicHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + SchematicHandler.class.getSimpleName());
|
||||
private static final Gson GSON = new Gson();
|
||||
public static SchematicHandler manager;
|
||||
private final WorldUtil worldUtil;
|
||||
private boolean exportAll = false;
|
||||
@ -453,7 +455,7 @@ public abstract class SchematicHandler {
|
||||
}
|
||||
|
||||
public List<String> getSaves(UUID uuid) {
|
||||
String rawJSON = "";
|
||||
String rawJSON;
|
||||
try {
|
||||
String website = Settings.Web.URL + "list.php?" + uuid.toString();
|
||||
URL url = new URL(website);
|
||||
@ -462,14 +464,14 @@ public abstract class SchematicHandler {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
rawJSON = reader.lines().collect(Collectors.joining());
|
||||
}
|
||||
JSONArray array = new JSONArray(rawJSON);
|
||||
JsonArray array = GSON.fromJson(rawJSON, JsonArray.class);
|
||||
List<String> schematics = new ArrayList<>();
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
String schematic = array.getString(i);
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
String schematic = array.get(i).getAsString();
|
||||
schematics.add(schematic);
|
||||
}
|
||||
return schematics;
|
||||
} catch (JSONException | IOException e) {
|
||||
} catch (JsonParseException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
@ -8,6 +8,7 @@ plugins {
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "6.0.0"
|
||||
id("net.minecrell.licenser") version "0.4.1"
|
||||
id("org.ajoberstar.grgit") version "4.1.0"
|
||||
|
||||
eclipse
|
||||
idea
|
||||
@ -63,14 +64,6 @@ subprojects {
|
||||
plugin<IdeaPlugin>()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT") {
|
||||
exclude(group = "bukkit-classloader-check")
|
||||
exclude(group = "mockito-core")
|
||||
exclude(group = "dummypermscompat")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
// This is to create the target dir under the root project with all jars.
|
||||
val assembleTargetDir = create<Copy>("assembleTargetDirectory") {
|
||||
@ -175,8 +168,8 @@ allprojects {
|
||||
tasks {
|
||||
named<Delete>("clean") {
|
||||
doFirst {
|
||||
delete(rootDir.resolve("target"))
|
||||
delete(javadocDir)
|
||||
rootDir.resolve("target").deleteRecursively()
|
||||
javadocDir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user