Archiviert
13
0

Initial update to 1.8.3

Dieser Commit ist enthalten in:
Dan Mulloy 2015-03-07 17:57:47 -05:00
Ursprung 0d4071f11e
Commit b0662b05c5
11 geänderte Dateien mit 69 neuen und 63 gelöschten Zeilen

Datei anzeigen

@ -240,13 +240,13 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version> <version>1.8.3-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId> <artifactId>spigot</artifactId>
<version>1.8-R0.1-SNAPSHOT</version> <version>1.8.3-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

Datei anzeigen

@ -781,28 +781,18 @@ public class MinecraftReflection {
*/ */
public static Class<?> getChatSerializerClass() { public static Class<?> getChatSerializerClass() {
try { try {
return getMinecraftClass("ChatSerializer"); return getMinecraftClass("IChatBaseComponent.ChatSerializer");
} catch (RuntimeException e) { } catch (RuntimeException e) {
// Analyse the ASM // ChatSerializer was moved into IChatBaseComponent in 1.8.3,
// but it was independent in 1.7-1.8
try { try {
List<AsmMethod> methodCalls = ClassAnalyser.getDefault().getMethodCalls( return getMinecraftClass("ChatSerializer");
PacketType.Play.Server.CHAT.getPacketClass(), } catch (RuntimeException e1) {
MinecraftMethods.getPacketReadByteBufMethod() // TODO: Figure out a good fallback
);
Class<?> packetSerializer = getPacketDataSerializerClass();
for (AsmMethod method : methodCalls) {
Class<?> owner = method.getOwnerClass();
if (isMinecraftClass(owner) && !owner.equals(packetSerializer)) {
return setMinecraftClass("ChatSerializer", owner);
}
}
} catch (Exception e1) {
throw new IllegalStateException("Cannot find ChatSerializer class.", e);
} }
throw new IllegalStateException("Could not find ChatSerializer class.", e);
} }
throw new IllegalStateException("Cannot find ChatSerializer class.");
} }
/** /**
@ -840,7 +830,7 @@ public class MinecraftReflection {
throw new IllegalStateException("ServerPingServerData is only supported in 1.7.2."); throw new IllegalStateException("ServerPingServerData is only supported in 1.7.2.");
try { try {
return getMinecraftClass("ServerPingServerData"); return getMinecraftClass("ServerPing.ServerData");
} catch (RuntimeException e) { } catch (RuntimeException e) {
Class<?> serverPing = getServerPingClass(); Class<?> serverPing = getServerPingClass();
@ -863,7 +853,7 @@ public class MinecraftReflection {
throw new IllegalStateException("ServerPingPlayerSample is only supported in 1.7.2."); throw new IllegalStateException("ServerPingPlayerSample is only supported in 1.7.2.");
try { try {
return getMinecraftClass("ServerPingPlayerSample"); return getMinecraftClass("ServerPing.ServerPingPlayerSample");
} catch (RuntimeException e) { } catch (RuntimeException e) {
Class<?> serverPing = getServerPingClass(); Class<?> serverPing = getServerPingClass();

Datei anzeigen

@ -3,21 +3,20 @@ package com.comphenix.protocol;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import net.minecraft.server.v1_8_R1.Block; import net.minecraft.server.v1_8_R2.Block;
import net.minecraft.server.v1_8_R1.Item; import net.minecraft.server.v1_8_R2.Item;
import net.minecraft.server.v1_8_R1.StatisticList; import net.minecraft.server.v1_8_R2.StatisticList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemFactory; import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import com.comphenix.protocol.reflect.FieldUtils; import com.comphenix.protocol.reflect.FieldUtils;
import com.comphenix.protocol.utility.Constants; import com.comphenix.protocol.utility.Constants;
import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.utility.MinecraftReflection;
// Will have to be updated for every version though
/** /**
* Used to ensure that ProtocolLib and Bukkit is prepared to be tested. * Used to ensure that ProtocolLib and Bukkit is prepared to be tested.
@ -39,7 +38,7 @@ public class BukkitInitialization {
initializePackage(); initializePackage();
try { try {
Block.R(); // Block.register(); Block.S(); // Block.register();
Item.t(); // Item.register(); Item.t(); // Item.register();
StatisticList.a(); // StatisticList.register(); StatisticList.a(); // StatisticList.register();
} catch (Throwable ex) { } catch (Throwable ex) {

Datei anzeigen

@ -21,12 +21,13 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_8_R1.AttributeModifier; import net.minecraft.server.v1_8_R2.AttributeModifier;
import net.minecraft.server.v1_8_R1.AttributeSnapshot; import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_8_R1.PacketPlayOutUpdateAttributes; import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.apache.commons.lang.SerializationUtils; import org.apache.commons.lang.SerializationUtils;
import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringBuilder;
@ -34,7 +35,7 @@ import org.apache.commons.lang.builder.ToStringStyle;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.WorldType; import org.bukkit.WorldType;
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -366,8 +367,17 @@ public class PacketContainerTest {
// Initialize some test data // Initialize some test data
List<AttributeModifier> modifiers = Lists.newArrayList( List<AttributeModifier> modifiers = Lists.newArrayList(
new AttributeModifier(UUID.randomUUID(), "Unknown synced attribute modifier", 10, 0)); new AttributeModifier(UUID.randomUUID(), "Unknown synced attribute modifier", 10, 0));
AttributeSnapshot snapshot = new AttributeSnapshot(
(PacketPlayOutUpdateAttributes) attribute.getHandle(), "generic.Maxhealth", 20.0, modifiers); // TODO This is hopefully just a temporary solution,
// but situations like this might be issues elsewhere
class PacketAccessor extends PacketPlayOutUpdateAttributes {
public AttributeSnapshot attributeSnapshot(String string, double d, Collection<AttributeModifier> coll) {
return new AttributeSnapshot(string, d, coll);
}
};
AttributeSnapshot snapshot = new PacketAccessor().attributeSnapshot("generic.Maxhealth", 20.0, modifiers);
attribute.getSpecificModifier(List.class).write(0, Lists.newArrayList(snapshot)); attribute.getSpecificModifier(List.class).write(0, Lists.newArrayList(snapshot));
PacketContainer cloned = attribute.deepClone(); PacketContainer cloned = attribute.deepClone();

Datei anzeigen

@ -4,12 +4,12 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import net.minecraft.server.v1_8_R1.ChatComponentText; import net.minecraft.server.v1_8_R2.ChatComponentText;
import net.minecraft.server.v1_8_R1.ChatSerializer; import net.minecraft.server.v1_8_R2.IChatBaseComponent;
import net.minecraft.server.v1_8_R1.IChatBaseComponent; import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R1.ServerPing; import net.minecraft.server.v1_8_R2.ServerPing;
import net.minecraft.server.v1_8_R1.ServerPingPlayerSample; import net.minecraft.server.v1_8_R2.ServerPing.ServerData;
import net.minecraft.server.v1_8_R1.ServerPingServerData; import net.minecraft.server.v1_8_R2.ServerPing.ServerPingPlayerSample;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -96,7 +96,7 @@ public class MinecraftReflectionTest {
@Test @Test
public void testServerPingServerData() { public void testServerPingServerData() {
assertEquals(ServerPingServerData.class, MinecraftReflection.getServerPingServerDataClass()); assertEquals(ServerData.class, MinecraftReflection.getServerPingServerDataClass());
} }
// @Test // @Test

Datei anzeigen

@ -8,10 +8,10 @@ import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import net.minecraft.server.v1_8_R1.IntHashMap; import net.minecraft.server.v1_8_R2.IntHashMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;

Datei anzeigen

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

Datei anzeigen

@ -1,12 +1,12 @@
package com.comphenix.protocol.wrappers; package com.comphenix.protocol.wrappers;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import net.minecraft.server.v1_8_R1.EnumChatVisibility; import net.minecraft.server.v1_8_R2.EntityHuman.EnumChatVisibility;
import net.minecraft.server.v1_8_R1.EnumClientCommand; import net.minecraft.server.v1_8_R2.EnumDifficulty;
import net.minecraft.server.v1_8_R1.EnumDifficulty; import net.minecraft.server.v1_8_R2.EnumProtocol;
import net.minecraft.server.v1_8_R1.EnumEntityUseAction; import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand.EnumClientCommand;
import net.minecraft.server.v1_8_R1.EnumGamemode; import net.minecraft.server.v1_8_R2.PacketPlayInUseEntity.EnumEntityUseAction;
import net.minecraft.server.v1_8_R1.EnumProtocol; import net.minecraft.server.v1_8_R2.WorldSettings.EnumGamemode;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;

Datei anzeigen

@ -4,11 +4,12 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.Collection;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_8_R1.AttributeModifier; import net.minecraft.server.v1_8_R2.AttributeModifier;
import net.minecraft.server.v1_8_R1.AttributeSnapshot; import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_8_R1.PacketPlayOutUpdateAttributes; import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -33,13 +34,13 @@ public class WrappedAttributeTest {
@Before @Before
public void setUp() { public void setUp() {
// Create a couple of modifiers // Create a couple of modifiers
doubleModifier = doubleModifier =
WrappedAttributeModifier.newBuilder(). WrappedAttributeModifier.newBuilder().
name("Double Damage"). name("Double Damage").
amount(1). amount(1).
operation(Operation.ADD_PERCENTAGE). operation(Operation.ADD_PERCENTAGE).
build(); build();
constantModifier = constantModifier =
WrappedAttributeModifier.newBuilder(). WrappedAttributeModifier.newBuilder().
name("Damage Bonus"). name("Damage Bonus").
amount(5). amount(5).
@ -84,9 +85,15 @@ public class WrappedAttributeTest {
for (WrappedAttributeModifier wrapper : attribute.getModifiers()) { for (WrappedAttributeModifier wrapper : attribute.getModifiers()) {
modifiers.add((AttributeModifier) wrapper.getHandle()); modifiers.add((AttributeModifier) wrapper.getHandle());
} }
return new AttributeSnapshot(
(PacketPlayOutUpdateAttributes) attribute.getParentPacket().getHandle(), class PacketAccessor extends PacketPlayOutUpdateAttributes {
attribute.getAttributeKey(), attribute.getBaseValue(), modifiers);
public AttributeSnapshot attributeSnapshot(String string, double d, Collection<AttributeModifier> coll) {
return new AttributeSnapshot(string, d, coll);
}
}
return new PacketAccessor().attributeSnapshot(attribute.getAttributeKey(), attribute.getBaseValue(), modifiers);
} }
private AttributeModifier getModifierCopy(WrappedAttributeModifier modifier) { private AttributeModifier getModifierCopy(WrappedAttributeModifier modifier) {

Datei anzeigen

@ -3,7 +3,7 @@ package com.comphenix.protocol.wrappers;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;

Datei anzeigen

@ -27,7 +27,7 @@ import java.io.DataOutput;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemFactory; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;