This fixes the output of /fawe version and gives the versioning a fresh overhaul as well
Dieser Commit ist enthalten in:
NotMyFault 2019-04-17 00:35:39 +02:00
Ursprung f829f51bcd
Commit 7b8bf18309
9 geänderte Dateien mit 55 neuen und 44 gelöschten Zeilen

Datei anzeigen

@ -59,7 +59,7 @@ if ( project.hasProperty("lzNoVersion") ) { // gradle build -PlzNoVersion
} else { } else {
version = String.format("%s.%s", rootVersion, buildNumber) version = String.format("%s.%s", rootVersion, buildNumber)
} }
description = """FastAsyncWorldEdit""" description = rootProject.name
subprojects { subprojects {
apply plugin: 'java' apply plugin: 'java'
@ -68,8 +68,6 @@ subprojects {
// Enable this requires putting license header files in many, many FAWE files // Enable this requires putting license header files in many, many FAWE files
//apply plugin: 'net.minecrell.licenser' //apply plugin: 'net.minecrell.licenser'
ext.internalVersion = version
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

Datei anzeigen

@ -34,14 +34,13 @@ dependencies {
} }
processResources { processResources {
from (sourceSets.main.resources.srcDirs) { from('src/main/resources') {
expand 'internalVersion': project.internalVersion expand(
name: project.parent.name,
version: project.parent.version
)
include 'plugin.yml' include 'plugin.yml'
} }
from (sourceSets.main.resources.srcDirs) {
exclude 'plugin.yml'
}
} }
jar.archiveName="fawe-bukkit-${project.parent.version}.jar" jar.archiveName="fawe-bukkit-${project.parent.version}.jar"

Datei anzeigen

@ -1,6 +1,6 @@
name: WorldEdit name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "${internalVersion}" version: ${version}
api-version: 1.13 api-version: 1.13
description: Fast Async WorldEdit plugin description: Fast Async WorldEdit plugin
authors: [Empire92] authors: [Empire92]

Datei anzeigen

@ -43,8 +43,10 @@ processResources {
from('src/main/resources') { from('src/main/resources') {
include 'fawe.properties' include 'fawe.properties'
expand( expand(
internalVersion: "${project.parent.version}", version: "${project.parent.version}",
name: project.parent.name, name: project.parent.name,
commit: "${git.head().abbreviatedId}",
date: "${git.head().getDate().format("yy.MM.dd")}",
) )
} }
} }

Datei anzeigen

@ -18,10 +18,7 @@ import com.sk89q.worldedit.session.request.Request;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceAlreadyExistsException;
import javax.management.NotificationEmitter; import javax.management.NotificationEmitter;
import java.io.File; import java.io.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean; import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryPoolMXBean;
@ -316,15 +313,17 @@ public class Fawe {
// Setting up config.yml // Setting up config.yml
File file = new File(this.IMP.getDirectory(), "config.yml"); File file = new File(this.IMP.getDirectory(), "config.yml");
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", ""); Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
try { try (InputStream stream = getClass().getResourceAsStream("/fawe.properties");
InputStream stream = getClass().getResourceAsStream("/fawe.properties"); BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); // java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A");
String versionString = scanner.next().trim(); String versionString = br.readLine();
scanner.close(); String commitString = br.readLine();
this.version = new FaweVersion(versionString); 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.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build; Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-Breaking/" + version.build;
Settings.IMP.COMMIT = "https://github.com/boy0001/FastAsyncWorldedit/commit/" + Integer.toHexString(version.hash); Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/commit/" + Integer.toHexString(version.hash);
} catch (Throwable ignore) {} } catch (Throwable ignore) {}
try { try {
Settings.IMP.reload(file); Settings.IMP.reload(file);

Datei anzeigen

@ -1,24 +1,33 @@
package com.boydti.fawe; package com.boydti.fawe;
public class FaweVersion { 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) { public FaweVersion(int year, int month, int day, int hash, int build) {
String[] split = version.substring(version.indexOf('=') + 1).split("-"); this.year = year;
if (split[0].equals("unknown")) { this.month = month;
this.year = month = day = hash = build = major = minor = patch = 0; this.day = day;
return; 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 @Override
@ -27,6 +36,6 @@ public class FaweVersion {
} }
public boolean isNewer(FaweVersion other) { 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;
} }
} }

Datei anzeigen

@ -3,6 +3,8 @@ package com.boydti.fawe.installer;
import com.boydti.fawe.FaweVersion; import com.boydti.fawe.FaweVersion;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.WorldEdit;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -149,11 +151,11 @@ public class InstallerFrame extends JFrame {
java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A");
String versionString = scanner.next().trim(); String versionString = scanner.next().trim();
scanner.close(); scanner.close();
FaweVersion version = new FaweVersion(versionString); FaweVersion version = null;
String date = new Date(100 + version.year, version.month, version.day).toGMTString(); String date = new Date(100 + version.year, version.month, version.day).toGMTString();
String build = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build; String build = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build;
String commit = "https://github.com/boy0001/FastAsyncWorldedit/commit/" + Integer.toHexString(version.hash); 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"); URL licenseUrl = new URL("https://github.com/boy0001/FastAsyncWorldedit/blob/master/LICENSE");
URLButton licenseButton = new URLButton(licenseUrl, footerMessage); URLButton licenseButton = new URLButton(licenseUrl, footerMessage);
bottomBar.add(licenseButton); bottomBar.add(licenseButton);

Datei anzeigen

@ -89,7 +89,7 @@ public class WorldEditCommands {
PlatformManager pm = we.getPlatformManager(); PlatformManager pm = we.getPlatformManager();
actor.printDebug("Platforms:"); actor.printDebug("Platforms:");
for (Platform platform : pm.getPlatforms()) { 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:"); actor.printDebug("Capabilities:");
for (Capability capability : Capability.values()) { for (Capability capability : Capability.values()) {

Datei anzeigen

@ -1 +1,3 @@
version=${internalVersion} version=${version}
commit=${commit}
date=${date}