Move version numbers, urls and certificate hash to build.gradle

This commit is contained in:
Marcel Konrad
2018-04-11 15:22:10 +02:00
parent e6f0fe4c4d
commit 1c353c664c
8 changed files with 30 additions and 27 deletions

View File

@@ -10,9 +10,15 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
def mcversion = "1.12.2"
def modversion = "2.1.2"
def mccompatible = "1.12"
def url = "https://minecraft.curseforge.com/projects/world-handler-command-gui"
def update_url = "https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json"
def certificate = "d6261bb645f41db84c74f98e512c2bb43f188af2"
version = "1.12.2-2.1.1"
group = "src.worldhandler.main.WorldHandler" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
version = mcversion + "-" + modversion
group = "exopandora.worldhandler.WorldHandler" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "WorldHandler"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
@@ -22,7 +28,7 @@ compileJava {
jar {
manifest {
attributes 'Main-Class': 'exopandora.worldhandler.main.Main'
attributes 'Main-Class': 'exopandora.worldhandler.Main'
}
}
@@ -39,7 +45,14 @@ build.dependsOn signJar
minecraft {
version = "1.12.2-14.23.2.2611"
runDir = "run"
replace '$version', modversion
replace '$mcversion', mcversion
replace '$compatible', mccompatible
replace '$url', url
replace '$update_url', update_url
replace '$certificate', certificate
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
@@ -81,11 +94,11 @@ processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'

View File

@@ -15,14 +15,6 @@ public class Main
{
public static final String NAME = "World Handler";
public static final String MODID = "worldhandler";
public static final String MC_VERSION = "1.12.2";
public static final String MC_COMPATIBLE = "1.12";
public static final String VERSION = "2.1.1";
public static final String FULL_VERSION = MC_VERSION + "-" + VERSION;
public static final String NAME_AND_VERSION = NAME + " " + FULL_VERSION;
public static final String URL = "https://minecraft.curseforge.com/projects/world-handler-command-gui";
public static final String UPDATE_URL = "https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json";
public static final String CERTIFICATE = "d6261bb645f41db84c74f98e512c2bb43f188af2";
public static void main(String[] args)
{

View File

@@ -37,7 +37,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
@Mod(modid = Main.MODID, name = Main.NAME, acceptedMinecraftVersions = "[" + Main.MC_COMPATIBLE + ",)", version = Main.VERSION, canBeDeactivated = false, guiFactory = "exopandora.worldhandler.gui.config.GuiFactoryWorldHandler", updateJSON = Main.UPDATE_URL, clientSideOnly = true, certificateFingerprint = Main.CERTIFICATE)
@Mod(modid = Main.MODID, name = Main.NAME, acceptedMinecraftVersions = "[$compatible,)", version = "$version", canBeDeactivated = false, guiFactory = "exopandora.worldhandler.gui.config.GuiFactoryWorldHandler", updateJSON = "$update_url", clientSideOnly = true, certificateFingerprint = "$certificate")
public class WorldHandler
{
@Instance(Main.MODID)
@@ -65,7 +65,7 @@ public class WorldHandler
LOGGER = event.getModLog();
LOGGER.info("Pre-Initialisation");
LOGGER.info("First Release on March 28 2013 - 02:29 PM CET by Exopandora");
LOGGER.info("Latest Version: " + Main.URL);
LOGGER.info("Latest Version: $url");
CONFIG = new Configuration(event.getSuggestedConfigurationFile());
}

View File

@@ -53,9 +53,9 @@ public class CommandWorldHandler extends CommandBase
}
else if(args[0].equalsIgnoreCase("version"))
{
sender.sendMessage(new TextComponentString("Installed: " + Main.MC_VERSION + "-" + Main.VERSION));
sender.sendMessage(new TextComponentString("Installed: $mcversion-$version"));
ComparableVersion target = ForgeVersion.getResult(Loader.instance().getIndexedModList().get(Main.MODID)).target;
sender.sendMessage(new TextComponentString("Latest: " + Main.MC_VERSION + "-" + (target != null ? target : Main.VERSION)));
sender.sendMessage(new TextComponentString("Latest: $mcversion-" + (target != null ? target : "$version")));
}
else
{

View File

@@ -541,7 +541,7 @@ public class GuiWorldHandlerContainer extends Container
final int hexAlpha = (int) (0xFF * 0.2) << 24;
final int color = ConfigSkin.getLabelColor() + hexAlpha;
this.fontRenderer.drawString(Main.MC_VERSION + "-" + Main.VERSION, this.width - this.fontRenderer.getStringWidth(Main.MC_VERSION + "-" + Main.VERSION) - 2, this.height - 10, color);
this.fontRenderer.drawString("$mcversion-$version", this.width - this.fontRenderer.getStringWidth("$mcversion-$version") - 2, this.height - 10, color);
//TITLE

View File

@@ -5,7 +5,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import exopandora.worldhandler.Main;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -19,7 +18,7 @@ public class ForumListener implements ActionListener
{
try
{
Desktop.getDesktop().browse(new URI(Main.URL));
Desktop.getDesktop().browse(new URI("$url"));
}
catch(Exception e)
{
@@ -27,5 +26,4 @@ public class ForumListener implements ActionListener
}
}
}
}
}

View File

@@ -37,7 +37,7 @@ public class InstallListener implements ActionListener
File mods = new File(directory, "mods");
File versions = new File(directory, "versions");
if(!this.isPartialFileNameInFolder(versions, Main.MC_VERSION, "Forge"))
if(!this.isPartialFileNameInFolder(versions, "$mcversion", "Forge"))
{
JOptionPane.showMessageDialog(null, "Please install Mineceaft Forge", null, JOptionPane.ERROR_MESSAGE);
}
@@ -54,8 +54,8 @@ public class InstallListener implements ActionListener
try
{
Path path = new File(InstallListener.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).toPath();
Files.copy(path, new File(mods, "WorldHandler-" + Main.FULL_VERSION + "-Universal.jar").toPath(), StandardCopyOption.REPLACE_EXISTING);
JOptionPane.showMessageDialog(null, Main.NAME_AND_VERSION + " has been successfully installed", null, JOptionPane.INFORMATION_MESSAGE);
Files.copy(path, new File(mods, "WorldHandler-$mcversion-$version-Universal.jar").toPath(), StandardCopyOption.REPLACE_EXISTING);
JOptionPane.showMessageDialog(null, Main.NAME + " $mcversion-$version has been successfully installed", null, JOptionPane.INFORMATION_MESSAGE);
}
catch(Exception e)
{

View File

@@ -24,7 +24,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class Window implements Runnable
{
private final String title = Main.NAME_AND_VERSION + " Installer";
private final String title = Main.NAME + " $mcversion-$version Installer";
private final JFrame frame = new JFrame();
@Override