Merge branch 'main' of github.com:IntellectualSites/FastAsyncWorldEdit

This commit is contained in:
dordsor21
2021-01-28 13:13:10 +00:00
24 changed files with 266 additions and 161 deletions

View File

@ -1,6 +1,4 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.mendhak.gradlecrowdin.DownloadTranslationsTask
import com.mendhak.gradlecrowdin.UploadSourceFileTask
import org.gradle.plugins.ide.idea.model.IdeaModel
plugins {
@ -8,14 +6,18 @@ plugins {
id("net.ltgt.apt-eclipse")
id("net.ltgt.apt-idea")
id("antlr")
id("com.mendhak.gradlecrowdin")
}
repositories {
maven { url = uri("https://plotsquared.com/mvn") }
maven { url = uri("https://mvn.intellectualsites.com/content/groups/public/") }
mavenCentral()
maven {
name = "IntellectualSites"
url = uri("https://mvn.intellectualsites.com/content/groups/public/")
content {
includeGroup("com.plotsquared")
includeGroup("com.intellectualsites.paster")
includeGroup("com.github.intellectualsites.plotsquared")
}
}
}
applyPlatformAndCoreConfiguration()
@ -27,39 +29,34 @@ configurations.all {
}
dependencies {
"api"(project(":worldedit-libs:core"))
"implementation"("de.schlichtherle:truezip:6.8.4")
"implementation"("net.java.truevfs:truevfs-profile-default_2.13:0.12.2")
"implementation"("org.mozilla:rhino-runtime:1.7.12")
"implementation"("org.yaml:snakeyaml:1.27")
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
"implementation"("com.google.code.findbugs:jsr305:3.0.2")
"implementation"("com.google.code.gson:gson:${Versions.GSON}")
"implementation"("org.slf4j:slf4j-api:1.7.26")
"implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}")
api(project(":worldedit-libs:core"))
implementation("de.schlichtherle:truezip:6.8.4")
implementation("net.java.truevfs:truevfs-profile-default_2.13:0.12.2")
implementation("org.mozilla:rhino-runtime:1.7.12")
implementation("org.yaml:snakeyaml:1.27")
implementation("com.google.guava:guava:21.0")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.google.code.gson:gson:2.8.6")
implementation("org.slf4j:slf4j-api:1.7.26")
implementation("it.unimi.dsi:fastutil:8.4.4")
val antlrVersion = "4.7.2"
"antlr"("org.antlr:antlr4:$antlrVersion")
"implementation"("org.antlr:antlr4-runtime:$antlrVersion")
antlr("org.antlr:antlr4:4.7.2")
implementation("org.antlr:antlr4-runtime:4.7.2")
"implementation"("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false }
"compileOnly"(project(":worldedit-libs:core:ap"))
"annotationProcessor"(project(":worldedit-libs:core:ap"))
implementation("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false }
compileOnly(project(":worldedit-libs:core:ap"))
annotationProcessor(project(":worldedit-libs:core:ap"))
// ensure this is on the classpath for the AP
"annotationProcessor"("com.google.guava:guava:21.0")
"compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}")
"annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}")
"testImplementation"("ch.qos.logback:logback-core:${Versions.LOGBACK}")
"testImplementation"("ch.qos.logback:logback-classic:${Versions.LOGBACK}")
"compile"("com.github.luben:zstd-jni:1.4.8-1")
"compileOnly"("net.fabiozumbi12:redprotect:1.9.6")
"compile"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
isTransitive = false
}
"compile"("com.plotsquared:PlotSquared-Core:5.13.3") {
isTransitive = false
}
"api"("com.intellectualsites.paster:Paster:1.0.1-SNAPSHOT")
annotationProcessor("com.google.guava:guava:21.0")
compileOnly("com.google.auto.value:auto-value-annotations:1.7")
annotationProcessor("com.google.auto.value:auto-value:1.7")
testImplementation("ch.qos.logback:logback-core:1.2.3")
testImplementation("ch.qos.logback:logback-classic:1.2.3")
implementation("com.github.luben:zstd-jni:1.4.8-1")
compileOnly("net.fabiozumbi12:redprotect:1.9.6")
api("com.github.intellectualsites.plotsquared:PlotSquared-API:4.514") { isTransitive = false }
api("com.plotsquared:PlotSquared-Core:5.13.3") { isTransitive = false }
api("com.intellectualsites.paster:Paster:1.0.1-SNAPSHOT")
}
tasks.named<Test>("test") {
@ -75,8 +72,8 @@ tasks.named<AntlrTask>("generateGrammarSource").configure {
val pkg = "com.sk89q.worldedit.antlr"
outputDirectory = file("build/generated-src/antlr/main/${pkg.replace('.', '/')}")
arguments = listOf(
"-visitor", "-package", pkg,
"-Xexact-output-dir"
"-visitor", "-package", pkg,
"-Xexact-output-dir"
)
}
@ -114,7 +111,7 @@ tasks.named<ShadowJar>("shadowJar") {
}
}
/*
val crowdinApiKey = "crowdin_apikey"
if (project.hasProperty(crowdinApiKey) && !gradle.startParameter.isOffline) {
@ -146,3 +143,5 @@ if (project.hasProperty(crowdinApiKey) && !gradle.startParameter.isOffline) {
dependsOn("crowdinDownload")
}
}
*/

View File

@ -21,5 +21,5 @@ dependencies {
"implementation"(project(":worldedit-core"))
"implementation"(kotlin("stdlib-jdk8"))
"implementation"(kotlin("reflect"))
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
"implementation"("com.google.guava:guava:21.0")
}

View File

@ -10,6 +10,8 @@ import com.google.gson.stream.JsonReader;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.PropertiesConfiguration;
import com.sk89q.worldedit.util.report.Unreported;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
@ -18,14 +20,19 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArraySet;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
@ -48,6 +55,8 @@ import static org.slf4j.LoggerFactory.getLogger;
// TODO FIXME
public class TextureUtil implements TextureHolder {
private static final Logger log = LoggerFactory.getLogger(TextureUtil.class);
private static final int[] FACTORS = new int[766];
static {
@ -344,8 +353,20 @@ public class TextureUtil implements TextureHolder {
public TextureUtil(File folder) throws FileNotFoundException {
this.folder = folder;
if (!folder.exists()) {
throw new FileNotFoundException(
"Please create a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar or mods in it.");
log.info("Downloading asset jar from Mojang, please wait...");
new File(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/" + "/.minecraft/versions/").mkdirs();
try (BufferedInputStream in = new BufferedInputStream(new URL("https://launcher.mojang.com/v1/objects/37fd3c903861eeff3bc24b71eed48f828b5269c8/client.jar").openStream());
FileOutputStream fileOutputStream = new FileOutputStream(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/" + "/.minecraft/versions/1.16.5.jar")) {
byte[] dataBuffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
fileOutputStream.write(dataBuffer, 0, bytesRead);
}
log.info("Asset jar down has been downloaded successfully.");
} catch (IOException e) {
log.error("Could not download version jar. Please do so manually by creating a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar or mods in it.");
log.error("If the file exists, please make sure the server has read access to the directory.");
}
}
}
@ -606,8 +627,18 @@ public class TextureUtil implements TextureHolder {
}
}
if (files.length == 0) {
getLogger(TextureUtil.class).debug(
"Please create a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions/1.15.jar` jar or mods in it. If the file exists, please make sure the server has read access to the directory");
new File(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/" + "/.minecraft/versions/").mkdirs();
try (BufferedInputStream in = new BufferedInputStream(new URL("https://launcher.mojang.com/v1/objects/37fd3c903861eeff3bc24b71eed48f828b5269c8/client.jar").openStream());
FileOutputStream fileOutputStream = new FileOutputStream(Fawe.imp().getDirectory() + "/" + Settings.IMP.PATHS.TEXTURES + "/" + "/.minecraft/versions/1.16.5.jar")) {
byte[] dataBuffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
fileOutputStream.write(dataBuffer, 0, bytesRead);
}
} catch (IOException e) {
log.error("Could not download version jar. Please do so manually by creating a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions` jar or mods in it.");
log.error("If the file exists, please make sure the server has read access to the directory.");
}
} else {
for (File file : files) {
ZipFile zipFile = new ZipFile(file);

View File

@ -125,7 +125,7 @@ public class UtilityCommands {
@Command(
name = "/heightmapinterface",
aliases = { "/hmi", "hmi" },
desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap"
desc = "Generate the heightmap interface: https://github.com/IntellectualSites/HeightMap"
)
@CommandPermissions("fawe.admin")
public void heightmapInterface(Player player, @Arg(name = "min", desc = "int", def = "100") int min, @Arg(name = "max", desc = "int", def = "200") int max) throws IOException {

View File

@ -471,7 +471,7 @@ public final class PlatformCommandManager {
registerSubCommands(
"/anvil",
ImmutableList.of(),
"Manipulate billions of blocks https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API",
"Manipulate billions of blocks",
AnvilCommandsRegistration.builder(),
new AnvilCommands(worldEdit)
);