Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main.java - Addition
- public static int onlineVersion;
- public static void main(String[] args) throws IOException {
- String str = "";
- String readText ="0";
- try {
- // Create a URL for the desired page
- URL url = new URL("http://dl.canarymod.net:80/version.txt");
- // Read all the text returned by the server
- BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
- while ((str = in.readLine()) != null) {
- onlineVersion = Integer.parseInt(str);
- }
- in.close();
- } catch (MalformedURLException e) {
- } catch (IOException e) {
- }
- if (etc.getInstance().getVersion() == Integer.parseInt(readText))
- log("Thank you for running the latest version of Canary");
- else
- log("There is an updated version of Canary available at:\nhttp://dl.canarymod.net/get.php?v=latest");
- Player.java - Addition/Modification @End of /mspawn
- } else if (cmd.equals("/update")){
- if (Main.onlineVersion == etc.getInstance().getVersion())
- sendMessage(Colors.Rose + "You have the latest version of Canary.");
- else
- sendMessage(Colors.Rose + "You need to update your version of Canary.");
- ServerConsoleCommands.java - Modified
- public final static BaseCommand version = new BaseCommand("- Displays the server version and checks for updates") {
- @Override
- void execute(MessageReceiver caller, String[] parameters) {
- if (!etc.getInstance().getTainted())
- caller.notify(Colors.Gold + "Canary Server Mod Build " + etc.getInstance().getVersion());
- else
- caller.notify(Colors.Gold + "Unofficial CanaryMod Build " + etc.getInstance().getVersionStr());
- if (Main.onlineVersion == etc.getInstance().getVersion())
- caller.notify(Colors.Gold + "Your have the latest version of Canary.");
- else
- caller.notify(Colors.Rose + "You need to update your version of Canary.");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment