Archiviert
13
0

Update to the 1.12 pre-release

- Now requires Java 8
- Added new packets
- Added ChatType enum (replaces magic value)
- Missing protocol version
Dieser Commit ist enthalten in:
Dan Mulloy 2017-05-14 14:28:56 -04:00
Ursprung be5d42ee19
Commit 3887ba27d2
32 geänderte Dateien mit 339 neuen und 222 gelöschten Zeilen

Datei anzeigen

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ProtocolLib-API</artifactId> <artifactId>ProtocolLib-API</artifactId>
<name>ProtocolLib-API</name> <name>ProtocolLib-API</name>
<version>4.2.2-SNAPSHOT</version> <version>4.3.0-SNAPSHOT</version>
<description>Provides read/write access to the Minecraft protocol.</description> <description>Provides read/write access to the Minecraft protocol.</description>
<url>http://www.spigotmc.org/resources/protocollib.1997/</url> <url>http://www.spigotmc.org/resources/protocollib.1997/</url>
@ -41,8 +41,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version> <version>3.5.1</version>
<configuration> <configuration>
<source>1.7</source> <source>1.8</source>
<target>1.7</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
@ -203,13 +203,13 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version> <version>${spigotVersion}</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.11.2-R0.1-SNAPSHOT</version> <version>${spigotVersion}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

Datei anzeigen

@ -106,82 +106,84 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
public static class Server extends ObjectEnum<PacketType> { public static class Server extends ObjectEnum<PacketType> {
private final static Sender SENDER = Sender.SERVER; private final static Sender SENDER = Sender.SERVER;
public static final PacketType SPAWN_ENTITY = new PacketType(PROTOCOL, SENDER, 0x00, 0x0E, "SpawnEntity"); public static final PacketType SPAWN_ENTITY = new PacketType(PROTOCOL, SENDER, 0x00, 0x00, "SpawnEntity");
public static final PacketType SPAWN_ENTITY_EXPERIENCE_ORB = new PacketType(PROTOCOL, SENDER, 0x01, 0x11, "SpawnEntityExperienceOrb"); public static final PacketType SPAWN_ENTITY_EXPERIENCE_ORB = new PacketType(PROTOCOL, SENDER, 0x01, 0x01, "SpawnEntityExperienceOrb");
public static final PacketType SPAWN_ENTITY_WEATHER = new PacketType(PROTOCOL, SENDER, 0x02, 0x2C, "SpawnEntityWeather"); public static final PacketType SPAWN_ENTITY_WEATHER = new PacketType(PROTOCOL, SENDER, 0x02, 0x02, "SpawnEntityWeather");
public static final PacketType SPAWN_ENTITY_LIVING = new PacketType(PROTOCOL, SENDER, 0x03, 0x0F, "SpawnEntityLiving"); public static final PacketType SPAWN_ENTITY_LIVING = new PacketType(PROTOCOL, SENDER, 0x03, 0x03, "SpawnEntityLiving");
public static final PacketType SPAWN_ENTITY_PAINTING = new PacketType(PROTOCOL, SENDER, 0x04, 0x10, "SpawnEntityPainting"); public static final PacketType SPAWN_ENTITY_PAINTING = new PacketType(PROTOCOL, SENDER, 0x04, 0x04, "SpawnEntityPainting");
public static final PacketType NAMED_ENTITY_SPAWN = new PacketType(PROTOCOL, SENDER, 0x05, 0x0C, "NamedEntitySpawn"); public static final PacketType NAMED_ENTITY_SPAWN = new PacketType(PROTOCOL, SENDER, 0x05, 0x05, "NamedEntitySpawn");
public static final PacketType ANIMATION = new PacketType(PROTOCOL, SENDER, 0x06, 0x0B, "Animation"); public static final PacketType ANIMATION = new PacketType(PROTOCOL, SENDER, 0x06, 0x06, "Animation");
public static final PacketType STATISTIC = new PacketType(PROTOCOL, SENDER, 0x07, 0x37, "Statistic"); public static final PacketType STATISTIC = new PacketType(PROTOCOL, SENDER, 0x07, 0x07, "Statistic");
public static final PacketType BLOCK_BREAK_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x08, 0x25, "BlockBreakAnimation"); public static final PacketType ADVANCEMENTS = new PacketType(PROTOCOL, SENDER, 0x08, 0x08, "Advancements");
public static final PacketType TILE_ENTITY_DATA = new PacketType(PROTOCOL, SENDER, 0x09, 0x35, "TileEntityData"); public static final PacketType BLOCK_BREAK_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x09, 0x08, "BlockBreakAnimation");
public static final PacketType BLOCK_ACTION = new PacketType(PROTOCOL, SENDER, 0x0A, 0x24, "BlockAction"); public static final PacketType TILE_ENTITY_DATA = new PacketType(PROTOCOL, SENDER, 0x0A, 0x09, "TileEntityData");
public static final PacketType BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x0B, 0x23, "BlockChange"); public static final PacketType BLOCK_ACTION = new PacketType(PROTOCOL, SENDER, 0x0B, 0x0A, "BlockAction");
public static final PacketType BOSS = new PacketType(PROTOCOL, SENDER, 0x0C, 0xFF, "Boss"); public static final PacketType BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x0C, 0x0B, "BlockChange");
public static final PacketType SERVER_DIFFICULTY = new PacketType(PROTOCOL, SENDER, 0x0D, 0x41, "ServerDifficulty"); public static final PacketType BOSS = new PacketType(PROTOCOL, SENDER, 0x0D, 0x0C, "Boss");
public static final PacketType TAB_COMPLETE = new PacketType(PROTOCOL, SENDER, 0x0E, 0x3A, "TabComplete"); public static final PacketType SERVER_DIFFICULTY = new PacketType(PROTOCOL, SENDER, 0x0E, 0x0D, "ServerDifficulty");
public static final PacketType CHAT = new PacketType(PROTOCOL, SENDER, 0x0F, 0x02, "Chat"); public static final PacketType TAB_COMPLETE = new PacketType(PROTOCOL, SENDER, 0x0F, 0x0E, "TabComplete");
public static final PacketType MULTI_BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x10, 0x22, "MultiBlockChange"); public static final PacketType CHAT = new PacketType(PROTOCOL, SENDER, 0x10, 0x0F, "Chat");
public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x11, 0x32, "Transaction"); public static final PacketType MULTI_BLOCK_CHANGE = new PacketType(PROTOCOL, SENDER, 0x11, 0x10, "MultiBlockChange");
public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x12, 0x2E, "CloseWindow"); public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x12, 0x11, "Transaction");
public static final PacketType OPEN_WINDOW = new PacketType(PROTOCOL, SENDER, 0x13, 0x2D, "OpenWindow"); public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x13, 0x12, "CloseWindow");
public static final PacketType WINDOW_ITEMS = new PacketType(PROTOCOL, SENDER, 0x14, 0x30, "WindowItems"); public static final PacketType OPEN_WINDOW = new PacketType(PROTOCOL, SENDER, 0x14, 0x13, "OpenWindow");
public static final PacketType WINDOW_DATA = new PacketType(PROTOCOL, SENDER, 0x15, 0x31, "WindowData"); public static final PacketType WINDOW_ITEMS = new PacketType(PROTOCOL, SENDER, 0x15, 0x14, "WindowItems");
public static final PacketType SET_SLOT = new PacketType(PROTOCOL, SENDER, 0x16, 0x2F, "SetSlot"); public static final PacketType WINDOW_DATA = new PacketType(PROTOCOL, SENDER, 0x16, 0x15, "WindowData");
public static final PacketType SET_COOLDOWN = new PacketType(PROTOCOL, SENDER, 0x17, 0xFC, "SetCooldown"); public static final PacketType SET_SLOT = new PacketType(PROTOCOL, SENDER, 0x17, 0x16, "SetSlot");
public static final PacketType CUSTOM_PAYLOAD = new PacketType(PROTOCOL, SENDER, 0x18, 0x3F, "CustomPayload"); public static final PacketType SET_COOLDOWN = new PacketType(PROTOCOL, SENDER, 0x18, 0x17, "SetCooldown");
public static final PacketType CUSTOM_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x19, 0xFD, "CustomSoundEffect"); public static final PacketType CUSTOM_PAYLOAD = new PacketType(PROTOCOL, SENDER, 0x19, 0x18, "CustomPayload");
public static final PacketType KICK_DISCONNECT = new PacketType(PROTOCOL, SENDER, 0x1A, 0x40, "KickDisconnect"); public static final PacketType CUSTOM_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x1A, 0x19, "CustomSoundEffect");
public static final PacketType ENTITY_STATUS = new PacketType(PROTOCOL, SENDER, 0x1B, 0x1A, "EntityStatus"); public static final PacketType KICK_DISCONNECT = new PacketType(PROTOCOL, SENDER, 0x1B, 0x1A, "KickDisconnect");
public static final PacketType EXPLOSION = new PacketType(PROTOCOL, SENDER, 0x1C, 0x27, "Explosion"); public static final PacketType ENTITY_STATUS = new PacketType(PROTOCOL, SENDER, 0x1C, 0x1B, "EntityStatus");
public static final PacketType UNLOAD_CHUNK = new PacketType(PROTOCOL, SENDER, 0x1D, 0xFA, "UnloadChunk"); public static final PacketType EXPLOSION = new PacketType(PROTOCOL, SENDER, 0x1D, 0x1C, "Explosion");
public static final PacketType GAME_STATE_CHANGE = new PacketType(PROTOCOL, SENDER, 0x1E, 0x2B, "GameStateChange"); public static final PacketType UNLOAD_CHUNK = new PacketType(PROTOCOL, SENDER, 0x1E, 0x1D, "UnloadChunk");
public static final PacketType KEEP_ALIVE = new PacketType(PROTOCOL, SENDER, 0x1F, 0x00, "KeepAlive"); public static final PacketType GAME_STATE_CHANGE = new PacketType(PROTOCOL, SENDER, 0x1F, 0x1E, "GameStateChange");
public static final PacketType MAP_CHUNK = new PacketType(PROTOCOL, SENDER, 0x20, 0x21, "MapChunk"); public static final PacketType KEEP_ALIVE = new PacketType(PROTOCOL, SENDER, 0x20, 0x1F, "KeepAlive");
public static final PacketType WORLD_EVENT = new PacketType(PROTOCOL, SENDER, 0x21, 0x28, "WorldEvent"); public static final PacketType MAP_CHUNK = new PacketType(PROTOCOL, SENDER, 0x21, 0x20, "MapChunk");
public static final PacketType WORLD_PARTICLES = new PacketType(PROTOCOL, SENDER, 0x22, 0x2A, "WorldParticles"); public static final PacketType WORLD_EVENT = new PacketType(PROTOCOL, SENDER, 0x22, 0x21, "WorldEvent");
public static final PacketType LOGIN = new PacketType(PROTOCOL, SENDER, 0x23, 0x01, "Login"); public static final PacketType WORLD_PARTICLES = new PacketType(PROTOCOL, SENDER, 0x23, 0x22, "WorldParticles");
public static final PacketType MAP = new PacketType(PROTOCOL, SENDER, 0x24, 0x34, "Map"); public static final PacketType LOGIN = new PacketType(PROTOCOL, SENDER, 0x24, 0x23, "Login");
public static final PacketType REL_ENTITY_MOVE = new PacketType(PROTOCOL, SENDER, 0x25, 0x15, "RelEntityMove"); public static final PacketType MAP = new PacketType(PROTOCOL, SENDER, 0x25, 0x24, "Map");
public static final PacketType REL_ENTITY_MOVE_LOOK = new PacketType(PROTOCOL, SENDER, 0x26, 0x17, "RelEntityMoveLook"); public static final PacketType REL_ENTITY_MOVE = new PacketType(PROTOCOL, SENDER, 0x26, 0x25, "RelEntityMove");
public static final PacketType ENTITY_LOOK = new PacketType(PROTOCOL, SENDER, 0x27, 0x16, "EntityLook"); public static final PacketType REL_ENTITY_MOVE_LOOK = new PacketType(PROTOCOL, SENDER, 0x27, 0x26, "RelEntityMoveLook");
public static final PacketType ENTITY = new PacketType(PROTOCOL, SENDER, 0x28, 0x14, "Entity"); public static final PacketType ENTITY_LOOK = new PacketType(PROTOCOL, SENDER, 0x28, 0x27, "EntityLook");
public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x29, 0xFE, "VehicleMove"); public static final PacketType ENTITY = new PacketType(PROTOCOL, SENDER, 0x29, 0x28, "Entity");
public static final PacketType OPEN_SIGN_EDITOR = new PacketType(PROTOCOL, SENDER, 0x2A, 0x36, "OpenSignEditor"); public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x2A, 0x29, "VehicleMove");
public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x2B, 0x39, "Abilities"); public static final PacketType OPEN_SIGN_EDITOR = new PacketType(PROTOCOL, SENDER, 0x2B, 0x2A, "OpenSignEditor");
public static final PacketType COMBAT_EVENT = new PacketType(PROTOCOL, SENDER, 0x2C, 0x42, "CombatEvent"); public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x2C, 0x2B, "Abilities");
public static final PacketType PLAYER_INFO = new PacketType(PROTOCOL, SENDER, 0x2D, 0x38, "PlayerInfo"); public static final PacketType COMBAT_EVENT = new PacketType(PROTOCOL, SENDER, 0x2D, 0x2C, "CombatEvent");
public static final PacketType POSITION = new PacketType(PROTOCOL, SENDER, 0x2E, 0x08, "Position"); public static final PacketType PLAYER_INFO = new PacketType(PROTOCOL, SENDER, 0x2E, 0x2D, "PlayerInfo");
public static final PacketType BED = new PacketType(PROTOCOL, SENDER, 0x2F, 0x0A, "Bed"); public static final PacketType POSITION = new PacketType(PROTOCOL, SENDER, 0x2F, 0x2E, "Position");
public static final PacketType ENTITY_DESTROY = new PacketType(PROTOCOL, SENDER, 0x30, 0x13, "EntityDestroy"); public static final PacketType BED = new PacketType(PROTOCOL, SENDER, 0x30, 0x2F, "Bed");
public static final PacketType REMOVE_ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x31, 0x1E, "RemoveEntityEffect"); public static final PacketType RECIPES = new PacketType(PROTOCOL, SENDER, 0x31, 0x31, "Recipes");
public static final PacketType RESOURCE_PACK_SEND = new PacketType(PROTOCOL, SENDER, 0x32, 0x48, "ResourcePackSend"); public static final PacketType ENTITY_DESTROY = new PacketType(PROTOCOL, SENDER, 0x32, 0x30, "EntityDestroy");
public static final PacketType RESPAWN = new PacketType(PROTOCOL, SENDER, 0x33, 0x07, "Respawn"); public static final PacketType REMOVE_ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x33, 0x31, "RemoveEntityEffect");
public static final PacketType ENTITY_HEAD_ROTATION = new PacketType(PROTOCOL, SENDER, 0x34, 0x19, "EntityHeadRotation"); public static final PacketType RESOURCE_PACK_SEND = new PacketType(PROTOCOL, SENDER, 0x34, 0x32, "ResourcePackSend");
public static final PacketType WORLD_BORDER = new PacketType(PROTOCOL, SENDER, 0x35, 0x44, "WorldBorder"); public static final PacketType RESPAWN = new PacketType(PROTOCOL, SENDER, 0x35, 0x33, "Respawn");
public static final PacketType CAMERA = new PacketType(PROTOCOL, SENDER, 0x36, 0x43, "Camera"); public static final PacketType ENTITY_HEAD_ROTATION = new PacketType(PROTOCOL, SENDER, 0x36, 0x34, "EntityHeadRotation");
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x37, 0x09, "HeldItemSlot"); public static final PacketType WORLD_BORDER = new PacketType(PROTOCOL, SENDER, 0x37, 0x35, "WorldBorder");
public static final PacketType SCOREBOARD_DISPLAY_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x38, 0x3D, "ScoreboardDisplayObjective"); public static final PacketType CAMERA = new PacketType(PROTOCOL, SENDER, 0x38, 0x36, "Camera");
public static final PacketType ENTITY_METADATA = new PacketType(PROTOCOL, SENDER, 0x39, 0x1C, "EntityMetadata"); public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x39, 0x37, "HeldItemSlot");
public static final PacketType ATTACH_ENTITY = new PacketType(PROTOCOL, SENDER, 0x3A, 0x1B, "AttachEntity"); public static final PacketType SCOREBOARD_DISPLAY_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x3A, 0x38, "ScoreboardDisplayObjective");
public static final PacketType ENTITY_VELOCITY = new PacketType(PROTOCOL, SENDER, 0x3B, 0x12, "EntityVelocity"); public static final PacketType ENTITY_METADATA = new PacketType(PROTOCOL, SENDER, 0x3B, 0x39, "EntityMetadata");
public static final PacketType ENTITY_EQUIPMENT = new PacketType(PROTOCOL, SENDER, 0x3C, 0x04, "EntityEquipment"); public static final PacketType ATTACH_ENTITY = new PacketType(PROTOCOL, SENDER, 0x3C, 0x3A, "AttachEntity");
public static final PacketType EXPERIENCE = new PacketType(PROTOCOL, SENDER, 0x3D, 0x1F, "Experience"); public static final PacketType ENTITY_VELOCITY = new PacketType(PROTOCOL, SENDER, 0x3D, 0x3B, "EntityVelocity");
public static final PacketType UPDATE_HEALTH = new PacketType(PROTOCOL, SENDER, 0x3E, 0x06, "UpdateHealth"); public static final PacketType ENTITY_EQUIPMENT = new PacketType(PROTOCOL, SENDER, 0x3E, 0x3C, "EntityEquipment");
public static final PacketType SCOREBOARD_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x3F, 0x3B, "ScoreboardObjective"); public static final PacketType EXPERIENCE = new PacketType(PROTOCOL, SENDER, 0x3F, 0x3D, "Experience");
public static final PacketType MOUNT = new PacketType(PROTOCOL, SENDER, 0x40, 0xFB, "Mount"); public static final PacketType UPDATE_HEALTH = new PacketType(PROTOCOL, SENDER, 0x40, 0x3E, "UpdateHealth");
public static final PacketType SCOREBOARD_TEAM = new PacketType(PROTOCOL, SENDER, 0x41, 0x3E, "ScoreboardTeam"); public static final PacketType SCOREBOARD_OBJECTIVE = new PacketType(PROTOCOL, SENDER, 0x41, 0x3F, "ScoreboardObjective");
public static final PacketType SCOREBOARD_SCORE = new PacketType(PROTOCOL, SENDER, 0x42, 0x3C, "ScoreboardScore"); public static final PacketType MOUNT = new PacketType(PROTOCOL, SENDER, 0x42, 0x40, "Mount");
public static final PacketType SPAWN_POSITION = new PacketType(PROTOCOL, SENDER, 0x43, 0x05, "SpawnPosition"); public static final PacketType SCOREBOARD_TEAM = new PacketType(PROTOCOL, SENDER, 0x43, 0x41, "ScoreboardTeam");
public static final PacketType UPDATE_TIME = new PacketType(PROTOCOL, SENDER, 0x44, 0x03, "UpdateTime"); public static final PacketType SCOREBOARD_SCORE = new PacketType(PROTOCOL, SENDER, 0x44, 0x42, "ScoreboardScore");
public static final PacketType TITLE = new PacketType(PROTOCOL, SENDER, 0x45, 0x45, "Title"); public static final PacketType SPAWN_POSITION = new PacketType(PROTOCOL, SENDER, 0x45, 0x43, "SpawnPosition");
public static final PacketType NAMED_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x46, 0x47, "NamedSoundEffect"); public static final PacketType UPDATE_TIME = new PacketType(PROTOCOL, SENDER, 0x46, 0x44, "UpdateTime");
public static final PacketType PLAYER_LIST_HEADER_FOOTER = new PacketType(PROTOCOL, SENDER, 0x47, 0x48, "PlayerListHeaderFooter"); public static final PacketType TITLE = new PacketType(PROTOCOL, SENDER, 0x47, 0x45, "Title");
public static final PacketType COLLECT = new PacketType(PROTOCOL, SENDER, 0x48, 0x49, "Collect"); public static final PacketType NAMED_SOUND_EFFECT = new PacketType(PROTOCOL, SENDER, 0x48, 0x46, "NamedSoundEffect");
public static final PacketType ENTITY_TELEPORT = new PacketType(PROTOCOL, SENDER, 0x49, 0x4A, "EntityTeleport"); public static final PacketType PLAYER_LIST_HEADER_FOOTER = new PacketType(PROTOCOL, SENDER, 0x49, 0x47, "PlayerListHeaderFooter");
public static final PacketType UPDATE_ATTRIBUTES = new PacketType(PROTOCOL, SENDER, 0x4A, 0x4B, "UpdateAttributes"); public static final PacketType COLLECT = new PacketType(PROTOCOL, SENDER, 0x4A, 0x48, "Collect");
public static final PacketType ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x4B, 0x4C, "EntityEffect"); public static final PacketType ENTITY_TELEPORT = new PacketType(PROTOCOL, SENDER, 0x4B, 0x49, "EntityTeleport");
public static final PacketType UPDATE_ATTRIBUTES = new PacketType(PROTOCOL, SENDER, 0x4C, 0x4A, "UpdateAttributes");
public static final PacketType ENTITY_EFFECT = new PacketType(PROTOCOL, SENDER, 0x4D, 0x4B, "EntityEffect");
// ---- Removed in 1.9 // ---- Removed in 1.9
@ -258,36 +260,38 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
public static class Client extends ObjectEnum<PacketType> { public static class Client extends ObjectEnum<PacketType> {
private final static Sender SENDER = Sender.CLIENT; private final static Sender SENDER = Sender.CLIENT;
public static final PacketType TELEPORT_ACCEPT = new PacketType(PROTOCOL, SENDER, 0x00, 0xF9, "TeleportAccept"); public static final PacketType TELEPORT_ACCEPT = new PacketType(PROTOCOL, SENDER, 0x00, 0x00, "TeleportAccept");
public static final PacketType TAB_COMPLETE = new PacketType(PROTOCOL, SENDER, 0x01, 0x14, "TabComplete"); public static final PacketType AUTO_RECIPE = new PacketType(PROTOCOL, SENDER, 0x01, 0x01, "AutoRecipe");
public static final PacketType CHAT = new PacketType(PROTOCOL, SENDER, 0x02, 0x01, "Chat"); public static final PacketType TAB_COMPLETE = new PacketType(PROTOCOL, SENDER, 0x02, 0x01, "TabComplete");
public static final PacketType CLIENT_COMMAND = new PacketType(PROTOCOL, SENDER, 0x03, 0x16, "ClientCommand"); public static final PacketType CHAT = new PacketType(PROTOCOL, SENDER, 0x03, 0x02, "Chat");
public static final PacketType SETTINGS = new PacketType(PROTOCOL, SENDER, 0x04, 0x15, "Settings"); public static final PacketType CLIENT_COMMAND = new PacketType(PROTOCOL, SENDER, 0x04, 0x03, "ClientCommand");
public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x05, 0x0F, "Transaction"); public static final PacketType SETTINGS = new PacketType(PROTOCOL, SENDER, 0x05, 0x04, "Settings");
public static final PacketType ENCHANT_ITEM = new PacketType(PROTOCOL, SENDER, 0x06, 0x11, "EnchantItem"); public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x06, 0x05, "Transaction");
public static final PacketType WINDOW_CLICK = new PacketType(PROTOCOL, SENDER, 0x07, 0x0E, "WindowClick"); public static final PacketType ENCHANT_ITEM = new PacketType(PROTOCOL, SENDER, 0x07, 0x06, "EnchantItem");
public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x08, 0x0D, "CloseWindow"); public static final PacketType WINDOW_CLICK = new PacketType(PROTOCOL, SENDER, 0x08, 0x07, "WindowClick");
public static final PacketType CUSTOM_PAYLOAD = new PacketType(PROTOCOL, SENDER, 0x09, 0x17, "CustomPayload"); public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x09, 0x08, "CloseWindow");
public static final PacketType USE_ENTITY = new PacketType(PROTOCOL, SENDER, 0x0A, 0x02, "UseEntity"); public static final PacketType CUSTOM_PAYLOAD = new PacketType(PROTOCOL, SENDER, 0x0A, 0x09, "CustomPayload");
public static final PacketType KEEP_ALIVE = new PacketType(PROTOCOL, SENDER, 0x0B, 0x00, "KeepAlive"); public static final PacketType USE_ENTITY = new PacketType(PROTOCOL, SENDER, 0x0B, 0x0A, "UseEntity");
public static final PacketType POSITION = new PacketType(PROTOCOL, SENDER, 0x0C, 0x04, "Position"); public static final PacketType KEEP_ALIVE = new PacketType(PROTOCOL, SENDER, 0x0C, 0x0B, "KeepAlive");
public static final PacketType POSITION_LOOK = new PacketType(PROTOCOL, SENDER, 0x0D, 0x06, "PositionLook"); public static final PacketType POSITION = new PacketType(PROTOCOL, SENDER, 0x0D, 0x0C, "Position");
public static final PacketType LOOK = new PacketType(PROTOCOL, SENDER, 0x0E, 0x05, "Look"); public static final PacketType POSITION_LOOK = new PacketType(PROTOCOL, SENDER, 0x0E, 0x0D, "PositionLook");
public static final PacketType FLYING = new PacketType(PROTOCOL, SENDER, 0x0F, 0x03, "Flying"); public static final PacketType LOOK = new PacketType(PROTOCOL, SENDER, 0x0F, 0x0E, "Look");
public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x10, 0xF8, "VehicleMove"); public static final PacketType FLYING = new PacketType(PROTOCOL, SENDER, 0x10, 0x0F, "Flying");
public static final PacketType BOAT_MOVE = new PacketType(PROTOCOL, SENDER, 0x11, 0xF7, "BoatMove"); public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x11, 0x10, "VehicleMove");
public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x12, 0x13, "Abilities"); public static final PacketType BOAT_MOVE = new PacketType(PROTOCOL, SENDER, 0x12, 0x11, "BoatMove");
public static final PacketType BLOCK_DIG = new PacketType(PROTOCOL, SENDER, 0x13, 0x07, "BlockDig"); public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x13, 0x12, "Abilities");
public static final PacketType ENTITY_ACTION = new PacketType(PROTOCOL, SENDER, 0x14, 0x0B, "EntityAction"); public static final PacketType BLOCK_DIG = new PacketType(PROTOCOL, SENDER, 0x14, 0x13, "BlockDig");
public static final PacketType STEER_VEHICLE = new PacketType(PROTOCOL, SENDER, 0x15, 0x0C, "SteerVehicle"); public static final PacketType ENTITY_ACTION = new PacketType(PROTOCOL, SENDER, 0x15, 0x14, "EntityAction");
public static final PacketType RESOURCE_PACK_STATUS = new PacketType(PROTOCOL, SENDER, 0x16, 0x19, "ResourcePackStatus"); public static final PacketType STEER_VEHICLE = new PacketType(PROTOCOL, SENDER, 0x16, 0x15, "SteerVehicle");
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x17, 0x09, "HeldItemSlot"); public static final PacketType RECIPE_DISPLAYED = new PacketType(PROTOCOL, SENDER, 0x17, 0x17, "RecipeDisplayed");
public static final PacketType SET_CREATIVE_SLOT = new PacketType(PROTOCOL, SENDER, 0x18, 0x10, "SetCreativeSlot"); public static final PacketType RESOURCE_PACK_STATUS = new PacketType(PROTOCOL, SENDER, 0x18, 0x16, "ResourcePackStatus");
public static final PacketType UPDATE_SIGN = new PacketType(PROTOCOL, SENDER, 0x19, 0x12, "UpdateSign"); public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x19, 0x17, "HeldItemSlot");
public static final PacketType ARM_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x1A, 0x0A, "ArmAnimation"); public static final PacketType SET_CREATIVE_SLOT = new PacketType(PROTOCOL, SENDER, 0x1A, 0x18, "SetCreativeSlot");
public static final PacketType SPECTATE = new PacketType(PROTOCOL, SENDER, 0x1B, 0x18, "Spectate"); public static final PacketType UPDATE_SIGN = new PacketType(PROTOCOL, SENDER, 0x1B, 0x19, "UpdateSign");
public static final PacketType USE_ITEM = new PacketType(PROTOCOL, SENDER, 0x1C, 0xF6, "UseItem"); public static final PacketType ARM_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x1C, 0x1A, "ArmAnimation");
public static final PacketType BLOCK_PLACE = new PacketType(PROTOCOL, SENDER, 0x1D, 0x08, "BlockPlace"); public static final PacketType SPECTATE = new PacketType(PROTOCOL, SENDER, 0x1D, 0x1B, "Spectate");
public static final PacketType USE_ITEM = new PacketType(PROTOCOL, SENDER, 0x1E, 0x1C, "UseItem");
public static final PacketType BLOCK_PLACE = new PacketType(PROTOCOL, SENDER, 0x1F, 0x1D, "BlockPlace");
private final static Client INSTANCE = new Client(); private final static Client INSTANCE = new Client();

Datei anzeigen

@ -238,12 +238,7 @@ public class ListeningWhitelist {
if (this == EMPTY_WHITELIST) if (this == EMPTY_WHITELIST)
return "EMPTY_WHITELIST"; return "EMPTY_WHITELIST";
else else
return Objects.toStringHelper(this). return "ListeningWhitelist[priority=" + priority + ", packets=" + types + ", gamephase=" + gamePhase + ", options=" + options + "]";
add("priority", priority).
add("packets", types).
add("gamephase", gamePhase).
add("options", options).
toString();
} }
/** /**

Datei anzeigen

@ -74,6 +74,7 @@ import com.comphenix.protocol.wrappers.BukkitConverters;
import com.comphenix.protocol.wrappers.ChunkCoordIntPair; import com.comphenix.protocol.wrappers.ChunkCoordIntPair;
import com.comphenix.protocol.wrappers.ChunkPosition; import com.comphenix.protocol.wrappers.ChunkPosition;
import com.comphenix.protocol.wrappers.EnumWrappers; import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.EnumWrappers.ChatType;
import com.comphenix.protocol.wrappers.EnumWrappers.ChatVisibility; import com.comphenix.protocol.wrappers.EnumWrappers.ChatVisibility;
import com.comphenix.protocol.wrappers.EnumWrappers.ClientCommand; import com.comphenix.protocol.wrappers.EnumWrappers.ClientCommand;
import com.comphenix.protocol.wrappers.EnumWrappers.CombatEventType; import com.comphenix.protocol.wrappers.EnumWrappers.CombatEventType;
@ -956,6 +957,15 @@ public class PacketContainer implements Serializable {
EnumWrappers.getDirectionClass(), EnumWrappers.getDirectionConverter()); EnumWrappers.getDirectionClass(), EnumWrappers.getDirectionConverter());
} }
/**
* Retrieve a read/write structure for the ChatType enum in 1.12.
* @return A modifier for ChatType enum fields.
*/
public StructureModifier<ChatType> getChatTypes() {
return structureModifier.<ChatType>withType(
EnumWrappers.getChatTypeClass(), EnumWrappers.getChatTypeConverter());
}
/** /**
* Retrieve a read/write structure for an enum. This allows for the use of * Retrieve a read/write structure for an enum. This allows for the use of
* user-created enums that may not exist in ProtocolLib. The specific (user * user-created enums that may not exist in ProtocolLib. The specific (user

Datei anzeigen

@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
import com.comphenix.protocol.PacketStream; import com.comphenix.protocol.PacketStream;
import com.comphenix.protocol.PacketType.Sender; import com.comphenix.protocol.PacketType.Sender;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
/** /**
@ -138,10 +137,6 @@ public class ScheduledPacket {
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper(this) return "ScheduledPacket[packet=" + packet + ", target=" + target + ", filtered=" + filtered + "]";
.add("packet", packet)
.add("target", target)
.add("filtered", filtered)
.toString();
} }
} }

Datei anzeigen

@ -139,7 +139,6 @@ class SerializedOfflinePlayer implements OfflinePlayer, Serializable {
return banned; return banned;
} }
@Override
public void setBanned(boolean banned) { public void setBanned(boolean banned) {
this.banned = banned; this.banned = banned;
} }

Datei anzeigen

@ -28,6 +28,7 @@ import java.io.OutputStream;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.GatheringByteChannel; import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel; import java.nio.channels.ScatteringByteChannel;
import java.nio.channels.WritableByteChannel; import java.nio.channels.WritableByteChannel;
@ -214,7 +215,7 @@ public class NettyByteBufAdapter extends AbstractByteBuf {
@Override @Override
public ByteBufAllocator alloc() { public ByteBufAllocator alloc() {
return null; return ByteBufAllocator.DEFAULT;
} }
@Override @Override
@ -389,4 +390,48 @@ public class NettyByteBufAdapter extends AbstractByteBuf {
public ByteBuf retain() { public ByteBuf retain() {
return this; return this;
} }
protected int _getIntLE(int arg0) {
return 0;
}
protected long _getLongLE(int arg0) {
return 0;
}
protected short _getShortLE(int arg0) {
return 0;
}
protected int _getUnsignedMediumLE(int arg0) {
return 0;
}
protected void _setIntLE(int arg0, int arg1) {
}
protected void _setLongLE(int arg0, long arg1) {
}
protected void _setMediumLE(int arg0, int arg1) {
}
protected void _setShortLE(int arg0, int arg1) {
}
public int getBytes(int arg0, FileChannel arg1, long arg2, int arg3) throws IOException {
return 0;
}
public int setBytes(int arg0, FileChannel arg1, long arg2, int arg3) throws IOException {
return 0;
}
public ByteBuf touch() {
return null;
}
public ByteBuf touch(Object arg0) {
return null;
}
} }

Datei anzeigen

@ -17,7 +17,6 @@ import com.google.common.collect.Lists;
* *
* @author Kristian * @author Kristian
*/ */
@SuppressWarnings("unused") // Java 8 compat
public abstract class MethodInfo implements GenericDeclaration, Member { public abstract class MethodInfo implements GenericDeclaration, Member {
/** /**
* Wraps a method as a MethodInfo object. * Wraps a method as a MethodInfo object.

Datei anzeigen

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

Datei anzeigen

@ -44,6 +44,7 @@ public class MinecraftProtocolVersion {
map.put(new MinecraftVersion(1, 10, 0), 210); map.put(new MinecraftVersion(1, 10, 0), 210);
map.put(new MinecraftVersion(1, 11, 0), 315); map.put(new MinecraftVersion(1, 11, 0), 315);
map.put(new MinecraftVersion(1, 11, 1), 316); map.put(new MinecraftVersion(1, 11, 1), 316);
// 1.12 will be >= 330
return map; return map;
} }

Datei anzeigen

@ -44,6 +44,11 @@ public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializa
*/ */
private static final Pattern VERSION_PATTERN = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)"); private static final Pattern VERSION_PATTERN = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)");
/**
* Version 1.12 - the world of color update.
*/
public static final MinecraftVersion COLOR_UPDATE = new MinecraftVersion("1.12");
/** /**
* Version 1.11 - the exploration update. * Version 1.11 - the exploration update.
*/ */

Datei anzeigen

@ -218,7 +218,9 @@ public abstract class EnumWrappers {
END_ROD("endRod", 43, false), END_ROD("endRod", 43, false),
DAMAGE_INDICATOR("damageIndicator", 44, true), DAMAGE_INDICATOR("damageIndicator", 44, true),
SWEEP_ATTACK("sweepAttack", 45, true), SWEEP_ATTACK("sweepAttack", 45, true),
FALLING_DUST("fallingdust", 46, true); FALLING_DUST("fallingdust", 46, false, 1),
TOTEM("totem", 47, false),
SPIT("spit", 48, true);
private static final Map<String, Particle> BY_NAME; private static final Map<String, Particle> BY_NAME;
private static final Map<Integer, Particle> BY_ID; private static final Map<Integer, Particle> BY_ID;
@ -323,12 +325,28 @@ public abstract class EnumWrappers {
} }
public enum Direction { public enum Direction {
DOWN(), DOWN,
UP(), UP,
NORTH(), NORTH,
SOUTH(), SOUTH,
WEST(), WEST,
EAST(); EAST;
}
public enum ChatType {
CHAT(0),
SYSTEM(1),
GAME_INFO(2);
private byte id;
ChatType(int id) {
this.id = (byte) id;
}
public byte getId() {
return id;
}
} }
private static Class<?> PROTOCOL_CLASS = null; private static Class<?> PROTOCOL_CLASS = null;
@ -350,6 +368,7 @@ public abstract class EnumWrappers {
private static Class<?> ITEM_SLOT_CLASS = null; private static Class<?> ITEM_SLOT_CLASS = null;
private static Class<?> HAND_CLASS = null; private static Class<?> HAND_CLASS = null;
private static Class<?> DIRECTION_CLASS = null; private static Class<?> DIRECTION_CLASS = null;
private static Class<?> CHAT_TYPE_CLASS = null;
private static boolean INITIALIZED = false; private static boolean INITIALIZED = false;
private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = Maps.newHashMap(); private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = Maps.newHashMap();
@ -386,6 +405,7 @@ public abstract class EnumWrappers {
ITEM_SLOT_CLASS = getEnum(PacketType.Play.Server.ENTITY_EQUIPMENT.getPacketClass(), 0); ITEM_SLOT_CLASS = getEnum(PacketType.Play.Server.ENTITY_EQUIPMENT.getPacketClass(), 0);
HAND_CLASS = getEnum(PacketType.Play.Client.USE_ENTITY.getPacketClass(), 1); HAND_CLASS = getEnum(PacketType.Play.Client.USE_ENTITY.getPacketClass(), 1);
DIRECTION_CLASS = getEnum(PacketType.Play.Client.USE_ITEM.getPacketClass(), 0); DIRECTION_CLASS = getEnum(PacketType.Play.Client.USE_ITEM.getPacketClass(), 0);
CHAT_TYPE_CLASS = getEnum(PacketType.Play.Server.CHAT.getPacketClass(), 0);
associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter()); associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter());
associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter()); associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter());
@ -406,6 +426,7 @@ public abstract class EnumWrappers {
associate(ITEM_SLOT_CLASS, ItemSlot.class, getItemSlotConverter()); associate(ITEM_SLOT_CLASS, ItemSlot.class, getItemSlotConverter());
associate(HAND_CLASS, Hand.class, getHandConverter()); associate(HAND_CLASS, Hand.class, getHandConverter());
associate(DIRECTION_CLASS, Direction.class, getDirectionConverter()); associate(DIRECTION_CLASS, Direction.class, getDirectionConverter());
associate(CHAT_TYPE_CLASS, ChatType.class, getChatTypeConverter());
INITIALIZED = true; INITIALIZED = true;
} }
@ -534,6 +555,11 @@ public abstract class EnumWrappers {
return DIRECTION_CLASS; return DIRECTION_CLASS;
} }
public static Class<?> getChatTypeClass() {
initialize();
return CHAT_TYPE_CLASS;
}
// Get the converters // Get the converters
public static EquivalentConverter<Protocol> getProtocolConverter() { public static EquivalentConverter<Protocol> getProtocolConverter() {
return new EnumConverter<Protocol>(Protocol.class); return new EnumConverter<Protocol>(Protocol.class);
@ -611,6 +637,10 @@ public abstract class EnumWrappers {
return new EnumConverter<Direction>(Direction.class); return new EnumConverter<Direction>(Direction.class);
} }
public static EquivalentConverter<ChatType> getChatTypeConverter() {
return new EnumConverter<ChatType>(ChatType.class);
}
/** /**
* Retrieve a generic enum converter for use with StructureModifiers. * Retrieve a generic enum converter for use with StructureModifiers.
* @param enumClass - Enum class * @param enumClass - Enum class

Datei anzeigen

@ -195,12 +195,12 @@ public class WrappedAttribute extends AbstractWrapper {
if (obj instanceof WrappedAttribute) { if (obj instanceof WrappedAttribute) {
WrappedAttribute other = (WrappedAttribute) obj; WrappedAttribute other = (WrappedAttribute) obj;
return getBaseValue() == other.getBaseValue() && if (getBaseValue() == other.getBaseValue() &&
Objects.equal(getAttributeKey(), other.getAttributeKey()) && Objects.equal(getAttributeKey(), other.getAttributeKey())) {
Sets.symmetricDifference( return getModifiers().stream()
getModifiers(), .filter((elem) -> !other.getModifiers().contains(elem))
other.getModifiers() .count() == 0;
).isEmpty(); }
} }
return false; return false;
} }
@ -251,12 +251,7 @@ public class WrappedAttribute extends AbstractWrapper {
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper("WrappedAttribute"). return "WrappedAttribute[key=" + getAttributeKey() + ", base=" + getBaseValue() + ", final=" + getFinalValue() + ", modifiers=" + getModifiers() + "]";
add("key", getAttributeKey()).
add("baseValue", getBaseValue()).
add("finalValue", getFinalValue()).
add("modifiers", getModifiers()).
toString();
} }
/** /**

Datei anzeigen

@ -147,10 +147,6 @@ public class WrappedSignedProperty extends AbstractWrapper {
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper(this) return "WrappedSignedProperty[name=" + getName() + ", value=" + getValue() + ", signature=" + getSignature() + "]";
.add("name", getName())
.add("value", getValue())
.add("signature", getSignature())
.toString();
} }
} }

Datei anzeigen

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<name>ProtocolLib</name> <name>ProtocolLib</name>
<version>4.2.2-SNAPSHOT</version> <version>4.3.0-SNAPSHOT</version>
<description>Provides read/write access to the Minecraft protocol.</description> <description>Provides read/write access to the Minecraft protocol.</description>
<url>http://www.spigotmc.org/resources/protocollib.1997/</url> <url>http://www.spigotmc.org/resources/protocollib.1997/</url>
@ -74,8 +74,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version> <version>3.5.1</version>
<configuration> <configuration>
<source>1.7</source> <source>1.8</source>
<target>1.7</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
@ -241,13 +241,13 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version> <version>${spigotVersion}</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.11.2-R0.1-SNAPSHOT</version> <version>${spigotVersion}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

Datei anzeigen

@ -16,19 +16,6 @@
*/ */
package com.comphenix.protocol.injector.netty; package com.comphenix.protocol.injector.netty;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.internal.TypeParameterMatcher;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.net.Socket; import java.net.Socket;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -55,7 +42,6 @@ import com.comphenix.protocol.events.ConnectionSide;
import com.comphenix.protocol.events.NetworkMarker; import com.comphenix.protocol.events.NetworkMarker;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.NetworkProcessor; import com.comphenix.protocol.injector.NetworkProcessor;
import com.comphenix.protocol.injector.netty.WirePacket;
import com.comphenix.protocol.injector.server.SocketInjector; import com.comphenix.protocol.injector.server.SocketInjector;
import com.comphenix.protocol.reflect.FuzzyReflection; import com.comphenix.protocol.reflect.FuzzyReflection;
import com.comphenix.protocol.reflect.VolatileField; import com.comphenix.protocol.reflect.VolatileField;
@ -70,6 +56,19 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.MapMaker; import com.google.common.collect.MapMaker;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.internal.TypeParameterMatcher;
/** /**
* Represents a channel injector. * Represents a channel injector.
* @author Kristian * @author Kristian

Datei anzeigen

@ -20,6 +20,7 @@ import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelId;
import io.netty.channel.ChannelMetadata; import io.netty.channel.ChannelMetadata;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelProgressivePromise; import io.netty.channel.ChannelProgressivePromise;
@ -331,4 +332,20 @@ public abstract class ChannelProxy implements Channel {
public int compareTo(Channel o) { public int compareTo(Channel o) {
return delegate.compareTo(o); return delegate.compareTo(o);
} }
public long bytesBeforeUnwritable() {
return delegate.bytesBeforeUnwritable();
}
public long bytesBeforeWritable() {
return delegate.bytesBeforeWritable();
}
public ChannelId id() {
return delegate.id();
}
public <T> boolean hasAttr(AttributeKey<T> key) {
return delegate.hasAttr(key);
}
} }

Datei anzeigen

@ -256,4 +256,8 @@ abstract class EventLoopProxy implements EventLoop {
public List<Runnable> shutdownNow() { public List<Runnable> shutdownNow() {
return getDelegate().shutdownNow(); return getDelegate().shutdownNow();
} }
public ChannelFuture register(ChannelPromise promise) {
return getDelegate().register(promise);
}
} }

Datei anzeigen

@ -21,6 +21,7 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelProgressivePromise;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.util.concurrent.EventExecutorGroup; import io.netty.util.concurrent.EventExecutorGroup;
@ -368,4 +369,24 @@ public class PipelineProxy implements ChannelPipeline {
public ChannelFuture writeAndFlush(Object arg0) { public ChannelFuture writeAndFlush(Object arg0) {
return pipeline.writeAndFlush(arg0); return pipeline.writeAndFlush(arg0);
} }
public ChannelFuture newFailedFuture(Throwable ex) {
return pipeline.newFailedFuture(ex);
}
public ChannelProgressivePromise newProgressivePromise() {
return pipeline.newProgressivePromise();
}
public ChannelPromise newPromise() {
return pipeline.newPromise();
}
public ChannelFuture newSucceededFuture() {
return pipeline.newSucceededFuture();
}
public ChannelPromise voidPromise() {
return pipeline.voidPromise();
}
} }

Datei anzeigen

@ -5,13 +5,13 @@ import static org.mockito.Mockito.when;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.server.v1_11_R1.DispenserRegistry; import net.minecraft.server.v1_12_R1.DispenserRegistry;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.v1_11_R1.CraftServer; import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemFactory; import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemFactory;
import org.bukkit.craftbukkit.v1_11_R1.util.Versioning; import org.bukkit.craftbukkit.v1_12_R1.util.Versioning;
import com.comphenix.protocol.utility.Constants; import com.comphenix.protocol.utility.Constants;
import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.utility.MinecraftReflection;
@ -52,8 +52,6 @@ public class BukkitInitialization {
// Inject this fake server // Inject this fake server
Bukkit.setServer(mockedServer); Bukkit.setServer(mockedServer);
} }
} }

Datei anzeigen

@ -22,7 +22,7 @@ import static org.junit.Assert.assertFalse;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.minecraft.server.v1_11_R1.PacketLoginInStart; import net.minecraft.server.v1_12_R1.PacketLoginInStart;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;

Datei anzeigen

@ -29,15 +29,15 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_11_R1.AttributeModifier; import net.minecraft.server.v1_12_R1.AttributeModifier;
import net.minecraft.server.v1_11_R1.DataWatcher; import net.minecraft.server.v1_12_R1.DataWatcher;
import net.minecraft.server.v1_11_R1.Entity; import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_11_R1.EntityLightning; import net.minecraft.server.v1_12_R1.EntityLightning;
import net.minecraft.server.v1_11_R1.MobEffect; import net.minecraft.server.v1_12_R1.MobEffect;
import net.minecraft.server.v1_11_R1.MobEffectList; import net.minecraft.server.v1_12_R1.MobEffectList;
import net.minecraft.server.v1_11_R1.PacketPlayOutBoss; import net.minecraft.server.v1_12_R1.PacketPlayOutBoss;
import net.minecraft.server.v1_11_R1.PacketPlayOutUpdateAttributes; import net.minecraft.server.v1_12_R1.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_11_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot; import net.minecraft.server.v1_12_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.apache.commons.lang.SerializationUtils; import org.apache.commons.lang.SerializationUtils;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;

Datei anzeigen

@ -13,6 +13,7 @@ import com.comphenix.protocol.BukkitInitialization;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.injector.netty.WirePacket; import com.comphenix.protocol.injector.netty.WirePacket;
import com.comphenix.protocol.wrappers.EnumWrappers.ChatType;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -29,6 +30,8 @@ public class WirePacketTest {
@Test @Test
public void testPackets() { public void testPackets() {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.CHAT); PacketContainer packet = new PacketContainer(PacketType.Play.Server.CHAT);
packet.getChatTypes().write(0, ChatType.CHAT);
WirePacket wire = WirePacket.fromPacket(packet); WirePacket wire = WirePacket.fromPacket(packet);
WirePacket handle = WirePacket.fromPacket(packet.getHandle()); WirePacket handle = WirePacket.fromPacket(packet.getHandle());
assertEquals(wire, handle); assertEquals(wire, handle);

Datei anzeigen

@ -1,13 +1,13 @@
package com.comphenix.protocol.reflect.cloning; package com.comphenix.protocol.reflect.cloning;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_11_R1.ItemStack; import net.minecraft.server.v1_12_R1.ItemStack;
import net.minecraft.server.v1_11_R1.NonNullList; import net.minecraft.server.v1_12_R1.NonNullList;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;

Datei anzeigen

@ -5,18 +5,18 @@ 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_11_R1.ChatComponentText; import net.minecraft.server.v1_12_R1.ChatComponentText;
import net.minecraft.server.v1_11_R1.ChunkCoordIntPair; import net.minecraft.server.v1_12_R1.ChunkCoordIntPair;
import net.minecraft.server.v1_11_R1.DataWatcher; import net.minecraft.server.v1_12_R1.DataWatcher;
import net.minecraft.server.v1_11_R1.IBlockData; import net.minecraft.server.v1_12_R1.IBlockData;
import net.minecraft.server.v1_11_R1.IChatBaseComponent; import net.minecraft.server.v1_12_R1.IChatBaseComponent;
import net.minecraft.server.v1_11_R1.IChatBaseComponent.ChatSerializer; import net.minecraft.server.v1_12_R1.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_11_R1.NBTCompressedStreamTools; import net.minecraft.server.v1_12_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_11_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot; import net.minecraft.server.v1_12_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import net.minecraft.server.v1_11_R1.PlayerConnection; import net.minecraft.server.v1_12_R1.PlayerConnection;
import net.minecraft.server.v1_11_R1.ServerPing; import net.minecraft.server.v1_12_R1.ServerPing;
import net.minecraft.server.v1_11_R1.ServerPing.ServerData; import net.minecraft.server.v1_12_R1.ServerPing.ServerData;
import net.minecraft.server.v1_11_R1.ServerPing.ServerPingPlayerSample; import net.minecraft.server.v1_12_R1.ServerPing.ServerPingPlayerSample;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

Datei anzeigen

@ -8,7 +8,7 @@ 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_11_R1.IntHashMap; import net.minecraft.server.v1_12_R1.IntHashMap;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;

Datei anzeigen

@ -16,15 +16,15 @@ public class ChunkCoordIntPairTest {
@Test @Test
public void test() { public void test() {
net.minecraft.server.v1_11_R1.ChunkCoordIntPair pair = new net.minecraft.server.v1_11_R1.ChunkCoordIntPair(1, 2); net.minecraft.server.v1_12_R1.ChunkCoordIntPair pair = new net.minecraft.server.v1_12_R1.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_11_R1.ChunkCoordIntPair roundtrip = net.minecraft.server.v1_12_R1.ChunkCoordIntPair roundtrip =
(net.minecraft.server.v1_11_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter(). (net.minecraft.server.v1_12_R1.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
getGeneric(net.minecraft.server.v1_11_R1.ChunkCoordIntPair.class, specific); getGeneric(net.minecraft.server.v1_12_R1.ChunkCoordIntPair.class, specific);
assertEquals(1, roundtrip.x); assertEquals(1, roundtrip.x);
assertEquals(2, roundtrip.z); assertEquals(2, roundtrip.z);

Datei anzeigen

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

Datei anzeigen

@ -6,9 +6,9 @@ import static org.junit.Assert.assertTrue;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_11_R1.AttributeModifier; import net.minecraft.server.v1_12_R1.AttributeModifier;
import net.minecraft.server.v1_11_R1.PacketPlayOutUpdateAttributes; import net.minecraft.server.v1_12_R1.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_11_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot; import net.minecraft.server.v1_12_R1.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;

Datei anzeigen

@ -23,9 +23,9 @@ import static org.junit.Assert.assertTrue;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_11_R1.EntityLightning; import net.minecraft.server.v1_12_R1.EntityLightning;
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftLightningStrike; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLightningStrike;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -90,8 +90,8 @@ public class WrappedDataWatcherTest {
@Test @Test
public void testSerializers() { public void testSerializers() {
Serializer blockPos = Registry.get(net.minecraft.server.v1_11_R1.BlockPosition.class, false); Serializer blockPos = Registry.get(net.minecraft.server.v1_12_R1.BlockPosition.class, false);
Serializer optionalBlockPos = Registry.get(net.minecraft.server.v1_11_R1.BlockPosition.class, true); Serializer optionalBlockPos = Registry.get(net.minecraft.server.v1_12_R1.BlockPosition.class, true);
assertNotSame(blockPos, optionalBlockPos); assertNotSame(blockPos, optionalBlockPos);
// assertNull(Registry.get(ItemStack.class, false)); // assertNull(Registry.get(ItemStack.class, false));

Datei anzeigen

@ -26,8 +26,8 @@ import java.io.DataInputStream;
import java.io.DataOutput; import java.io.DataOutput;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import net.minecraft.server.v1_11_R1.ItemStack; import net.minecraft.server.v1_12_R1.ItemStack;
import net.minecraft.server.v1_11_R1.Items; import net.minecraft.server.v1_12_R1.Items;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;

Datei anzeigen

@ -8,6 +8,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigotVersion>1.12-pre2-SNAPSHOT</spigotVersion>
</properties> </properties>
<modules> <modules>