diff --git a/build.gradle b/build.gradle index a88ee73c6..2eef07f19 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ if ( project.hasProperty("lzNoVersion") ) { // gradle build -PlzNoVersion } else { version = String.format("%s.%s", rootVersion, buildNumber) } -description = """FastAsyncWorldEdit""" +description = rootProject.name subprojects { apply plugin: 'java' @@ -68,8 +68,6 @@ subprojects { // Enable this requires putting license header files in many, many FAWE files //apply plugin: 'net.minecrell.licenser' - ext.internalVersion = version - sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index e5c8f76ec..3d5e99d23 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -34,14 +34,13 @@ dependencies { } processResources { - from (sourceSets.main.resources.srcDirs) { - expand 'internalVersion': project.internalVersion + from('src/main/resources') { + expand( + name: project.parent.name, + version: project.parent.version + ) include 'plugin.yml' } - - from (sourceSets.main.resources.srcDirs) { - exclude 'plugin.yml' - } } jar.archiveName="fawe-bukkit-${project.parent.version}.jar" diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index 42713b7eb..8c514eaa2 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: WorldEdit main: com.sk89q.worldedit.bukkit.WorldEditPlugin -version: "${internalVersion}" +version: ${version} api-version: 1.13 description: Fast Async WorldEdit plugin authors: [Empire92] diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index eb0f957c3..ae5138932 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -43,8 +43,10 @@ processResources { from('src/main/resources') { include 'fawe.properties' expand( - internalVersion: "${project.parent.version}", + version: "${project.parent.version}", name: project.parent.name, + commit: "${git.head().abbreviatedId}", + date: "${git.head().getDate().format("yy.MM.dd")}", ) } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java index 65bf3ccfe..ef9625376 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java @@ -18,10 +18,7 @@ import com.sk89q.worldedit.session.request.Request; import javax.annotation.Nullable; import javax.management.InstanceAlreadyExistsException; import javax.management.NotificationEmitter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; import java.lang.management.MemoryPoolMXBean; @@ -316,15 +313,17 @@ public class Fawe { // Setting up config.yml File file = new File(this.IMP.getDirectory(), "config.yml"); Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", ""); - try { - InputStream stream = getClass().getResourceAsStream("/fawe.properties"); - java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); - String versionString = scanner.next().trim(); - scanner.close(); - this.version = new FaweVersion(versionString); + try (InputStream stream = getClass().getResourceAsStream("/fawe.properties"); + BufferedReader br = new BufferedReader(new InputStreamReader(stream))) { + // java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); + String versionString = br.readLine(); + String commitString = br.readLine(); + String dateString = br.readLine(); + // scanner.close(); + this.version = FaweVersion.tryParse(versionString, commitString, dateString); Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString(); - Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build; - Settings.IMP.COMMIT = "https://github.com/boy0001/FastAsyncWorldedit/commit/" + Integer.toHexString(version.hash); + Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-Breaking/" + version.build; + Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/commit/" + Integer.toHexString(version.hash); } catch (Throwable ignore) {} try { Settings.IMP.reload(file); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java index c2a826ab7..cea5c6ac5 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java @@ -1,24 +1,33 @@ package com.boydti.fawe; public class FaweVersion { - public final int year, month, day, hash, build, major, minor, patch; + public final int year, month, day, hash, build; - public FaweVersion(String version) { - String[] split = version.substring(version.indexOf('=') + 1).split("-"); - if (split[0].equals("unknown")) { - this.year = month = day = hash = build = major = minor = patch = 0; - return; + public FaweVersion(int year, int month, int day, int hash, int build) { + this.year = year; + this.month = month; + this.day = day; + this.hash = hash; + this.build = build; + } + + public FaweVersion(String version, String commit, String date) { + String[] split = version.substring(version.indexOf('=') + 1).split("\\."); + this.build = Integer.parseInt(split[1]); + this.hash = Integer.parseInt(commit.substring(commit.indexOf('=') + 1), 16); + String[] split1 = date.substring(date.indexOf('=') + 1).split("\\."); + this.year = Integer.parseInt(split1[0]); + this.month = Integer.parseInt(split1[1]); + this.day = Integer.parseInt(split1[2]); + } + + public static FaweVersion tryParse(String version, String commit, String date) { + try { + return new FaweVersion(version, commit, date); + } catch (Exception ignore) { + ignore.printStackTrace(); + return new FaweVersion(0, 0, 0, 0, 0); } - String[] date = split[0].split("\\."); - this.year = Integer.parseInt(date[0]); - this.month = Integer.parseInt(date[1]); - this.day = Integer.parseInt(date[2]); - this.hash = Integer.parseInt(split[1], 16); - this.build = Integer.parseInt(split[2]); - String[] semver = split[3].split("\\."); - this.major = Integer.parseInt(semver[0]); - this.minor = Integer.parseInt(semver[1]); - this.patch = Integer.parseInt(semver[2]); } @Override @@ -27,6 +36,6 @@ public class FaweVersion { } public boolean isNewer(FaweVersion other) { - return other.build < this.build && (this.major > other.major || (this.major == other.major && this.minor > other.minor) || (this.major == other.major && this.minor == other.minor && this.patch > other.patch)); + return other.build < this.build; } } \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/boydti/fawe/installer/InstallerFrame.java b/worldedit-core/src/main/java/com/boydti/fawe/installer/InstallerFrame.java index ffc1f610e..d68476e3e 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/installer/InstallerFrame.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/installer/InstallerFrame.java @@ -3,6 +3,8 @@ package com.boydti.fawe.installer; import com.boydti.fawe.FaweVersion; import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.StringMan; +import com.sk89q.worldedit.WorldEdit; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -149,11 +151,11 @@ public class InstallerFrame extends JFrame { java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); String versionString = scanner.next().trim(); scanner.close(); - FaweVersion version = new FaweVersion(versionString); + FaweVersion version = null; String date = new Date(100 + version.year, version.month, version.day).toGMTString(); String build = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build; String commit = "https://github.com/boy0001/FastAsyncWorldedit/commit/" + Integer.toHexString(version.hash); - String footerMessage = "FAWE v" + version.major + "." + version.minor + "." + version.patch + " by Empire92 (c) 2017 (GPL v3.0)"; + String footerMessage = "FAWE v" + version.year + "." + version.month + "." + version.day + " by Empire92 (c) 2017 (GPL v3.0)"; URL licenseUrl = new URL("https://github.com/boy0001/FastAsyncWorldedit/blob/master/LICENSE"); URLButton licenseButton = new URLButton(licenseUrl, footerMessage); bottomBar.add(licenseButton); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index f2e07ffff..4c83671c5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -89,7 +89,7 @@ public class WorldEditCommands { PlatformManager pm = we.getPlatformManager(); actor.printDebug("Platforms:"); for (Platform platform : pm.getPlatforms()) { - actor.printDebug(String.format(" - %s (%s)", platform.getPlatformName(), platform.getPlatformVersion())); + actor.printDebug(String.format(" - %s", platform.getPlatformName())); } actor.printDebug("Capabilities:"); for (Capability capability : Capability.values()) { diff --git a/worldedit-core/src/main/resources/fawe.properties b/worldedit-core/src/main/resources/fawe.properties index 8570852e5..9ff2dd711 100644 --- a/worldedit-core/src/main/resources/fawe.properties +++ b/worldedit-core/src/main/resources/fawe.properties @@ -1 +1,3 @@ -version=${internalVersion} +version=${version} +commit=${commit} +date=${date}