Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.chef.mod;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.event.ClickEvent;
- import net.minecraft.event.ClickEvent.Action;
- import net.minecraft.util.ChatComponentText;
- import net.minecraft.util.ChatStyle;
- import net.minecraft.util.EnumChatFormatting;
- import net.minecraft.util.IChatComponent;
- public class VersionCheck {
- static String newVersion = "6.0";
- public static void checkVersion(EntityPlayer player) {
- String[] newVersionStringArray = newVersion.split("\\.");
- String[] usingVersionStringArray = Reference.VERSION.split("\\.");
- int[] newVersionArray = new int[3];
- int[] usingVersionArray = new int[3];
- for (int i = 0; i < newVersionStringArray.length; i++) {
- int a = Integer.parseInt(newVersionStringArray[i]);
- newVersionArray[i] = a;
- }
- for (int i = 0; i < usingVersionStringArray.length; i++) {
- int a = Integer.parseInt(usingVersionStringArray[i]);
- usingVersionArray[i] = a;
- }
- if (newVersionArray[0] > usingVersionArray[0] || newVersionArray[1] > usingVersionArray[1] || newVersionArray[2] > usingVersionArray[2]) {
- ClickEvent openUrl = new ClickEvent(Action.OPEN_URL, "http://minetronic.com/masterchef_downloads.php");
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "New version available! (V" + newVersion + ")."));
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Please update the master chef mod."));
- player.addChatMessage((IChatComponent) new ChatComponentText(EnumChatFormatting.YELLOW + "http://minetronic.com/masterchef_downloads.php").getChatStyle().setChatClickEvent(openUrl));
- }
- Debugger.log("De huidige versie is: " + Reference.VERSION);
- Debugger.log("De nieuwe versie is: " + newVersion);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment