From b9818cace7cd342ea9b0fa16aecbe139c9e445a5 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Fri, 28 Nov 2014 22:36:47 -0500 Subject: [PATCH] Update some version stuff --- .gitignore | 3 +++ .../comphenix/protocol/ProtocolLibrary.java | 4 +-- .../protocol/utility/MinecraftVersion.java | 27 +++++++++++-------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 71db6a9a..8d5020f2 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,6 @@ pip-log.txt # Mac crap .DS_Store + +# Maven +logs/ diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java index 20675c4b..ec82810f 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java @@ -87,12 +87,12 @@ public class ProtocolLibrary extends JavaPlugin { /** * The maximum version ProtocolLib has been tested with, */ - public static final String MAXIMUM_MINECRAFT_VERSION = "1.7.10"; + public static final String MAXIMUM_MINECRAFT_VERSION = "1.8"; /** * The date (with ISO 8601 or YYYY-MM-DD) when the most recent version was released. */ - public static final String MINECRAFT_LAST_RELEASE_DATE = "2013-12-10"; + public static final String MINECRAFT_LAST_RELEASE_DATE = "2014-09-02"; // Different commands private enum ProtocolCommand { diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java index 0fcf38e3..a5903fa3 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java @@ -2,16 +2,16 @@ * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. * Copyright (C) 2012 Kristian S. Stangeland * - * 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 2 of + * 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 2 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. + * 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * You should have received a copy of the GNU General Public License along with this program; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA */ @@ -42,6 +42,11 @@ public class MinecraftVersion implements Comparable, Serializa * Regular expression used to parse version strings. */ private static final String VERSION_PATTERN = ".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)"; + + /** + * Version 1.8 - the "bountiful" update. + */ + public static final MinecraftVersion BOUNTIFUL_UPDATE = new MinecraftVersion("1.8"); /** * Version 1.7.8 - the update that changed the skin format (and distribution - R.I.P. player disguise) @@ -73,7 +78,7 @@ public class MinecraftVersion implements Comparable, Serializa private final int build; // The development stage - private final String development; + private final String development; // Snapshot? private final SnapshotVersion snapshot; @@ -165,7 +170,7 @@ public class MinecraftVersion implements Comparable, Serializa String[] elements = version.split("\\."); int[] numbers = new int[3]; - // Make sure it's even a valid version + // Make sure it's even a valid version if (elements.length < 1) throw new IllegalStateException("Corrupt MC version: " + version); @@ -231,7 +236,7 @@ public class MinecraftVersion implements Comparable, Serializa if (getDevelopmentStage() == null) return String.format("%s.%s.%s", getMajor(), getMinor(), getBuild()); else - return String.format("%s.%s.%s-%s%s", getMajor(), getMinor(), getBuild(), + return String.format("%s.%s.%s-%s%s", getMajor(), getMinor(), getBuild(), getDevelopmentStage(), isSnapshot() ? snapshot : ""); } @@ -260,8 +265,8 @@ public class MinecraftVersion implements Comparable, Serializa if (obj instanceof MinecraftVersion) { MinecraftVersion other = (MinecraftVersion) obj; - return getMajor() == other.getMajor() && - getMinor() == other.getMinor() && + return getMajor() == other.getMajor() && + getMinor() == other.getMinor() && getBuild() == other.getBuild() && Objects.equal(getDevelopmentStage(), other.getDevelopmentStage()); }