Initial update to 1.8.3
Dieser Commit ist enthalten in:
Ursprung
0d4071f11e
Commit
b0662b05c5
@ -240,13 +240,13 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -781,28 +781,18 @@ public class MinecraftReflection {
|
||||
*/
|
||||
public static Class<?> getChatSerializerClass() {
|
||||
try {
|
||||
return getMinecraftClass("ChatSerializer");
|
||||
return getMinecraftClass("IChatBaseComponent.ChatSerializer");
|
||||
} 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 {
|
||||
List<AsmMethod> methodCalls = ClassAnalyser.getDefault().getMethodCalls(
|
||||
PacketType.Play.Server.CHAT.getPacketClass(),
|
||||
MinecraftMethods.getPacketReadByteBufMethod()
|
||||
);
|
||||
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);
|
||||
return getMinecraftClass("ChatSerializer");
|
||||
} catch (RuntimeException e1) {
|
||||
// TODO: Figure out a good fallback
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
try {
|
||||
return getMinecraftClass("ServerPingServerData");
|
||||
return getMinecraftClass("ServerPing.ServerData");
|
||||
} catch (RuntimeException e) {
|
||||
Class<?> serverPing = getServerPingClass();
|
||||
|
||||
@ -863,7 +853,7 @@ public class MinecraftReflection {
|
||||
throw new IllegalStateException("ServerPingPlayerSample is only supported in 1.7.2.");
|
||||
|
||||
try {
|
||||
return getMinecraftClass("ServerPingPlayerSample");
|
||||
return getMinecraftClass("ServerPing.ServerPingPlayerSample");
|
||||
} catch (RuntimeException e) {
|
||||
Class<?> serverPing = getServerPingClass();
|
||||
|
||||
|
@ -3,21 +3,20 @@ package com.comphenix.protocol;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import net.minecraft.server.v1_8_R1.Block;
|
||||
import net.minecraft.server.v1_8_R1.Item;
|
||||
import net.minecraft.server.v1_8_R1.StatisticList;
|
||||
import net.minecraft.server.v1_8_R2.Block;
|
||||
import net.minecraft.server.v1_8_R2.Item;
|
||||
import net.minecraft.server.v1_8_R2.StatisticList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
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.meta.ItemMeta;
|
||||
|
||||
import com.comphenix.protocol.reflect.FieldUtils;
|
||||
import com.comphenix.protocol.utility.Constants;
|
||||
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.
|
||||
@ -39,7 +38,7 @@ public class BukkitInitialization {
|
||||
initializePackage();
|
||||
|
||||
try {
|
||||
Block.R(); // Block.register();
|
||||
Block.S(); // Block.register();
|
||||
Item.t(); // Item.register();
|
||||
StatisticList.a(); // StatisticList.register();
|
||||
} catch (Throwable ex) {
|
||||
|
@ -21,12 +21,13 @@ import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_8_R1.AttributeModifier;
|
||||
import net.minecraft.server.v1_8_R1.AttributeSnapshot;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_8_R2.AttributeModifier;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
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.Material;
|
||||
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.PotionEffectType;
|
||||
import org.junit.BeforeClass;
|
||||
@ -366,8 +367,17 @@ public class PacketContainerTest {
|
||||
// Initialize some test data
|
||||
List<AttributeModifier> modifiers = Lists.newArrayList(
|
||||
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));
|
||||
PacketContainer cloned = attribute.deepClone();
|
||||
|
@ -4,12 +4,12 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import net.minecraft.server.v1_8_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_8_R1.ChatSerializer;
|
||||
import net.minecraft.server.v1_8_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_8_R1.ServerPing;
|
||||
import net.minecraft.server.v1_8_R1.ServerPingPlayerSample;
|
||||
import net.minecraft.server.v1_8_R1.ServerPingServerData;
|
||||
import net.minecraft.server.v1_8_R2.ChatComponentText;
|
||||
import net.minecraft.server.v1_8_R2.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_8_R2.ServerPing;
|
||||
import net.minecraft.server.v1_8_R2.ServerPing.ServerData;
|
||||
import net.minecraft.server.v1_8_R2.ServerPing.ServerPingPlayerSample;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -96,7 +96,7 @@ public class MinecraftReflectionTest {
|
||||
|
||||
@Test
|
||||
public void testServerPingServerData() {
|
||||
assertEquals(ServerPingServerData.class, MinecraftReflection.getServerPingServerDataClass());
|
||||
assertEquals(ServerData.class, MinecraftReflection.getServerPingServerDataClass());
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
@ -8,10 +8,10 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
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.craftbukkit.v1_8_R1.inventory.CraftItemFactory;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -15,15 +15,15 @@ public class ChunkCoordIntPairTest {
|
||||
|
||||
@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);
|
||||
|
||||
assertEquals(1, specific.getChunkX());
|
||||
assertEquals(2, specific.getChunkZ());
|
||||
|
||||
net.minecraft.server.v1_8_R1.ChunkCoordIntPair roundtrip =
|
||||
(net.minecraft.server.v1_8_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
|
||||
getGeneric(net.minecraft.server.v1_8_R1.ChunkCoordIntPair.class, specific);
|
||||
net.minecraft.server.v1_8_R2.ChunkCoordIntPair roundtrip =
|
||||
(net.minecraft.server.v1_8_R2.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
|
||||
getGeneric(net.minecraft.server.v1_8_R2.ChunkCoordIntPair.class, specific);
|
||||
|
||||
assertEquals(1, roundtrip.x);
|
||||
assertEquals(2, roundtrip.z);
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.comphenix.protocol.wrappers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import net.minecraft.server.v1_8_R1.EnumChatVisibility;
|
||||
import net.minecraft.server.v1_8_R1.EnumClientCommand;
|
||||
import net.minecraft.server.v1_8_R1.EnumDifficulty;
|
||||
import net.minecraft.server.v1_8_R1.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_8_R1.EnumGamemode;
|
||||
import net.minecraft.server.v1_8_R1.EnumProtocol;
|
||||
import net.minecraft.server.v1_8_R2.EntityHuman.EnumChatVisibility;
|
||||
import net.minecraft.server.v1_8_R2.EnumDifficulty;
|
||||
import net.minecraft.server.v1_8_R2.EnumProtocol;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand.EnumClientCommand;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_8_R2.WorldSettings.EnumGamemode;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -4,11 +4,12 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_8_R1.AttributeModifier;
|
||||
import net.minecraft.server.v1_8_R1.AttributeSnapshot;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_8_R2.AttributeModifier;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
@ -33,13 +34,13 @@ public class WrappedAttributeTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
// Create a couple of modifiers
|
||||
doubleModifier =
|
||||
doubleModifier =
|
||||
WrappedAttributeModifier.newBuilder().
|
||||
name("Double Damage").
|
||||
amount(1).
|
||||
operation(Operation.ADD_PERCENTAGE).
|
||||
build();
|
||||
constantModifier =
|
||||
constantModifier =
|
||||
WrappedAttributeModifier.newBuilder().
|
||||
name("Damage Bonus").
|
||||
amount(5).
|
||||
@ -84,9 +85,15 @@ public class WrappedAttributeTest {
|
||||
for (WrappedAttributeModifier wrapper : attribute.getModifiers()) {
|
||||
modifiers.add((AttributeModifier) wrapper.getHandle());
|
||||
}
|
||||
return new AttributeSnapshot(
|
||||
(PacketPlayOutUpdateAttributes) attribute.getParentPacket().getHandle(),
|
||||
attribute.getAttributeKey(), attribute.getBaseValue(), modifiers);
|
||||
|
||||
class PacketAccessor extends PacketPlayOutUpdateAttributes {
|
||||
|
||||
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) {
|
||||
|
@ -3,7 +3,7 @@ package com.comphenix.protocol.wrappers;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
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.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -27,7 +27,7 @@ import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
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.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren