mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-07 19:28:11 +01:00
Move magic values to pom
This commit is contained in:
parent
e30bd2fd66
commit
81146d6f0a
26
Components/Minepacks-MagicValues/pom.xml
Normal file
26
Components/Minepacks-MagicValues/pom.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>Minepacks-MagicValues</artifactId>
|
||||
<parent>
|
||||
<artifactId>Minepacks-Parent</artifactId>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Minepacks-MagicValues</name>
|
||||
<description>Contains the magic values used by Minepacks.</description>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,3 @@
|
||||
LanguageFileVersion=${languageFileVersion}
|
||||
ConfigFileVersion=${configFileVersion}
|
||||
PCGFPluginLibVersion=${pcgfPluginLibVersion}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2023 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MagicValues
|
||||
{
|
||||
public static final int LANG_VERSION;
|
||||
public static final int CONFIG_VERSION;
|
||||
public static final String MIN_PCGF_PLUGIN_LIB_VERSION;
|
||||
public static final String MIN_MC_VERSION_FOR_UPDATES = "1.8";
|
||||
|
||||
static
|
||||
{
|
||||
String pcgfPluginLibVersion = "99999", langVersion = "0", configVersion = "0";
|
||||
|
||||
try(InputStream propertiesStream = MagicValues.class.getClassLoader().getResourceAsStream("Minepacks.properties"))
|
||||
{
|
||||
Properties properties = new Properties();
|
||||
properties.load(propertiesStream);
|
||||
|
||||
pcgfPluginLibVersion = properties.getProperty("PCGFPluginLibVersion");
|
||||
langVersion = properties.getProperty("LanguageFileVersion");
|
||||
configVersion = properties.getProperty("ConfigFileVersion");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
MIN_PCGF_PLUGIN_LIB_VERSION = pcgfPluginLibVersion;
|
||||
// Try to parse the version strings, fall back to a known min version
|
||||
LANG_VERSION = tryParse(langVersion, 20);
|
||||
CONFIG_VERSION = tryParse(configVersion, 33);
|
||||
}
|
||||
|
||||
private static int tryParse(@NotNull String string, int fallbackValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(string);
|
||||
}
|
||||
catch (NumberFormatException ignored)
|
||||
{
|
||||
System.out.println("Failed to parse integer '" + string + "'! Falling back to: " + fallbackValue);
|
||||
}
|
||||
return fallbackValue;
|
||||
}
|
||||
|
||||
private MagicValues() { /* You should not create an instance of this utility class! */ }
|
||||
}
|
@ -26,6 +26,10 @@
|
||||
<releaseType>Normal</releaseType>
|
||||
<updateChannel>Release</updateChannel>
|
||||
<mavenShade.version>3.3.0</mavenShade.version>
|
||||
|
||||
<configFileVersion>33</configFileVersion>
|
||||
<languageFileVersion>20</languageFileVersion>
|
||||
<pcgfPluginLibVersion>1.0.39-SNAPSHOT</pcgfPluginLibVersion>
|
||||
</properties>
|
||||
|
||||
<pluginRepositories>
|
||||
@ -42,11 +46,16 @@
|
||||
<artifactId>Minepacks-API</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks-MagicValues</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- PCGF Plugin Lib -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
<version>1.0.38-SNAPSHOT</version>
|
||||
<version>${pcgfPluginLibVersion}</version>
|
||||
</dependency>
|
||||
<!-- BadRabbit -->
|
||||
<dependency>
|
||||
@ -104,6 +113,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:Minepacks-MagicValues</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
@ -175,6 +185,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:Minepacks-MagicValues</include>
|
||||
<include>at.pcgamingfreaks:PluginLib</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
@ -270,6 +281,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:Minepacks-MagicValues</include>
|
||||
<include>at.pcgamingfreaks:BadRabbit-Bukkit</include>
|
||||
<include>at.pcgamingfreaks:Minepacks</include>
|
||||
</includes>
|
||||
|
@ -219,4 +219,4 @@ Misc:
|
||||
UseBungeeCord: false
|
||||
|
||||
# Config file version. Don't touch it!
|
||||
Version: 33
|
||||
Version: ${configFileVersion}
|
@ -122,4 +122,4 @@ LanguageName: "english"
|
||||
Author: "GeorgH93"
|
||||
|
||||
# Language file version. Don't touch it!
|
||||
Version: 20
|
||||
Version: ${languageFileVersion}
|
@ -20,9 +20,9 @@
|
||||
import at.pcgamingfreaks.Bukkit.MCVersion;
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.MagicValues;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
import at.pcgamingfreaks.Minepacks.MagicValues;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -48,7 +48,7 @@ public UpdateCommand(Minepacks plugin)
|
||||
@Override
|
||||
public void execute(@NotNull final CommandSender sender, final @NotNull String mainCommandAlias, final @NotNull String alias, final @NotNull String[] args)
|
||||
{
|
||||
if(MCVersion.isNewerOrEqualThan(MagicValues.MIN_MC_VERSION_FOR_UPDATES))
|
||||
if(MCVersion.isNewerOrEqualThan(MCVersion.getFromVersionName(MagicValues.MIN_MC_VERSION_FOR_UPDATES)))
|
||||
{
|
||||
messageCheckingForUpdates.send(sender);
|
||||
/*if_not[STANDALONE]*/
|
||||
|
@ -27,9 +27,9 @@
|
||||
import at.pcgamingfreaks.Database.DatabaseConnectionConfiguration;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.OldFileUpdater;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.MagicValues;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.ShrinkApproach;
|
||||
import at.pcgamingfreaks.Minepacks.MagicValues;
|
||||
import at.pcgamingfreaks.Version;
|
||||
|
||||
import org.bukkit.*;
|
||||
@ -205,7 +205,7 @@ public ShrinkApproach getShrinkApproach()
|
||||
//region Misc getters
|
||||
public boolean useUpdater()
|
||||
{
|
||||
return (MCVersion.isNewerOrEqualThan(MagicValues.MIN_MC_VERSION_FOR_UPDATES)) && getConfigE().getBoolean("Misc.AutoUpdate.Enabled", getConfigE().getBoolean("Misc.AutoUpdate", true));
|
||||
return (MCVersion.isNewerOrEqualThan(MCVersion.getFromVersionName(MagicValues.MIN_MC_VERSION_FOR_UPDATES))) && getConfigE().getBoolean("Misc.AutoUpdate.Enabled", getConfigE().getBoolean("Misc.AutoUpdate", true));
|
||||
}
|
||||
|
||||
public String getUpdateChannel()
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit;
|
||||
|
||||
import at.pcgamingfreaks.Bukkit.MCVersion;
|
||||
|
||||
public class MagicValues
|
||||
{
|
||||
public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.36-SNAPSHOT";
|
||||
public static final MCVersion MIN_MC_VERSION_FOR_UPDATES = MCVersion.MC_1_8;
|
||||
}
|
@ -32,6 +32,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
|
||||
import at.pcgamingfreaks.Minepacks.MagicValues;
|
||||
import at.pcgamingfreaks.Plugin.IPlugin;
|
||||
import at.pcgamingfreaks.StringUtils;
|
||||
import at.pcgamingfreaks.Updater.UpdateResponseCallback;
|
||||
|
@ -18,6 +18,7 @@
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit;
|
||||
|
||||
import at.pcgamingfreaks.BadRabbit.Bukkit.BadRabbit;
|
||||
import at.pcgamingfreaks.Minepacks.MagicValues;
|
||||
import at.pcgamingfreaks.Version;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
Loading…
Reference in New Issue
Block a user