Fixes and tweaks after testing

This commit is contained in:
Blue (Lukas Rieger) 2020-08-25 18:05:25 +02:00
parent 67abcf73ca
commit 36161a1f49
10 changed files with 37 additions and 31 deletions

View File

@ -4,9 +4,6 @@ on:
push:
branches:
- master
- mc/1.12
- mc/1.13
- mc/1.15
jobs:
build:
@ -19,10 +16,8 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Test with Gradle
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean test build
- uses: actions/upload-artifact@v2
with:
name: artifact

View File

@ -221,7 +221,7 @@ private synchronized void loadWorldsAndMaps() throws IOException {
public synchronized ResourcePack getResourcePack() throws IOException, MissingResourcesException {
if (resourcePack == null) {
File defaultResourceFile = new File(getCoreConfig().getDataFolder(), "minecraft-client-" + minecraftVersion.getVersionString() + ".jar");
File resourceExtensionsFile = new File(getCoreConfig().getDataFolder(), minecraftVersion.getResourcePrefix() + File.separator + "resourceExtensions.zip");
File resourceExtensionsFile = new File(getCoreConfig().getDataFolder(), "resourceExtensions.zip");
File textureExportFile = new File(getRenderConfig().getWebRoot(), "data" + File.separator + "textures.json");
@ -244,7 +244,7 @@ public synchronized ResourcePack getResourcePack() throws IOException, MissingRe
Logger.global.logInfo("Loading resources...");
resourceExtensionsFile.delete();
FileUtils.copyURLToFile(Plugin.class.getResource("/de/bluecolored/bluemap/resourceExtensions.zip"), resourceExtensionsFile, 10000, 10000);
FileUtils.copyURLToFile(Plugin.class.getResource("/de/bluecolored/bluemap/" + minecraftVersion.getResourcePrefix() + "/resourceExtensions.zip"), resourceExtensionsFile, 10000, 10000);
//find more resource packs
File resourcePackFolder = new File(configFolder, "resourcepacks");

View File

@ -102,6 +102,9 @@ public synchronized void load() throws IOException, ParseResourceException {
RenderConfig renderConfig = blueMap.getRenderConfig();
WebServerConfig webServerConfig = blueMap.getWebServerConfig();
//try load resources
try {
//load plugin config
pluginConfig = new PluginConfig(blueMap.getConfigManager().loadOrCreate(
new File(serverInterface.getConfigFolder(), "plugin.conf"),
@ -111,9 +114,9 @@ public synchronized void load() throws IOException, ParseResourceException {
true
));
//try load resources
try {
blueMap.getResourcePack();
//make sure resources are loaded
getResourcePack();
} catch (MissingResourcesException ex) {
Logger.global.logWarning("BlueMap is missing important resources!");
Logger.global.logWarning("You need to accept the download of the required files in order of BlueMap to work!");

View File

@ -35,7 +35,7 @@ public enum MinecraftVersion {
MC_1_15 ("1.15", "mc1_15", "https://launcher.mojang.com/v1/objects/e3f78cd16f9eb9a52307ed96ebec64241cc5b32d/client.jar"),
MC_1_16 ("1.16", "mc1_16", "https://launcher.mojang.com/v1/objects/653e97a2d1d76f87653f02242d243cdee48a5144/client.jar");
private static final Pattern VERSION_REGEX = Pattern.compile("(?:(?'major'\\d+)\\.(?'minor'\\d+))(?:\\.(?'patch'\\d+))?(?:\\-(?:pre|rc)\\d+)?");
private static final Pattern VERSION_REGEX = Pattern.compile("(?:(?<major>\\d+)\\.(?<minor>\\d+))(?:\\.(?<patch>\\d+))?(?:\\-(?:pre|rc)\\d+)?");
private final String versionString;
private final String resourcePrefix;

View File

@ -123,7 +123,7 @@ public ConfigurationNode loadOrCreate(File configFile, URL defaultConfig, URL de
public void loadResourceConfigs(File configFolder, ResourcePack resourcePack) throws IOException {
//load blockColors.json from resources, config-folder and resourcepack
URL blockColorsConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/blockColors.json");
URL blockColorsConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/" + resourcePack.getMinecraftVersion().getResourcePrefix() + "/blockColors.json");
File blockColorsConfigFile = new File(configFolder, "blockColors.json");
ConfigurationNode blockColorsConfigNode = loadOrCreate(
blockColorsConfigFile,
@ -136,7 +136,7 @@ public void loadResourceConfigs(File configFolder, ResourcePack resourcePack) th
resourcePack.getBlockColorCalculator().loadColorConfig(blockColorsConfigNode);
//load blockIds.json from resources, config-folder and resourcepack
URL blockIdsConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/blockIds.json");
URL blockIdsConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/" + resourcePack.getMinecraftVersion().getResourcePrefix() + "/blockIds.json");
File blockIdsConfigFile = new File(configFolder, "blockIds.json");
ConfigurationNode blockIdsConfigNode = loadOrCreate(
blockIdsConfigFile,
@ -152,7 +152,7 @@ public void loadResourceConfigs(File configFolder, ResourcePack resourcePack) th
);
//load blockProperties.json from resources, config-folder and resourcepack
URL blockPropertiesConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/blockProperties.json");
URL blockPropertiesConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/" + resourcePack.getMinecraftVersion().getResourcePrefix() + "/blockProperties.json");
File blockPropertiesConfigFile = new File(configFolder, "blockProperties.json");
ConfigurationNode blockPropertiesConfigNode = loadOrCreate(
blockPropertiesConfigFile,
@ -169,7 +169,7 @@ public void loadResourceConfigs(File configFolder, ResourcePack resourcePack) th
);
//load biomes.json from resources, config-folder and resourcepack
URL biomeConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/biomes.json");
URL biomeConfigUrl = BlueMap.class.getResource("/de/bluecolored/bluemap/" + resourcePack.getMinecraftVersion().getResourcePrefix() + "/biomes.json");
File biomeConfigFile = new File(configFolder, "biomes.json");
ConfigurationNode biomeConfigNode = loadOrCreate(
biomeConfigFile,

View File

@ -65,6 +65,7 @@ public class LiquidModelBuilder {
public LiquidModelBuilder(Block block, BlockState liquidBlockState, MinecraftVersion minecraftVersion, RenderSettings renderSettings, BlockColorCalculator colorCalculator) {
this.block = block;
this.minecraftVersion = minecraftVersion;
this.renderSettings = renderSettings;
this.liquidBlockState = liquidBlockState;
this.colorCalculator = colorCalculator;

View File

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
coreVersion=1.0.0-RC1
coreVersion=1.0.0-rc1

View File

@ -9,7 +9,7 @@ repositories {
}
dependencies {
shadow "org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT"
shadow "org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT"
compile group: 'org.bstats', name: 'bstats-bukkit-lite', version: '1.5'
@ -23,7 +23,7 @@ dependencies {
build.dependsOn shadowJar {
destinationDir = file '../../build/release'
archiveFileName = "BlueMap-${version}-spigot-1.16.2.jar"
archiveFileName = "BlueMap-${version}-spigot.jar"
//relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it
relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config'

View File

@ -38,6 +38,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bstats.bukkit.MetricsLite;
import org.bukkit.Bukkit;
@ -75,10 +77,15 @@ public BukkitPlugin() {
Logger.global = new JavaLogger(getLogger());
MinecraftVersion version = MinecraftVersion.getLatest();
//try to get best matching minecraft-version
try {
version = MinecraftVersion.fromVersionString(Bukkit.getVersion());
String versionString = getServer().getBukkitVersion();
Matcher versionMatcher = Pattern.compile("(\\d+\\.\\d+\\.\\d+)[-_].*").matcher(versionString);
if (!versionMatcher.matches()) throw new IllegalArgumentException();
version = MinecraftVersion.fromVersionString(versionMatcher.group(1));
} catch (IllegalArgumentException e) {
Logger.global.logWarning("Failed to find a matching version for version-string '" + Bukkit.getVersion() + "'! Using latest version: " + version.getVersionString());
Logger.global.logWarning("Failed to detect the minecraft version of this server! Using latest version: " + version.getVersionString());
}
this.onlinePlayerMap = new ConcurrentHashMap<>();

View File

@ -2,7 +2,7 @@ name: BlueMap
description: "A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)"
main: de.bluecolored.bluemap.bukkit.BukkitPlugin
version: ${version}
api-version: 1.16
api-version: 1.13
author: "Blue (TBlueF / Lukas Rieger)"
website: "https://github.com/BlueMap-Minecraft"
commands: