diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index f823c87..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Setup Gradle Wrapper - run: ./gradlew wrapper - - name: Build with Gradle - run: ./gradlew build - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: artifact - path: build/target/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..96c1b97 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: release.yml +on: + push: + tags: + - "v*" + +jobs: + build-and-release: + runs-on: ubuntu-latest + permissions: + contents: write # Essential for creating the release + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for changelog generation to see history + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Make Gradle Wrapper Executable + run: chmod +x ./gradlew + - name: Build Shaded JARs + run: ./gradlew clean shadowJar + - name: Remove Unshaded JAR + run: rm build/target/BlueBridgeCore-*-NoDependencies.jar + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: | + build/target/BlueBridgeCore-*.jar + build/target/BlueBridgeGP-*.jar + build/target/BlueBridgeWG-*.jar + build/target/BlueBridgeWB-*.jar \ No newline at end of file diff --git a/BlueBridgeCore/build.gradle b/BlueBridgeCore/build.gradle index 3dc5332..3aaf9a5 100644 --- a/BlueBridgeCore/build.gradle +++ b/BlueBridgeCore/build.gradle @@ -1,21 +1,11 @@ -buildscript { - repositories { - gradlePluginPortal() - } - dependencies { - classpath 'com.gradleup.shadow:shadow-gradle-plugin:8.3.0' - } -} - plugins { id 'com.gradleup.shadow' version '8.3.0' } - dependencies { - provided 'com.github.BlueMap-Minecraft:BlueMapAPI:2.6.2' + compileOnly 'de.bluecolored:bluemap-api:2.7.7' // https://mvnrepository.com/artifact/org.apache.commons/commons-text - implementation 'org.apache.commons:commons-text:1.9' + implementation 'org.apache.commons:commons-text:1.15.0' } tasks.build.dependsOn tasks.shadowJar diff --git a/BlueBridgeCore/settings.gradle b/BlueBridgeCore/settings.gradle deleted file mode 100644 index f162469..0000000 --- a/BlueBridgeCore/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'BlueBridge' \ No newline at end of file diff --git a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/addon/AddonConfig.java b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/addon/AddonConfig.java index 5d38905..2e6b746 100644 --- a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/addon/AddonConfig.java +++ b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/addon/AddonConfig.java @@ -5,7 +5,6 @@ import org.bukkit.configuration.file.FileConfiguration; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.regex.Pattern; @@ -53,6 +52,10 @@ public synchronized Color defaultOutlineColor() { return new Color("#" + rgb); } + public synchronized int defaultOutlineWidth() { + return config.getInt("defaultOutlineWidth", 2); + } + public synchronized String markerSetName() { return config.getString("markerSetName", "Undefined (Check BlueBridge addon config)"); } diff --git a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/bluemap/BlueMapIntegration.java b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/bluemap/BlueMapIntegration.java index f58708f..9711a4f 100644 --- a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/bluemap/BlueMapIntegration.java +++ b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/bluemap/BlueMapIntegration.java @@ -104,6 +104,7 @@ private void addToMarkerSet(MarkerSet ms, RegionSnapshot rs, Shape shape, Vector .label(StringEscapeUtils.escapeHtml4(rs.getShortName())) .detail(rs.getHtmlDisplay()) .lineColor(rs.getBorderColor()) + .lineWidth(rs.getOutlineWidth()) .fillColor(rs.getColor()) .depthTestEnabled(rs.getDepthCheck()) .build(); @@ -116,6 +117,7 @@ private void addToMarkerSet(MarkerSet ms, RegionSnapshot rs, Shape shape, Vector .label(StringEscapeUtils.escapeHtml4(rs.getShortName())) .detail(rs.getHtmlDisplay()) .lineColor(rs.getBorderColor()) + .lineWidth(rs.getOutlineWidth()) .fillColor(rs.getColor()) .depthTestEnabled(rs.getDepthCheck()) .build(); diff --git a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshot.java b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshot.java index 48b6499..2738d90 100644 --- a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshot.java +++ b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshot.java @@ -23,6 +23,7 @@ public class RegionSnapshot { private List points; private Color color = new Color(0, 0, 0); private Color borderColor = new Color(0, 0, 0); + private int outlineWidth = 2; private double minDistance; private double maxDistance; @@ -81,6 +82,10 @@ public Color getBorderColor() { return borderColor; } + public int getOutlineWidth() { + return outlineWidth; + } + public double getMinDistance() { return minDistance; } @@ -126,6 +131,10 @@ public void setBorderColor(Color borderColor) { this.borderColor = borderColor; } + public void setOutlineWidth(int outlineWidth) { + this.outlineWidth = outlineWidth; + } + public void setMinDistance(double minDistance) { this.minDistance = minDistance; } diff --git a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshotBuilder.java b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshotBuilder.java index 5a40705..8c91b52 100644 --- a/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshotBuilder.java +++ b/BlueBridgeCore/src/main/java/de/mark225/bluebridge/core/region/RegionSnapshotBuilder.java @@ -30,6 +30,7 @@ private void prefillDefaults() { region.setDepthCheck(cfg.defaultDepthCheck()); region.setColor(cfg.defaultColor()); region.setBorderColor(cfg.defaultOutlineColor()); + region.setOutlineWidth(cfg.defaultOutlineWidth()); region.setMinDistance(cfg.minDistance()); region.setMaxDistance(cfg.maxDistance()); @@ -75,6 +76,11 @@ public RegionSnapshotBuilder setBorderColor(Color color) { return this; } + public RegionSnapshotBuilder setOutlineWidth(int outlineWidth) { + region.setOutlineWidth(outlineWidth); + return this; + } + public RegionSnapshotBuilder setMinDistance(double minDistance) { region.setMinDistance(minDistance); return this; diff --git a/BlueBridgeCore/src/main/resources/config.yml b/BlueBridgeCore/src/main/resources/config.yml index d7254cf..6cfb4a2 100644 --- a/BlueBridgeCore/src/main/resources/config.yml +++ b/BlueBridgeCore/src/main/resources/config.yml @@ -25,6 +25,8 @@ maxDistance: -1 defaultColor: "0087ff96" defaultOutlineColor: "0060ff" +defaultOutlineWidth: 2 + # Uncomment this section to exclude BlueMap maps from rendering regions. # You can also add this list to the addon configs to block only their regions from appearing on a map. The two lists (addon specific and BlueBridgeCore) will be merged. # excludedMaps: diff --git a/BlueBridgeGP/build.gradle b/BlueBridgeGP/build.gradle index c6abd1b..0300141 100644 --- a/BlueBridgeGP/build.gradle +++ b/BlueBridgeGP/build.gradle @@ -1,5 +1,37 @@ +plugins { + id 'com.gradleup.shadow' version '8.3.0' +} + dependencies { - implementation project(':BlueBridgeCore') - provided 'com.github.BlueMap-Minecraft:BlueMapAPI:2.6.2' - implementation 'com.github.TechFortress:GriefPrevention:16.18' + compileOnly project(':BlueBridgeCore') + compileOnly 'de.bluecolored:bluemap-api:2.7.7' + compileOnly 'com.github.GriefPrevention:GriefPrevention:16.18.5' +} + +tasks.build.dependsOn tasks.shadowJar + +jar { + archiveClassifier = 'NoDependencies' } + +shadowJar { + zip64 = true + mergeServiceFiles() + relocate 'org.apache.commons.text', 'de.mark225.shadow.org.apache.commons.text' + relocate 'org.apache.commons.lang3', 'de.mark225.shadow.org.apache.commons.lang3' + archiveClassifier = '' + def exclude_modules = project + .configurations + .provided + .resolvedConfiguration + .getLenientConfiguration() + .getAllModuleDependencies() + .collect { + it.name + } + dependencies { + exclude(dependency { + exclude_modules.contains(it.name) + }) + } +} \ No newline at end of file diff --git a/BlueBridgeGP/settings.gradle b/BlueBridgeGP/settings.gradle deleted file mode 100644 index a6a3d2e..0000000 --- a/BlueBridgeGP/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'BlueBridge' -include ':BlueBridgeCore' \ No newline at end of file diff --git a/BlueBridgeWB/build.gradle b/BlueBridgeWB/build.gradle index a1e5b1d..c250562 100644 --- a/BlueBridgeWB/build.gradle +++ b/BlueBridgeWB/build.gradle @@ -1,4 +1,36 @@ +plugins { + id 'com.gradleup.shadow' version '8.3.0' +} + dependencies { - implementation project(':BlueBridgeCore') - provided 'com.github.BlueMap-Minecraft:BlueMapAPI:2.6.2' + compileOnly project(':BlueBridgeCore') + compileOnly 'de.bluecolored:bluemap-api:2.7.7' +} + +tasks.build.dependsOn tasks.shadowJar + +jar { + archiveClassifier = 'NoDependencies' +} + +shadowJar { + zip64 = true + mergeServiceFiles() + relocate 'org.apache.commons.text', 'de.mark225.shadow.org.apache.commons.text' + relocate 'org.apache.commons.lang3', 'de.mark225.shadow.org.apache.commons.lang3' + archiveClassifier = '' + def exclude_modules = project + .configurations + .provided + .resolvedConfiguration + .getLenientConfiguration() + .getAllModuleDependencies() + .collect { + it.name + } + dependencies { + exclude(dependency { + exclude_modules.contains(it.name) + }) + } } \ No newline at end of file diff --git a/BlueBridgeWG/build.gradle b/BlueBridgeWG/build.gradle index 30da7df..c2c30a9 100644 --- a/BlueBridgeWG/build.gradle +++ b/BlueBridgeWG/build.gradle @@ -1,9 +1,41 @@ +plugins { + id 'com.gradleup.shadow' version '8.3.0' +} + repositories { maven { url "https://maven.enginehub.org/repo/" } } dependencies { - implementation project(':BlueBridgeCore') - provided 'com.github.BlueMap-Minecraft:BlueMapAPI:2.6.2' - provided 'com.sk89q.worldguard:worldguard-bukkit:7.0.14' + compileOnly project(':BlueBridgeCore') + compileOnly 'de.bluecolored:bluemap-api:2.7.7' + compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.14' +} + +tasks.build.dependsOn tasks.shadowJar + +jar { + archiveClassifier = 'NoDependencies' } + +shadowJar { + zip64 = true + mergeServiceFiles() + relocate 'org.apache.commons.text', 'de.mark225.shadow.org.apache.commons.text' + relocate 'org.apache.commons.lang3', 'de.mark225.shadow.org.apache.commons.lang3' + archiveClassifier = '' + def exclude_modules = project + .configurations + .provided + .resolvedConfiguration + .getLenientConfiguration() + .getAllModuleDependencies() + .collect { + it.name + } + dependencies { + exclude(dependency { + exclude_modules.contains(it.name) + }) + } +} \ No newline at end of file diff --git a/BlueBridgeWG/settings.gradle b/BlueBridgeWG/settings.gradle deleted file mode 100644 index a6a3d2e..0000000 --- a/BlueBridgeWG/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'BlueBridge' -include ':BlueBridgeCore' \ No newline at end of file diff --git a/BlueBridgeWG/src/main/java/de/mark225/bluebridge/worldguard/addon/WorldGuardIntegration.java b/BlueBridgeWG/src/main/java/de/mark225/bluebridge/worldguard/addon/WorldGuardIntegration.java index 6e9ddad..458f588 100644 --- a/BlueBridgeWG/src/main/java/de/mark225/bluebridge/worldguard/addon/WorldGuardIntegration.java +++ b/BlueBridgeWG/src/main/java/de/mark225/bluebridge/worldguard/addon/WorldGuardIntegration.java @@ -33,6 +33,7 @@ public class WorldGuardIntegration { public static StateFlag EXTRUDE_FLAG; public static StringFlag COLOR_FLAG; public static StringFlag OUTLINE_FLAG; + public static IntegerFlag OUTLINE_WIDTH_FLAG; public static StringFlag DISPLAY_FLAG; public static DoubleFlag MAX_DISTANCE_FLAG; public static DoubleFlag MIN_DISTANCE_FLAG; @@ -55,15 +56,17 @@ public boolean init() { StateFlag extrudeFlag = new StateFlag("bluemap-extrude", false); StringFlag colorFlag = new StringFlag("bluemap-color", Integer.toHexString(BlueBridgeUtils.colorToInt(BlueBridgeWGConfig.getInstance().defaultColor()))); StringFlag outlineFlag = new StringFlag("bluemap-color-outline", Integer.toHexString(BlueBridgeUtils.colorToInt(BlueBridgeWGConfig.getInstance().defaultOutlineColor())).substring(2)); + IntegerFlag outlineWidthFlag = new IntegerFlag("bluemap-outline-width"); StringFlag displayFlag = new StringFlag("bluemap-display"); DoubleFlag maxDistanceFlag = new DoubleFlag("bluemap-max-distance"); DoubleFlag minDistanceFlag = new DoubleFlag("bluemap-min-distance"); - flags.registerAll(Arrays.asList(new Flag[]{renderFlag, depthCheckFlag, heightFlag, extrudeFlag, colorFlag, outlineFlag, displayFlag, maxDistanceFlag, minDistanceFlag})); + flags.registerAll(Arrays.asList(new Flag[]{renderFlag, depthCheckFlag, heightFlag, extrudeFlag, colorFlag, outlineFlag, outlineWidthFlag, displayFlag, maxDistanceFlag, minDistanceFlag})); RENDER_FLAG = renderFlag; HEIGHT_FLAG = heightFlag; EXTRUDE_FLAG = extrudeFlag; COLOR_FLAG = colorFlag; OUTLINE_FLAG = outlineFlag; + OUTLINE_WIDTH_FLAG = outlineWidthFlag; DISPLAY_FLAG = displayFlag; DEPTH_CHECK_FLAG = depthCheckFlag; MAX_DISTANCE_FLAG = maxDistanceFlag; @@ -88,7 +91,7 @@ public List getAllRegions(UUID worldUUID) { if (bukkitWorld == null) { BlueBridgeWG.getInstance().getLogger().warning("World " + worldUUID.toString() + " not found! Please check your Bluemap config for invalid worlds!"); - return new ArrayList(); + return new ArrayList<>(); } World w = BukkitAdapter.adapt(bukkitWorld); @@ -104,19 +107,25 @@ public List getAllRegions(UUID worldUUID) { List points = getPointsForRegion(pr); //Convert color flags to Color Objects, if applicable String color = pr.getFlag(COLOR_FLAG); - Color colorRGBA = null; + Color colorRGBA; if (color != null && hexPatternRGBA.matcher(color).matches()) { colorRGBA = new Color("#" + color); } else { colorRGBA = BlueBridgeWGConfig.getInstance().defaultColor(); } String bordercolor = pr.getFlag(OUTLINE_FLAG); - Color colorRGB = null; + Color colorRGB; if (bordercolor != null && hexPatternRGB.matcher(bordercolor).matches()) { colorRGB = new Color("#" + bordercolor); } else { colorRGB = BlueBridgeWGConfig.getInstance().defaultOutlineColor(); } + + int outlineWidth = pr.getFlag(OUTLINE_WIDTH_FLAG) != null ? pr.getFlag(OUTLINE_WIDTH_FLAG) : BlueBridgeWGConfig.getInstance().defaultOutlineWidth(); + if (outlineWidth <= 0) { + outlineWidth = BlueBridgeWGConfig.getInstance().defaultOutlineWidth(); + } + StateFlag.State depthCheckVal = pr.getFlag(DEPTH_CHECK_FLAG); boolean depthCheck = depthCheckVal != null ? depthCheckVal == StateFlag.State.ALLOW : BlueBridgeWGConfig.getInstance().defaultDepthCheck(); @@ -142,6 +151,7 @@ public List getAllRegions(UUID worldUUID) { .setDepthCheck(depthCheck) .setColor(colorRGBA) .setBorderColor(colorRGB) + .setOutlineWidth(outlineWidth) .setMaxDistance(maxDistance) .setMinDistance(minDistance) .build(); diff --git a/build.gradle b/build.gradle index cd63550..efbf683 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ subprojects { apply plugin: 'java' - version '2.2' + version '2.3' //Add maintainers here (separated by a comma and space). This will be added to the plugin.yml. def authors = 'Mark_225' @@ -24,6 +24,7 @@ subprojects { name = "papermc" url = uri("https://repo.papermc.io/repository/maven-public/") } + maven { url 'https://repo.bluecolored.de/releases' } } configurations { @@ -32,12 +33,12 @@ subprojects { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT") - provided 'com.flowpowered:flow-math:1.0.3' + compileOnly("io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT") + compileOnly 'com.flowpowered:flow-math:1.0.3' } - tasks.withType(Jar) { - destinationDirectory = file("$rootDir/build/target") + tasks.withType(Jar).configureEach { + it.destinationDirectory = file("$rootDir/build/target") } processResources { diff --git a/settings.gradle b/settings.gradle index 340aed1..bb21dd0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,7 @@ rootProject.name = 'BlueBridge' + include ':BlueBridgeCore' include ':BlueBridgeWG' include ':BlueBridgeGP' - -project(':BlueBridgeCore').projectDir = "$rootDir/BlueBridgeCore" as File -project(':BlueBridgeWG').projectDir = "$rootDir/BlueBridgeWG" as File -project(':BlueBridgeGP').projectDir = "$rootDir/BlueBridgeGP" as File -include 'BlueBridgeWB' +include ':BlueBridgeWB'