Update to 1.10

This commit is contained in:
Dan Mulloy 2016-06-08 22:28:53 -04:00
parent cdcb6a6007
commit f51427b63c
17 changed files with 76 additions and 88 deletions

View File

@ -196,13 +196,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -39,12 +39,12 @@ public class ProtocolLibrary {
/**
* The maximum version ProtocolLib has been tested with.
*/
public static final String MAXIMUM_MINECRAFT_VERSION = "1.9.4";
public static final String MAXIMUM_MINECRAFT_VERSION = "1.10";
/**
* The date (with ISO 8601 or YYYY-MM-DD) when the most recent version (1.9.4) was released.
*/
public static final String MINECRAFT_LAST_RELEASE_DATE = "2016-05-10";
public static final String MINECRAFT_LAST_RELEASE_DATE = "2016-06-08";
/**
* Plugins that are currently incompatible with ProtocolLib.

View File

@ -21,7 +21,7 @@ package com.comphenix.protocol.utility;
*/
public final class Constants {
public static final String PACKAGE_VERSION = "v1_9_R2";
public static final String PACKAGE_VERSION = "v1_10_R1";
public static final String NMS = "net.minecraft.server." + PACKAGE_VERSION;
public static final String OBC = "org.bukkit.craftbukkit." + PACKAGE_VERSION;
}

View File

@ -4,7 +4,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeMap;
import com.comphenix.protocol.ProtocolLibrary;
import com.google.common.collect.Maps;
/**
@ -42,6 +41,7 @@ public class MinecraftProtocolVersion {
map.put(new MinecraftVersion(1, 9, 0), 107);
map.put(new MinecraftVersion(1, 9, 2), 109);
map.put(new MinecraftVersion(1, 9, 4), 110);
map.put(new MinecraftVersion(1, 10, 0), 210);
return map;
}
@ -50,7 +50,7 @@ public class MinecraftProtocolVersion {
* @return The version number.
*/
public static int getCurrentVersion() {
return getVersion(ProtocolLibrary.getProtocolManager().getMinecraftVersion());
return getVersion(MinecraftVersion.getCurrentVersion());
}
/**

View File

@ -44,6 +44,11 @@ public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializa
*/
private static final Pattern VERSION_PATTERN = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)");
/**
* Version 1.10 - the frostburn update.
*/
public static final MinecraftVersion FROSTBURN_UPDATE = new MinecraftVersion("1.10");
/**
* Version 1.9 - the combat update.
*/

View File

@ -1,9 +1,5 @@
package com.comphenix.protocol.wrappers;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.ByteArrayInputStream;
@ -19,14 +15,13 @@ import org.bukkit.Server;
import org.bukkit.entity.Player;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.injector.BukkitUnwrapper;
import com.comphenix.protocol.reflect.EquivalentConverter;
import com.comphenix.protocol.reflect.accessors.Accessors;
import com.comphenix.protocol.reflect.accessors.ConstructorAccessor;
import com.comphenix.protocol.reflect.accessors.FieldAccessor;
import com.comphenix.protocol.reflect.accessors.MethodAccessor;
import com.comphenix.protocol.utility.MinecraftProtocolVersion;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.utility.MinecraftVersion;
import com.comphenix.protocol.utility.Util;
@ -34,25 +29,18 @@ import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64;
/**
* Represents a server ping packet data.
* @author Kristian
*/
public class WrappedServerPing extends AbstractWrapper {
/**
* Lookup of Minecraft versions and ping version numbers.
*/
private static ImmutableMap<MinecraftVersion, Integer> VERSION_NUMBERS = ImmutableMap.<MinecraftVersion, Integer>builder()
.put(MinecraftVersion.WORLD_UPDATE, 4)
.put(MinecraftVersion.SKIN_UPDATE, 5)
.put(MinecraftVersion.BOUNTIFUL_UPDATE, 47)
.build();
private static MinecraftVersion LAST_VERSION = MinecraftVersion.BOUNTIFUL_UPDATE;
private static Class<?> GAME_PROFILE = MinecraftReflection.getGameProfileClass();
private static Class<?> GAME_PROFILE_ARRAY = MinecraftReflection.getArrayClass(GAME_PROFILE);
@ -101,7 +89,7 @@ public class WrappedServerPing extends AbstractWrapper {
/**
* Construct a new server ping initialized with a zero player count, and zero maximum.
* <p>
* Note that the version string is set to 1.8.
* Note that the version string is set to 1.9.4.
*/
public WrappedServerPing() {
super(MinecraftReflection.getServerPingClass());
@ -129,14 +117,8 @@ public class WrappedServerPing extends AbstractWrapper {
* Reset the version string to the default state.
*/
protected void resetVersion() {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
MinecraftVersion minecraftVersion = LAST_VERSION;
// Fetch the latest known version
if (manager != null) {
minecraftVersion = manager.getMinecraftVersion();
}
version = VERSION_CONSTRUCTOR.invoke(minecraftVersion.toString(), VERSION_NUMBERS.get(minecraftVersion));
MinecraftVersion minecraftVersion = MinecraftVersion.getCurrentVersion();
version = VERSION_CONSTRUCTOR.invoke(minecraftVersion.toString(), MinecraftProtocolVersion.getCurrentVersion());
VERSION.set(handle, version);
}

View File

@ -234,13 +234,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -5,18 +5,18 @@ import static org.mockito.Mockito.when;
import java.util.logging.Logger;
import net.minecraft.server.v1_9_R2.DispenserRegistry;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.craftbukkit.v1_9_R2.CraftServer;
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemFactory;
import org.bukkit.craftbukkit.v1_9_R2.util.Versioning;
import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemFactory;
import org.bukkit.craftbukkit.v1_10_R1.util.Versioning;
import com.comphenix.protocol.utility.Constants;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.utility.MinecraftVersion;
import net.minecraft.server.v1_10_R1.DispenserRegistry;
/**
* Used to ensure that ProtocolLib and Bukkit is prepared to be tested.
*

View File

@ -14,7 +14,7 @@ import com.comphenix.protocol.PacketType.Sender;
import com.comphenix.protocol.injector.netty.NettyProtocolRegistry;
import com.comphenix.protocol.injector.netty.ProtocolRegistry;
import net.minecraft.server.v1_9_R2.PacketLoginInStart;
import net.minecraft.server.v1_10_R1.PacketLoginInStart;
public class PacketTypeTest {

View File

@ -28,16 +28,6 @@ import java.util.List;
import java.util.Objects;
import java.util.UUID;
import net.minecraft.server.v1_9_R2.AttributeModifier;
import net.minecraft.server.v1_9_R2.DataWatcher;
import net.minecraft.server.v1_9_R2.Entity;
import net.minecraft.server.v1_9_R2.EntityLightning;
import net.minecraft.server.v1_9_R2.MobEffect;
import net.minecraft.server.v1_9_R2.MobEffectList;
import net.minecraft.server.v1_9_R2.PacketPlayOutBoss;
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.apache.commons.lang.SerializationUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.bukkit.ChatColor;
@ -76,6 +66,16 @@ import com.comphenix.protocol.wrappers.nbt.NbtCompound;
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
import com.google.common.collect.Lists;
import net.minecraft.server.v1_10_R1.AttributeModifier;
import net.minecraft.server.v1_10_R1.DataWatcher;
import net.minecraft.server.v1_10_R1.Entity;
import net.minecraft.server.v1_10_R1.EntityLightning;
import net.minecraft.server.v1_10_R1.MobEffect;
import net.minecraft.server.v1_10_R1.MobEffectList;
import net.minecraft.server.v1_10_R1.PacketPlayOutBoss;
import net.minecraft.server.v1_10_R1.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_10_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
// Ensure that the CraftItemFactory is mockable
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })

View File

@ -18,18 +18,18 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
import com.comphenix.protocol.BukkitInitialization;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_9_R2.ChatComponentText;
import net.minecraft.server.v1_9_R2.ChunkCoordIntPair;
import net.minecraft.server.v1_9_R2.DataWatcher;
import net.minecraft.server.v1_9_R2.IBlockData;
import net.minecraft.server.v1_9_R2.IChatBaseComponent;
import net.minecraft.server.v1_9_R2.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_9_R2.NBTCompressedStreamTools;
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import net.minecraft.server.v1_9_R2.PlayerConnection;
import net.minecraft.server.v1_9_R2.ServerPing;
import net.minecraft.server.v1_9_R2.ServerPing.ServerData;
import net.minecraft.server.v1_9_R2.ServerPing.ServerPingPlayerSample;
import net.minecraft.server.v1_10_R1.ChatComponentText;
import net.minecraft.server.v1_10_R1.ChunkCoordIntPair;
import net.minecraft.server.v1_10_R1.DataWatcher;
import net.minecraft.server.v1_10_R1.IBlockData;
import net.minecraft.server.v1_10_R1.IChatBaseComponent;
import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_10_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_10_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import net.minecraft.server.v1_10_R1.PlayerConnection;
import net.minecraft.server.v1_10_R1.ServerPing;
import net.minecraft.server.v1_10_R1.ServerPing.ServerData;
import net.minecraft.server.v1_10_R1.ServerPing.ServerPingPlayerSample;
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })

View File

@ -8,8 +8,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.server.v1_9_R2.IntHashMap;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
@ -24,6 +22,8 @@ import com.comphenix.protocol.BukkitInitialization;
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
import net.minecraft.server.v1_10_R1.IntHashMap;
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
//@PrepareForTest(CraftItemFactory.class)

View File

@ -16,15 +16,15 @@ public class ChunkCoordIntPairTest {
@Test
public void test() {
net.minecraft.server.v1_9_R2.ChunkCoordIntPair pair = new net.minecraft.server.v1_9_R2.ChunkCoordIntPair(1, 2);
net.minecraft.server.v1_10_R1.ChunkCoordIntPair pair = new net.minecraft.server.v1_10_R1.ChunkCoordIntPair(1, 2);
ChunkCoordIntPair specific = ChunkCoordIntPair.getConverter().getSpecific(pair);
assertEquals(1, specific.getChunkX());
assertEquals(2, specific.getChunkZ());
net.minecraft.server.v1_9_R2.ChunkCoordIntPair roundtrip =
(net.minecraft.server.v1_9_R2.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
getGeneric(net.minecraft.server.v1_9_R2.ChunkCoordIntPair.class, specific);
net.minecraft.server.v1_10_R1.ChunkCoordIntPair roundtrip =
(net.minecraft.server.v1_10_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
getGeneric(net.minecraft.server.v1_10_R1.ChunkCoordIntPair.class, specific);
assertEquals(1, roundtrip.x);
assertEquals(2, roundtrip.z);

View File

@ -1,12 +1,6 @@
package com.comphenix.protocol.wrappers;
import static org.junit.Assert.assertEquals;
import net.minecraft.server.v1_9_R2.EntityHuman.EnumChatVisibility;
import net.minecraft.server.v1_9_R2.EnumDifficulty;
import net.minecraft.server.v1_9_R2.EnumProtocol;
import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand.EnumClientCommand;
import net.minecraft.server.v1_9_R2.PacketPlayInUseEntity.EnumEntityUseAction;
import net.minecraft.server.v1_9_R2.WorldSettings.EnumGamemode;
import org.junit.BeforeClass;
import org.junit.Test;
@ -16,6 +10,13 @@ import com.comphenix.protocol.reflect.EquivalentConverter;
import com.comphenix.protocol.reflect.accessors.Accessors;
import com.comphenix.protocol.reflect.accessors.FieldAccessor;
import net.minecraft.server.v1_10_R1.EntityHuman.EnumChatVisibility;
import net.minecraft.server.v1_10_R1.EnumDifficulty;
import net.minecraft.server.v1_10_R1.EnumGamemode;
import net.minecraft.server.v1_10_R1.EnumProtocol;
import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand.EnumClientCommand;
import net.minecraft.server.v1_10_R1.PacketPlayInUseEntity.EnumEntityUseAction;
public class EnumWrappersTest {
private static class EnumClass {
public EnumProtocol protocol;

View File

@ -6,10 +6,6 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import net.minecraft.server.v1_9_R2.AttributeModifier;
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_9_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -20,6 +16,10 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedAttributeModifier.Operation;
import com.google.common.collect.Lists;
import net.minecraft.server.v1_10_R1.AttributeModifier;
import net.minecraft.server.v1_10_R1.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_10_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
public class WrappedAttributeTest {
private WrappedAttributeModifier doubleModifier;
private WrappedAttributeModifier constantModifier;

View File

@ -24,10 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.util.UUID;
import net.minecraft.server.v1_9_R2.EntityLightning;
import net.minecraft.server.v1_9_R2.ItemStack;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftLightningStrike;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftLightningStrike;
import org.bukkit.entity.Entity;
import org.junit.BeforeClass;
import org.junit.Test;
@ -37,6 +34,9 @@ import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
import net.minecraft.server.v1_10_R1.EntityLightning;
import net.minecraft.server.v1_10_R1.ItemStack;
/**
* @author dmulloy2
*/
@ -92,8 +92,8 @@ public class WrappedDataWatcherTest {
@Test
public void testSerializers() {
Serializer blockPos = Registry.get(net.minecraft.server.v1_9_R2.BlockPosition.class, false);
Serializer optionalBlockPos = Registry.get(net.minecraft.server.v1_9_R2.BlockPosition.class, true);
Serializer blockPos = Registry.get(net.minecraft.server.v1_10_R1.BlockPosition.class, false);
Serializer optionalBlockPos = Registry.get(net.minecraft.server.v1_10_R1.BlockPosition.class, true);
assertNotSame(blockPos, optionalBlockPos);
assertNull(Registry.get(ItemStack.class, false));

View File

@ -26,9 +26,6 @@ import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import net.minecraft.server.v1_9_R2.ItemStack;
import net.minecraft.server.v1_9_R2.Items;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -38,6 +35,9 @@ import com.comphenix.protocol.BukkitInitialization;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.nbt.io.NbtBinarySerializer;
import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_10_R1.Items;
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
//@PrepareForTest(CraftItemFactory.class)