diff --git a/build.gradle b/build.gradle index d3e7ab0..449a446 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/src/main/java/exopandora/worldhandler/Main.java b/src/main/java/exopandora/worldhandler/Main.java index 366b52c..ddb79d8 100644 --- a/src/main/java/exopandora/worldhandler/Main.java +++ b/src/main/java/exopandora/worldhandler/Main.java @@ -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) { diff --git a/src/main/java/exopandora/worldhandler/WorldHandler.java b/src/main/java/exopandora/worldhandler/WorldHandler.java index ca72850..9761244 100644 --- a/src/main/java/exopandora/worldhandler/WorldHandler.java +++ b/src/main/java/exopandora/worldhandler/WorldHandler.java @@ -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()); } diff --git a/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java b/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java index 6969162..f2d02b1 100644 --- a/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java +++ b/src/main/java/exopandora/worldhandler/command/CommandWorldHandler.java @@ -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 { diff --git a/src/main/java/exopandora/worldhandler/gui/container/impl/GuiWorldHandlerContainer.java b/src/main/java/exopandora/worldhandler/gui/container/impl/GuiWorldHandlerContainer.java index 20cd80a..d988f2b 100644 --- a/src/main/java/exopandora/worldhandler/gui/container/impl/GuiWorldHandlerContainer.java +++ b/src/main/java/exopandora/worldhandler/gui/container/impl/GuiWorldHandlerContainer.java @@ -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 diff --git a/src/main/java/exopandora/worldhandler/installer/ForumListener.java b/src/main/java/exopandora/worldhandler/installer/ForumListener.java index 9bc7a8d..490bcbd 100644 --- a/src/main/java/exopandora/worldhandler/installer/ForumListener.java +++ b/src/main/java/exopandora/worldhandler/installer/ForumListener.java @@ -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 } } } -} - \ No newline at end of file +} \ No newline at end of file diff --git a/src/main/java/exopandora/worldhandler/installer/InstallListener.java b/src/main/java/exopandora/worldhandler/installer/InstallListener.java index cc95c9a..f8d4cab 100644 --- a/src/main/java/exopandora/worldhandler/installer/InstallListener.java +++ b/src/main/java/exopandora/worldhandler/installer/InstallListener.java @@ -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) { diff --git a/src/main/java/exopandora/worldhandler/installer/Window.java b/src/main/java/exopandora/worldhandler/installer/Window.java index 6c87c03..bf1f685 100644 --- a/src/main/java/exopandora/worldhandler/installer/Window.java +++ b/src/main/java/exopandora/worldhandler/installer/Window.java @@ -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