Compare commits

..
18 Commits
53 changed files with 888 additions and 973 deletions

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
name: Java CI with Gradle
on: [ push, pull_request ]
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1.0.4
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'zulu'
cache: 'gradle'
- name: Build with Gradle
run: ./gradlew clean build
+20 -37
View File
@@ -1,13 +1,11 @@
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,intellij,maven,gradle
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,intellij,maven,gradle
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,intellij+all,gradle,maven
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,intellij+all,gradle,maven
### Intellij ###
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/**
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
@@ -68,6 +66,9 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
@@ -80,35 +81,21 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
.idea/*
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
.idea/sonarlint
### macOS ###
# General
@@ -152,7 +139,6 @@ buildNumber.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
### Maven Patch ###
# Eclipse m2e generated files
# Eclipse Core
.project
@@ -188,6 +174,7 @@ $RECYCLE.BIN/
### Gradle ###
.gradle
build/
build-cache/
# Ignore Gradle GUI config
gradle-app.setting
@@ -204,8 +191,4 @@ gradle-app.setting
### Gradle Patch ###
**/build/
# Eclipse Gradle plugin generated files
# Eclipse Core
# JDT-specific (Eclipse Java Development Tools)
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,intellij,maven,gradle
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,intellij+all,gradle,maven
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
-108
View File
@@ -1,108 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'maven-publish'
id 'java-library'
}
version = "2.7.3"
dependencies {
implementation 'com.github.NLthijs48:InteractiveMessenger:e7749258ca'
implementation 'com.github.NLthijs48:BukkitDo:819d51ec2b'
implementation 'io.papermc:paperlib:1.0.6'
implementation 'io.github.baked-libs:dough-data:1.0.3'
implementation ('com.google.inject:guice:5.0.1') {
exclude group: 'com.google.guava'
}
implementation ('com.google.inject.extensions:guice-assistedinject:5.0.1') {
exclude group: 'com.google.guava'
}
implementation project(':areashop-interface')
implementation project(':areashop-bukkit-1_13')
implementation project(':areashop-nms')
runtimeOnly project(path: ':areashop-nms-1-17', configuration: 'reobf')
runtimeOnly project(path: ':areashop-nms-1-18', configuration: 'reobf')
implementation project(':areashop-worldedit-7')
implementation project(':areashop-worldguard-7')
implementation project(':areashop-fastasyncworldedit')
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly ('com.sk89q.worldedit:worldedit-bukkit:7.2.8') {
exclude group: 'com.google.guava'
}
compileOnly ('com.sk89q.worldguard:worldguard-bukkit:7.0.6') {
exclude group: 'com.google.guava'
}
compileOnly ('com.github.MilkBowl:VaultAPI:1.7')
}
processResources {
from (sourceSets.main.resources) {
filter ReplaceTokens, tokens: [version: project.version]
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
}
}
assemble {
dependsOn(shadowJar)
dependsOn(publishToMavenLocal)
}
jar {
archiveClassifier.set('original')
}
java {
withSourcesJar()
}
shadowJar {
archiveClassifier.set('')
setArchivesBaseName('AreaShop')
String base = "me.wiefferink.areashop.libraries"
relocate('me.wiefferink.interactivemessenger', "${base}.interactivemessenger")
relocate('me.wiefferink.bukkitdo', "${base}.bukkitdo")
relocate('io.papermc.lib', "${base}.paperlib")
relocate('io.github.bakedlibs.dough', "${base}.dough")
relocate("com.google.inject", "${base}.inject")
relocate("org.aopalliance", "${base}.aopalliance")
relocate("javax.inject", "${base}.javax.inject")
include {
include("com.google.inject")
minimize()
}
}
sourcesJar {
classifier('sources')
from sourceSets.main.allSource
}
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop'
+95
View File
@@ -0,0 +1,95 @@
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}
description = "AreaShop"
dependencies {
// Platform
compileOnlyApi(libs.spigot)
compileOnlyApi(libs.worldeditCore) {
exclude("com.google.guava", "guava")
}
compileOnlyApi(libs.worldeditBukkit) {
exclude("com.google.guava", "guava")
}
compileOnlyApi(libs.worldguardCore) {
exclude("com.google.guava", "guava")
}
compileOnlyApi(libs.worldguardBukkit) {
exclude("com.google.guava", "guava")
}
compileOnlyApi("com.github.MilkBowl:VaultAPI:1.7") {
exclude("com.google.guava", "guava")
}
// 3rd party libraries
implementation(libs.findbugs)
implementation("io.papermc:paperlib:1.0.7")
implementation("com.github.NLthijs48:InteractiveMessenger:e7749258ca")
implementation("com.github.NLthijs48:BukkitDo:819d51ec2b")
implementation("io.github.baked-libs:dough-data:1.0.3")
implementation("com.google.inject:guice:5.1.0") {
exclude("com.google.guava", "guava")
}
implementation("com.google.inject.extensions:guice-assistedinject:5.1.0") {
exclude("com.google.guava", "guava")
}
// Project submodules
implementation(projects.areashopInterface)
implementation(projects.areashopBukkit113)
implementation(projects.areashopNms)
// Adapters
runtimeOnly(projects.adapters.plugins.worldedit)
runtimeOnly(projects.adapters.plugins.worldguard)
runtimeOnly(projects.adapters.plugins.fastasyncworldedit)
runtimeOnly(project(":adapters:platform:bukkit-1-17", "reobf"))
runtimeOnly(project(":adapters:platform:bukkit-1-18", "reobf"))
runtimeOnly(project(":adapters:platform:bukkit-1-18-1", "reobf"))
}
repositories {
mavenCentral()
}
tasks {
processResources {
filesMatching("plugin.yml") {
expand("version" to project.version)
}
}
assemble {
dependsOn(shadowJar)
}
jar {
archiveClassifier.set("original")
}
java {
withSourcesJar()
}
val javaComponent = project.components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
shadowJar {
archiveClassifier.set("")
base {
archiveBaseName.set("AreaShop")
}
val base = "me.wiefferink.areashop.libraries"
relocate("me.wiefferink.interactivemessenger", "${base}.interactivemessenger")
relocate("me.wiefferink.bukkitdo", "${base}.bukkitdo")
relocate("io.papermc.lib", "${base}.paperlib")
relocate("io.github.bakedlibs.dough", "${base}.dough")
relocate("com.google.inject", "${base}.inject")
relocate("org.aopalliance", "${base}.aopalliance")
relocate("javax.annotation", "${base}.javax.annotation")
relocate("javax.inject", "${base}.javax.inject")
}
}
@@ -91,7 +91,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
public static final String defaultFile = "default.yml";
public static final String configFile = "config.yml";
public static final String configFileHidden = "hiddenConfig.yml";
public static final String signLogFile = "sign-errors.yml";
public static final String signLogFile = "sign-errors.log";
public static final String versionFile = "versions";
// Euro tag for in the config
@@ -175,163 +175,82 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
String[] split = rawServerVersion.split("\\.");
String serverVersion = split[3];
try {
Class<?> nmsImpl = Class.forName("me.wiefferink.areashop.nms." + serverVersion + ".NMSImpl");
Class<?> nmsImpl = Class.forName("me.wiefferink.areashop.adapters.platform." + serverVersion + ".NMSImpl");
this.nms = nmsImpl.asSubclass(NMS.class).getConstructor().newInstance();
} catch (ReflectiveOperationException ex) {
ex.printStackTrace();
getLogger().severe("Failed to initialize NMS implementation!");
getServer().getPluginManager().disablePlugin(this);
error("Failed to initialize NMS implementation!");
shutdownOnError();
return;
}
// Find WorldEdit integration version to load
String weHandlerVersion = null;
String rawWeVersion = null;
String weBeta = null;
Plugin plugin = getServer().getPluginManager().getPlugin("WorldEdit");
boolean fawe = false;
if(!(plugin instanceof WorldEditPlugin) || !plugin.isEnabled()) {
error("WorldEdit plugin is not present or has not loaded correctly");
error = true;
} else {
worldEdit = (WorldEditPlugin)plugin;
rawWeVersion = worldEdit.getDescription().getVersion();
// Find beta version
Pattern pattern = Pattern.compile("beta-?\\d+");
Matcher matcher = pattern.matcher(rawWeVersion);
if (matcher.find()) {
weBeta = matcher.group();
}
// Get correct WorldEditInterface (handles things that changed version to version)
if(worldEdit.getDescription().getVersion().startsWith("7.")) {
weHandlerVersion = "WorldEditHandler7";
} else {
// Check if FastAsyncWorldEdit is installed
try {
Class.forName("com.fastasyncworldedit.core.FaweAPI" );
} catch (ClassNotFoundException ignore) {
throw new IllegalStateException("Unknown WE Version: " + worldEdit.getDescription().getVersion());
}
weHandlerVersion = "FastAsyncWorldEditHandler";
fawe = true;
}
}
// Find WorldGuard integration version to load
String wgVersion = null;
String rawWgVersion = null;
int major = 0;
int minor = 0;
int fixes = 0;
Integer build = null;
plugin = getServer().getPluginManager().getPlugin("WorldGuard");
if(!(plugin instanceof WorldGuardPlugin) || !plugin.isEnabled()) {
error("WorldGuard plugin is not present or has not loaded correctly");
error = true;
} else {
worldGuard = (WorldGuardPlugin)plugin;
// Get correct WorldGuardInterface (handles things that changed version to version)
try {
rawWgVersion = worldGuard.getDescription().getVersion();
if(rawWgVersion.contains("-SNAPSHOT;")) {
String buildNumber = rawWgVersion.substring(rawWgVersion.indexOf("-SNAPSHOT;") + 10);
if(buildNumber.contains("-")) {
buildNumber = buildNumber.substring(0, buildNumber.indexOf('-'));
if (Utils.isNumeric(buildNumber)) {
build = Integer.parseInt(buildNumber);
} else {
warn("Could not correctly parse the build of WorldGuard, raw version: " + rawWgVersion + ", buildNumber: " + buildNumber);
}
}
}
// Clear stuff from the version string that is not a number
String[] versionParts = rawWgVersion.split("\\.");
for(int i = 0; i < versionParts.length; i++) {
Pattern pattern = Pattern.compile("^\\d+");
Matcher matcher = pattern.matcher(versionParts[i]);
if(matcher.find()) {
versionParts[i] = matcher.group();
}
}
// Find major, minor and fix numbers
try {
if(versionParts.length > 0) {
major = Integer.parseInt(versionParts[0]);
}
if(versionParts.length > 1) {
minor = Integer.parseInt(versionParts[1]);
}
if(versionParts.length > 2) {
fixes = Integer.parseInt(versionParts[2]);
}
} catch(NumberFormatException e) {
warn("Something went wrong while parsing WorldGuard version number: " + rawWgVersion);
}
// Determine correct implementation to use
if(rawWgVersion.startsWith("7.")) {
wgVersion = "7";
}
} catch(Exception e) { // If version detection fails, at least try to load the latest version
warn("Parsing the WorldGuard version failed, assuming version 7:", rawWgVersion);
wgVersion = "7";
}
wgVersion = "WorldGuardHandler" + wgVersion;
}
DependencyModule dependencyModule = new DependencyModule(worldEdit, worldGuard, getEconomy(), getPermissionProvider());
// Load WorldEdit
try {
Class<?> clazz = Class.forName("me.wiefferink.areashop.handlers." + weHandlerVersion);
// Check if we have a NMSHandler class at that location.
if(WorldEditInterface.class.isAssignableFrom(clazz)) { // Make sure it actually implements WorldEditInterface
worldEditInterface = (WorldEditInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this); // Set our handler
}
} catch(Exception e) {
error("Could not load the handler for WorldEdit (tried to load " + weHandlerVersion + "), report this problem to the author: " + ExceptionUtils.getStackTrace(e));
error = true;
weHandlerVersion = null;
}
// Load WorldGuard
try {
Class<?> clazz = Class.forName("me.wiefferink.areashop.handlers." + wgVersion);
// Check if we have a NMSHandler class at that location.
if(WorldGuardInterface.class.isAssignableFrom(clazz)) { // Make sure it actually implements WorldGuardInterface
worldGuardInterface = (WorldGuardInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this); // Set our handler
}
} catch(Exception e) {
error("Could not load the handler for WorldGuard (tried to load " + wgVersion + "), report this problem to the author:" + ExceptionUtils.getStackTrace(e));
error = true;
wgVersion = null;
}
// Load Bukkit implementation
String bukkitHandler;
try {
Class.forName("org.bukkit.block.data.type.WallSign");
bukkitHandler = "1_13";
} catch (ClassNotFoundException e) {
bukkitHandler = "1_12";
}
try {
Class<?> clazz = Class.forName("me.wiefferink.areashop.handlers.BukkitHandler" + bukkitHandler);
bukkitInterface = (BukkitInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this);
} catch (Exception e) {
error("Could not load the Bukkit handler (used for sign updates), tried to load:", bukkitHandler + ", report this problem to the author:", ExceptionUtils.getStackTrace(e));
error = true;
bukkitHandler = null;
}
// Check if Vault is present
if(getServer().getPluginManager().getPlugin("Vault") == null) {
error("Vault plugin is not present or has not loaded correctly");
error = true;
shutdownOnError();
return;
}
// Find WorldEdit integration version to load
String weHandlerVersion;
Plugin plugin = getServer().getPluginManager().getPlugin("WorldEdit");
if(!(plugin instanceof WorldEditPlugin) || !plugin.isEnabled()) {
error("WorldEdit plugin is not present or has not loaded correctly");
return;
} else {
this.worldEdit = (WorldEditPlugin) plugin;
Plugin fawePlugin = getServer().getPluginManager().getPlugin("FastAsyncWorldEdit");
if (fawePlugin != null && fawePlugin.isEnabled()) {
weHandlerVersion = "FastAsyncWorldEditHandler";
info("Detected FastAsyncWorldEdit, using the fawe handler");
} else {
weHandlerVersion = "WorldEditHandler";
}
}
plugin = getServer().getPluginManager().getPlugin("WorldGuard");
if(!(plugin instanceof WorldGuardPlugin) || !plugin.isEnabled()) {
error("WorldGuard plugin is not present or has not loaded correctly");
shutdownOnError();
return;
} else {
this.worldGuard = (WorldGuardPlugin) plugin;
}
DependencyModule dependencyModule = new DependencyModule(this.worldEdit, this.worldGuard, getEconomy(), getPermissionProvider());
// Load WorldEdit
try {
Class<?> clazz = Class.forName("me.wiefferink.areashop.adapters.plugins." + weHandlerVersion);
if(WorldEditInterface.class.isAssignableFrom(clazz)) { // Make sure it actually implements WorldEditInterface
worldEditInterface = (WorldEditInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this); // Set our handler
}
} catch(Exception e) {
error("Could not load the handler for WorldEdit (tried to load " + weHandlerVersion + "), report this problem to the author: " + ExceptionUtils.getStackTrace(e));
shutdownOnError();
return;
}
// Load WorldGuard
try {
Class<?> clazz = Class.forName("me.wiefferink.areashop.adapters.plugins.WorldGuardHandler");
// Check if we have a NMSHandler class at that location.
if(WorldGuardInterface.class.isAssignableFrom(clazz)) { // Make sure it actually implements WorldGuardInterface
worldGuardInterface = (WorldGuardInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this); // Set our handler
}
} catch(Exception e) {
error("Could not load the handler for WorldGuard, report this problem to the author:" + ExceptionUtils.getStackTrace(e));
shutdownOnError();
return;
}
try {
Class<?> clazz = Class.forName("me.wiefferink.areashop.handlers.BukkitHandler1_13");
bukkitInterface = (BukkitInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this);
} catch (Exception e) {
error("Could not load the Bukkit handler (used for sign updates), report this problem to the author:", ExceptionUtils.getStackTrace(e));
shutdownOnError();
return;
}
AreaShopModule asModule = new AreaShopModule(this, messageBridge, nms, bukkitInterface, worldEditInterface, worldGuardInterface, signErrorLogger, dependencyModule);
@@ -343,23 +262,8 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
boolean loadFilesResult = fileManager.loadFiles(false);
error = error || !loadFilesResult;
// Print loaded version of WG and WE in debug
if(wgVersion != null) {
AreaShop.debug("Loaded ", wgVersion, "(raw version:" + rawWgVersion + ", major:" + major + ", minor:" + minor + ", fixes:" + fixes + ", build:" + build + ", fawe:" + fawe + ")");
}
if(weHandlerVersion != null) {
AreaShop.debug("Loaded ", weHandlerVersion, "(raw version:" + rawWeVersion + ", beta:" + weBeta + ")");
}
if(bukkitHandler != null) {
AreaShop.debug("Loaded BukkitHandler", bukkitHandler);
}
setupLanguageManager();
if(error) {
error("The plugin has not started, fix the errors listed above");
return;
}
featureManager = injector.getInstance(FeatureManager.class);
featureManager.initializeFeatures(injector);
managers.add(featureManager);
@@ -386,7 +290,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
if(getConfig().getBoolean("checkForUpdates")) {
githubUpdateCheck = new GithubUpdateCheck(
this,
"NLThijs48",
"md5sha256",
"AreaShop"
).withVersionComparator((latestVersion, currentVersion) ->
!cleanVersion(latestVersion).equals(cleanVersion(currentVersion))
@@ -414,6 +318,11 @@ public final class AreaShop extends JavaPlugin implements AreaShopApi {
}
}
private void shutdownOnError() {
error("The plugin has not started, fix the errors listed above");
getServer().getPluginManager().disablePlugin(this);
}
/**
* Cleanup a version number.
* @param version Version to clean
@@ -45,6 +45,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
public abstract class GeneralRegion implements GeneralRegionInterface, Comparable<GeneralRegion>, ReplacementProvider {
@@ -809,6 +810,40 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
return true;
}
/**
* Save all blocks in a region for restoring later.
* @param fileName The name of the file to save to (extension and folder will be added)
* @return true if the region has been saved properly, otherwise false
*/
public CompletableFuture<Boolean> saveRegionBlocksAsync(String fileName) {
if (!worldEditInterface.supportsAsyncOperations()) {
return CompletableFuture.completedFuture(saveRegionBlocks(fileName));
}
// Check if the region is correct
ProtectedRegion region = getRegion();
if(region == null) {
AreaShop.debug("Region '" + getName() + "' does not exist in WorldGuard, save failed");
return CompletableFuture.completedFuture(false);
}
// The path to save the schematic
File saveFile = new File(plugin.getFileManager().getSchematicFolder() + File.separator + fileName);
// Create parent directories
File parent = saveFile.getParentFile();
if(parent != null && !parent.exists()) {
if(!parent.mkdirs()) {
AreaShop.warn("Did not save region " + getName() + ", schematic directory could not be created: " + saveFile.getAbsolutePath());
return CompletableFuture.completedFuture(false);
}
}
return worldEditInterface.saveRegionBlocksAsync(saveFile, this)
.thenApply(result -> {
if(result) {
AreaShop.debug("Saved schematic async for region " + getName());
}
return result;
});
}
/**
* Restore all blocks in a region for restoring later.
* @param fileName The name of the file to save to (extension and folder will be added)
@@ -831,6 +866,35 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
return result;
}
/**
* Restore all blocks in a region for restoring later.
* @param fileName The name of the file to save to (extension and folder will be added)
* @return true if the region has been restored properly, otherwise false
*/
public CompletableFuture<Boolean> restoreRegionBlocksAsync(String fileName) {
if (!worldEditInterface.supportsAsyncOperations()) {
return CompletableFuture.completedFuture(restoreRegionBlocks(fileName));
}
if(getRegion() == null) {
AreaShop.debug("Region '" + getName() + "' does not exist in WorldGuard, restore failed");
return CompletableFuture.completedFuture(false);
}
// The path to save the schematic
File restoreFile = new File(plugin.getFileManager().getSchematicFolder() + File.separator + fileName);
return worldEditInterface.restoreRegionBlocksAsync(restoreFile, this)
.thenApply(result -> {
if(result) {
AreaShop.debug("Restored schematic async for region " + getName());
// Sync back to main
Do.syncLater(10, getSignsFeature().signManager()::update);
}
return result;
}
);
}
/**
* Reset all flags of the region.
*/
@@ -1452,14 +1516,23 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
String save = profileSection.getString(type.getValue() + ".save");
String restore = profileSection.getString(type.getValue() + ".restore");
// Save the region if needed
boolean async = worldEditInterface.supportsAsyncOperations();
if(save != null && !save.isEmpty()) {
save = Message.fromString(save).replacements(this).getSingle();
saveRegionBlocks(save);
if (async) {
saveRegionBlocksAsync(save);
} else {
saveRegionBlocks(save);
}
}
// Restore the region if needed
if(restore != null && !restore.isEmpty()) {
restore = Message.fromString(restore).replacements(this).getSingle();
restoreRegionBlocks(restore);
if (async) {
restoreRegionBlocksAsync(restore);
} else {
restoreRegionBlocks(restore);
}
}
}
+2
View File
@@ -121,6 +121,8 @@ debug: false
version: ${project.version}
# Maximum number of blocks to save to or restore from a .schemetic file.
maximumBlocks: 1000000
# Maximum number of entities to save to or restore from a .schematic file (FAWE only)
maximumEntities: 1000
# Maximum number of locations the teleport function should check to find a safe spot.
maximumTries: 50000
+3 -3
View File
@@ -1,11 +1,11 @@
name: AreaShop
main: me.wiefferink.areashop.AreaShop
version: "@version@"
version: "${version}"
description: "Selling and renting WorldGuard regions to your players, highly configurable."
depend: [Vault, WorldGuard, WorldEdit]
softdepend: [Multiverse-Core, FastAsyncWorldEdit]
author: NLThijs48
website: https://github.com/NLthijs48/AreaShop
website: https://github.com/md5sha256/AreaShop
commands:
AreaShop:
description: 'For all commands use /as help.'
@@ -13,7 +13,7 @@ commands:
aliases: [as]
awareness:
- !@UTF8
api-version: 1.13
api-version: 1.17
permissions:
areashop.*:
description: Give access to all commands of AreaShop
@@ -0,0 +1,22 @@
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
paperDevBundle("1.17.1-R0.1-SNAPSHOT")
compileOnly(projects.areashopInterface)
compileOnly(projects.areashopNms)
}
description = "AreaShop NMS Helper 1-17"
tasks {
assemble {
dependsOn("reobfJar")
}
named("reobfJar", io.papermc.paperweight.tasks.RemapJar::class) {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
}
@@ -1,4 +1,4 @@
package me.wiefferink.areashop.nms.v1_17_R1;
package me.wiefferink.areashop.adapters.platform.v1_17_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import net.minecraft.core.BlockPos;
@@ -1,4 +1,4 @@
package me.wiefferink.areashop.nms.v1_17_R1;
package me.wiefferink.areashop.adapters.platform.v1_17_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import me.wiefferink.areashop.nms.NMS;
@@ -0,0 +1,21 @@
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
paperDevBundle("1.18.1-R0.1-SNAPSHOT")
compileOnly(projects.areashopInterface)
compileOnly(projects.areashopNms)
}
description = "AreaShop NMS Helper 1-18"
tasks {
assemble {
dependsOn("reobfJar")
}
named("reobfJar", io.papermc.paperweight.tasks.RemapJar::class) {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
}
@@ -1,4 +1,4 @@
package me.wiefferink.areashop.nms.v1_18_R1;
package me.wiefferink.areashop.adapters.platform.v1_18_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import net.minecraft.core.BlockPos;
@@ -1,4 +1,4 @@
package me.wiefferink.areashop.nms.v1_18_R1;
package me.wiefferink.areashop.adapters.platform.v1_18_R1;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import me.wiefferink.areashop.nms.NMS;
@@ -0,0 +1,21 @@
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
paperDevBundle("1.18.2-R0.1-SNAPSHOT")
compileOnly(projects.areashopInterface)
compileOnly(projects.areashopNms)
}
description = "AreaShop NMS Helper 1-18"
tasks {
assemble {
dependsOn("reobfJar")
}
named("reobfJar", io.papermc.paperweight.tasks.RemapJar::class) {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
}
@@ -0,0 +1,46 @@
package me.wiefferink.areashop.adapters.platform.v1_18_R2;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.BlockState;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_18_R2.block.CraftBlockState;
import org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData;
import java.util.Objects;
public class BlockBehaviourImpl implements BlockBehaviourHelper {
@Override
public boolean canPlace(Location location, BlockData blockData) {
Objects.requireNonNull(location.getWorld(), "Null World!");
final BlockPos blockPosition = new BlockPos(location.getX(), location.getY(), location.getZ());
final CraftWorld craftWorld = (CraftWorld) location.getWorld();
final ServerLevel world = craftWorld.getHandle();
final CraftBlockData craftBlockData = (CraftBlockData) blockData;
final BlockState ibd = craftBlockData.getState();
return ibd.canSurvive(world, blockPosition);
}
@Override
public boolean isBlockValid(Block block) {
final CraftBlock craftBlock = (CraftBlock) block;
final CraftWorld craftWorld = (CraftWorld) craftBlock.getWorld();
final ServerLevel world = craftWorld.getHandle();
final BlockState ibd = craftBlock.getNMS();
return ibd.canSurvive(world, craftBlock.getPosition());
}
@Override
public boolean isBlockStateValid(org.bukkit.block.BlockState blockState) {
final CraftBlockState craftBlockState = (CraftBlockState) blockState;
final BlockState ibd = craftBlockState.getHandle();
return ibd.canSurvive(craftBlockState.getBlock().getCraftWorld().getHandle(), craftBlockState.getPosition());
}
}
@@ -0,0 +1,15 @@
package me.wiefferink.areashop.adapters.platform.v1_18_R2;
import me.wiefferink.areashop.nms.BlockBehaviourHelper;
import me.wiefferink.areashop.nms.NMS;
public class NMSImpl implements NMS {
private final BlockBehaviourImpl blockBehaviourHelper = new BlockBehaviourImpl();
@Override
public BlockBehaviourHelper blockBehaviourHelper() {
return this.blockBehaviourHelper;
}
}
@@ -0,0 +1,9 @@
dependencies {
compileOnly(libs.spigot)
compileOnly(projects.areashopInterface)
compileOnly(libs.fastasyncworldeditCore)
compileOnly(libs.fastasyncworldeditBukkit)
compileOnly(libs.worldguardCore)
}
description = "AreaShop FastAsyncWorldEdit"
@@ -1,20 +1,23 @@
package me.wiefferink.areashop.handlers;
package me.wiefferink.areashop.adapters.plugins;
import com.fastasyncworldedit.core.FaweAPI;
import com.fastasyncworldedit.core.extent.clipboard.MemoryOptimizedClipboard;
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader;
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
import com.fastasyncworldedit.core.internal.exception.FaweException;
import com.fastasyncworldedit.core.limit.FaweLimit;
import com.google.common.annotations.Beta;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.*;
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Mask2D;
@@ -32,19 +35,16 @@ import me.wiefferink.areashop.interfaces.AreaShopInterface;
import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import net.kyori.adventure.nbt.TagStringIO;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.entity.Player;
import org.bukkit.util.BoundingBox;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.zip.GZIPInputStream;
// Future: this class could use the schematic save/paste api of FAWE: https://github.com/boy0001/FastAsyncWorldedit/wiki/Pasting-a-schematic
// This would not allow for shaping the schematic to a polygon region though
@@ -59,7 +59,8 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
private final BoundingBox boundingBox;
public RegionBoundMask(final ProtectedRegion region) {
final BlockVector3 min = region.getMinimumPoint(), max = region.getMaximumPoint();
final BlockVector3 min = region.getMinimumPoint();
final BlockVector3 max = region.getMaximumPoint();
this.boundingBox = new BoundingBox(min.getX(), min.getY(), min.getZ(), max.getX(), max.getY(), max.getZ());
}
@@ -83,16 +84,19 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
}
}
@Override
public boolean supportsAsyncOperations() {
return true;
}
@Beta
public CompletableFuture<Boolean> restoreRegionBlocksAsync(File rawFile, GeneralRegionInterface regionInterface) {
File file = null;
ClipboardFormat format = null;
for (ClipboardFormat formatOption : BuiltInClipboardFormat.values()) {
if (new File(rawFile.getAbsolutePath() + "." + formatOption.getPrimaryFileExtension())
.exists()) {
file = new File(
rawFile.getAbsolutePath() + "." + formatOption.getPrimaryFileExtension());
format = formatOption;
break;
}
}
@@ -101,6 +105,11 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
+ ", schematic file does not exist: " + rawFile.getAbsolutePath());
return CompletableFuture.completedFuture(false);
}
ClipboardFormat format = ClipboardFormats.findByFile(file);
if (format == null) {
pluginInterface.debugI("Did not restore region " + regionInterface.getName() + ", could not find a valid clipboard format");
return CompletableFuture.completedFuture(false);
}
pluginInterface.debugI("Trying to restore region", regionInterface.getName(), " from file",
file.getAbsolutePath(), "with format", format.getName());
@@ -114,36 +123,37 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
+ regionInterface.getWorldName());
return CompletableFuture.completedFuture(false);
}
final CompletableFuture<Boolean> completableFuture = new CompletableFuture<>();
final FaweLimit limit = new FaweLimit();
final FaweLimit limit = FaweLimit.MAX.copy();
limit.MAX_CHANGES = pluginInterface.getConfig().getInt("maximumBlocks");
EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder()
limit.MAX_ENTITIES = pluginInterface.getConfig().getInt("maximumEntities", (int) (limit.MAX_CHANGES / 1000));
EditSession editSession = pluginInterface.getWorldEdit().getWorldEdit()
.newEditSessionBuilder()
.world(world)
.limit(limit)
.relightMode(RelightMode.OPTIMAL)
.build();
editSession.setReorderMode(EditSession.ReorderMode.MULTI_STAGE);
ProtectedRegion region = regionInterface.getRegion();
final RegionType regionType = region.getType();
// Get the origin and size of the region
final BlockVector3 origin = BlockVector3
.at(region.getMinimumPoint().getBlockX(), region.getMinimumPoint().getBlockY(),
BlockVector3 origin = BlockVector3
.at(region.getMinimumPoint().getBlockX(),
region.getMinimumPoint().getBlockY(),
region.getMinimumPoint().getBlockZ());
final RegionBoundMask mask = new RegionBoundMask(region);
final File finalFile = file;
final String regionName = regionInterface.getName();
final double regionWidth = regionInterface.getWidth(), regionHeight = regionInterface.getHeight(), regionDepth = regionInterface.getDepth();
final LocalSession session =
new LocalSession(pluginInterface.getWorldEdit().getLocalConfiguration());
final CompletableFuture<Boolean> completableFuture = new CompletableFuture<>();
final RegionType regionType = region.getType();
final Mask mask = new RegionBoundMask(region);
FaweAPI.getTaskManager().async(() -> {
boolean result = true;
// Read the schematic and paste it into the world
try (Closer closer = Closer.create()) {
FileInputStream fis = closer.register(new FileInputStream(finalFile));
BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
NBTInputStream nbtStream = new NBTInputStream(new GZIPInputStream(bis));
ClipboardReader reader = new FastSchematicReader(nbtStream);
final FileInputStream fis = closer.register(new FileInputStream(finalFile));
final ClipboardReader reader = format.getReader(fis);
final Clipboard clipboard = reader.read();
Clipboard clipboard = reader.read();
if (clipboard.getDimensions().getY() != regionHeight
|| clipboard.getDimensions().getX() != regionWidth
|| clipboard.getDimensions().getZ() != regionDepth) {
@@ -179,35 +189,29 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
"exceeded the block limit while restoring schematic of " + regionInterface.getName()
+ ", limit in exception: " + e.getBlockLimit() + ", limit passed by AreaShop: "
+ pluginInterface.getConfig().getInt("maximumBlocks"));
CompletableFuture.completedFuture(false);
result = false;
} catch (IOException e) {
pluginInterface.getLogger().warning(
"An error occured while restoring schematic of " + regionInterface.getName()
"An error occurred while restoring schematic of " + regionInterface.getName()
+ ", enable debug to see the complete stacktrace");
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
CompletableFuture.completedFuture(false);
result = false;
} catch (Exception e) {
pluginInterface.getLogger()
.warning("crashed during restore of " + regionInterface.getName());
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
CompletableFuture.completedFuture(false);
result = false;
}
editSession.flushQueue();
CompletableFuture.completedFuture(true);
completableFuture.complete(result);
});
return completableFuture;
}
@Override
public boolean restoreRegionBlocks(File rawFile, GeneralRegionInterface regionInterface) {
return restoreRegionBlocksAsync(rawFile, regionInterface).join();
}
@Beta
public CompletableFuture<Boolean> saveRegionBlocksAsync(File file, GeneralRegionInterface regionInterface) {
// TODO implement using the FastAsyncWorldEdit api to save async
ClipboardFormat format = BuiltInClipboardFormat.MINECRAFT_STRUCTURE;
ClipboardFormat format = BuiltInClipboardFormat.FAST;
// TODO allow selecting FAWE format in the config? (when enabled you cannot go back to vanilla WorldEdit easily)
file = new File(file.getAbsolutePath() + "." + format.getPrimaryFileExtension());
@@ -225,7 +229,7 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
}
final FaweLimit limit = new FaweLimit();
limit.MAX_CHANGES = pluginInterface.getConfig().getInt("maximumBlocks");
EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder()
EditSession editSession = pluginInterface.getWorldEdit().getWorldEdit().newEditSessionBuilder()
.world(world)
.relightMode(RelightMode.OPTIMAL)
.limit(limit)
@@ -254,6 +258,7 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
+ ", limit in exception: " + e.getBlockLimit() + ", limit passed by AreaShop: "
+ pluginInterface.getConfig().getInt("maximumBlocks"));
completableFuture.complete(false);
return;
}
try (Closer closer = Closer.create()) {
@@ -263,7 +268,7 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
writer.write(clipboard);
} catch (IOException e) {
pluginInterface.getLogger().warning(
"An error occured while saving schematic of " + regionName
"An error occurred while saving schematic of " + regionName
+ ", enable debug to see the complete stacktrace");
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
completableFuture.complete(false);
@@ -272,15 +277,194 @@ public class FastAsyncWorldEditHandler extends WorldEditInterface {
.warning("Crashed during save of " + regionName);
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
completableFuture.complete(false);
return;
}
completableFuture.complete(true);
});
return completableFuture;
}
@Override
public boolean restoreRegionBlocks(File rawFile, GeneralRegionInterface regionInterface) {
// TODO implement using the FastAsyncWorldEdit api to paste async
File file = null;
for (ClipboardFormat formatOption : BuiltInClipboardFormat.values()) {
if (new File(rawFile.getAbsolutePath() + "." + formatOption.getPrimaryFileExtension())
.exists()) {
file = new File(
rawFile.getAbsolutePath() + "." + formatOption.getPrimaryFileExtension());
break;
}
}
if (file == null) {
pluginInterface.getLogger().info("Did not restore region " + regionInterface.getName()
+ ", schematic file does not exist: " + rawFile.getAbsolutePath());
return false;
}
ClipboardFormat format = ClipboardFormats.findByFile(file);
if (format == null) {
pluginInterface.debugI("Did not restore region " + regionInterface.getName() + ", could not find a valid clipboard format");
return false;
}
pluginInterface.debugI("Trying to restore region", regionInterface.getName(), " from file",
file.getAbsolutePath(), "with format", format.getName());
com.sk89q.worldedit.world.World world = null;
if (regionInterface.getName() != null) {
world = BukkitAdapter.adapt(regionInterface.getWorld());
}
if (world == null) {
pluginInterface.getLogger().info(
"Did not restore region " + regionInterface.getName() + ", world not found: "
+ regionInterface.getWorldName());
return false;
}
final FaweLimit limit = FaweLimit.MAX.copy();
limit.MAX_CHANGES = pluginInterface.getConfig().getInt("maximumBlocks");
limit.MAX_ENTITIES = pluginInterface.getConfig().getInt("maximumEntities", (int) (limit.MAX_CHANGES / 1000));
EditSession editSession = pluginInterface.getWorldEdit().getWorldEdit()
.newEditSessionBuilder()
.world(world)
.limit(limit)
.build();
editSession.setReorderMode(EditSession.ReorderMode.MULTI_STAGE);
ProtectedRegion region = regionInterface.getRegion();
// Get the origin and size of the region
BlockVector3 origin = BlockVector3
.at(region.getMinimumPoint().getBlockX(), region.getMinimumPoint().getBlockY(),
region.getMinimumPoint().getBlockZ());
// Read the schematic and paste it into the world
try(Closer closer = Closer.create()) {
final FileInputStream fis = closer.register(new FileInputStream(file));
final ClipboardReader reader = format.getReader(fis);
final Clipboard clipboard = reader.read();
if (clipboard.getDimensions().getY() != regionInterface.getHeight()
|| clipboard.getDimensions().getX() != regionInterface.getWidth()
|| clipboard.getDimensions().getZ() != regionInterface.getDepth()) {
pluginInterface.getLogger().warning(
"Size of the region " + regionInterface.getName()
+ " is not the same as the schematic to restore!");
pluginInterface.debugI(
"schematic|region, x:" + clipboard.getDimensions().getX() + "|"
+ regionInterface.getWidth() + ", y:" + clipboard.getDimensions().getY()
+ "|" + regionInterface.getHeight() + ", z:" + clipboard.getDimensions()
.getZ() + "|" + regionInterface.getDepth());
}
clipboard.setOrigin(clipboard.getMinimumPoint());
ClipboardHolder clipboardHolder = new ClipboardHolder(clipboard);
LocalSession session =
new LocalSession(pluginInterface.getWorldEdit().getLocalConfiguration());
session.setBlockChangeLimit(pluginInterface.getConfig().getInt("maximumBlocks"));
session.setClipboard(clipboardHolder);
// Build operation
BlockTransformExtent extent = new BlockTransformExtent(clipboard);
ForwardExtentCopy copy =
new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(),
editSession, origin);
copy.setTransform(clipboardHolder.getTransform());
// Mask to region (for polygon and other weird shaped regions)
// TODO make this more efficient (especially for polygon regions)
if (region.getType() != RegionType.CUBOID) {
copy.setSourceMask(new RegionBoundMask(region));
}
Operations.completeLegacy(copy);
} catch (MaxChangedBlocksException e) {
pluginInterface.getLogger().warning(
"exceeded the block limit while restoring schematic of " + regionInterface.getName()
+ ", limit in exception: " + e.getBlockLimit() + ", limit passed by AreaShop: "
+ pluginInterface.getConfig().getInt("maximumBlocks"));
return false;
} catch (FaweException ex) {
pluginInterface.getLogger().warning(
"exceeded the block entity limit while restoring schematic of " + regionInterface.getName()
+ ", limit passed by AreaShop: "
+ pluginInterface.getConfig().getInt("maximumEntities"));
return false;
}
catch (IOException e) {
pluginInterface.getLogger().warning(
"An error occurred while restoring schematic of " + regionInterface.getName()
+ ", enable debug to see the complete stacktrace");
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
return false;
} catch (Exception e) {
pluginInterface.getLogger()
.warning("crashed during restore of " + regionInterface.getName());
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
return false;
}
editSession.flushQueue();
return true;
}
@Override
public boolean saveRegionBlocks(File file, GeneralRegionInterface regionInterface) {
return saveRegionBlocksAsync(file, regionInterface).join();
// TODO implement using the FastAsyncWorldEdit api to save async
ClipboardFormat format = BuiltInClipboardFormat.FAST;
// TODO allow selecting FAWE format in the config? (when enabled you cannot go back to vanilla WorldEdit easily)
file = new File(file.getAbsolutePath() + "." + format.getPrimaryFileExtension());
pluginInterface.debugI("Trying to save region", regionInterface.getName(), " to file",
file.getAbsolutePath(), "with format", format.getName());
com.sk89q.worldedit.world.World world = null;
if (regionInterface.getWorld() != null) {
world = BukkitAdapter.adapt(regionInterface.getWorld());
}
if (world == null) {
pluginInterface.getLogger().warning(
"Did not save region " + regionInterface.getName() + ", world not found: "
+ regionInterface.getWorldName());
return false;
}
EditSession editSession =
pluginInterface.getWorldEdit().getWorldEdit()
.newEditSessionBuilder()
.world(world)
.maxBlocks(pluginInterface.getConfig().getInt("maximumBlocks"))
.build();
// Create a clipboard
CuboidRegion selection =
new CuboidRegion(world, regionInterface.getRegion().getMinimumPoint(),
regionInterface.getRegion().getMaximumPoint());
BlockArrayClipboard clipboard = new BlockArrayClipboard(selection);
clipboard.setOrigin(regionInterface.getRegion().getMinimumPoint());
ForwardExtentCopy copy = new ForwardExtentCopy(editSession,
new CuboidRegion(world, regionInterface.getRegion().getMinimumPoint(),
regionInterface.getRegion().getMaximumPoint()), clipboard,
regionInterface.getRegion().getMinimumPoint());
try {
Operations.completeLegacy(copy);
} catch (MaxChangedBlocksException e) {
pluginInterface.getLogger().warning(
"Exceeded the block limit while saving schematic of " + regionInterface.getName()
+ ", limit in exception: " + e.getBlockLimit() + ", limit passed by AreaShop: "
+ pluginInterface.getConfig().getInt("maximumBlocks"));
return false;
}
try (Closer closer = Closer.create()) {
FileOutputStream fos = closer.register(new FileOutputStream(file));
BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
ClipboardWriter writer = closer.register(format.getWriter(bos));
writer.write(clipboard);
} catch (IOException e) {
pluginInterface.getLogger().warning(
"An error occurred while saving schematic of " + regionInterface.getName()
+ ", enable debug to see the complete stacktrace");
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
return false;
} catch (Exception e) {
pluginInterface.getLogger()
.warning("Crashed during save of " + regionInterface.getName());
pluginInterface.debugI(ExceptionUtils.getStackTrace(e));
return false;
}
return true;
}
@Override
@@ -0,0 +1,9 @@
dependencies {
compileOnly(libs.spigot)
compileOnly(projects.areashopInterface)
compileOnly(libs.worldeditCore)
compileOnly(libs.worldeditBukkit)
compileOnly(libs.worldguardCore)
}
description = "AreaShop WorldEdit 7"
@@ -1,4 +1,4 @@
package me.wiefferink.areashop.handlers;
package me.wiefferink.areashop.adapters.plugins;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
@@ -37,9 +37,9 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class WorldEditHandler7 extends WorldEditInterface {
public class WorldEditHandler extends WorldEditInterface {
public WorldEditHandler7(AreaShopInterface pluginInterface) {
public WorldEditHandler(AreaShopInterface pluginInterface) {
super(pluginInterface);
}
@@ -0,0 +1,9 @@
dependencies {
compileOnly(libs.spigot)
compileOnly(projects.areashopInterface)
compileOnly(libs.worldeditCore)
compileOnly(libs.worldeditBukkit)
compileOnly(libs.worldguardCore)
}
description = "AreaShop WorldGuard 7"
@@ -1,4 +1,4 @@
package me.wiefferink.areashop.handlers;
package me.wiefferink.areashop.adapters.plugins;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector2;
@@ -27,9 +27,9 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
public class WorldGuardHandler7 extends WorldGuardInterface {
public class WorldGuardHandler extends WorldGuardInterface {
public WorldGuardHandler7(AreaShopInterface pluginInterface) {
public WorldGuardHandler(AreaShopInterface pluginInterface) {
super(pluginInterface);
}
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
-31
View File
@@ -1,31 +0,0 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly project(':areashop-interface')
}
description = 'AreaShop Bukkit 1.13 and higher'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
+6
View File
@@ -0,0 +1,6 @@
dependencies {
compileOnly(libs.spigot)
compileOnly(projects.areashopInterface)
}
description = "AreaShop Bukkit 1.13 and higher"
@@ -9,6 +9,11 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Sign;
import org.bukkit.block.data.type.WallSign;
/**
* Sign handler for 1.13+
* @deprecated Obsolete as we don't support pre-1.13 versions anyway
*/
@Deprecated(forRemoval = true)
public class BukkitHandler1_13 extends BukkitInterface {
public BukkitHandler1_13(AreaShopInterface pluginInterface) {
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
-32
View File
@@ -1,32 +0,0 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
}
description = 'AreaShop Interface'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
+9
View File
@@ -0,0 +1,9 @@
dependencies {
compileOnly(libs.spigot)
compileOnly(libs.worldeditCore)
compileOnly(libs.worldeditBukkit)
compileOnly(libs.worldguardCore)
compileOnly(libs.worldguardBukkit)
}
description = "AreaShop Interface"
@@ -3,6 +3,7 @@ package me.wiefferink.areashop.interfaces;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.concurrent.CompletableFuture;
public abstract class WorldEditInterface {
protected final AreaShopInterface pluginInterface;
@@ -11,6 +12,10 @@ public abstract class WorldEditInterface {
this.pluginInterface = pluginInterface;
}
public boolean supportsAsyncOperations() {
return false;
}
/**
* Different way to restore blocks per implementation, newer ones support entities as well.
* Why: the schematic api has changed between WorldEdit 5 and 6, and the schematic format changed between 6 and 7
@@ -20,6 +25,16 @@ public abstract class WorldEditInterface {
*/
public abstract boolean restoreRegionBlocks(File file, GeneralRegionInterface regionInterface);
/**
* Different way to restore blocks per implementation, newer ones support entities as well.
* @param file File to try restoring from to the location of the region
* @param regionInterface Region to restore from
* @return true when successful, otherwise false
*/
public CompletableFuture<Boolean> restoreRegionBlocksAsync(File file, GeneralRegionInterface regionInterface) {
return CompletableFuture.completedFuture(restoreRegionBlocks(file, regionInterface));
}
/**
* Different way to save blocks per implementation, newer ones support entities as well.
* Why: the schematic api has changed between WorldEdit 5 and 6, and the schematic format changed between 6 and 7
@@ -29,6 +44,17 @@ public abstract class WorldEditInterface {
*/
public abstract boolean saveRegionBlocks(File file, GeneralRegionInterface regionInterface);
/**
* Different way to save blocks per implementation, newer ones support entities as well.
* Why: the schematic api has changed between WorldEdit 5 and 6, and the schematic format changed between 6 and 7
* @param file File to try saving the region to
* @param regionInterface Region to restore from
* @return true when successful, otherwise false
*/
public CompletableFuture<Boolean> saveRegionBlocksAsync(File file, GeneralRegionInterface regionInterface) {
return CompletableFuture.completedFuture(saveRegionBlocks(file, regionInterface));
}
/**
* Get the selection of the player.
* Why: the underlying WorldEdit selection class has changed from interface <-> class
+5
View File
@@ -0,0 +1,5 @@
dependencies {
compileOnly(libs.spigot)
}
description = "AreaShop NMS Interface"
-55
View File
@@ -1,55 +0,0 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'io.papermc.paperweight.userdev' version '1.3.3' apply false
}
group = 'me.wiefferink'
version = '2.7.3'
subprojects {
plugins.apply('java-library')
plugins.apply('maven-publish')
version = '2.7.1'
repositories {
mavenCentral()
maven {
name = 'oss-sonatype'
url = uri("https://oss.sonatype.org/content/groups/public/")
}
maven {
name = 'paper-repo'
url = uri('https://papermc.io/repo/repository/maven-public/')
}
maven {
name = 'spigot-repo'
url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
}
maven {
name = 'jitpack'
url = uri('https://jitpack.io')
content {
includeGroupByRegex("com\\.github.*")
}
}
maven {
name = 'aikar-repo'
url = uri('https://repo.aikar.co/content/groups/aikar/')
}
maven {
name = 'enginehub-repo'
url = uri('https://maven.enginehub.org/repo/')
}
}
tasks.withType(JavaCompile) {
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
options.release.set(17)
options.encoding = 'UTF-8'
options.fork = true
options.deprecation = true
}
}
+84
View File
@@ -0,0 +1,84 @@
plugins {
java
`java-library`
`maven-publish`
id("io.papermc.paperweight.userdev") version "1.3.5" apply false
idea
eclipse
}
group = "me.wiefferink"
version = "2.7.6"
subprojects {
group = rootProject.group
version = rootProject.version
apply {
plugin<JavaPlugin>()
plugin<JavaLibraryPlugin>()
if (project.path.contains("platform").not()) {
plugin<MavenPublishPlugin>()
}
plugin<IdeaPlugin>()
plugin<EclipsePlugin>()
}
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven {
name = "jitpack"
url = uri("https://jitpack.io")
content {
includeGroupByRegex("com\\.github.*")
}
}
maven("https://repo.aikar.co/content/groups/aikar/")
maven("https://maven.enginehub.org/repo/")
}
tasks {
withType(JavaCompile::class) {
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
options.release.set(17)
options.encoding = Charsets.UTF_8.name()
options.isFork = true
options.isDeprecation = true
}
withType(Javadoc::class) {
options.encoding = Charsets.UTF_8.name()
}
withType(ProcessResources::class) {
filteringCharset = Charsets.UTF_8.name()
}
}
if (project.path.contains("platform").not()) {
publishing {
publications {
create<MavenPublication>(project.name) {
from(components["java"])
pom {
scm {
connection.set("scm:git:git://github.com/md5sha256/AreaShop.git")
developerConnection.set("scm:git:ssh://github.com/md5sha256/AreaShop.git")
url.set("https://github.com/md5sha256/AreaShop/tree/dev/bleeding")
}
licenses {
license {
name.set("GNU General Public License v3.0")
url.set("https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE")
}
}
}
}
}
}
}
}
+3 -1
View File
@@ -1 +1,3 @@
org.gradle.parallel=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.java.installations.auto-download=false
+29
View File
@@ -0,0 +1,29 @@
[versions]
# Platforms
minecraft = "1.17.1-R0.1-SNAPSHOT"
findbugs = "3.0.2"
# Minecraft Plugins
worldedit = "7.2.8"
worldguard = "7.0.6"
fawe = "2.0.1"
# Gradle plugins
paperweight = "1.3.5"
[libraries]
# Platform
spigot = { group = "org.spigotmc", name = "spigot-api", version.ref = "minecraft" }
findbugs = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "findbugs" }
# Minecraft Plugins
worldeditBukkit = { group = "com.sk89q.worldedit", name = "worldedit-bukkit", version.ref = "worldedit" }
worldeditCore = { group = "com.sk89q.worldedit", name = "worldedit-core", version.ref = "worldedit" }
worldguardBukkit = { group = "com.sk89q.worldguard", name = "worldguard-bukkit", version.ref = "worldguard" }
worldguardCore = { group = "com.sk89q.worldguard", name = "worldguard-core", version.ref = "worldguard" }
fastasyncworldeditBukkit = { group = "com.fastasyncworldedit", name = "FastAsyncWorldEdit-Bukkit", version.ref = "fawe" }
fastasyncworldeditCore = { group = "com.fastasyncworldedit", name = "FastAsyncWorldEdit-Core", version.ref = "fawe" }
[plugins]
# Gradle plugins
paperweightUserdev = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight" }
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+5 -5
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
@@ -1,43 +0,0 @@
repositories {
maven {
name = "S01 Sonatype Snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.0.0")
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.0.0") {
}
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
compileOnly project(':areashop-interface')
}
description = 'AreaShop FastAsyncWorldEdit'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
@@ -1,165 +0,0 @@
package me.wiefferink.areashop.handlers;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.FlagContext;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
import com.sk89q.worldguard.protection.flags.RegionGroup;
import com.sk89q.worldguard.protection.flags.RegionGroupFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import me.wiefferink.areashop.interfaces.AreaShopInterface;
import me.wiefferink.areashop.interfaces.RegionAccessSet;
import me.wiefferink.areashop.interfaces.WorldGuardInterface;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
/**
* FAWE WorldGuard handler for pre 1.13
* @deprecated FAWE no longer has a custom WG implementation.
*/
@Deprecated(forRemoval = true)
public class FastAsyncWorldEditWorldGuardHandler extends WorldGuardInterface {
public FastAsyncWorldEditWorldGuardHandler(AreaShopInterface pluginInterface) {
super(pluginInterface);
}
@Override
public RegionManager getRegionManager(World world) {
return WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(world));
}
@Override
public Set<ProtectedRegion> getApplicableRegionsSet(Location location) {
Set<ProtectedRegion> result = new HashSet<>();
BlockVector3 vector = BlockVector3.at(location.getX(), location.getY(), location.getZ());
for(ProtectedRegion region : getRegionManager(location.getWorld()).getRegions().values()) {
if(region.contains(vector)) {
result.add(region);
}
}
return result;
}
/**
* Build a DefaultDomain from a RegionAccessSet.
* @param regionAccessSet RegionAccessSet to read
* @return DefaultDomain containing the entities from the RegionAccessSet
*/
private DefaultDomain buildDomain(RegionAccessSet regionAccessSet) {
DefaultDomain owners = new DefaultDomain();
for(String playerName : regionAccessSet.getPlayerNames()) {
owners.addPlayer(playerName);
}
for(UUID uuid : regionAccessSet.getPlayerUniqueIds()) {
owners.addPlayer(uuid);
}
for(String group : regionAccessSet.getGroupNames()) {
owners.addGroup(group);
}
return owners;
}
@Override
public void setOwners(ProtectedRegion region, RegionAccessSet regionAccessSet) {
DefaultDomain defaultDomain = buildDomain(regionAccessSet);
if(!region.getOwners().toUserFriendlyString().equals(defaultDomain.toUserFriendlyString())) {
region.setOwners(defaultDomain);
}
}
@Override
public void setMembers(ProtectedRegion region, RegionAccessSet regionAccessSet) {
DefaultDomain defaultDomain = buildDomain(regionAccessSet);
if(!region.getMembers().toUserFriendlyString().equals(defaultDomain.toUserFriendlyString())) {
region.setMembers(defaultDomain);
}
}
@Override
public boolean containsMember(ProtectedRegion region, UUID player) {
return region.getMembers().contains(player);
}
@Override
public boolean containsOwner(ProtectedRegion region, UUID player) {
return region.getOwners().contains(player);
}
@Override
public RegionAccessSet getMembers(ProtectedRegion region) {
RegionAccessSet result = new RegionAccessSet();
result.getGroupNames().addAll(region.getMembers().getGroups());
result.getPlayerNames().addAll(region.getMembers().getPlayers());
result.getPlayerUniqueIds().addAll(region.getMembers().getUniqueIds());
return result;
}
@Override
public RegionAccessSet getOwners(ProtectedRegion region) {
RegionAccessSet result = new RegionAccessSet();
result.getGroupNames().addAll(region.getOwners().getGroups());
result.getPlayerNames().addAll(region.getOwners().getPlayers());
result.getPlayerUniqueIds().addAll(region.getOwners().getUniqueIds());
return result;
}
@Override
public Flag<?> fuzzyMatchFlag(String flagName) {
return Flags.fuzzyMatchFlag(WorldGuard.getInstance().getFlagRegistry(), flagName);
}
@Override
public <V> V parseFlagInput(Flag<V> flag, String input) throws InvalidFlagFormat {
return flag.parseInput(FlagContext.create().setInput(input).build());
}
@Override
public RegionGroup parseFlagGroupInput(RegionGroupFlag flag, String input) throws InvalidFlagFormat {
return flag.parseInput(FlagContext.create().setInput(input).build());
}
@Override
public Vector getMinimumPoint(ProtectedRegion region) {
BlockVector3 min = region.getMinimumPoint();
return new Vector(min.getX(), min.getY(), min.getZ());
}
@Override
public Vector getMaximumPoint(ProtectedRegion region) {
BlockVector3 min = region.getMaximumPoint();
return new Vector(min.getX(), min.getY(), min.getZ());
}
@Override
public List<Vector> getRegionPoints(ProtectedRegion region) {
List<Vector> result = new ArrayList<>();
for (BlockVector2 point : region.getPoints()) {
result.add(new Vector(point.getX(), 0,point.getZ()));
}
return result;
}
@Override
public ProtectedCuboidRegion createCuboidRegion(String name, Vector corner1, Vector corner2) {
return new ProtectedCuboidRegion(name, BlockVector3.at(corner1.getBlockX(), corner1.getBlockY(), corner1.getBlockZ()), BlockVector3.at(corner2.getBlockX(), corner2.getBlockY(), corner2.getBlockZ()));
}
}
-41
View File
@@ -1,41 +0,0 @@
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.17.1-R0.1-SNAPSHOT")
compileOnly project(':areashop-interface')
compileOnly project(':areashop-nms')
}
reobfJar {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
assemble {
dependsOn(reobfJar)
}
publishing {
publications {
// ... artifact publications
nmsProvider(MavenPublication) {
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop NMS Helper'
-41
View File
@@ -1,41 +0,0 @@
plugins.apply("io.papermc.paperweight.userdev")
dependencies {
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.18.1-R0.1-SNAPSHOT")
compileOnly project(':areashop-interface')
compileOnly project(':areashop-nms')
}
reobfJar {
outputJar.set(file("build/libs/${project.name}-${project.version}.jar"))
}
assemble {
dependsOn(reobfJar)
}
publishing {
publications {
// ... artifact publications
nmsProvider(MavenPublication) {
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop NMS Helper'
-29
View File
@@ -1,29 +0,0 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
}
publishing {
publications {
// ... artifact publications
nmsProvider(MavenPublication) {
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
description = 'AreaShop NMS Interface'
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
-33
View File
@@ -1,33 +0,0 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
compileOnly project(':areashop-interface')
}
description = 'AreaShop WorldEdit 7'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
-33
View File
@@ -1,33 +0,0 @@
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'
compileOnly project(':areashop-interface')
}
description = 'AreaShop WorldGuard 7'
publishing {
publications {
// ... artifact publications
areaShop(MavenPublication) {
from components.java
pom {
group = "me.wiefferink"
artifactId = "$project.name"
version = "$project.version"
scm {
connection = 'scm:git:git://github.com/md5sha256/AreaShop.git'
developerConnection = 'scm:git:ssh://github.com/md5sha256/AreaShop.git'
url = "https://github.com/md5sha256/AreaShop/tree/dev/bleeding"
}
licenses {
license {
name = 'GNU General Public License v3.0'
url = "https://github.com/md5sha256/AreaShop/blob/dev/bleeding/LICENSE"
}
}
}
}
}
}
-27
View File
@@ -1,27 +0,0 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'paper-repo'
url = uri('https://papermc.io/repo/repository/maven-public/')
}
}
}
rootProject.name = 'areashop-parent'
include(':areashop-bukkit-1_13')
include(':areashop-worldguard-7')
include(':areashop-interface')
include(':areashop-nms')
include(':areashop-nms-1-17')
include(':areashop-nms-1-18')
include(':areashop-worldedit-7')
include(':areashop-fastasyncworldedit')
include(':areashop')
project(':areashop').projectDir = file('AreaShop')
project(':areashop-nms').projectDir = file('hooks/areashop-nms')
project(':areashop-nms-1-17').projectDir = file('hooks/areashop-nms-1-17')
project(':areashop-nms-1-18').projectDir = file('hooks/areashop-nms-1-18')
project(':areashop-worldedit-7').projectDir = file('hooks/areashop-worldedit-7')
project(':areashop-worldguard-7').projectDir = file('hooks/areashop-worldguard-7')
project(':areashop-fastasyncworldedit').projectDir = file('hooks/areashop-fastasyncworldedit')
+38
View File
@@ -0,0 +1,38 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = "paper-repo"
url = uri("https://papermc.io/repo/repository/maven-public/")
}
}
}
buildCache {
local {
directory = File(rootDir, "build-cache")
removeUnusedEntriesAfterDays = 30
}
}
rootProject.name = "areashop-parent"
// Interfaces
include(":areashop-bukkit-1_13")
include(":areashop-interface")
include(":areashop-nms")
// Adapters
include(":adapters:platform:bukkit-1-17")
include(":adapters:platform:bukkit-1-18")
include(":adapters:platform:bukkit-1-18-1")
include(":adapters:plugins:worldedit")
include(":adapters:plugins:worldguard")
include(":adapters:plugins:fastasyncworldedit")
// Main project
include(":areashop")
project(":areashop").projectDir = file("AreaShop")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")