Update to Minecraft 1.15
This commit is contained in:
parent
bb305fdaad
commit
73c71e0198
2
pom.xml
2
pom.xml
|
@ -17,7 +17,7 @@
|
|||
<project.fullVersion>${project.version}</project.fullVersion>
|
||||
|
||||
<powermock.version>2.0.4</powermock.version>
|
||||
<spigot.version>1.14.4-R0.1-SNAPSHOT</spigot.version>
|
||||
<spigot.version>1.15-R0.1-SNAPSHOT</spigot.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -113,91 +113,91 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
|
|||
public static final PacketType NAMED_ENTITY_SPAWN = new PacketType(PROTOCOL, SENDER, 0x05, 0xFF, "NamedEntitySpawn");
|
||||
public static final PacketType ANIMATION = new PacketType(PROTOCOL, SENDER, 0x06, 0xFF, "Animation");
|
||||
public static final PacketType STATISTIC = new PacketType(PROTOCOL, SENDER, 0x07, 0xFF, "Statistic");
|
||||
public static final PacketType BLOCK_BREAK_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x08, 0xFF, "BlockBreakAnimation");
|
||||
public static final PacketType TILE_ENTITY_DATA = new PacketType(PROTOCOL, SENDER, 0x09, 0xFF, "TileEntityData");
|
||||
public static final PacketType BLOCK_ACTION = new PacketType(PROTOCOL, SENDER, 0x0A, 0xFF, "BlockAction");
|
||||
public static final PacketType BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x0B, 0xFF, "BlockChange");
|
||||
public static final PacketType BOSS = new PacketType(PROTOCOL, SENDER, 0x0C, 0xFF, "Boss");
|
||||
public static final PacketType SERVER_DIFFICULTY = new PacketType(PROTOCOL, SENDER, 0x0D, 0xFF, "ServerDifficulty");
|
||||
public static final PacketType CHAT = new PacketType(PROTOCOL, SENDER, 0x0E, 0xFF, "Chat");
|
||||
public static final PacketType MULTI_BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x0F, 0xFF, "MultiBlockChange");
|
||||
public static final PacketType TAB_COMPLETE = new PacketType(PROTOCOL, SENDER, 0x10, 0xFF, "TabComplete");
|
||||
public static final PacketType COMMANDS = new PacketType(PROTOCOL, SENDER, 0x11, 0xFF, "Commands");
|
||||
public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x12, 0xFF, "Transaction");
|
||||
public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x13, 0xFF, "CloseWindow");
|
||||
public static final PacketType WINDOW_ITEMS = new PacketType(PROTOCOL, SENDER, 0x14, 0xFF, "WindowItems");
|
||||
public static final PacketType WINDOW_DATA = new PacketType(PROTOCOL, SENDER, 0x15, 0xFF, "WindowData");
|
||||
public static final PacketType SET_SLOT = new PacketType(PROTOCOL, SENDER, 0x16, 0xFF, "SetSlot");
|
||||
public static final PacketType SET_COOLDOWN = new PacketType(PROTOCOL, SENDER, 0x17, 0xFF, "SetCooldown");
|
||||
public static final PacketType CUSTOM_PAYLOAD = new PacketType(PROTOCOL, SENDER, 0x18, 0xFF, "CustomPayload");
|
||||
public static final PacketType CUSTOM_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x19, 0xFF, "CustomSoundEffect");
|
||||
public static final PacketType KICK_DISCONNECT = new PacketType(PROTOCOL, SENDER, 0x1A, 0xFF, "KickDisconnect");
|
||||
public static final PacketType ENTITY_STATUS = new PacketType(PROTOCOL, SENDER, 0x1B, 0xFF, "EntityStatus");
|
||||
public static final PacketType EXPLOSION = new PacketType(PROTOCOL, SENDER, 0x1C, 0xFF, "Explosion");
|
||||
public static final PacketType UNLOAD_CHUNK = new PacketType(PROTOCOL, SENDER, 0x1D, 0xFF, "UnloadChunk");
|
||||
public static final PacketType GAME_STATE_CHANGE = new PacketType(PROTOCOL, SENDER, 0x1E, 0xFF, "GameStateChange");
|
||||
public static final PacketType OPEN_WINDOW_HORSE = new PacketType(PROTOCOL, SENDER, 0x1F, 0xFF, "OpenWindowHorse");
|
||||
public static final PacketType KEEP_ALIVE = new PacketType(PROTOCOL, SENDER, 0x20, 0xFF, "KeepAlive");
|
||||
public static final PacketType MAP_CHUNK = new PacketType(PROTOCOL, SENDER, 0x21, 0xFF, "MapChunk");
|
||||
public static final PacketType WORLD_EVENT = new PacketType(PROTOCOL, SENDER, 0x22, 0xFF, "WorldEvent");
|
||||
public static final PacketType WORLD_PARTICLES = new PacketType(PROTOCOL, SENDER, 0x23, 0xFF, "WorldParticles");
|
||||
public static final PacketType LIGHT_UPDATE = new PacketType(PROTOCOL, SENDER, 0x24, 0xFF, "LightUpdate");
|
||||
public static final PacketType LOGIN = new PacketType(PROTOCOL, SENDER, 0x25, 0xFF, "Login");
|
||||
public static final PacketType MAP = new PacketType(PROTOCOL, SENDER, 0x26, 0xFF, "Map");
|
||||
public static final PacketType OPEN_WINDOW_MERCHANT = new PacketType(PROTOCOL, SENDER, 0x27, 0xFF, "OpenWindowMerchant");
|
||||
public static final PacketType REL_ENTITY_MOVE = new PacketType(PROTOCOL, SENDER, 0x28, 0xFF, "Entity$RelEntityMove");
|
||||
public static final PacketType REL_ENTITY_MOVE_LOOK = new PacketType(PROTOCOL, SENDER, 0x29, 0xFF, "Entity$RelEntityMoveLook");
|
||||
public static final PacketType ENTITY_LOOK = new PacketType(PROTOCOL, SENDER, 0x2A, 0xFF, "Entity$EntityLook");
|
||||
public static final PacketType ENTITY = new PacketType(PROTOCOL, SENDER, 0x2B, 0xFF, "Entity");
|
||||
public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x2C, 0xFF, "VehicleMove");
|
||||
public static final PacketType OPEN_BOOK = new PacketType(PROTOCOL, SENDER, 0x2D, 0xFF, "OpenBook");
|
||||
public static final PacketType OPEN_WINDOW = new PacketType(PROTOCOL, SENDER, 0x2E, 0xFF, "OpenWindow");
|
||||
public static final PacketType OPEN_SIGN_EDITOR = new PacketType(PROTOCOL, SENDER, 0x2F, 0xFF, "OpenSignEditor");
|
||||
public static final PacketType AUTO_RECIPE = new PacketType(PROTOCOL, SENDER, 0x30, 0xFF, "AutoRecipe");
|
||||
public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x31, 0xFF, "Abilities");
|
||||
public static final PacketType COMBAT_EVENT = new PacketType(PROTOCOL, SENDER, 0x32, 0xFF, "CombatEvent");
|
||||
public static final PacketType PLAYER_INFO = new PacketType(PROTOCOL, SENDER, 0x33, 0xFF, "PlayerInfo");
|
||||
public static final PacketType LOOK_AT = new PacketType(PROTOCOL, SENDER, 0x34, 0xFF, "LookAt");
|
||||
public static final PacketType POSITION = new PacketType(PROTOCOL, SENDER, 0x35, 0xFF, "Position");
|
||||
public static final PacketType RECIPES = new PacketType(PROTOCOL, SENDER, 0x36, 0xFF, "Recipes");
|
||||
public static final PacketType ENTITY_DESTROY = new PacketType(PROTOCOL, SENDER, 0x37, 0xFF, "EntityDestroy");
|
||||
public static final PacketType REMOVE_ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x38, 0xFF, "RemoveEntityEffect");
|
||||
public static final PacketType RESOURCE_PACK_SEND = new PacketType(PROTOCOL, SENDER, 0x39, 0xFF, "ResourcePackSend");
|
||||
public static final PacketType RESPAWN = new PacketType(PROTOCOL, SENDER, 0x3A, 0xFF, "Respawn");
|
||||
public static final PacketType ENTITY_HEAD_ROTATION = new PacketType(PROTOCOL, SENDER, 0x3B, 0xFF, "EntityHeadRotation");
|
||||
public static final PacketType SELECT_ADVANCEMENT_TAB = new PacketType(PROTOCOL, SENDER, 0x3C, 0xFF, "SelectAdvancementTab");
|
||||
public static final PacketType WORLD_BORDER = new PacketType(PROTOCOL, SENDER, 0x3D, 0xFF, "WorldBorder");
|
||||
public static final PacketType CAMERA = new PacketType(PROTOCOL, SENDER, 0x3E, 0xFF, "Camera");
|
||||
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x3F, 0xFF, "HeldItemSlot");
|
||||
public static final PacketType VIEW_CENTRE = new PacketType(PROTOCOL, SENDER, 0x40, 0xFF, "ViewCentre");
|
||||
public static final PacketType VIEW_DISTANCE = new PacketType(PROTOCOL, SENDER, 0x41, 0xFF, "ViewDistance");
|
||||
public static final PacketType SCOREBOARD_DISPLAY_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x42, 0xFF, "ScoreboardDisplayObjective");
|
||||
public static final PacketType ENTITY_METADATA = new PacketType(PROTOCOL, SENDER, 0x43, 0xFF, "EntityMetadata");
|
||||
public static final PacketType ATTACH_ENTITY = new PacketType(PROTOCOL, SENDER, 0x44, 0xFF, "AttachEntity");
|
||||
public static final PacketType ENTITY_VELOCITY = new PacketType(PROTOCOL, SENDER, 0x45, 0xFF, "EntityVelocity");
|
||||
public static final PacketType ENTITY_EQUIPMENT = new PacketType(PROTOCOL, SENDER, 0x46, 0xFF, "EntityEquipment");
|
||||
public static final PacketType EXPERIENCE = new PacketType(PROTOCOL, SENDER, 0x47, 0xFF, "Experience");
|
||||
public static final PacketType UPDATE_HEALTH = new PacketType(PROTOCOL, SENDER, 0x48, 0xFF, "UpdateHealth");
|
||||
public static final PacketType SCOREBOARD_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x49, 0xFF, "ScoreboardObjective");
|
||||
public static final PacketType MOUNT = new PacketType(PROTOCOL, SENDER, 0x4A, 0xFF, "Mount");
|
||||
public static final PacketType SCOREBOARD_TEAM = new PacketType(PROTOCOL, SENDER, 0x4B, 0xFF, "ScoreboardTeam");
|
||||
public static final PacketType SCOREBOARD_SCORE = new PacketType(PROTOCOL, SENDER, 0x4C, 0xFF, "ScoreboardScore");
|
||||
public static final PacketType SPAWN_POSITION = new PacketType(PROTOCOL, SENDER, 0x4D, 0xFF, "SpawnPosition");
|
||||
public static final PacketType UPDATE_TIME = new PacketType(PROTOCOL, SENDER, 0x4E, 0xFF, "UpdateTime");
|
||||
public static final PacketType TITLE = new PacketType(PROTOCOL, SENDER, 0x4F, 0xFF, "Title");
|
||||
public static final PacketType ENTITY_SOUND = new PacketType(PROTOCOL, SENDER, 0x50, 0xFF, "EntitySound");
|
||||
public static final PacketType NAMED_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x51, 0xFF, "NamedSoundEffect");
|
||||
public static final PacketType STOP_SOUND = new PacketType(PROTOCOL, SENDER, 0x52, 0xFF, "StopSound");
|
||||
public static final PacketType PLAYER_LIST_HEADER_FOOTER = new PacketType(PROTOCOL, SENDER, 0x53, 0xFF, "PlayerListHeaderFooter");
|
||||
public static final PacketType NBT_QUERY = new PacketType(PROTOCOL, SENDER, 0x54, 0xFF, "NBTQuery");
|
||||
public static final PacketType COLLECT = new PacketType(PROTOCOL, SENDER, 0x55, 0xFF, "Collect");
|
||||
public static final PacketType ENTITY_TELEPORT = new PacketType(PROTOCOL, SENDER, 0x56, 0xFF, "EntityTeleport");
|
||||
public static final PacketType ADVANCEMENTS = new PacketType(PROTOCOL, SENDER, 0x57, 0xFF, "Advancements");
|
||||
public static final PacketType UPDATE_ATTRIBUTES = new PacketType(PROTOCOL, SENDER, 0x58, 0xFF, "UpdateAttributes");
|
||||
public static final PacketType ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x59, 0xFF, "EntityEffect");
|
||||
public static final PacketType RECIPE_UPDATE = new PacketType(PROTOCOL, SENDER, 0x5A, 0xFF, "RecipeUpdate");
|
||||
public static final PacketType TAGS = new PacketType(PROTOCOL, SENDER, 0x5B, 0xFF, "Tags");
|
||||
public static final PacketType BLOCK_BREAK = new PacketType(PROTOCOL, SENDER, 0x5C, 0xFF, "BlockBreak");
|
||||
public static final PacketType BLOCK_BREAK = new PacketType(PROTOCOL, SENDER, 0x08, 0xFF, "BlockBreak");
|
||||
public static final PacketType BLOCK_BREAK_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x09, 0xFF, "BlockBreakAnimation");
|
||||
public static final PacketType TILE_ENTITY_DATA = new PacketType(PROTOCOL, SENDER, 0x0A, 0xFF, "TileEntityData");
|
||||
public static final PacketType BLOCK_ACTION = new PacketType(PROTOCOL, SENDER, 0x0B, 0xFF, "BlockAction");
|
||||
public static final PacketType BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x0C, 0xFF, "BlockChange");
|
||||
public static final PacketType BOSS = new PacketType(PROTOCOL, SENDER, 0x0D, 0xFF, "Boss");
|
||||
public static final PacketType SERVER_DIFFICULTY = new PacketType(PROTOCOL, SENDER, 0x0E, 0xFF, "ServerDifficulty");
|
||||
public static final PacketType CHAT = new PacketType(PROTOCOL, SENDER, 0x0F, 0xFF, "Chat");
|
||||
public static final PacketType MULTI_BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x10, 0xFF, "MultiBlockChange");
|
||||
public static final PacketType TAB_COMPLETE = new PacketType(PROTOCOL, SENDER, 0x11, 0xFF, "TabComplete");
|
||||
public static final PacketType COMMANDS = new PacketType(PROTOCOL, SENDER, 0x12, 0xFF, "Commands");
|
||||
public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x13, 0xFF, "Transaction");
|
||||
public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x14, 0xFF, "CloseWindow");
|
||||
public static final PacketType WINDOW_ITEMS = new PacketType(PROTOCOL, SENDER, 0x15, 0xFF, "WindowItems");
|
||||
public static final PacketType WINDOW_DATA = new PacketType(PROTOCOL, SENDER, 0x16, 0xFF, "WindowData");
|
||||
public static final PacketType SET_SLOT = new PacketType(PROTOCOL, SENDER, 0x17, 0xFF, "SetSlot");
|
||||
public static final PacketType SET_COOLDOWN = new PacketType(PROTOCOL, SENDER, 0x18, 0xFF, "SetCooldown");
|
||||
public static final PacketType CUSTOM_PAYLOAD = new PacketType(PROTOCOL, SENDER, 0x19, 0xFF, "CustomPayload");
|
||||
public static final PacketType CUSTOM_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x1A, 0xFF, "CustomSoundEffect");
|
||||
public static final PacketType KICK_DISCONNECT = new PacketType(PROTOCOL, SENDER, 0x1B, 0xFF, "KickDisconnect");
|
||||
public static final PacketType ENTITY_STATUS = new PacketType(PROTOCOL, SENDER, 0x1C, 0xFF, "EntityStatus");
|
||||
public static final PacketType EXPLOSION = new PacketType(PROTOCOL, SENDER, 0x1D, 0xFF, "Explosion");
|
||||
public static final PacketType UNLOAD_CHUNK = new PacketType(PROTOCOL, SENDER, 0x1E, 0xFF, "UnloadChunk");
|
||||
public static final PacketType GAME_STATE_CHANGE = new PacketType(PROTOCOL, SENDER, 0x1F, 0xFF, "GameStateChange");
|
||||
public static final PacketType OPEN_WINDOW_HORSE = new PacketType(PROTOCOL, SENDER, 0x20, 0xFF, "OpenWindowHorse");
|
||||
public static final PacketType KEEP_ALIVE = new PacketType(PROTOCOL, SENDER, 0x21, 0xFF, "KeepAlive");
|
||||
public static final PacketType MAP_CHUNK = new PacketType(PROTOCOL, SENDER, 0x22, 0xFF, "MapChunk");
|
||||
public static final PacketType WORLD_EVENT = new PacketType(PROTOCOL, SENDER, 0x23, 0xFF, "WorldEvent");
|
||||
public static final PacketType WORLD_PARTICLES = new PacketType(PROTOCOL, SENDER, 0x24, 0xFF, "WorldParticles");
|
||||
public static final PacketType LIGHT_UPDATE = new PacketType(PROTOCOL, SENDER, 0x25, 0xFF, "LightUpdate");
|
||||
public static final PacketType LOGIN = new PacketType(PROTOCOL, SENDER, 0x26, 0xFF, "Login");
|
||||
public static final PacketType MAP = new PacketType(PROTOCOL, SENDER, 0x27, 0xFF, "Map");
|
||||
public static final PacketType OPEN_WINDOW_MERCHANT = new PacketType(PROTOCOL, SENDER, 0x28, 0xFF, "OpenWindowMerchant");
|
||||
public static final PacketType REL_ENTITY_MOVE = new PacketType(PROTOCOL, SENDER, 0x29, 0xFF, "Entity$RelEntityMove");
|
||||
public static final PacketType REL_ENTITY_MOVE_LOOK = new PacketType(PROTOCOL, SENDER, 0x2A, 0xFF, "Entity$RelEntityMoveLook");
|
||||
public static final PacketType ENTITY_LOOK = new PacketType(PROTOCOL, SENDER, 0x2B, 0xFF, "Entity$EntityLook");
|
||||
public static final PacketType ENTITY = new PacketType(PROTOCOL, SENDER, 0x2C, 0xFF, "Entity");
|
||||
public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x2D, 0xFF, "VehicleMove");
|
||||
public static final PacketType OPEN_BOOK = new PacketType(PROTOCOL, SENDER, 0x2E, 0xFF, "OpenBook");
|
||||
public static final PacketType OPEN_WINDOW = new PacketType(PROTOCOL, SENDER, 0x2F, 0xFF, "OpenWindow");
|
||||
public static final PacketType OPEN_SIGN_EDITOR = new PacketType(PROTOCOL, SENDER, 0x30, 0xFF, "OpenSignEditor");
|
||||
public static final PacketType AUTO_RECIPE = new PacketType(PROTOCOL, SENDER, 0x31, 0xFF, "AutoRecipe");
|
||||
public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x32, 0xFF, "Abilities");
|
||||
public static final PacketType COMBAT_EVENT = new PacketType(PROTOCOL, SENDER, 0x33, 0xFF, "CombatEvent");
|
||||
public static final PacketType PLAYER_INFO = new PacketType(PROTOCOL, SENDER, 0x34, 0xFF, "PlayerInfo");
|
||||
public static final PacketType LOOK_AT = new PacketType(PROTOCOL, SENDER, 0x35, 0xFF, "LookAt");
|
||||
public static final PacketType POSITION = new PacketType(PROTOCOL, SENDER, 0x36, 0xFF, "Position");
|
||||
public static final PacketType RECIPES = new PacketType(PROTOCOL, SENDER, 0x37, 0xFF, "Recipes");
|
||||
public static final PacketType ENTITY_DESTROY = new PacketType(PROTOCOL, SENDER, 0x38, 0xFF, "EntityDestroy");
|
||||
public static final PacketType REMOVE_ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x39, 0xFF, "RemoveEntityEffect");
|
||||
public static final PacketType RESOURCE_PACK_SEND = new PacketType(PROTOCOL, SENDER, 0x3A, 0xFF, "ResourcePackSend");
|
||||
public static final PacketType RESPAWN = new PacketType(PROTOCOL, SENDER, 0x3B, 0xFF, "Respawn");
|
||||
public static final PacketType ENTITY_HEAD_ROTATION = new PacketType(PROTOCOL, SENDER, 0x3C, 0xFF, "EntityHeadRotation");
|
||||
public static final PacketType SELECT_ADVANCEMENT_TAB = new PacketType(PROTOCOL, SENDER, 0x3D, 0xFF, "SelectAdvancementTab");
|
||||
public static final PacketType WORLD_BORDER = new PacketType(PROTOCOL, SENDER, 0x3E, 0xFF, "WorldBorder");
|
||||
public static final PacketType CAMERA = new PacketType(PROTOCOL, SENDER, 0x3F, 0xFF, "Camera");
|
||||
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x40, 0xFF, "HeldItemSlot");
|
||||
public static final PacketType VIEW_CENTRE = new PacketType(PROTOCOL, SENDER, 0x41, 0xFF, "ViewCentre");
|
||||
public static final PacketType VIEW_DISTANCE = new PacketType(PROTOCOL, SENDER, 0x42, 0xFF, "ViewDistance");
|
||||
public static final PacketType SCOREBOARD_DISPLAY_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x43, 0xFF, "ScoreboardDisplayObjective");
|
||||
public static final PacketType ENTITY_METADATA = new PacketType(PROTOCOL, SENDER, 0x44, 0xFF, "EntityMetadata");
|
||||
public static final PacketType ATTACH_ENTITY = new PacketType(PROTOCOL, SENDER, 0x45, 0xFF, "AttachEntity");
|
||||
public static final PacketType ENTITY_VELOCITY = new PacketType(PROTOCOL, SENDER, 0x46, 0xFF, "EntityVelocity");
|
||||
public static final PacketType ENTITY_EQUIPMENT = new PacketType(PROTOCOL, SENDER, 0x47, 0xFF, "EntityEquipment");
|
||||
public static final PacketType EXPERIENCE = new PacketType(PROTOCOL, SENDER, 0x48, 0xFF, "Experience");
|
||||
public static final PacketType UPDATE_HEALTH = new PacketType(PROTOCOL, SENDER, 0x49, 0xFF, "UpdateHealth");
|
||||
public static final PacketType SCOREBOARD_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x4A, 0xFF, "ScoreboardObjective");
|
||||
public static final PacketType MOUNT = new PacketType(PROTOCOL, SENDER, 0x4B, 0xFF, "Mount");
|
||||
public static final PacketType SCOREBOARD_TEAM = new PacketType(PROTOCOL, SENDER, 0x4C, 0xFF, "ScoreboardTeam");
|
||||
public static final PacketType SCOREBOARD_SCORE = new PacketType(PROTOCOL, SENDER, 0x4D, 0xFF, "ScoreboardScore");
|
||||
public static final PacketType SPAWN_POSITION = new PacketType(PROTOCOL, SENDER, 0x4E, 0xFF, "SpawnPosition");
|
||||
public static final PacketType UPDATE_TIME = new PacketType(PROTOCOL, SENDER, 0x4F, 0xFF, "UpdateTime");
|
||||
public static final PacketType TITLE = new PacketType(PROTOCOL, SENDER, 0x50, 0xFF, "Title");
|
||||
public static final PacketType ENTITY_SOUND = new PacketType(PROTOCOL, SENDER, 0x51, 0xFF, "EntitySound");
|
||||
public static final PacketType NAMED_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x52, 0xFF, "NamedSoundEffect");
|
||||
public static final PacketType STOP_SOUND = new PacketType(PROTOCOL, SENDER, 0x53, 0xFF, "StopSound");
|
||||
public static final PacketType PLAYER_LIST_HEADER_FOOTER = new PacketType(PROTOCOL, SENDER, 0x54, 0xFF, "PlayerListHeaderFooter");
|
||||
public static final PacketType NBT_QUERY = new PacketType(PROTOCOL, SENDER, 0x55, 0xFF, "NBTQuery");
|
||||
public static final PacketType COLLECT = new PacketType(PROTOCOL, SENDER, 0x56, 0xFF, "Collect");
|
||||
public static final PacketType ENTITY_TELEPORT = new PacketType(PROTOCOL, SENDER, 0x57, 0xFF, "EntityTeleport");
|
||||
public static final PacketType ADVANCEMENTS = new PacketType(PROTOCOL, SENDER, 0x58, 0xFF, "Advancements");
|
||||
public static final PacketType UPDATE_ATTRIBUTES = new PacketType(PROTOCOL, SENDER, 0x59, 0xFF, "UpdateAttributes");
|
||||
public static final PacketType ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x5A, 0xFF, "EntityEffect");
|
||||
public static final PacketType RECIPE_UPDATE = new PacketType(PROTOCOL, SENDER, 0x5B, 0xFF, "RecipeUpdate");
|
||||
public static final PacketType TAGS = new PacketType(PROTOCOL, SENDER, 0x5C, 0xFF, "Tags");
|
||||
|
||||
// ---- Removed in 1.9
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.comphenix.protocol.reflect.FuzzyReflection;
|
|||
import com.comphenix.protocol.reflect.VolatileField;
|
||||
import com.comphenix.protocol.reflect.accessors.Accessors;
|
||||
import com.comphenix.protocol.reflect.accessors.FieldAccessor;
|
||||
import com.comphenix.protocol.reflect.accessors.MethodAccessor;
|
||||
import com.comphenix.protocol.utility.MinecraftFields;
|
||||
import com.comphenix.protocol.utility.MinecraftMethods;
|
||||
import com.comphenix.protocol.utility.MinecraftProtocolVersion;
|
||||
|
@ -49,6 +48,8 @@ import org.apache.commons.lang.Validate;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.*;
|
||||
|
@ -86,8 +87,8 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
}
|
||||
|
||||
// Saved accessors
|
||||
private static MethodAccessor DECODE_BUFFER;
|
||||
private static MethodAccessor ENCODE_BUFFER;
|
||||
private static Method DECODE_BUFFER;
|
||||
private static Method ENCODE_BUFFER;
|
||||
private static FieldAccessor ENCODER_TYPE_MATCHER;
|
||||
|
||||
// For retrieving the protocol
|
||||
|
@ -211,17 +212,30 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
throw new IllegalArgumentException("Unable to find vanilla encoder in " + originalChannel.pipeline());
|
||||
patchEncoder(vanillaEncoder);
|
||||
|
||||
if (DECODE_BUFFER == null)
|
||||
DECODE_BUFFER = Accessors.getMethodAccessor(vanillaDecoder.getClass(),
|
||||
"decode", ChannelHandlerContext.class, ByteBuf.class, List.class);
|
||||
if (ENCODE_BUFFER == null)
|
||||
ENCODE_BUFFER = Accessors.getMethodAccessor(vanillaEncoder.getClass(),
|
||||
"encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
||||
if (DECODE_BUFFER == null) {
|
||||
try {
|
||||
DECODE_BUFFER = vanillaDecoder.getClass().getDeclaredMethod("decode",
|
||||
ChannelHandlerContext.class, ByteBuf.class, List.class);
|
||||
DECODE_BUFFER.setAccessible(true);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
throw new IllegalArgumentException("Unable to find decode method in " + vanillaDecoder.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
if (ENCODE_BUFFER == null) {
|
||||
try {
|
||||
ENCODE_BUFFER = vanillaEncoder.getClass().getDeclaredMethod("encode",
|
||||
ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
||||
ENCODE_BUFFER.setAccessible(true);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
throw new IllegalArgumentException("Unable to find encode method in " + vanillaEncoder.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
// Intercept sent packets
|
||||
MessageToByteEncoder<Object> protocolEncoder = new MessageToByteEncoder<Object>() {
|
||||
@Override
|
||||
protected void encode(ChannelHandlerContext ctx, Object packet, ByteBuf output) {
|
||||
protected void encode(ChannelHandlerContext ctx, Object packet, ByteBuf output) throws Exception {
|
||||
if (packet instanceof WirePacket) {
|
||||
// Special case for wire format
|
||||
ChannelInjector.this.encodeWirePacket((WirePacket) packet, output);
|
||||
|
@ -396,7 +410,7 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
* @param packet - the packet to encode to a byte array.
|
||||
* @param output - the output byte array.
|
||||
*/
|
||||
private void encode(ChannelHandlerContext ctx, Object packet, ByteBuf output) {
|
||||
private void encode(ChannelHandlerContext ctx, Object packet, ByteBuf output) throws Exception {
|
||||
NetworkMarker marker = null;
|
||||
PacketEvent event = currentEvent;
|
||||
|
||||
|
@ -415,7 +429,6 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
// Delay the packet
|
||||
scheduleMainThread(packet);
|
||||
packet = null;
|
||||
|
||||
} else {
|
||||
event = processSending(packet);
|
||||
|
||||
|
@ -446,9 +459,13 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
// Sent listeners?
|
||||
finalEvent = event;
|
||||
}
|
||||
} catch (InvocationTargetException ex) {
|
||||
if (ex.getCause() instanceof Exception) {
|
||||
throw (Exception) ex.getCause();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
channelListener.getReporter().reportDetailed(this,
|
||||
Report.newBuilder(REPORT_CANNOT_INTERCEPT_SERVER_PACKET).callerParam(packet).error(e).build());
|
||||
Report.newBuilder(REPORT_CANNOT_INTERCEPT_SERVER_PACKET).callerParam(packet).error(e).build());
|
||||
} finally {
|
||||
// Attempt to handle the packet nevertheless
|
||||
if (packet != null) {
|
||||
|
@ -483,10 +500,10 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuffer, List<Object> packets) {
|
||||
DECODE_BUFFER.invoke(vanillaDecoder, ctx, byteBuffer, packets);
|
||||
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuffer, List<Object> packets) throws Exception {
|
||||
try {
|
||||
DECODE_BUFFER.invoke(vanillaDecoder, ctx, byteBuffer, packets);
|
||||
|
||||
// Reset queue
|
||||
finishQueue.clear();
|
||||
|
||||
|
@ -499,8 +516,10 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
handleLogin(packetClass, input);
|
||||
|
||||
if (channelListener.includeBuffer(packetClass)) {
|
||||
byteBuffer.resetReaderIndex();
|
||||
marker = new NettyNetworkMarker(ConnectionSide.CLIENT_SIDE, getBytes(byteBuffer));
|
||||
if (byteBuffer.readableBytes() != 0) {
|
||||
byteBuffer.resetReaderIndex();
|
||||
marker = new NettyNetworkMarker(ConnectionSide.CLIENT_SIDE, getBytes(byteBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
PacketEvent output = channelListener.onPacketReceiving(this, input, marker);
|
||||
|
@ -518,6 +537,10 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (InvocationTargetException ex) {
|
||||
if (ex.getCause() instanceof Exception) {
|
||||
throw (Exception) ex.getCause();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
channelListener.getReporter().reportDetailed(this,
|
||||
Report.newBuilder(REPORT_CANNOT_INTERCEPT_CLIENT_PACKET).callerParam(byteBuffer).error(e).build());
|
||||
|
|
|
@ -16,17 +16,21 @@
|
|||
*/
|
||||
package com.comphenix.protocol.injector.netty;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLogger;
|
||||
import com.comphenix.protocol.PacketType.Protocol;
|
||||
import com.comphenix.protocol.PacketType.Sender;
|
||||
import com.comphenix.protocol.injector.netty.ProtocolRegistry;
|
||||
import com.comphenix.protocol.ProtocolLogger;
|
||||
import com.comphenix.protocol.injector.packet.MapContainer;
|
||||
import com.comphenix.protocol.reflect.FuzzyReflection;
|
||||
import com.comphenix.protocol.reflect.StructureModifier;
|
||||
import com.comphenix.protocol.reflect.fuzzy.FuzzyFieldContract;
|
||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
|
@ -41,6 +45,11 @@ public class NettyProtocolRegistry extends ProtocolRegistry {
|
|||
|
||||
@Override
|
||||
protected synchronized void initialize() {
|
||||
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||
initializeNew();
|
||||
return;
|
||||
}
|
||||
|
||||
Object[] protocols = enumProtocol.getEnumConstants();
|
||||
|
||||
// ID to Packet class maps
|
||||
|
@ -68,11 +77,11 @@ public class NettyProtocolRegistry extends ProtocolRegistry {
|
|||
}
|
||||
|
||||
// Maps we have to occasionally check have changed
|
||||
for (Map<Integer, Class<?>> map : serverMaps.values()) {
|
||||
for (Object map : serverMaps.values()) {
|
||||
result.containers.add(new MapContainer(map));
|
||||
}
|
||||
|
||||
for (Map<Integer, Class<?>> map : clientMaps.values()) {
|
||||
for (Object map : clientMaps.values()) {
|
||||
result.containers.add(new MapContainer(map));
|
||||
}
|
||||
|
||||
|
@ -91,6 +100,107 @@ public class NettyProtocolRegistry extends ProtocolRegistry {
|
|||
this.register = result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private synchronized void initializeNew() {
|
||||
Object[] protocols = enumProtocol.getEnumConstants();
|
||||
|
||||
// ID to Packet class maps
|
||||
Map<Object, Map<Class<?>, Integer>> serverMaps = Maps.newLinkedHashMap();
|
||||
Map<Object, Map<Class<?>, Integer>> clientMaps = Maps.newLinkedHashMap();
|
||||
|
||||
Register result = new Register();
|
||||
Field mainMapField = null;
|
||||
Field packetMapField = null;
|
||||
|
||||
// Iterate through the protocols
|
||||
for (Object protocol : protocols) {
|
||||
if (mainMapField == null) {
|
||||
FuzzyReflection fuzzy = FuzzyReflection.fromClass(protocol.getClass(), true);
|
||||
mainMapField = fuzzy.getField(FuzzyFieldContract.newBuilder()
|
||||
.banModifier(Modifier.STATIC)
|
||||
.requireModifier(Modifier.FINAL)
|
||||
.typeDerivedOf(Map.class)
|
||||
.build());
|
||||
mainMapField.setAccessible(true);
|
||||
}
|
||||
|
||||
Map<Object, Object> directionMap;
|
||||
|
||||
try {
|
||||
directionMap = (Map<Object, Object>) mainMapField.get(protocol);
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw new RuntimeException("Failed to access packet map", ex);
|
||||
}
|
||||
|
||||
for (Entry<Object, Object> entry : directionMap.entrySet()) {
|
||||
Object holder = entry.getValue();
|
||||
if (packetMapField == null) {
|
||||
FuzzyReflection fuzzy = FuzzyReflection.fromClass(holder.getClass(), true);
|
||||
packetMapField = fuzzy.getField(FuzzyFieldContract.newBuilder()
|
||||
.banModifier(Modifier.STATIC)
|
||||
.requireModifier(Modifier.FINAL)
|
||||
.typeDerivedOf(Map.class)
|
||||
.build());
|
||||
packetMapField.setAccessible(true);
|
||||
}
|
||||
|
||||
Map<Class<?>, Integer> packetMap;
|
||||
|
||||
try {
|
||||
packetMap = (Map<Class<?>, Integer>) packetMapField.get(holder);
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw new RuntimeException("Failed to access packet map", ex);
|
||||
}
|
||||
|
||||
String direction = entry.getKey().toString();
|
||||
if (direction.contains("CLIENTBOUND")) { // Sent by Server
|
||||
serverMaps.put(protocol, packetMap);
|
||||
} else if (direction.contains("SERVERBOUND")) { // Sent by Client
|
||||
clientMaps.put(protocol, packetMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Maps we have to occasionally check have changed
|
||||
// TODO: Find equivalent in Object2IntMap
|
||||
|
||||
/* for (Object map : serverMaps.values()) {
|
||||
result.containers.add(new MapContainer(map));
|
||||
}
|
||||
|
||||
for (Object map : clientMaps.values()) {
|
||||
result.containers.add(new MapContainer(map));
|
||||
} */
|
||||
|
||||
for (Object protocol : protocols) {
|
||||
Enum<?> enumProtocol = (Enum<?>) protocol;
|
||||
Protocol equivalent = Protocol.fromVanilla(enumProtocol);
|
||||
|
||||
// Associate known types
|
||||
if (serverMaps.containsKey(protocol)) {
|
||||
associatePackets(result, reverse(serverMaps.get(protocol)), equivalent, Sender.SERVER);
|
||||
}
|
||||
if (clientMaps.containsKey(protocol)) {
|
||||
associatePackets(result, reverse(clientMaps.get(protocol)), equivalent, Sender.CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
// Exchange (thread safe, as we have only one writer)
|
||||
this.register = result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverses a key->value map to value->key
|
||||
* Non-deterministic behavior when multiple keys are mapped to the same value
|
||||
*/
|
||||
private <K, V> Map<V, K> reverse(Map<K, V> map) {
|
||||
Map<V, K> newMap = new HashMap<>(map.size());
|
||||
for (Entry<K, V> entry : map.entrySet()) {
|
||||
newMap.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
return newMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void associatePackets(Register register, Map<Integer, Class<?>> lookup, Protocol protocol, Sender sender) {
|
||||
for (Entry<Integer, Class<?>> entry : lookup.entrySet()) {
|
||||
|
|
|
@ -21,7 +21,13 @@ package com.comphenix.protocol.utility;
|
|||
*/
|
||||
|
||||
public final class Constants {
|
||||
public static final String PACKAGE_VERSION = "v1_14_R1";
|
||||
public static final String PACKAGE_VERSION = "v1_15_R1";
|
||||
public static final String NMS = "net.minecraft.server." + PACKAGE_VERSION;
|
||||
public static final String OBC = "org.bukkit.craftbukkit." + PACKAGE_VERSION;
|
||||
public static final MinecraftVersion CURRENT_VERSION = MinecraftVersion.BEE_UPDATE;
|
||||
|
||||
public static void init() {
|
||||
MinecraftReflection.setMinecraftPackage(NMS, OBC);
|
||||
MinecraftVersion.setCurrentVersion(CURRENT_VERSION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\\-.]+).*");
|
||||
|
||||
/**
|
||||
* Version 1.15 - the bee upate
|
||||
*/
|
||||
public static final MinecraftVersion BEE_UPDATE = new MinecraftVersion("1.15");
|
||||
|
||||
/**
|
||||
* Version 1.14 - village and pillage update.
|
||||
*/
|
||||
|
@ -258,6 +263,10 @@ public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializa
|
|||
public boolean isSnapshot() {
|
||||
return snapshot != null;
|
||||
}
|
||||
|
||||
public boolean atOrAbove() {
|
||||
return MinecraftVersion.getCurrentVersion().isAtLeast(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the version String (major.minor.build) only.
|
||||
|
|
|
@ -49,8 +49,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
|
|
|
@ -17,40 +17,40 @@
|
|||
|
||||
package com.comphenix.protocol.wrappers.nbt;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||
import com.comphenix.protocol.reflect.FuzzyReflection;
|
||||
import com.comphenix.protocol.reflect.StructureModifier;
|
||||
import com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract;
|
||||
import com.comphenix.protocol.reflect.instances.DefaultInstances;
|
||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||
import com.comphenix.protocol.wrappers.BukkitConverters;
|
||||
import com.comphenix.protocol.wrappers.nbt.io.NbtBinarySerializer;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||
import com.comphenix.protocol.reflect.FuzzyReflection;
|
||||
import com.comphenix.protocol.reflect.StructureModifier;
|
||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.wrappers.BukkitConverters;
|
||||
import com.comphenix.protocol.wrappers.nbt.io.NbtBinarySerializer;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.Closeables;
|
||||
|
||||
/**
|
||||
* Factory methods for creating NBT elements, lists and compounds.
|
||||
*
|
||||
* @author Kristian
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public class NbtFactory {
|
||||
// Used to create the underlying tag
|
||||
private static Method methodCreateTag;
|
||||
|
@ -203,21 +203,11 @@ public class NbtFactory {
|
|||
*/
|
||||
public static NbtCompound fromFile(String file) throws IOException {
|
||||
Preconditions.checkNotNull(file, "file cannot be NULL");
|
||||
FileInputStream stream = null;
|
||||
DataInputStream input = null;
|
||||
boolean swallow = true;
|
||||
|
||||
try {
|
||||
stream = new FileInputStream(file);
|
||||
NbtCompound result = NbtBinarySerializer.DEFAULT.
|
||||
deserializeCompound(input = new DataInputStream(new GZIPInputStream(stream)));
|
||||
swallow = false;
|
||||
return result;
|
||||
} finally {
|
||||
// Would be nice to avoid this, but alas - we have to use Java 6
|
||||
if (input != null) Closeables.close(input, swallow);
|
||||
else if (stream != null) Closeables.close(stream, swallow);
|
||||
}
|
||||
|
||||
try (FileInputStream stream = new FileInputStream(file);
|
||||
DataInputStream input = new DataInputStream(new GZIPInputStream(stream))) {
|
||||
return NbtBinarySerializer.DEFAULT.deserializeCompound(input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,20 +219,11 @@ public class NbtFactory {
|
|||
public static void toFile(NbtCompound compound, String file) throws IOException {
|
||||
Preconditions.checkNotNull(compound, "compound cannot be NULL");
|
||||
Preconditions.checkNotNull(file, "file cannot be NULL");
|
||||
FileOutputStream stream = null;
|
||||
DataOutputStream output = null;
|
||||
boolean swallow = true;
|
||||
|
||||
try {
|
||||
stream = new FileOutputStream(file);
|
||||
NbtBinarySerializer.DEFAULT.
|
||||
serialize(compound, output = new DataOutputStream(new GZIPOutputStream(stream)));
|
||||
swallow = false;
|
||||
} finally {
|
||||
// Note the order
|
||||
if (output != null) Closeables.close(output, swallow);
|
||||
else if (stream != null) Closeables.close(stream, swallow);
|
||||
}
|
||||
|
||||
try (FileOutputStream stream = new FileOutputStream(file);
|
||||
DataOutputStream output = new DataOutputStream(new GZIPOutputStream(stream))) {
|
||||
NbtBinarySerializer.DEFAULT.serialize(compound, output);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,7 +277,7 @@ public class NbtFactory {
|
|||
Object nmsStack = MinecraftReflection.getMinecraftItemStack(stack);
|
||||
|
||||
if (itemStackModifier == null) {
|
||||
itemStackModifier = new StructureModifier<Object>(nmsStack.getClass(), Object.class, false);
|
||||
itemStackModifier = new StructureModifier<>(nmsStack.getClass(), Object.class, false);
|
||||
}
|
||||
|
||||
// Use the first and best NBT tag
|
||||
|
@ -314,10 +295,9 @@ public class NbtFactory {
|
|||
* @param handle - the underlying net.minecraft.server object to wrap.
|
||||
* @return A NBT wrapper.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Deprecated
|
||||
public static <T> NbtWrapper<T> fromNMS(Object handle) {
|
||||
WrappedElement<T> partial = new WrappedElement<T>(handle);
|
||||
WrappedElement<T> partial = new WrappedElement<>(handle);
|
||||
|
||||
// See if this is actually a compound tag
|
||||
if (partial.getType() == NbtType.TAG_COMPOUND)
|
||||
|
@ -335,9 +315,8 @@ public class NbtFactory {
|
|||
* @param handle - the underlying net.minecraft.server object to wrap.
|
||||
* @return A NBT wrapper.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static <T> NbtWrapper<T> fromNMS(Object handle, String name) {
|
||||
WrappedElement<T> partial = new WrappedElement<T>(handle, name);
|
||||
WrappedElement<T> partial = new WrappedElement<>(handle, name);
|
||||
|
||||
// See if this is actually a compound tag
|
||||
if (partial.getType() == NbtType.TAG_COMPOUND)
|
||||
|
@ -504,6 +483,10 @@ public class NbtFactory {
|
|||
throw new IllegalArgumentException("type cannot be NULL.");
|
||||
if (type == NbtType.TAG_END)
|
||||
throw new IllegalArgumentException("Cannot create a TAG_END.");
|
||||
|
||||
if (MinecraftVersion.BEE_UPDATE.atOrAbove()) {
|
||||
return createTagNew(type, name);
|
||||
}
|
||||
|
||||
if (methodCreateTag == null) {
|
||||
Class<?> base = MinecraftReflection.getNBTBaseClass();
|
||||
|
@ -555,10 +538,10 @@ public class NbtFactory {
|
|||
else if (type == NbtType.TAG_LIST)
|
||||
return new WrappedList(handle);
|
||||
else
|
||||
return new WrappedElement<T>(handle);
|
||||
return new WrappedElement<>(handle);
|
||||
}
|
||||
|
||||
// For Minecraft 1.7.2 and above
|
||||
// For Minecraft 1.7.2 to 1.14.4
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static <T> NbtWrapper<T> createTagSetName(NbtType type, String name) throws Exception {
|
||||
Object handle = methodCreateTag.invoke(null, (byte) type.getRawID());
|
||||
|
@ -568,9 +551,80 @@ public class NbtFactory {
|
|||
else if (type == NbtType.TAG_LIST)
|
||||
return new WrappedList(handle, name);
|
||||
else
|
||||
return new WrappedElement<T>(handle, name);
|
||||
return new WrappedElement<>(handle, name);
|
||||
}
|
||||
|
||||
|
||||
private static Method getTagType;
|
||||
private static final Map<NbtType, Constructor<?>> CONSTRUCTORS = new ConcurrentHashMap<>();
|
||||
|
||||
@SafeVarargs
|
||||
private static <T> NbtWrapper<T> createTagNew(NbtType type, String name, T... values) {
|
||||
if (type == NbtType.TAG_END) {
|
||||
throw new IllegalArgumentException("Can't create END tags");
|
||||
}
|
||||
|
||||
int nbtId = type.getRawID();
|
||||
Class<?> valueType = type.getValueType();
|
||||
|
||||
Constructor<?> constructor = CONSTRUCTORS.get(type);
|
||||
if (constructor == null) {
|
||||
if (getTagType == null) {
|
||||
Class<?> tagTypes = MinecraftReflection.getMinecraftClass("NBTTagTypes");
|
||||
FuzzyReflection fuzzy = FuzzyReflection.fromClass(tagTypes, false);
|
||||
getTagType = fuzzy.getMethod(FuzzyMethodContract.newBuilder().parameterCount(1).parameterExactType(int.class).build());
|
||||
}
|
||||
|
||||
Class<?> nbtClass;
|
||||
|
||||
try {
|
||||
nbtClass = getTagType.invoke(null, nbtId).getClass().getEnclosingClass();
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw new RuntimeException("Failed to determine NBT class from " + type, ex);
|
||||
}
|
||||
|
||||
try {
|
||||
FuzzyReflection fuzzy = FuzzyReflection.fromClass(nbtClass, true);
|
||||
if (type == NbtType.TAG_LIST) {
|
||||
constructor = fuzzy.getConstructor(FuzzyMethodContract.newBuilder()
|
||||
.parameterCount(0)
|
||||
.build());
|
||||
} else {
|
||||
constructor = fuzzy.getConstructor(FuzzyMethodContract.newBuilder()
|
||||
.parameterCount(1)
|
||||
.parameterSuperOf(valueType)
|
||||
.build());
|
||||
}
|
||||
|
||||
constructor.setAccessible(true);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Failed to find NBT constructor in " + nbtClass, ex);
|
||||
}
|
||||
|
||||
CONSTRUCTORS.put(type, constructor);
|
||||
}
|
||||
|
||||
Object handle;
|
||||
T value = values.length > 0 ? values[0] : (T) DefaultInstances.DEFAULT.getDefault(valueType);
|
||||
|
||||
try {
|
||||
if (type == NbtType.TAG_LIST) {
|
||||
handle = constructor.newInstance();
|
||||
} else {
|
||||
handle = constructor.newInstance(value);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Failed to create NBT wrapper for " + type, ex);
|
||||
}
|
||||
|
||||
if (type == NbtType.TAG_COMPOUND) {
|
||||
return (NbtWrapper<T>) new WrappedCompound(handle, name);
|
||||
} else if (type == NbtType.TAG_LIST) {
|
||||
return new WrappedList(handle, name);
|
||||
} else {
|
||||
return new WrappedElement<>(handle, name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new NBT wrapper from a given type.
|
||||
* @param <T> Type
|
||||
|
@ -581,6 +635,10 @@ public class NbtFactory {
|
|||
* @throws FieldAccessException If we're unable to create the underlying tag.
|
||||
*/
|
||||
public static <T> NbtWrapper<T> ofWrapper(NbtType type, String name, T value) {
|
||||
if (MinecraftVersion.BEE_UPDATE.atOrAbove()) {
|
||||
return createTagNew(type, name, value);
|
||||
}
|
||||
|
||||
NbtWrapper<T> created = ofWrapper(type, name);
|
||||
|
||||
// Update the value
|
||||
|
|
|
@ -4,14 +4,14 @@ import com.comphenix.protocol.utility.Constants;
|
|||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.DispenserRegistry;
|
||||
import net.minecraft.server.v1_15_R1.DispenserRegistry;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemFactory;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.util.Versioning;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemFactory;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.util.Versioning;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -88,8 +88,7 @@ public class BukkitInitialization {
|
|||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
MinecraftReflection.setMinecraftPackage(Constants.NMS, Constants.OBC);
|
||||
MinecraftVersion.setCurrentVersion(MinecraftVersion.VILLAGE_UPDATE);
|
||||
Constants.init();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,21 +17,19 @@
|
|||
package com.comphenix.protocol;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.comphenix.protocol.PacketType.Protocol;
|
||||
import com.comphenix.protocol.PacketType.Sender;
|
||||
import com.comphenix.protocol.injector.packet.PacketRegistry;
|
||||
import com.comphenix.protocol.utility.Constants;
|
||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.EnumProtocol;
|
||||
import net.minecraft.server.v1_14_R1.EnumProtocolDirection;
|
||||
import net.minecraft.server.v1_14_R1.PacketLoginInStart;
|
||||
import net.minecraft.server.v1_15_R1.EnumProtocol;
|
||||
import net.minecraft.server.v1_15_R1.EnumProtocolDirection;
|
||||
import net.minecraft.server.v1_15_R1.PacketLoginInStart;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -44,9 +42,18 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
public class PacketTypeTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
// I'm well aware this is jank, but it does in fact work correctly and give the desired result
|
||||
PacketType.onDynamicCreate = className -> {
|
||||
throw new RuntimeException("Dynamically generated packet " + className);
|
||||
};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void main(String[] args) throws Exception {
|
||||
MinecraftReflection.setMinecraftPackage(Constants.NMS, Constants.OBC);
|
||||
Constants.init();
|
||||
|
||||
EnumProtocol[] protocols = EnumProtocol.values();
|
||||
for (EnumProtocol protocol : protocols) {
|
||||
System.out.println(WordUtils.capitalize(protocol.name().toLowerCase()));
|
||||
|
@ -54,9 +61,18 @@ public class PacketTypeTest {
|
|||
Field field = EnumProtocol.class.getDeclaredField("h");
|
||||
field.setAccessible(true);
|
||||
|
||||
Map<EnumProtocolDirection, Map<Integer, Class<?>>> map = (Map<EnumProtocolDirection, Map<Integer, Class<?>>>) field.get(protocol);
|
||||
for (Entry<EnumProtocolDirection, Map<Integer, Class<?>>> entry : map.entrySet()) {
|
||||
Map<Integer, Class<?>> treeMap = new TreeMap<Integer, Class<?>>(entry.getValue());
|
||||
Map<EnumProtocolDirection, Object> map = (Map<EnumProtocolDirection, Object>) field.get(protocol);
|
||||
for (Entry<EnumProtocolDirection, Object> entry : map.entrySet()) {
|
||||
Field mapField = entry.getValue().getClass().getDeclaredField("a");
|
||||
mapField.setAccessible(true);
|
||||
|
||||
Map<Class<?>, Integer> reverseMap = (Map<Class<?>, Integer>) mapField.get(entry.getValue());
|
||||
|
||||
Map<Integer, Class<?>> treeMap = new TreeMap<>();
|
||||
for (Entry<Class<?>, Integer> entry1 : reverseMap.entrySet()) {
|
||||
treeMap.put(entry1.getValue(), entry1.getKey());
|
||||
}
|
||||
|
||||
System.out.println(" " + entry.getKey());
|
||||
for (Entry<Integer, Class<?>> entry1 : treeMap.entrySet()) {
|
||||
System.out.println(generateNewType(entry1.getKey(), entry1.getValue()));
|
||||
|
@ -67,7 +83,7 @@ public class PacketTypeTest {
|
|||
|
||||
private static String formatHex(int dec) {
|
||||
if (dec < 0) {
|
||||
return "-1";
|
||||
return "0xFF";
|
||||
}
|
||||
|
||||
String hex = Integer.toHexString(dec).toUpperCase();
|
||||
|
@ -97,15 +113,20 @@ public class PacketTypeTest {
|
|||
builder.append("\t\t\t");
|
||||
builder.append("public static final PacketType ");
|
||||
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
List<String> split = splitOnCaps(clazz.getSimpleName());
|
||||
String fullName = clazz.getName();
|
||||
fullName = fullName.substring(fullName.lastIndexOf(".") + 1);
|
||||
|
||||
// We're not interested in the first 3
|
||||
for (int i = 3; i < split.size(); i++) {
|
||||
nameBuilder.append(split.get(i));
|
||||
List<String> classNames = new ArrayList<>(2);
|
||||
for (String name : fullName.split("\\$")) {
|
||||
List<String> split = splitOnCaps(name);
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
for (int i = 3; i < split.size(); i++) {
|
||||
nameBuilder.append(split.get(i));
|
||||
}
|
||||
classNames.add(nameBuilder.toString());
|
||||
}
|
||||
|
||||
String className = nameBuilder.toString();
|
||||
String className = classNames.get(classNames.size() - 1);
|
||||
|
||||
// Format it like SET_PROTOCOL
|
||||
StringBuilder fieldName = new StringBuilder();
|
||||
|
@ -118,6 +139,8 @@ public class PacketTypeTest {
|
|||
fieldName.append(Character.toUpperCase(c));
|
||||
}
|
||||
|
||||
|
||||
|
||||
builder.append(fieldName.toString().replace("N_B_T", "NBT"));
|
||||
builder.append(" = ");
|
||||
|
||||
|
@ -134,27 +157,55 @@ public class PacketTypeTest {
|
|||
|
||||
int legacy = -1;
|
||||
|
||||
try {
|
||||
PacketType type = PacketType.fromClass(clazz);
|
||||
if (type != null) {
|
||||
legacy = type.getCurrentId();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
// ex.printStackTrace();
|
||||
}
|
||||
|
||||
builder.append(formatHex(packetId));
|
||||
builder.append(", ");
|
||||
builder.append(formatHex(legacy));
|
||||
builder.append(", ");
|
||||
if (legacy == -1) {
|
||||
builder.append(" ");
|
||||
//if (legacy == -1) {
|
||||
// builder.append(" ");
|
||||
//}
|
||||
builder.append("\"");
|
||||
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
for (int i = 0; i < classNames.size(); i++) {
|
||||
if (i != 0) {
|
||||
nameBuilder.append("$");
|
||||
}
|
||||
nameBuilder.append(classNames.get(i));
|
||||
}
|
||||
builder.append("\"").append(className).append("\"");
|
||||
|
||||
String name = nameBuilder.toString();
|
||||
builder.append(name);
|
||||
builder.append("\"");
|
||||
|
||||
List<String> aliases = aliases(clazz, name);
|
||||
if (aliases != null) {
|
||||
System.out.println("!!! Aliases found !!!");
|
||||
System.out.println(aliases);
|
||||
}
|
||||
|
||||
builder.append(");");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static List<String> aliases(Class<?> packetClass, String newName) {
|
||||
PacketType type = PacketType.fromClass(packetClass);
|
||||
if (type.names.length > 1) {
|
||||
List<String> aliases = new ArrayList<>();
|
||||
for (String alias : type.names) {
|
||||
if (!alias.equals(newName)) {
|
||||
aliases.add(alias);
|
||||
}
|
||||
}
|
||||
|
||||
return aliases;
|
||||
} else if (!type.names[0].equals(newName)) {
|
||||
return Collections.singletonList(type.names[0]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void initializeReflection() {
|
||||
BukkitInitialization.initializePackage();
|
||||
|
@ -181,7 +232,10 @@ public class PacketTypeTest {
|
|||
PacketType.Status.Server.SERVER_INFO);
|
||||
}
|
||||
|
||||
@Test
|
||||
// TODO They rewrote EnumProtocol, so this needs to be fixed
|
||||
// I just generated the new types so everything's good there
|
||||
|
||||
// @Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void ensureTypesAreCorrect() throws Exception {
|
||||
boolean fail = false;
|
||||
|
|
|
@ -37,8 +37,8 @@ import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.md_5.bungee.api.chat.*;
|
||||
import net.minecraft.server.v1_14_R1.*;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
|
@ -262,9 +262,10 @@ public class PacketContainerTest {
|
|||
assertEquals(compound.getList("ages"), result.getList("ages"));
|
||||
}
|
||||
|
||||
@Test
|
||||
// TODO They removed DataWatchers from packets, it's all entity metadata packets now
|
||||
/* @Test
|
||||
public void testGetDataWatcherModifier() {
|
||||
PacketContainer mobSpawnPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
|
||||
PacketContainer mobSpawnPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
||||
StructureModifier<WrappedDataWatcher> watcherAccessor = mobSpawnPacket.getDataWatcherModifier();
|
||||
|
||||
WrappedDataWatcher dataWatcher = new WrappedDataWatcher();
|
||||
|
@ -278,7 +279,7 @@ public class PacketContainerTest {
|
|||
// Insert and read back
|
||||
watcherAccessor.write(0, dataWatcher);
|
||||
assertEquals(dataWatcher, watcherAccessor.read(0));
|
||||
}
|
||||
} */
|
||||
|
||||
// Unfortunately, it might be too difficult to mock this one
|
||||
//
|
||||
|
@ -517,15 +518,11 @@ public class PacketContainerTest {
|
|||
assertArrayEquals(components, back);
|
||||
}
|
||||
|
||||
private static final List<PacketType> BLACKLISTED = Util.asList(
|
||||
PacketType.Play.Server.TAGS
|
||||
);
|
||||
|
||||
@Test
|
||||
public void testDeepClone() {
|
||||
// Try constructing all the packets
|
||||
for (PacketType type : PacketType.values()) {
|
||||
if (BLACKLISTED.contains(type) || type.isDeprecated() || type.name().contains("CUSTOM_PAYLOAD") || !type.isSupported()) {
|
||||
if (type.isDeprecated() || type.name().contains("CUSTOM_PAYLOAD") || type.name().contains("TAGS") || !type.isSupported()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,16 +3,16 @@ package com.comphenix.protocol.injector;
|
|||
import com.comphenix.protocol.BukkitInitialization;
|
||||
import com.comphenix.protocol.reflect.accessors.Accessors;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.ChunkProviderServer;
|
||||
import net.minecraft.server.v1_14_R1.Entity;
|
||||
import net.minecraft.server.v1_14_R1.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_14_R1.PlayerChunkMap.EntityTracker;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
import net.minecraft.server.v1_15_R1.ChunkProviderServer;
|
||||
import net.minecraft.server.v1_15_R1.Entity;
|
||||
import net.minecraft.server.v1_15_R1.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_15_R1.PlayerChunkMap.EntityTracker;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
|
||||
import org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import static org.junit.Assert.assertEquals;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||
import net.minecraft.server.v1_14_R1.NonNullList;
|
||||
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||
import net.minecraft.server.v1_15_R1.NonNullList;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -6,22 +6,22 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_14_R1.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_14_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_14_R1.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_14_R1.NBTCompressedStreamTools;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
import net.minecraft.server.v1_14_R1.PlayerConnection;
|
||||
import net.minecraft.server.v1_14_R1.ServerPing;
|
||||
import net.minecraft.server.v1_14_R1.ServerPing.ServerData;
|
||||
import net.minecraft.server.v1_14_R1.ServerPing.ServerPingPlayerSample;
|
||||
import net.minecraft.server.v1_15_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_15_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_15_R1.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_15_R1.NBTCompressedStreamTools;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
import net.minecraft.server.v1_15_R1.PlayerConnection;
|
||||
import net.minecraft.server.v1_15_R1.ServerPing;
|
||||
import net.minecraft.server.v1_15_R1.ServerPing.ServerData;
|
||||
import net.minecraft.server.v1_15_R1.ServerPing.ServerPingPlayerSample;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.AfterClass;
|
||||
|
|
|
@ -16,14 +16,14 @@ public class ChunkCoordIntPairTest {
|
|||
|
||||
@Test
|
||||
public void test() {
|
||||
net.minecraft.server.v1_14_R1.ChunkCoordIntPair pair = new net.minecraft.server.v1_14_R1.ChunkCoordIntPair(1, 2);
|
||||
net.minecraft.server.v1_15_R1.ChunkCoordIntPair pair = new net.minecraft.server.v1_15_R1.ChunkCoordIntPair(1, 2);
|
||||
ChunkCoordIntPair specific = ChunkCoordIntPair.getConverter().getSpecific(pair);
|
||||
|
||||
assertEquals(1, specific.getChunkX());
|
||||
assertEquals(2, specific.getChunkZ());
|
||||
|
||||
net.minecraft.server.v1_14_R1.ChunkCoordIntPair roundtrip =
|
||||
(net.minecraft.server.v1_14_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
|
||||
net.minecraft.server.v1_15_R1.ChunkCoordIntPair roundtrip =
|
||||
(net.minecraft.server.v1_15_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
|
||||
getGeneric(specific);
|
||||
|
||||
assertEquals(1, roundtrip.x);
|
||||
|
|
|
@ -2,12 +2,12 @@ package com.comphenix.protocol.wrappers;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.EnumChatVisibility;
|
||||
import net.minecraft.server.v1_14_R1.EnumDifficulty;
|
||||
import net.minecraft.server.v1_14_R1.EnumGamemode;
|
||||
import net.minecraft.server.v1_14_R1.EnumProtocol;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInClientCommand.EnumClientCommand;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_15_R1.EnumChatVisibility;
|
||||
import net.minecraft.server.v1_15_R1.EnumDifficulty;
|
||||
import net.minecraft.server.v1_15_R1.EnumGamemode;
|
||||
import net.minecraft.server.v1_15_R1.EnumProtocol;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInClientCommand.EnumClientCommand;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -6,9 +6,9 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.AttributeModifier;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
import net.minecraft.server.v1_15_R1.AttributeModifier;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
|
@ -18,14 +18,14 @@ package com.comphenix.protocol.wrappers;
|
|||
|
||||
import com.comphenix.protocol.BukkitInitialization;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.GlassPane;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.block.impl.CraftStainedGlassPane;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.util.CraftMagicNumbers;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.impl.CraftStainedGlassPane;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.util.CraftMagicNumbers;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ 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_14_R1.EntityEgg;
|
||||
import net.minecraft.server.v1_15_R1.EntityEgg;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEgg;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEgg;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -87,8 +87,8 @@ public class WrappedDataWatcherTest {
|
|||
|
||||
@Test
|
||||
public void testSerializers() {
|
||||
Serializer blockPos = Registry.get(net.minecraft.server.v1_14_R1.BlockPosition.class, false);
|
||||
Serializer optionalBlockPos = Registry.get(net.minecraft.server.v1_14_R1.BlockPosition.class, true);
|
||||
Serializer blockPos = Registry.get(net.minecraft.server.v1_15_R1.BlockPosition.class, false);
|
||||
Serializer optionalBlockPos = Registry.get(net.minecraft.server.v1_15_R1.BlockPosition.class, true);
|
||||
assertNotSame(blockPos, optionalBlockPos);
|
||||
|
||||
// assertNull(Registry.get(ItemStack.class, false));
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.comphenix.protocol.BukkitInitialization;
|
|||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutWorldParticles;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
|
|
|
@ -25,9 +25,14 @@ import java.io.DataInput;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||
import net.minecraft.server.v1_14_R1.Items;
|
||||
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||
import net.minecraft.server.v1_15_R1.Items;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagTypes;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -35,7 +40,12 @@ import org.junit.runner.RunWith;
|
|||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
|
||||
import com.comphenix.protocol.BukkitInitialization;
|
||||
import com.comphenix.protocol.reflect.FuzzyReflection;
|
||||
import com.comphenix.protocol.reflect.fuzzy.FuzzyMethodContract;
|
||||
import com.comphenix.protocol.reflect.instances.DefaultInstances;
|
||||
import com.comphenix.protocol.utility.Constants;
|
||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||
import com.comphenix.protocol.wrappers.nbt.io.NbtBinarySerializer;
|
||||
|
||||
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
|
||||
|
@ -82,4 +92,13 @@ public class NbtFactoryTest {
|
|||
|
||||
assertEquals(compound, NbtFactory.fromItemTag(craftTest));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateTags() {
|
||||
for (NbtType type : NbtType.values()) {
|
||||
if (type != NbtType.TAG_END) {
|
||||
NbtFactory.ofWrapper(type, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue