mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fixes #124
This fixes the output of /fawe version and gives the versioning a fresh overhaul as well
This commit is contained in:
parent
f829f51bcd
commit
7b8bf18309
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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]
|
||||
|
@ -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")}",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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()) {
|
||||
|
@ -1 +1,3 @@
|
||||
version=${internalVersion}
|
||||
version=${version}
|
||||
commit=${commit}
|
||||
date=${date}
|
||||
|
Loading…
Reference in New Issue
Block a user