├── .gitattributes ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── License.txt ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── comphenix │ │ └── packetwrapper │ │ ├── PacketWrapper.java │ │ ├── util │ │ ├── MoreConverters.java │ │ ├── ProtocolConversion.java │ │ ├── ReflectiveAdventureComponentConverter.java │ │ ├── Removed.java │ │ ├── TestExclusion.java │ │ └── UtilityMethod.java │ │ └── wrappers │ │ ├── AbstractPacket.java │ │ ├── data │ │ ├── ResourceKey.java │ │ ├── Vector3I.java │ │ ├── WrappedBoundChatType.java │ │ └── WrappedLastSeenMessagesUpdate.java │ │ ├── handshaking │ │ └── WrapperHandshakingClientSetProtocol.java │ │ ├── login │ │ ├── clientbound │ │ │ ├── WrapperLoginServerCustomPayload.java │ │ │ ├── WrapperLoginServerDisconnect.java │ │ │ ├── WrapperLoginServerEncryptionBegin.java │ │ │ ├── WrapperLoginServerSetCompression.java │ │ │ └── WrapperLoginServerSuccess.java │ │ └── serverbound │ │ │ ├── WrapperLoginClientCustomPayload.java │ │ │ ├── WrapperLoginClientEncryptionBegin.java │ │ │ └── WrapperLoginClientStart.java │ │ ├── play │ │ ├── clientbound │ │ │ ├── WrapperPlayServerAbilities.java │ │ │ ├── WrapperPlayServerAdvancements.java │ │ │ ├── WrapperPlayServerAnimation.java │ │ │ ├── WrapperPlayServerAttachEntity.java │ │ │ ├── WrapperPlayServerAutoRecipe.java │ │ │ ├── WrapperPlayServerBlockAction.java │ │ │ ├── WrapperPlayServerBlockBreakAnimation.java │ │ │ ├── WrapperPlayServerBlockChange.java │ │ │ ├── WrapperPlayServerBlockChangedAck.java │ │ │ ├── WrapperPlayServerBoss.java │ │ │ ├── WrapperPlayServerBundle.java │ │ │ ├── WrapperPlayServerCamera.java │ │ │ ├── WrapperPlayServerChat.java │ │ │ ├── WrapperPlayServerChunksBiomes.java │ │ │ ├── WrapperPlayServerClearTitles.java │ │ │ ├── WrapperPlayServerCloseWindow.java │ │ │ ├── WrapperPlayServerCollect.java │ │ │ ├── WrapperPlayServerCommands.java │ │ │ ├── WrapperPlayServerCustomChatCompletions.java │ │ │ ├── WrapperPlayServerCustomPayload.java │ │ │ ├── WrapperPlayServerDamageEvent.java │ │ │ ├── WrapperPlayServerDeleteChatMessage.java │ │ │ ├── WrapperPlayServerDisguisedChat.java │ │ │ ├── WrapperPlayServerEntityDestroy.java │ │ │ ├── WrapperPlayServerEntityEffect.java │ │ │ ├── WrapperPlayServerEntityEquipment.java │ │ │ ├── WrapperPlayServerEntityHeadRotation.java │ │ │ ├── WrapperPlayServerEntityLook.java │ │ │ ├── WrapperPlayServerEntityMetadata.java │ │ │ ├── WrapperPlayServerEntitySound.java │ │ │ ├── WrapperPlayServerEntityStatus.java │ │ │ ├── WrapperPlayServerEntityTeleport.java │ │ │ ├── WrapperPlayServerEntityVelocity.java │ │ │ ├── WrapperPlayServerExperience.java │ │ │ ├── WrapperPlayServerExplosion.java │ │ │ ├── WrapperPlayServerGameStateChange.java │ │ │ ├── WrapperPlayServerHeldItemSlot.java │ │ │ ├── WrapperPlayServerHurtAnimation.java │ │ │ ├── WrapperPlayServerInitializeBorder.java │ │ │ ├── WrapperPlayServerKeepAlive.java │ │ │ ├── WrapperPlayServerKickDisconnect.java │ │ │ ├── WrapperPlayServerLightUpdate.java │ │ │ ├── WrapperPlayServerLogin.java │ │ │ ├── WrapperPlayServerLookAt.java │ │ │ ├── WrapperPlayServerMap.java │ │ │ ├── WrapperPlayServerMapChunk.java │ │ │ ├── WrapperPlayServerMount.java │ │ │ ├── WrapperPlayServerMultiBlockChange.java │ │ │ ├── WrapperPlayServerNamedEntitySpawn.java │ │ │ ├── WrapperPlayServerNamedSoundEffect.java │ │ │ ├── WrapperPlayServerNbtQuery.java │ │ │ ├── WrapperPlayServerOpenBook.java │ │ │ ├── WrapperPlayServerOpenSignEditor.java │ │ │ ├── WrapperPlayServerOpenWindow.java │ │ │ ├── WrapperPlayServerOpenWindowHorse.java │ │ │ ├── WrapperPlayServerOpenWindowMerchant.java │ │ │ ├── WrapperPlayServerPing.java │ │ │ ├── WrapperPlayServerPlayerCombatEnd.java │ │ │ ├── WrapperPlayServerPlayerCombatEnter.java │ │ │ ├── WrapperPlayServerPlayerCombatKill.java │ │ │ ├── WrapperPlayServerPlayerInfo.java │ │ │ ├── WrapperPlayServerPlayerInfoRemove.java │ │ │ ├── WrapperPlayServerPlayerListHeaderFooter.java │ │ │ ├── WrapperPlayServerPosition.java │ │ │ ├── WrapperPlayServerRecipeUpdate.java │ │ │ ├── WrapperPlayServerRecipes.java │ │ │ ├── WrapperPlayServerRelEntityMove.java │ │ │ ├── WrapperPlayServerRelEntityMoveLook.java │ │ │ ├── WrapperPlayServerRemoveEntityEffect.java │ │ │ ├── WrapperPlayServerResourcePackSend.java │ │ │ ├── WrapperPlayServerRespawn.java │ │ │ ├── WrapperPlayServerScoreboardDisplayObjective.java │ │ │ ├── WrapperPlayServerScoreboardObjective.java │ │ │ ├── WrapperPlayServerScoreboardScore.java │ │ │ ├── WrapperPlayServerScoreboardTeam.java │ │ │ ├── WrapperPlayServerSelectAdvancementTab.java │ │ │ ├── WrapperPlayServerServerData.java │ │ │ ├── WrapperPlayServerServerDifficulty.java │ │ │ ├── WrapperPlayServerSetActionBarText.java │ │ │ ├── WrapperPlayServerSetBorderCenter.java │ │ │ ├── WrapperPlayServerSetBorderLerpSize.java │ │ │ ├── WrapperPlayServerSetBorderSize.java │ │ │ ├── WrapperPlayServerSetBorderWarningDelay.java │ │ │ ├── WrapperPlayServerSetBorderWarningDistance.java │ │ │ ├── WrapperPlayServerSetCooldown.java │ │ │ ├── WrapperPlayServerSetSlot.java │ │ │ ├── WrapperPlayServerSetSubtitleText.java │ │ │ ├── WrapperPlayServerSetTitleText.java │ │ │ ├── WrapperPlayServerSetTitlesAnimation.java │ │ │ ├── WrapperPlayServerSpawnEntity.java │ │ │ ├── WrapperPlayServerSpawnEntityExperienceOrb.java │ │ │ ├── WrapperPlayServerSpawnPosition.java │ │ │ ├── WrapperPlayServerStatistic.java │ │ │ ├── WrapperPlayServerStopSound.java │ │ │ ├── WrapperPlayServerSystemChat.java │ │ │ ├── WrapperPlayServerTabComplete.java │ │ │ ├── WrapperPlayServerTags.java │ │ │ ├── WrapperPlayServerTileEntityData.java │ │ │ ├── WrapperPlayServerUnloadChunk.java │ │ │ ├── WrapperPlayServerUpdateAttributes.java │ │ │ ├── WrapperPlayServerUpdateEnabledFeatures.java │ │ │ ├── WrapperPlayServerUpdateHealth.java │ │ │ ├── WrapperPlayServerUpdateSimulationDistance.java │ │ │ ├── WrapperPlayServerUpdateTime.java │ │ │ ├── WrapperPlayServerVehicleMove.java │ │ │ ├── WrapperPlayServerViewCentre.java │ │ │ ├── WrapperPlayServerViewDistance.java │ │ │ ├── WrapperPlayServerWindowData.java │ │ │ ├── WrapperPlayServerWindowItems.java │ │ │ ├── WrapperPlayServerWorldEvent.java │ │ │ └── WrapperPlayServerWorldParticles.java │ │ └── serverbound │ │ │ ├── WrapperPlayClientAbilities.java │ │ │ ├── WrapperPlayClientAdvancements.java │ │ │ ├── WrapperPlayClientArmAnimation.java │ │ │ ├── WrapperPlayClientAutoRecipe.java │ │ │ ├── WrapperPlayClientBEdit.java │ │ │ ├── WrapperPlayClientBeacon.java │ │ │ ├── WrapperPlayClientBlockDig.java │ │ │ ├── WrapperPlayClientBoatMove.java │ │ │ ├── WrapperPlayClientChat.java │ │ │ ├── WrapperPlayClientChatAck.java │ │ │ ├── WrapperPlayClientChatCommand.java │ │ │ ├── WrapperPlayClientChatSessionUpdate.java │ │ │ ├── WrapperPlayClientClientCommand.java │ │ │ ├── WrapperPlayClientCloseWindow.java │ │ │ ├── WrapperPlayClientCustomPayload.java │ │ │ ├── WrapperPlayClientDifficultyChange.java │ │ │ ├── WrapperPlayClientDifficultyLock.java │ │ │ ├── WrapperPlayClientEnchantItem.java │ │ │ ├── WrapperPlayClientEntityAction.java │ │ │ ├── WrapperPlayClientEntityNbtQuery.java │ │ │ ├── WrapperPlayClientGround.java │ │ │ ├── WrapperPlayClientHeldItemSlot.java │ │ │ ├── WrapperPlayClientItemName.java │ │ │ ├── WrapperPlayClientJigsawGenerate.java │ │ │ ├── WrapperPlayClientKeepAlive.java │ │ │ ├── WrapperPlayClientLook.java │ │ │ ├── WrapperPlayClientPickItem.java │ │ │ ├── WrapperPlayClientPong.java │ │ │ ├── WrapperPlayClientPosition.java │ │ │ ├── WrapperPlayClientPositionLook.java │ │ │ ├── WrapperPlayClientRecipeDisplayed.java │ │ │ ├── WrapperPlayClientRecipeSettings.java │ │ │ ├── WrapperPlayClientResourcePackStatus.java │ │ │ ├── WrapperPlayClientSetCommandBlock.java │ │ │ ├── WrapperPlayClientSetCommandMinecart.java │ │ │ ├── WrapperPlayClientSetCreativeSlot.java │ │ │ ├── WrapperPlayClientSetJigsaw.java │ │ │ ├── WrapperPlayClientSettings.java │ │ │ ├── WrapperPlayClientSpectate.java │ │ │ ├── WrapperPlayClientSteerVehicle.java │ │ │ ├── WrapperPlayClientStruct.java │ │ │ ├── WrapperPlayClientTabComplete.java │ │ │ ├── WrapperPlayClientTeleportAccept.java │ │ │ ├── WrapperPlayClientTileNbtQuery.java │ │ │ ├── WrapperPlayClientTrSel.java │ │ │ ├── WrapperPlayClientUpdateSign.java │ │ │ ├── WrapperPlayClientUseEntity.java │ │ │ ├── WrapperPlayClientUseItem.java │ │ │ ├── WrapperPlayClientVehicleMove.java │ │ │ └── WrapperPlayClientWindowClick.java │ │ └── status │ │ ├── clientbound │ │ ├── WrapperStatusServerPong.java │ │ └── WrapperStatusServerServerInfo.java │ │ └── serverbound │ │ ├── WrapperStatusClientPing.java │ │ └── WrapperStatusClientStart.java └── resources │ └── plugin.yml └── test └── java └── com └── comphenix └── packetwrapper ├── BaseTestInitialization.java ├── PacketWrapperTest.java ├── util ├── BukkitInitialization.java ├── MinecraftReflectionTestUtil.java ├── PacketWrapperUtils.java ├── ProtocolConversionTest.java └── Utils.java └── wrappers ├── login ├── clientbound │ └── WrapperLoginServerCustomPayloadTest.java └── serverbound │ └── WrapperLoginClientCustomPayloadTest.java └── play ├── clientbound ├── WrapperPlayServerBossTest.java ├── WrapperPlayServerBundleTest.java ├── WrapperPlayServerChatTest.java ├── WrapperPlayServerChunksBiomesTest.java ├── WrapperPlayServerCustomChatCompletionsTest.java ├── WrapperPlayServerEntityEffectTest.java ├── WrapperPlayServerEntityEquipmentTest.java ├── WrapperPlayServerEntityLookTest.java ├── WrapperPlayServerLoginTest.java ├── WrapperPlayServerLookAtTest.java ├── WrapperPlayServerMapTest.java ├── WrapperPlayServerPlayerListHeaderFooterTest.java ├── WrapperPlayServerPositionTest.java ├── WrapperPlayServerRecipesTest.java ├── WrapperPlayServerRelEntityMoveLookTest.java ├── WrapperPlayServerRelEntityMoveTest.java ├── WrapperPlayServerRespawnTest.java ├── WrapperPlayServerScoreboardTeamTest.java ├── WrapperPlayServerSetCooldownTest.java ├── WrapperPlayServerTabCompleteTest.java ├── WrapperPlayServerTagsTest.java └── WrapperPlayServerTileEntityDataTest.java └── serverbound ├── WrapperPlayClientAdvancementsTest.java ├── WrapperPlayClientChatCommandTest.java ├── WrapperPlayClientRecipeSettingsTest.java ├── WrapperPlayClientSetCommandBlockTest.java ├── WrapperPlayClientSetJigsawTest.java ├── WrapperPlayClientSettingsTest.java ├── WrapperPlayClientStructTest.java ├── WrapperPlayClientUseEntityTest.java ├── WrapperPlayClientWindowClickTest.java └── WrapperPlayServerLoginTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.java eol=crlf 2 | *.yml eol=crlf 3 | *.xml eol=crlf -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created 2 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path 3 | 4 | name: Build 5 | 6 | permissions: write-all 7 | on: 8 | - push 9 | - pull_request 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: read 16 | packages: write 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | - name: Set up JDK 11 21 | uses: actions/setup-java@v3 22 | with: 23 | distribution: 'temurin' 24 | java-version: '19' 25 | cache: 'maven' 26 | server-id: github # Value of the distributionManagement/repository/id field of the pom.xml 27 | settings-path: ${{ github.workspace }} # location for the settings.xml file 28 | 29 | - name: Build with Maven 30 | run: mvn --batch-mode package 31 | 32 | # - name: Publish to GitHub Packages Apache Maven 33 | # run: mvn --batch-mode deploy -s $GITHUB_WORKSPACE/settings.xml 34 | # env: 35 | # GITHUB_TOKEN: ${{ github.token }} 36 | 37 | - name: Upload plugin file 38 | uses: actions/upload-artifact@v3 39 | with: 40 | name: PacketWrapper 41 | path: target/PacketWrapper.jar 42 | # - name: Deploy JavaDoc 43 | # uses: MathieuSoysal/Javadoc-publisher.yml@v2.4.0 44 | # with: 45 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 46 | # javadoc-branch: javadoc 47 | # java-version: 17 48 | # target-folder: javadoc 49 | # project: maven -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse stuff 2 | .classpath 3 | .project 4 | .settings/ 5 | 6 | # netbeans 7 | nbproject/ 8 | nbactions.xml 9 | 10 | # we use maven! 11 | build.xml 12 | 13 | # maven 14 | target/ 15 | dependency-reduced-pom.xml 16 | 17 | # vim 18 | .*.sw[a-p] 19 | 20 | # various other potential build files 21 | build/ 22 | bin/ 23 | dist/ 24 | manifest.mf 25 | 26 | # Mac filesystem dust 27 | .DS_Store/ 28 | 29 | # intellij 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | 35 | # other files 36 | *.log* 37 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukalt/PacketWrapper/a9fbeb417aa137e869c9fef12715f265d7a3d9f1/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 19 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/PacketWrapper.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper; 2 | 3 | import com.comphenix.protocol.utility.MinecraftVersion; 4 | import org.bukkit.plugin.java.JavaPlugin; 5 | 6 | import java.util.Objects; 7 | 8 | public class PacketWrapper extends JavaPlugin { 9 | @Override 10 | public void onEnable() { 11 | if(!Objects.equals(MinecraftVersion.getCurrentVersion(), MinecraftVersion.FEATURE_PREVIEW_2) && !Objects.equals(MinecraftVersion.getCurrentVersion(), MinecraftVersion.TRAILS_AND_TAILS)) { 12 | this.getLogger().severe("Incompatible version of Minecraft. This version of PacketWrapper is only compatible with Minecraft 1.19.4 and 1.20 but you are using " + MinecraftVersion.getCurrentVersion()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/util/ProtocolConversion.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | /** 4 | * @author Lukas Alt 5 | * @since 15.05.2023 6 | */ 7 | public class ProtocolConversion { 8 | public static float angleToDegrees(byte rawAngle) { 9 | return rawAngle / 256.0F * 360.0F; 10 | } 11 | 12 | public static byte degreesToAngle(float degree) { 13 | return (byte)((int)(degree * 256.0F / 360.0F)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/util/Removed.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface Removed { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/util/TestExclusion.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author Lukas Alt 10 | * @since 07.05.2023 11 | */ 12 | @Target(ElementType.METHOD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface TestExclusion { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/util/UtilityMethod.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author Lukas Alt 10 | * @since 07.05.2023 11 | */ 12 | @Target(ElementType.METHOD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface UtilityMethod { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/clientbound/WrapperLoginServerDisconnect.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.WrappedChatComponent; 7 | 8 | public class WrapperLoginServerDisconnect extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Login.Server.DISCONNECT; 11 | 12 | public WrapperLoginServerDisconnect() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperLoginServerDisconnect(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'reason' 22 | * 23 | * @return 'reason' 24 | */ 25 | public WrappedChatComponent getReason() { 26 | return this.handle.getChatComponents().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'reason' 31 | * 32 | * @param value New value for field 'reason' 33 | */ 34 | public void setReason(WrappedChatComponent value) { 35 | this.handle.getChatComponents().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/clientbound/WrapperLoginServerEncryptionBegin.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperLoginServerEncryptionBegin extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Login.Server.ENCRYPTION_BEGIN; 10 | 11 | public WrapperLoginServerEncryptionBegin() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperLoginServerEncryptionBegin(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'serverId' 21 | * 22 | * @return 'serverId' 23 | */ 24 | public String getServerId() { 25 | return this.handle.getStrings().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'serverId' 30 | * 31 | * @param value New value for field 'serverId' 32 | */ 33 | public void setServerId(String value) { 34 | this.handle.getStrings().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'publicKey' 39 | * 40 | * @return 'publicKey' 41 | */ 42 | public byte[] getPublicKey() { 43 | return this.handle.getByteArrays().read(0); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'publicKey' 48 | * 49 | * @param value New value for field 'publicKey' 50 | */ 51 | public void setPublicKey(byte[] value) { 52 | this.handle.getByteArrays().write(0, value); 53 | } 54 | 55 | /** 56 | * Retrieves the value of field 'challenge' 57 | * 58 | * @return 'challenge' 59 | */ 60 | public byte[] getChallenge() { 61 | return this.handle.getByteArrays().read(1); 62 | } 63 | 64 | /** 65 | * Sets the value of field 'challenge' 66 | * 67 | * @param value New value for field 'challenge' 68 | */ 69 | public void setChallenge(byte[] value) { 70 | this.handle.getByteArrays().write(1, value); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/clientbound/WrapperLoginServerSetCompression.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperLoginServerSetCompression extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Login.Server.SET_COMPRESSION; 10 | 11 | public WrapperLoginServerSetCompression() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperLoginServerSetCompression(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'compressionThreshold' 21 | * 22 | * @return 'compressionThreshold' 23 | */ 24 | public int getCompressionThreshold() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'compressionThreshold' 30 | * 31 | * @param value New value for field 'compressionThreshold' 32 | */ 33 | public void setCompressionThreshold(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/clientbound/WrapperLoginServerSuccess.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.WrappedGameProfile; 7 | 8 | public class WrapperLoginServerSuccess extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Login.Server.SUCCESS; 11 | 12 | public WrapperLoginServerSuccess() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperLoginServerSuccess(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'gameProfile' 22 | * 23 | * @return 'gameProfile' 24 | */ 25 | public WrappedGameProfile getGameProfile() { 26 | return this.handle.getGameProfiles().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'gameProfile' 31 | * 32 | * @param value New value for field 'gameProfile' 33 | */ 34 | public void setGameProfile(WrappedGameProfile value) { 35 | this.handle.getGameProfiles().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/serverbound/WrapperLoginClientCustomPayload.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.packetwrapper.util.TestExclusion; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.InternalStructure; 7 | import com.comphenix.protocol.events.PacketContainer; 8 | import com.comphenix.protocol.utility.MinecraftReflection; 9 | import io.netty.buffer.ByteBuf; 10 | 11 | public class WrapperLoginClientCustomPayload extends AbstractPacket { 12 | 13 | public static final PacketType TYPE = PacketType.Login.Client.CUSTOM_PAYLOAD; 14 | 15 | public WrapperLoginClientCustomPayload() { 16 | super(TYPE); 17 | } 18 | 19 | public WrapperLoginClientCustomPayload(PacketContainer packet) { 20 | super(packet, TYPE); 21 | } 22 | 23 | /** 24 | * Retrieves the value of field 'transactionId' 25 | * 26 | * @return 'transactionId' 27 | */ 28 | public int getTransactionId() { 29 | return this.handle.getIntegers().read(0); 30 | } 31 | 32 | /** 33 | * Sets the value of field 'transactionId' 34 | * 35 | * @param value New value for field 'transactionId' 36 | */ 37 | public void setTransactionId(int value) { 38 | this.handle.getIntegers().write(0, value); 39 | } 40 | 41 | /** 42 | * Retrieves the value of field 'data' 43 | * 44 | * @return 'data' 45 | */ 46 | @TestExclusion 47 | public ByteBuf getData() { 48 | return this.handle.getStructures().read(0).getModifier().withType(ByteBuf.class).read(0); 49 | } 50 | 51 | /** 52 | * Sets the value of field 'data' 53 | * 54 | * @param value New value for field 'data' 55 | */ 56 | public void setData(ByteBuf value) { 57 | InternalStructure structure = InternalStructure.getConverter().getSpecific(MinecraftReflection.getPacketDataSerializer(value)); 58 | this.handle.getStructures().write(0, structure); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/serverbound/WrapperLoginClientEncryptionBegin.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperLoginClientEncryptionBegin extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Login.Client.ENCRYPTION_BEGIN; 10 | 11 | public WrapperLoginClientEncryptionBegin() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperLoginClientEncryptionBegin(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'keybytes' 21 | * 22 | * @return 'keybytes' 23 | */ 24 | public byte[] getKeyBytes() { 25 | return this.handle.getByteArrays().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'keybytes' 30 | * 31 | * @param value New value for field 'keybytes' 32 | */ 33 | public void setKeyBytes(byte[] value) { 34 | this.handle.getByteArrays().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'encryptedChallenge' 39 | * 40 | * @return 'encryptedChallenge' 41 | */ 42 | public byte[] getEncryptedChallenge() { 43 | return this.handle.getByteArrays().read(1); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'encryptedChallenge' 48 | * 49 | * @param value New value for field 'encryptedChallenge' 50 | */ 51 | public void setEncryptedChallenge(byte[] value) { 52 | this.handle.getByteArrays().write(1, value); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/login/serverbound/WrapperLoginClientStart.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.Converters; 7 | 8 | import javax.annotation.Nullable; 9 | import java.util.Optional; 10 | import java.util.UUID; 11 | 12 | public class WrapperLoginClientStart extends AbstractPacket { 13 | 14 | public static final PacketType TYPE = PacketType.Login.Client.START; 15 | 16 | public WrapperLoginClientStart() { 17 | super(TYPE); 18 | } 19 | 20 | public WrapperLoginClientStart(PacketContainer packet) { 21 | super(packet, TYPE); 22 | } 23 | 24 | /** 25 | * Retrieves the value of field 'name' 26 | * 27 | * @return 'name' 28 | */ 29 | public String getName() { 30 | return this.handle.getStrings().read(0); 31 | } 32 | 33 | /** 34 | * Sets the value of field 'name' 35 | * 36 | * @param value New value for field 'name' 37 | */ 38 | public void setName(String value) { 39 | this.handle.getStrings().write(0, value); 40 | } 41 | 42 | /** 43 | * Retrieves the value of field 'profileId' 44 | * 45 | * @return 'profileId' 46 | */ 47 | public Optional getProfileId() { 48 | return this.handle.getOptionals(Converters.passthrough(UUID.class)).read(0); 49 | } 50 | 51 | /** 52 | * Sets the value of field 'profileId' 53 | * 54 | * @param value New value for field 'profileId' 55 | */ 56 | public void setProfileId(@Nullable UUID value) { 57 | this.handle.getOptionals(Converters.passthrough(UUID.class)).write(0, Optional.ofNullable(value)); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerAttachEntity.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerAttachEntity extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.ATTACH_ENTITY; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerAttachEntity() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerAttachEntity(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'sourceId' 32 | * 33 | * @return 'sourceId' 34 | */ 35 | public int getSourceId() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'sourceId' 41 | * 42 | * @param value New value for field 'sourceId' 43 | */ 44 | public void setSourceId(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'destId' 50 | * 51 | * @return 'destId' 52 | */ 53 | public int getDestId() { 54 | return this.handle.getIntegers().read(1); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'destId' 59 | * 60 | * @param value New value for field 'destId' 61 | */ 62 | public void setDestId(int value) { 63 | this.handle.getIntegers().write(1, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerAutoRecipe.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.MinecraftKey; 7 | 8 | public class WrapperPlayServerAutoRecipe extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.AUTO_RECIPE; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerAutoRecipe() { 19 | super(TYPE); 20 | } 21 | 22 | /** 23 | * Constructors a new wrapper for the specified packet 24 | * 25 | * @param packet the packet to wrap 26 | */ 27 | public WrapperPlayServerAutoRecipe(PacketContainer packet) { 28 | super(packet, TYPE); 29 | } 30 | 31 | /** 32 | * Retrieves the value of field 'containerId' 33 | * 34 | * @return 'containerId' 35 | */ 36 | public int getContainerId() { 37 | return this.handle.getIntegers().read(0); 38 | } 39 | 40 | /** 41 | * Sets the value of field 'containerId' 42 | * 43 | * @param value New value for field 'containerId' 44 | */ 45 | public void setContainerId(int value) { 46 | this.handle.getIntegers().write(0, value); 47 | } 48 | 49 | /** 50 | * Retrieves the value of field 'recipe' 51 | * 52 | * @return 'recipe' 53 | */ 54 | public MinecraftKey getRecipe() { 55 | return this.handle.getMinecraftKeys().read(0); 56 | } 57 | 58 | /** 59 | * Sets the value of field 'recipe' 60 | * 61 | * @param value New value for field 'recipe' 62 | */ 63 | public void setRecipe(MinecraftKey value) { 64 | this.handle.getMinecraftKeys().write(0, value); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerBlockChange.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BlockPosition; 7 | import com.comphenix.protocol.wrappers.WrappedBlockData; 8 | 9 | /** 10 | * Fired whenever a block is changed within the render distance. 11 | */ 12 | public class WrapperPlayServerBlockChange extends AbstractPacket { 13 | 14 | /** 15 | * The packet type that is wrapped by this wrapper. 16 | */ 17 | public static final PacketType TYPE = PacketType.Play.Server.BLOCK_CHANGE; 18 | 19 | /** 20 | * Constructs a new wrapper and initialize it with a packet handle with default values 21 | */ 22 | public WrapperPlayServerBlockChange() { 23 | super(TYPE); 24 | } 25 | 26 | /** 27 | * Constructors a new wrapper for the specified packet 28 | * 29 | * @param packet the packet to wrap 30 | */ 31 | public WrapperPlayServerBlockChange(PacketContainer packet) { 32 | super(packet, TYPE); 33 | } 34 | 35 | /** 36 | * Retrieves the position of the block. 37 | * 38 | * @return position of block 39 | */ 40 | public BlockPosition getPos() { 41 | return this.handle.getBlockPositionModifier().read(0); 42 | } 43 | 44 | /** 45 | * Sets the position of the block 46 | * 47 | * @param value position of block 48 | */ 49 | public void setPos(BlockPosition value) { 50 | this.handle.getBlockPositionModifier().write(0, value); 51 | } 52 | 53 | /** 54 | * Retrieves the new block state 55 | * 56 | * @return 'blockState' 57 | */ 58 | public WrappedBlockData getBlockState() { 59 | return this.handle.getBlockData().read(0); 60 | } 61 | 62 | /** 63 | * Sets the new block state 64 | * 65 | * @param value New value for field 'blockState' 66 | */ 67 | public void setBlockState(WrappedBlockData value) { 68 | this.handle.getBlockData().write(0, value); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerBlockChangedAck.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * Acknowledges a user-initiated block change. After receiving this packet, the client will display the block state sent by the server instead of the one predicted by the client. 9 | */ 10 | public class WrapperPlayServerBlockChangedAck extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.BLOCK_CHANGED_ACK; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerBlockChangedAck() { 21 | super(TYPE); 22 | } 23 | 24 | /** 25 | * Constructors a new wrapper for the specified packet 26 | * 27 | * @param packet the packet to wrap 28 | */ 29 | public WrapperPlayServerBlockChangedAck(PacketContainer packet) { 30 | super(packet, TYPE); 31 | } 32 | 33 | /** 34 | * Retrieves the value of field 'sequence'. This is used for properly syncing block changes to the client after interactions. 35 | * 36 | * @return 'sequence' 37 | */ 38 | public int getSequence() { 39 | return this.handle.getIntegers().read(0); 40 | } 41 | 42 | /** 43 | * Sets the value of field 'sequence'. This is used for properly syncing block changes to the client after interactions. 44 | * 45 | * @param value New value for field 'sequence' 46 | */ 47 | public void setSequence(int value) { 48 | this.handle.getIntegers().write(0, value); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerBundle.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * A collection of several packets that are sent to the client at once. The client executes each of these packets 9 | * in the same tick. 10 | */ 11 | public class WrapperPlayServerBundle extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.BUNDLE; 17 | 18 | /** 19 | * Constructs a new wrapper and initialize it with a packet handle with default values 20 | */ 21 | public WrapperPlayServerBundle() { 22 | super(TYPE); 23 | } 24 | 25 | /** 26 | * Constructors a new wrapper for the specified packet 27 | * 28 | * @param packet the packet to wrap 29 | */ 30 | public WrapperPlayServerBundle(PacketContainer packet) { 31 | super(packet, TYPE); 32 | } 33 | 34 | /** 35 | * Gets an iterable of the packets in this bundle 36 | * 37 | * @return packets in this bundle 38 | */ 39 | public Iterable getPackets() { 40 | return this.handle.getPacketBundles().read(0); 41 | } 42 | 43 | /** 44 | * Sets the packets in this bundle 45 | * 46 | * @param packets packets in this bundle 47 | */ 48 | public void setPackets(Iterable packets) { 49 | this.handle.getPacketBundles().write(0, packets); 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerCamera.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * Sent by the server to the client to instruct the client to render from the entity identified by the provided id 9 | * perspective. 10 | */ 11 | public class WrapperPlayServerCamera extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.CAMERA; 17 | 18 | /** 19 | * Constructs a new wrapper and initialize it with a packet handle with default values 20 | */ 21 | public WrapperPlayServerCamera() { 22 | super(TYPE); 23 | } 24 | 25 | public WrapperPlayServerCamera(PacketContainer packet) { 26 | super(packet, TYPE); 27 | } 28 | 29 | /** 30 | * Gets the id of the entity to spectate 31 | * 32 | * @return 'cameraId' 33 | */ 34 | public int getCameraId() { 35 | return this.handle.getIntegers().read(0); 36 | } 37 | 38 | /** 39 | * Sets the entity id of the entity to spectate 40 | * 41 | * @param value New value for field 'cameraId' 42 | */ 43 | public void setCameraId(int value) { 44 | this.handle.getIntegers().write(0, value); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerClearTitles.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerClearTitles extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.CLEAR_TITLES; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerClearTitles() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerClearTitles(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'resetTimes' 27 | * 28 | * @return 'resetTimes' 29 | */ 30 | public boolean getResetTimes() { 31 | return this.handle.getBooleans().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'resetTimes' 36 | * 37 | * @param value New value for field 'resetTimes' 38 | */ 39 | public void setResetTimes(boolean value) { 40 | this.handle.getBooleans().write(0, value); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerCloseWindow.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * Send by server to client to close a container with provided id 9 | */ 10 | public class WrapperPlayServerCloseWindow extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.CLOSE_WINDOW; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerCloseWindow() { 21 | super(TYPE); 22 | } 23 | 24 | public WrapperPlayServerCloseWindow(PacketContainer packet) { 25 | super(packet, TYPE); 26 | } 27 | 28 | /** 29 | * Gets the id of the container to close 30 | * 31 | * @return 'containerId' 32 | */ 33 | public int getContainerId() { 34 | return this.handle.getIntegers().read(0); 35 | } 36 | 37 | /** 38 | * Sets the id of the container to close 39 | * 40 | * @param value New value for field 'containerId' 41 | */ 42 | public void setContainerId(int value) { 43 | this.handle.getIntegers().write(0, value); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerCollect.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerCollect extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.COLLECT; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerCollect() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerCollect(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'itemId' 27 | * 28 | * @return 'itemId' 29 | */ 30 | public int getItemId() { 31 | return this.handle.getIntegers().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'itemId' 36 | * 37 | * @param value New value for field 'itemId' 38 | */ 39 | public void setItemId(int value) { 40 | this.handle.getIntegers().write(0, value); 41 | } 42 | 43 | /** 44 | * Retrieves the value of field 'playerId' 45 | * 46 | * @return 'playerId' 47 | */ 48 | public int getPlayerId() { 49 | return this.handle.getIntegers().read(1); 50 | } 51 | 52 | /** 53 | * Sets the value of field 'playerId' 54 | * 55 | * @param value New value for field 'playerId' 56 | */ 57 | public void setPlayerId(int value) { 58 | this.handle.getIntegers().write(1, value); 59 | } 60 | 61 | /** 62 | * Retrieves the value of field 'amount' 63 | * 64 | * @return 'amount' 65 | */ 66 | public int getAmount() { 67 | return this.handle.getIntegers().read(2); 68 | } 69 | 70 | /** 71 | * Sets the value of field 'amount' 72 | * 73 | * @param value New value for field 'amount' 74 | */ 75 | public void setAmount(int value) { 76 | this.handle.getIntegers().write(2, value); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerCommands.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.InternalStructure; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | 8 | import java.util.List; 9 | 10 | public class WrapperPlayServerCommands extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.COMMANDS; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerCommands() { 21 | super(TYPE); 22 | } 23 | 24 | public WrapperPlayServerCommands(PacketContainer packet) { 25 | super(packet, TYPE); 26 | } 27 | 28 | /** 29 | * Retrieves the value of field 'rootIndex' 30 | * 31 | * @return 'rootIndex' 32 | */ 33 | public int getRootIndex() { 34 | return this.handle.getIntegers().read(0); 35 | } 36 | 37 | /** 38 | * Sets the value of field 'rootIndex' 39 | * 40 | * @param value New value for field 'rootIndex' 41 | */ 42 | public void setRootIndex(int value) { 43 | this.handle.getIntegers().write(0, value); 44 | } 45 | 46 | /** 47 | * Retrieves the value of field 'entries' 48 | * 49 | * @return 'entries' 50 | */ 51 | public List getEntriesInternal() { 52 | return this.handle.getLists(InternalStructure.getConverter()).read(0); // TODO: Multiple modifier have been found for type interface java.util.List Generic type: [class net.minecraft.network.protocol.game.ClientboundCommandsPacket$Entry] 53 | } 54 | 55 | /** 56 | * Sets the value of field 'entries' 57 | * 58 | * @param value New value for field 'entries' 59 | */ 60 | public void setEntriesInternal(List value) { 61 | this.handle.getLists(InternalStructure.getConverter()).write(0, value); // TODO 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerDeleteChatMessage.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.InternalStructure; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | 8 | public class WrapperPlayServerDeleteChatMessage extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.DELETE_CHAT_MESSAGE; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerDeleteChatMessage() { 19 | super(TYPE); 20 | } 21 | 22 | public WrapperPlayServerDeleteChatMessage(PacketContainer packet) { 23 | super(packet, TYPE); 24 | } 25 | 26 | /** 27 | * Retrieves the value of field 'messageSignature' 28 | * ProtocolLib currently does not provide a wrapper for this type. Access to this type is only provided by an InternalStructure 29 | * 30 | * @return 'messageSignature' 31 | */ 32 | public InternalStructure getMessageSignatureInternal() { 33 | return this.handle.getStructures().read(0); // TODO: No specific modifier has been found for type class net.minecraft.network.chat.MessageSignature$Packed Generic type: class net.minecraft.network.chat.MessageSignature$Packed 34 | } 35 | 36 | /** 37 | * Sets the value of field 'messageSignature' 38 | * ProtocolLib currently does not provide a wrapper for this type. Access to this type is only provided by an InternalStructure 39 | * 40 | * @param value New value for field 'messageSignature' 41 | */ 42 | public void setMessageSignatureInternal(InternalStructure value) { 43 | this.handle.getStructures().write(0, value); // TODO: No specific modifier has been found for type class net.minecraft.network.chat.MessageSignature$Packed Generic type: class net.minecraft.network.chat.MessageSignature$Packed 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerEntityDestroy.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.Converters; 7 | import it.unimi.dsi.fastutil.ints.IntList; 8 | 9 | /** 10 | * Sent by the server to client to remove one or more entities. 11 | */ 12 | public class WrapperPlayServerEntityDestroy extends AbstractPacket { 13 | 14 | /** 15 | * The packet type that is wrapped by this wrapper. 16 | */ 17 | public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY; 18 | 19 | /** 20 | * Constructs a new wrapper and initialize it with a packet handle with default values 21 | */ 22 | public WrapperPlayServerEntityDestroy() { 23 | super(TYPE); 24 | } 25 | 26 | public WrapperPlayServerEntityDestroy(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Gets a list of entity ids to remove 32 | * 33 | * @return 'entityIds' to remove 34 | */ 35 | public IntList getEntityIds() { 36 | return this.handle.getModifier().withType(IntList.class, Converters.passthrough(IntList.class)).read(0); 37 | } 38 | 39 | /** 40 | * Sets the list of entity ids to remove 41 | * 42 | * @param value New value for field 'entityIds' 43 | */ 44 | public void setEntityIds(IntList value) { 45 | this.handle.getModifier().withType(IntList.class, Converters.passthrough(IntList.class)).write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerEntityStatus.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerEntityStatus extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.ENTITY_STATUS; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerEntityStatus() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerEntityStatus(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'entityId' 27 | * 28 | * @return 'entityId' 29 | */ 30 | public int getEntityId() { 31 | return this.handle.getIntegers().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'entityId' 36 | * 37 | * @param value New value for field 'entityId' 38 | */ 39 | public void setEntityId(int value) { 40 | this.handle.getIntegers().write(0, value); 41 | } 42 | 43 | /** 44 | * Retrieves the value of field 'eventId' 45 | * 46 | * @return 'eventId' 47 | */ 48 | public byte getEventId() { 49 | return this.handle.getBytes().read(0); 50 | } 51 | 52 | /** 53 | * Sets the value of field 'eventId' 54 | * 55 | * @param value New value for field 'eventId' 56 | */ 57 | public void setEventId(byte value) { 58 | this.handle.getBytes().write(0, value); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerGameStateChange.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerGameStateChange extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.GAME_STATE_CHANGE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerGameStateChange() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerGameStateChange(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'event' 27 | * 28 | * @return 'event' 29 | */ 30 | public Integer getEvent() { 31 | return this.handle.getGameStateIDs().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'event' 36 | * 37 | * @param value New value for field 'event' 38 | */ 39 | public void setEvent(Integer value) { 40 | this.handle.getGameStateIDs().write(0, value); 41 | } 42 | 43 | /** 44 | * Retrieves the value of field 'param' 45 | * 46 | * @return 'param' 47 | */ 48 | public float getParam() { 49 | return this.handle.getFloat().read(0); 50 | } 51 | 52 | /** 53 | * Sets the value of field 'param' 54 | * 55 | * @param value New value for field 'param' 56 | */ 57 | public void setParam(float value) { 58 | this.handle.getFloat().write(0, value); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerHeldItemSlot.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerHeldItemSlot extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.HELD_ITEM_SLOT; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerHeldItemSlot() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerHeldItemSlot(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'slot' 32 | * 33 | * @return 'slot' 34 | */ 35 | public int getSlot() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'slot' 41 | * 42 | * @param value New value for field 'slot' 43 | */ 44 | public void setSlot(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerHurtAnimation.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerHurtAnimation extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.HURT_ANIMATION; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerHurtAnimation() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerHurtAnimation(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'id' 32 | * 33 | * @return 'id' 34 | */ 35 | public int getId() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'id' 41 | * 42 | * @param value New value for field 'id' 43 | */ 44 | public void setId(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'yaw' 50 | * 51 | * @return 'yaw' 52 | */ 53 | public float getYaw() { 54 | return this.handle.getFloat().read(0); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'yaw' 59 | * 60 | * @param value New value for field 'yaw' 61 | */ 62 | public void setYaw(float value) { 63 | this.handle.getFloat().write(0, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerKeepAlive.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerKeepAlive extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.KEEP_ALIVE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerKeepAlive() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerKeepAlive(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'id' 32 | * 33 | * @return 'id' 34 | */ 35 | public long getId() { 36 | return this.handle.getLongs().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'id' 41 | * 42 | * @param value New value for field 'id' 43 | */ 44 | public void setId(long value) { 45 | this.handle.getLongs().write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerKickDisconnect.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.WrappedChatComponent; 7 | 8 | /** 9 | * Send by server to client to disconnect the client. The specified message will be shown on the disconnect screen. 10 | */ 11 | public class WrapperPlayServerKickDisconnect extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.KICK_DISCONNECT; 17 | 18 | /** 19 | * Constructs a new wrapper and initialize it with a packet handle with default values 20 | */ 21 | public WrapperPlayServerKickDisconnect() { 22 | super(TYPE); 23 | } 24 | 25 | /** 26 | * Constructors a new wrapper for the specified packet 27 | * 28 | * @param packet the packet to wrap 29 | */ 30 | public WrapperPlayServerKickDisconnect(PacketContainer packet) { 31 | super(packet, TYPE); 32 | } 33 | 34 | /** 35 | * Retrieves the kick reason shown on the disconnect screen 36 | * 37 | * @return 'reason' 38 | */ 39 | public WrappedChatComponent getReason() { 40 | return this.handle.getChatComponents().read(0); 41 | } 42 | 43 | /** 44 | * Sets the kick reason shown on the disconnect screen 45 | * 46 | * @param value New value for field 'reason' 47 | */ 48 | public void setReason(WrappedChatComponent value) { 49 | this.handle.getChatComponents().write(0, value); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerLightUpdate.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.WrappedLevelChunkData.LightData; 7 | 8 | public class WrapperPlayServerLightUpdate extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.LIGHT_UPDATE; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerLightUpdate() { 19 | super(TYPE); 20 | } 21 | 22 | public WrapperPlayServerLightUpdate(PacketContainer packet) { 23 | super(packet, TYPE); 24 | } 25 | 26 | /** 27 | * Retrieves the value of field 'x' 28 | * 29 | * @return 'x' 30 | */ 31 | public int getX() { 32 | return this.handle.getIntegers().read(0); 33 | } 34 | 35 | /** 36 | * Sets the value of field 'x' 37 | * 38 | * @param value New value for field 'x' 39 | */ 40 | public void setX(int value) { 41 | this.handle.getIntegers().write(0, value); 42 | } 43 | 44 | /** 45 | * Retrieves the value of field 'z' 46 | * 47 | * @return 'z' 48 | */ 49 | public int getZ() { 50 | return this.handle.getIntegers().read(1); 51 | } 52 | 53 | /** 54 | * Sets the value of field 'z' 55 | * 56 | * @param value New value for field 'z' 57 | */ 58 | public void setZ(int value) { 59 | this.handle.getIntegers().write(1, value); 60 | } 61 | 62 | /** 63 | * Retrieves the value of field 'lightData' 64 | * 65 | * @return 'lightData' 66 | */ 67 | public LightData getLightData() { 68 | return this.handle.getLightUpdateData().read(0); 69 | } 70 | 71 | /** 72 | * Sets the value of field 'lightData' 73 | * 74 | * @param value New value for field 'lightData' 75 | */ 76 | public void setLightData(LightData value) { 77 | this.handle.getLightUpdateData().write(0, value); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerMount.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerMount extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.MOUNT; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerMount() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerMount(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'vehicle' 32 | * 33 | * @return 'vehicle' 34 | */ 35 | public int getVehicle() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'vehicle' 41 | * 42 | * @param value New value for field 'vehicle' 43 | */ 44 | public void setVehicle(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'passengers' 50 | * 51 | * @return 'passengers' 52 | */ 53 | public int[] getPassengers() { 54 | return this.handle.getIntegerArrays().read(0); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'passengers' 59 | * 60 | * @param value New value for field 'passengers' 61 | */ 62 | public void setPassengers(int[] value) { 63 | this.handle.getIntegerArrays().write(0, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerNbtQuery.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.WrappedChatComponent; 7 | 8 | public class WrapperPlayServerNbtQuery extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.NBT_QUERY; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerNbtQuery() { 19 | super(TYPE); 20 | } 21 | 22 | public WrapperPlayServerNbtQuery(PacketContainer packet) { 23 | super(packet, TYPE); 24 | } 25 | 26 | /** 27 | * Retrieves the value of field 'transactionId' 28 | * 29 | * @return 'transactionId' 30 | */ 31 | public int getTransactionId() { 32 | return this.handle.getIntegers().read(0); 33 | } 34 | 35 | /** 36 | * Sets the value of field 'transactionId' 37 | * 38 | * @param value New value for field 'transactionId' 39 | */ 40 | public void setTransactionId(int value) { 41 | this.handle.getIntegers().write(0, value); 42 | } 43 | 44 | /** 45 | * Retrieves the value of field 'tag' 46 | * 47 | * @return 'tag' 48 | */ 49 | public WrappedChatComponent[] getTag() { 50 | return this.handle.getChatComponentArrays().read(0); 51 | } 52 | 53 | /** 54 | * Sets the value of field 'tag' 55 | * 56 | * @param value New value for field 'tag' 57 | */ 58 | public void setTag(WrappedChatComponent[] value) { 59 | this.handle.getChatComponentArrays().write(0, value); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerOpenBook.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.Hand; 7 | 8 | public class WrapperPlayServerOpenBook extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.OPEN_BOOK; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerOpenBook() { 19 | super(TYPE); 20 | } 21 | 22 | public WrapperPlayServerOpenBook(PacketContainer packet) { 23 | super(packet, TYPE); 24 | } 25 | 26 | /** 27 | * Retrieves the value of field 'hand' 28 | * 29 | * @return 'hand' 30 | */ 31 | public Hand getHand() { 32 | return this.handle.getHands().read(0); 33 | } 34 | 35 | /** 36 | * Sets the value of field 'hand' 37 | * 38 | * @param value New value for field 'hand' 39 | */ 40 | public void setHand(Hand value) { 41 | this.handle.getHands().write(0, value); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerOpenSignEditor.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BlockPosition; 7 | 8 | public class WrapperPlayServerOpenSignEditor extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.OPEN_SIGN_EDITOR; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerOpenSignEditor() { 19 | super(TYPE); 20 | } 21 | 22 | public WrapperPlayServerOpenSignEditor(PacketContainer packet) { 23 | super(packet, TYPE); 24 | } 25 | 26 | /** 27 | * Retrieves the value of field 'pos' 28 | * 29 | * @return 'pos' 30 | */ 31 | public BlockPosition getPos() { 32 | return this.handle.getBlockPositionModifier().read(0); 33 | } 34 | 35 | /** 36 | * Sets the value of field 'pos' 37 | * 38 | * @param value New value for field 'pos' 39 | */ 40 | public void setPos(BlockPosition value) { 41 | this.handle.getBlockPositionModifier().write(0, value); 42 | } 43 | 44 | 45 | /** 46 | * Gets the field front text 47 | * @since 1.20 48 | * @return whether the opened editor is for the front or on the back of the sign 49 | */ 50 | public boolean getIsFrontText() { 51 | return this.handle.getBooleans().read(0); 52 | } 53 | 54 | /** 55 | * Sets the field front text 56 | * @since 1.20 57 | * @param value whether the opened editor is for the front or on the back of the sign 58 | */ 59 | public void setIsFrontText(boolean value) { 60 | this.handle.getBooleans().write(0, value); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerOpenWindowHorse.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerOpenWindowHorse extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.OPEN_WINDOW_HORSE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerOpenWindowHorse() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerOpenWindowHorse(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'containerId' 27 | * 28 | * @return 'containerId' 29 | */ 30 | public int getContainerId() { 31 | return this.handle.getIntegers().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'containerId' 36 | * 37 | * @param value New value for field 'containerId' 38 | */ 39 | public void setContainerId(int value) { 40 | this.handle.getIntegers().write(0, value); 41 | } 42 | 43 | /** 44 | * Retrieves the value of field 'size' 45 | * 46 | * @return 'size' 47 | */ 48 | public int getSize() { 49 | return this.handle.getIntegers().read(1); 50 | } 51 | 52 | /** 53 | * Sets the value of field 'size' 54 | * 55 | * @param value New value for field 'size' 56 | */ 57 | public void setSize(int value) { 58 | this.handle.getIntegers().write(1, value); 59 | } 60 | 61 | /** 62 | * Retrieves the value of field 'entityId' 63 | * 64 | * @return 'entityId' 65 | */ 66 | public int getEntityId() { 67 | return this.handle.getIntegers().read(2); 68 | } 69 | 70 | /** 71 | * Sets the value of field 'entityId' 72 | * 73 | * @param value New value for field 'entityId' 74 | */ 75 | public void setEntityId(int value) { 76 | this.handle.getIntegers().write(2, value); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPing.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * Send from server to client. The client should respond with the same ID using {@link com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientPong}. 9 | * Currently not used on the Notchian server. 10 | */ 11 | public class WrapperPlayServerPing extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.PING; 17 | 18 | /** 19 | * Constructs a new wrapper and initialize it with a packet handle with default values 20 | */ 21 | public WrapperPlayServerPing() { 22 | super(TYPE); 23 | } 24 | 25 | public WrapperPlayServerPing(PacketContainer packet) { 26 | super(packet, TYPE); 27 | } 28 | 29 | /** 30 | * Retrieves the id of this ping. 31 | * 32 | * @return 'id' 33 | */ 34 | public int getId() { 35 | return this.handle.getIntegers().read(0); 36 | } 37 | 38 | /** 39 | * Sets the id of this ping. 40 | * 41 | * @param value New value for field 'id' 42 | */ 43 | public void setId(int value) { 44 | this.handle.getIntegers().write(0, value); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPlayerCombatEnd.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * @deprecated Unused packet 9 | */ 10 | @Deprecated 11 | public class WrapperPlayServerPlayerCombatEnd extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.PLAYER_COMBAT_END; 17 | 18 | private int dummyKillerId; 19 | 20 | /** 21 | * Constructs a new wrapper and initialize it with a packet handle with default values 22 | */ 23 | public WrapperPlayServerPlayerCombatEnd() { 24 | super(TYPE); 25 | } 26 | 27 | public WrapperPlayServerPlayerCombatEnd(PacketContainer packet) { 28 | super(packet, TYPE); 29 | } 30 | 31 | /** 32 | * Retrieves the value of field 'killerId' 33 | * @deprecated Removed in 1.20 34 | * @return 'killerId' 35 | */ 36 | public int getKillerId() { 37 | return this.dummyKillerId; 38 | } 39 | 40 | /** 41 | * Sets the value of field 'killerId' 42 | * @deprecated Removed in 1.20 43 | * @param value New value for field 'killerId' 44 | */ 45 | public void setKillerId(int value) { 46 | this.dummyKillerId = value; 47 | } 48 | 49 | /** 50 | * Retrieves the value of field 'duration' 51 | * 52 | * @return 'duration' 53 | */ 54 | public int getDuration() { 55 | return this.handle.getIntegers().read(0); 56 | } 57 | 58 | /** 59 | * Sets the value of field 'duration' 60 | * 61 | * @param value New value for field 'duration' 62 | */ 63 | public void setDuration(int value) { 64 | this.handle.getIntegers().write(0, value); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPlayerCombatEnter.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * @deprecated Unused packet 9 | */ 10 | @Deprecated 11 | public class WrapperPlayServerPlayerCombatEnter extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.PLAYER_COMBAT_ENTER; 17 | 18 | /** 19 | * Constructs a new wrapper and initialize it with a packet handle with default values 20 | */ 21 | public WrapperPlayServerPlayerCombatEnter() { 22 | super(TYPE); 23 | } 24 | 25 | public WrapperPlayServerPlayerCombatEnter(PacketContainer packet) { 26 | super(packet, TYPE); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPlayerInfoRemove.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.Converters; 7 | 8 | import java.util.List; 9 | import java.util.UUID; 10 | 11 | /** 12 | * Send by server to client to remove player info data (from the tab list) 13 | */ 14 | public class WrapperPlayServerPlayerInfoRemove extends AbstractPacket { 15 | 16 | /** 17 | * The packet type that is wrapped by this wrapper. 18 | */ 19 | public static final PacketType TYPE = PacketType.Play.Server.PLAYER_INFO_REMOVE; 20 | 21 | /** 22 | * Constructs a new wrapper and initialize it with a packet handle with default values 23 | */ 24 | public WrapperPlayServerPlayerInfoRemove() { 25 | super(TYPE); 26 | } 27 | 28 | public WrapperPlayServerPlayerInfoRemove(PacketContainer packet) { 29 | super(packet, TYPE); 30 | } 31 | 32 | /** 33 | * Gets list of player uuids to remove 34 | * 35 | * @return list of player uuids to remove 36 | */ 37 | public List getProfileIds() { 38 | return this.handle.getLists(Converters.passthrough(UUID.class)).read(0); 39 | } 40 | 41 | /** 42 | * Sets list of player uuids to remove 43 | * 44 | * @param value list of player uuids to remove. 45 | */ 46 | public void setProfileIds(List value) { 47 | this.handle.getLists(Converters.passthrough(UUID.class)).write(0, value); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRecipeUpdate.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.InternalStructure; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | 8 | import java.util.List; 9 | 10 | public class WrapperPlayServerRecipeUpdate extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.RECIPE_UPDATE; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerRecipeUpdate() { 21 | super(TYPE); 22 | } 23 | 24 | public WrapperPlayServerRecipeUpdate(PacketContainer packet) { 25 | super(packet, TYPE); 26 | } 27 | 28 | /** 29 | * Retrieves the value of field 'recipes' 30 | * 31 | * @return 'recipes' 32 | */ 33 | public List getRecipesInternal() { 34 | return this.handle.getLists(InternalStructure.getConverter()).read(0); // TODO 35 | } 36 | 37 | /** 38 | * Sets the value of field 'recipes' 39 | * 40 | * @param value New value for field 'recipes' 41 | */ 42 | public void setRecipesInternal(List value) { 43 | this.handle.getLists(InternalStructure.getConverter()).write(0, value); // TODO 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRelEntityMove.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | /** 8 | * Sent by the server when an entity moves less than 8 blocks; if an entity moves more than 8 blocks {@link WrapperPlayServerEntityTeleport} should be sent instead. 9 | */ 10 | public class WrapperPlayServerRelEntityMove extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.REL_ENTITY_MOVE; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerRelEntityMove() { 21 | super(TYPE); 22 | } 23 | 24 | public WrapperPlayServerRelEntityMove(PacketContainer packet) { 25 | super(packet, TYPE); 26 | } 27 | 28 | public int getEntityId() { 29 | return this.handle.getIntegers().read(0); 30 | } 31 | 32 | public void setEntityId(int value) { 33 | this.handle.getIntegers().write(0, value); 34 | } 35 | 36 | public short getDeltaX() { 37 | return this.handle.getShorts().read(0); 38 | } 39 | 40 | public void setDeltaX(short value) { 41 | this.handle.getShorts().write(0, value); 42 | } 43 | 44 | public short getDeltaY() { 45 | return this.handle.getShorts().read(1); 46 | } 47 | 48 | public void setDeltaY(short value) { 49 | this.handle.getShorts().write(1, value); 50 | } 51 | 52 | public short getDeltaZ() { 53 | return this.handle.getShorts().read(2); 54 | } 55 | 56 | public void setDeltaZ(short value) { 57 | this.handle.getShorts().write(2, value); 58 | } 59 | 60 | public boolean getOnGround() { 61 | return this.handle.getBooleans().read(0); 62 | } 63 | 64 | public void setOnGround(boolean value) { 65 | this.handle.getBooleans().write(0, value); 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRemoveEntityEffect.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import org.bukkit.potion.PotionEffectType; 7 | 8 | public class WrapperPlayServerRemoveEntityEffect extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.REMOVE_ENTITY_EFFECT; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerRemoveEntityEffect() { 19 | super(TYPE); 20 | } 21 | 22 | public WrapperPlayServerRemoveEntityEffect(PacketContainer packet) { 23 | super(packet, TYPE); 24 | } 25 | 26 | /** 27 | * Retrieves the value of field 'entityId' 28 | * 29 | * @return 'entityId' 30 | */ 31 | public int getEntityId() { 32 | return this.handle.getIntegers().read(0); 33 | } 34 | 35 | /** 36 | * Sets the value of field 'entityId' 37 | * 38 | * @param value New value for field 'entityId' 39 | */ 40 | public void setEntityId(int value) { 41 | this.handle.getIntegers().write(0, value); 42 | } 43 | 44 | /** 45 | * Retrieves the value of field 'effect' 46 | * 47 | * @return 'effect' 48 | */ 49 | public PotionEffectType getEffect() { 50 | return this.handle.getEffectTypes().read(0); 51 | } 52 | 53 | /** 54 | * Sets the value of field 'effect' 55 | * 56 | * @param value New value for field 'effect' 57 | */ 58 | public void setEffect(PotionEffectType value) { 59 | this.handle.getEffectTypes().write(0, value); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerScoreboardDisplayObjective.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerScoreboardDisplayObjective extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerScoreboardDisplayObjective() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerScoreboardDisplayObjective(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'slot' 27 | * 28 | * @return 'slot' 29 | */ 30 | public int getSlot() { 31 | return this.handle.getIntegers().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'slot' 36 | * 37 | * @param value New value for field 'slot' 38 | */ 39 | public void setSlot(int value) { 40 | this.handle.getIntegers().write(0, value); 41 | } 42 | 43 | /** 44 | * Retrieves the value of field 'objectiveName' 45 | * 46 | * @return 'objectiveName' 47 | */ 48 | public String getObjectiveName() { 49 | return this.handle.getStrings().read(0); 50 | } 51 | 52 | /** 53 | * Sets the value of field 'objectiveName' 54 | * 55 | * @param value New value for field 'objectiveName' 56 | */ 57 | public void setObjectiveName(String value) { 58 | this.handle.getStrings().write(0, value); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSelectAdvancementTab.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.util.TestExclusion; 4 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | import com.comphenix.protocol.wrappers.MinecraftKey; 8 | 9 | public class WrapperPlayServerSelectAdvancementTab extends AbstractPacket { 10 | 11 | /** 12 | * The packet type that is wrapped by this wrapper. 13 | */ 14 | public static final PacketType TYPE = PacketType.Play.Server.SELECT_ADVANCEMENT_TAB; 15 | 16 | /** 17 | * Constructs a new wrapper and initialize it with a packet handle with default values 18 | */ 19 | public WrapperPlayServerSelectAdvancementTab() { 20 | super(TYPE); 21 | } 22 | 23 | /** 24 | * Constructors a new wrapper for the specified packet 25 | * 26 | * @param packet the packet to wrap 27 | */ 28 | public WrapperPlayServerSelectAdvancementTab(PacketContainer packet) { 29 | super(packet, TYPE); 30 | } 31 | 32 | /** 33 | * Retrieves the value of field 'tab' 34 | * 35 | * @return 'tab' 36 | */ 37 | @TestExclusion 38 | public MinecraftKey getTab() { 39 | return this.handle.getMinecraftKeys().read(0); 40 | } 41 | 42 | /** 43 | * Sets the value of field 'tab' 44 | * 45 | * @param value New value for field 'tab' 46 | */ 47 | @TestExclusion 48 | public void setTab(MinecraftKey value) { 49 | this.handle.getMinecraftKeys().write(0, value); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerServerDifficulty.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.Difficulty; 7 | 8 | public class WrapperPlayServerServerDifficulty extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.SERVER_DIFFICULTY; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerServerDifficulty() { 19 | super(TYPE); 20 | } 21 | 22 | /** 23 | * Constructors a new wrapper for the specified packet 24 | * 25 | * @param packet the packet to wrap 26 | */ 27 | public WrapperPlayServerServerDifficulty(PacketContainer packet) { 28 | super(packet, TYPE); 29 | } 30 | 31 | /** 32 | * Retrieves the value of field 'difficulty' 33 | * 34 | * @return 'difficulty' 35 | */ 36 | public Difficulty getDifficulty() { 37 | return this.handle.getDifficulties().read(0); 38 | } 39 | 40 | /** 41 | * Sets the value of field 'difficulty' 42 | * 43 | * @param value New value for field 'difficulty' 44 | */ 45 | public void setDifficulty(Difficulty value) { 46 | this.handle.getDifficulties().write(0, value); 47 | } 48 | 49 | /** 50 | * Retrieves the value of field 'locked' 51 | * 52 | * @return 'locked' 53 | */ 54 | public boolean getLocked() { 55 | return this.handle.getBooleans().read(0); 56 | } 57 | 58 | /** 59 | * Sets the value of field 'locked' 60 | * 61 | * @param value New value for field 'locked' 62 | */ 63 | public void setLocked(boolean value) { 64 | this.handle.getBooleans().write(0, value); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSetBorderCenter.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerSetBorderCenter extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.SET_BORDER_CENTER; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerSetBorderCenter() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerSetBorderCenter(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'newCenterX' 32 | * 33 | * @return 'newCenterX' 34 | */ 35 | public double getNewCenterX() { 36 | return this.handle.getDoubles().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'newCenterX' 41 | * 42 | * @param value New value for field 'newCenterX' 43 | */ 44 | public void setNewCenterX(double value) { 45 | this.handle.getDoubles().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'newCenterZ' 50 | * 51 | * @return 'newCenterZ' 52 | */ 53 | public double getNewCenterZ() { 54 | return this.handle.getDoubles().read(1); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'newCenterZ' 59 | * 60 | * @param value New value for field 'newCenterZ' 61 | */ 62 | public void setNewCenterZ(double value) { 63 | this.handle.getDoubles().write(1, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSetBorderSize.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerSetBorderSize extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.SET_BORDER_SIZE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerSetBorderSize() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerSetBorderSize(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'size' 32 | * 33 | * @return 'size' 34 | */ 35 | public double getSize() { 36 | return this.handle.getDoubles().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'size' 41 | * 42 | * @param value New value for field 'size' 43 | */ 44 | public void setSize(double value) { 45 | this.handle.getDoubles().write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSetBorderWarningDelay.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerSetBorderWarningDelay extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.SET_BORDER_WARNING_DELAY; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerSetBorderWarningDelay() { 18 | super(TYPE); 19 | } 20 | 21 | public WrapperPlayServerSetBorderWarningDelay(PacketContainer packet) { 22 | super(packet, TYPE); 23 | } 24 | 25 | /** 26 | * Retrieves the value of field 'warningDelay' 27 | * 28 | * @return 'warningDelay' 29 | */ 30 | public int getWarningDelay() { 31 | return this.handle.getIntegers().read(0); 32 | } 33 | 34 | /** 35 | * Sets the value of field 'warningDelay' 36 | * 37 | * @param value New value for field 'warningDelay' 38 | */ 39 | public void setWarningDelay(int value) { 40 | this.handle.getIntegers().write(0, value); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSetBorderWarningDistance.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerSetBorderWarningDistance extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.SET_BORDER_WARNING_DISTANCE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerSetBorderWarningDistance() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerSetBorderWarningDistance(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'warningBlocks' 32 | * 33 | * @return 'warningBlocks' 34 | */ 35 | public int getWarningBlocks() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'warningBlocks' 41 | * 42 | * @param value New value for field 'warningBlocks' 43 | */ 44 | public void setWarningBlocks(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSetCooldown.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.util.MoreConverters; 4 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | import com.comphenix.protocol.utility.MinecraftReflection; 8 | import org.bukkit.Material; 9 | 10 | public class WrapperPlayServerSetCooldown extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.SET_COOLDOWN; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerSetCooldown() { 21 | super(TYPE); 22 | } 23 | 24 | /** 25 | * Constructors a new wrapper for the specified packet 26 | * 27 | * @param packet the packet to wrap 28 | */ 29 | public WrapperPlayServerSetCooldown(PacketContainer packet) { 30 | super(packet, TYPE); 31 | } 32 | 33 | /** 34 | * Retrieves the value of field 'item' 35 | * 36 | * @return 'item' 37 | */ 38 | public Material getItem() { 39 | return this.handle.getModifier().withType(MinecraftReflection.getItemClass(), MoreConverters.getMaterialConverter()).read(0); 40 | } 41 | 42 | /** 43 | * Sets the value of field 'item' 44 | * 45 | * @param value New value for field 'item' 46 | */ 47 | public void setItem(Material value) { 48 | this.handle.getModifier().withType(MinecraftReflection.getItemClass(), MoreConverters.getMaterialConverter()).write(0, value); 49 | } 50 | 51 | /** 52 | * Retrieves the value of field 'duration' 53 | * 54 | * @return 'duration' 55 | */ 56 | public int getDuration() { 57 | return this.handle.getIntegers().read(0); 58 | } 59 | 60 | /** 61 | * Sets the value of field 'duration' 62 | * 63 | * @param value New value for field 'duration' 64 | */ 65 | public void setDuration(int value) { 66 | this.handle.getIntegers().write(0, value); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSpawnPosition.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BlockPosition; 7 | 8 | public class WrapperPlayServerSpawnPosition extends AbstractPacket { 9 | 10 | /** 11 | * The packet type that is wrapped by this wrapper. 12 | */ 13 | public static final PacketType TYPE = PacketType.Play.Server.SPAWN_POSITION; 14 | 15 | /** 16 | * Constructs a new wrapper and initialize it with a packet handle with default values 17 | */ 18 | public WrapperPlayServerSpawnPosition() { 19 | super(TYPE); 20 | } 21 | 22 | /** 23 | * Constructors a new wrapper for the specified packet 24 | * 25 | * @param packet the packet to wrap 26 | */ 27 | public WrapperPlayServerSpawnPosition(PacketContainer packet) { 28 | super(packet, TYPE); 29 | } 30 | 31 | /** 32 | * Retrieves the value of field 'pos' 33 | * 34 | * @return 'pos' 35 | */ 36 | public BlockPosition getPos() { 37 | return this.handle.getBlockPositionModifier().read(0); 38 | } 39 | 40 | /** 41 | * Sets the value of field 'pos' 42 | * 43 | * @param value New value for field 'pos' 44 | */ 45 | public void setPos(BlockPosition value) { 46 | this.handle.getBlockPositionModifier().write(0, value); 47 | } 48 | 49 | /** 50 | * Retrieves the value of field 'angle' 51 | * 52 | * @return 'angle' 53 | */ 54 | public float getAngle() { 55 | return this.handle.getFloat().read(0); 56 | } 57 | 58 | /** 59 | * Sets the value of field 'angle' 60 | * 61 | * @param value New value for field 'angle' 62 | */ 63 | public void setAngle(float value) { 64 | this.handle.getFloat().write(0, value); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerStatistic.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.WrappedStatistic; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * Sent as a response to @link{{@link com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientClientCommand}}. Will only send the changed values if previously requested. 12 | */ 13 | public class WrapperPlayServerStatistic extends AbstractPacket { 14 | 15 | /** 16 | * The packet type that is wrapped by this wrapper. 17 | */ 18 | public static final PacketType TYPE = PacketType.Play.Server.STATISTIC; 19 | 20 | /** 21 | * Constructs a new wrapper and initialize it with a packet handle with default values 22 | */ 23 | public WrapperPlayServerStatistic() { 24 | super(TYPE); 25 | } 26 | 27 | /** 28 | * Constructors a new wrapper for the specified packet 29 | * 30 | * @param packet the packet to wrap 31 | */ 32 | public WrapperPlayServerStatistic(PacketContainer packet) { 33 | super(packet, TYPE); 34 | } 35 | 36 | /** 37 | * Retrieves the value of field 'stats' 38 | * 39 | * @return 'stats' 40 | */ 41 | public Map getStats() { 42 | return this.handle.getStatisticMaps().read(0); 43 | } 44 | 45 | /** 46 | * Sets the value of field 'stats' 47 | * 48 | * @param value New value for field 'stats' 49 | */ 50 | public void setStats(Map value) { 51 | this.handle.getStatisticMaps().write(0, value); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerStopSound.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.util.TestExclusion; 4 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | import com.comphenix.protocol.wrappers.EnumWrappers.SoundCategory; 8 | import com.comphenix.protocol.wrappers.MinecraftKey; 9 | 10 | public class WrapperPlayServerStopSound extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.STOP_SOUND; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerStopSound() { 21 | super(TYPE); 22 | } 23 | 24 | /** 25 | * Constructors a new wrapper for the specified packet 26 | * 27 | * @param packet the packet to wrap 28 | */ 29 | public WrapperPlayServerStopSound(PacketContainer packet) { 30 | super(packet, TYPE); 31 | } 32 | 33 | /** 34 | * Retrieves the value of field 'name' 35 | * 36 | * @return 'name' 37 | */ 38 | @TestExclusion 39 | public MinecraftKey getName() { 40 | return this.handle.getMinecraftKeys().read(0); 41 | } 42 | 43 | /** 44 | * Sets the value of field 'name' 45 | * 46 | * @param value New value for field 'name' 47 | */ 48 | public void setName(MinecraftKey value) { 49 | this.handle.getMinecraftKeys().write(0, value); 50 | } 51 | 52 | /** 53 | * Retrieves the value of field 'source' 54 | * 55 | * @return 'source' 56 | */ 57 | @TestExclusion 58 | public SoundCategory getSource() { 59 | return this.handle.getSoundCategories().read(0); 60 | } 61 | 62 | /** 63 | * Sets the value of field 'source' 64 | * 65 | * @param value New value for field 'source' 66 | */ 67 | public void setSource(SoundCategory value) { 68 | this.handle.getSoundCategories().write(0, value); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerUnloadChunk.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerUnloadChunk extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.UNLOAD_CHUNK; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerUnloadChunk() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerUnloadChunk(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'x' 32 | * 33 | * @return 'x' 34 | */ 35 | public int getX() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'x' 41 | * 42 | * @param value New value for field 'x' 43 | */ 44 | public void setX(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'z' 50 | * 51 | * @return 'z' 52 | */ 53 | public int getZ() { 54 | return this.handle.getIntegers().read(1); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'z' 59 | * 60 | * @param value New value for field 'z' 61 | */ 62 | public void setZ(int value) { 63 | this.handle.getIntegers().write(1, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerUpdateAttributes.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BukkitConverters; 7 | import com.comphenix.protocol.wrappers.WrappedAttribute; 8 | 9 | import java.util.List; 10 | 11 | public class WrapperPlayServerUpdateAttributes extends AbstractPacket { 12 | 13 | /** 14 | * The packet type that is wrapped by this wrapper. 15 | */ 16 | public static final PacketType TYPE = PacketType.Play.Server.UPDATE_ATTRIBUTES; 17 | 18 | /** 19 | * Constructs a new wrapper and initialize it with a packet handle with default values 20 | */ 21 | public WrapperPlayServerUpdateAttributes() { 22 | super(TYPE); 23 | } 24 | 25 | /** 26 | * Constructors a new wrapper for the specified packet 27 | * 28 | * @param packet the packet to wrap 29 | */ 30 | public WrapperPlayServerUpdateAttributes(PacketContainer packet) { 31 | super(packet, TYPE); 32 | } 33 | 34 | /** 35 | * Retrieves the value of field 'entityId' 36 | * 37 | * @return 'entityId' 38 | */ 39 | public int getEntityId() { 40 | return this.handle.getIntegers().read(0); 41 | } 42 | 43 | /** 44 | * Sets the value of field 'entityId' 45 | * 46 | * @param value New value for field 'entityId' 47 | */ 48 | public void setEntityId(int value) { 49 | this.handle.getIntegers().write(0, value); 50 | } 51 | 52 | /** 53 | * Retrieves the value of field 'attributes' 54 | * 55 | * @return 'attributes' 56 | */ 57 | public List getAttributes() { 58 | return this.handle.getLists(BukkitConverters.getWrappedAttributeConverter()).read(0); 59 | } 60 | 61 | /** 62 | * Sets the value of field 'attributes' 63 | * 64 | * @param value New value for field 'attributes' 65 | */ 66 | public void setAttributes(List value) { 67 | this.handle.getLists(BukkitConverters.getWrappedAttributeConverter()).write(0, value); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerUpdateEnabledFeatures.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.MinecraftKey; 7 | 8 | import java.util.Set; 9 | 10 | public class WrapperPlayServerUpdateEnabledFeatures extends AbstractPacket { 11 | 12 | /** 13 | * The packet type that is wrapped by this wrapper. 14 | */ 15 | public static final PacketType TYPE = PacketType.Play.Server.UPDATE_ENABLED_FEATURES; 16 | 17 | /** 18 | * Constructs a new wrapper and initialize it with a packet handle with default values 19 | */ 20 | public WrapperPlayServerUpdateEnabledFeatures() { 21 | super(TYPE); 22 | } 23 | 24 | /** 25 | * Constructors a new wrapper for the specified packet 26 | * 27 | * @param packet the packet to wrap 28 | */ 29 | public WrapperPlayServerUpdateEnabledFeatures(PacketContainer packet) { 30 | super(packet, TYPE); 31 | } 32 | 33 | /** 34 | * Retrieves the value of field 'features' 35 | * 36 | * @return 'features' 37 | */ 38 | public Set getFeatures() { 39 | return this.handle.getSets(MinecraftKey.getConverter()).read(0); 40 | } 41 | 42 | /** 43 | * Sets the value of field 'features' 44 | * 45 | * @param value New value for field 'features' 46 | */ 47 | public void setFeatures(Set value) { 48 | this.handle.getSets(MinecraftKey.getConverter()).write(0, value); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerUpdateSimulationDistance.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerUpdateSimulationDistance extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.UPDATE_SIMULATION_DISTANCE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerUpdateSimulationDistance() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerUpdateSimulationDistance(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'simulationDistance' 32 | * 33 | * @return 'simulationDistance' 34 | */ 35 | public int getSimulationDistance() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'simulationDistance' 41 | * 42 | * @param value New value for field 'simulationDistance' 43 | */ 44 | public void setSimulationDistance(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerUpdateTime.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerUpdateTime extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.UPDATE_TIME; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerUpdateTime() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerUpdateTime(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'gameTime' 32 | * 33 | * @return 'gameTime' 34 | */ 35 | public long getGameTime() { 36 | return this.handle.getLongs().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'gameTime' 41 | * 42 | * @param value New value for field 'gameTime' 43 | */ 44 | public void setGameTime(long value) { 45 | this.handle.getLongs().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'dayTime' 50 | * 51 | * @return 'dayTime' 52 | */ 53 | public long getDayTime() { 54 | return this.handle.getLongs().read(1); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'dayTime' 59 | * 60 | * @param value New value for field 'dayTime' 61 | */ 62 | public void setDayTime(long value) { 63 | this.handle.getLongs().write(1, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerViewCentre.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerViewCentre extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.VIEW_CENTRE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerViewCentre() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerViewCentre(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'x' 32 | * 33 | * @return 'x' 34 | */ 35 | public int getX() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'x' 41 | * 42 | * @param value New value for field 'x' 43 | */ 44 | public void setX(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | /** 49 | * Retrieves the value of field 'z' 50 | * 51 | * @return 'z' 52 | */ 53 | public int getZ() { 54 | return this.handle.getIntegers().read(1); 55 | } 56 | 57 | /** 58 | * Sets the value of field 'z' 59 | * 60 | * @param value New value for field 'z' 61 | */ 62 | public void setZ(int value) { 63 | this.handle.getIntegers().write(1, value); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerViewDistance.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayServerViewDistance extends AbstractPacket { 8 | 9 | /** 10 | * The packet type that is wrapped by this wrapper. 11 | */ 12 | public static final PacketType TYPE = PacketType.Play.Server.VIEW_DISTANCE; 13 | 14 | /** 15 | * Constructs a new wrapper and initialize it with a packet handle with default values 16 | */ 17 | public WrapperPlayServerViewDistance() { 18 | super(TYPE); 19 | } 20 | 21 | /** 22 | * Constructors a new wrapper for the specified packet 23 | * 24 | * @param packet the packet to wrap 25 | */ 26 | public WrapperPlayServerViewDistance(PacketContainer packet) { 27 | super(packet, TYPE); 28 | } 29 | 30 | /** 31 | * Retrieves the value of field 'radius' 32 | * 33 | * @return 'radius' 34 | */ 35 | public int getRadius() { 36 | return this.handle.getIntegers().read(0); 37 | } 38 | 39 | /** 40 | * Sets the value of field 'radius' 41 | * 42 | * @param value New value for field 'radius' 43 | */ 44 | public void setRadius(int value) { 45 | this.handle.getIntegers().write(0, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientAbilities.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientAbilities extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.ABILITIES; 10 | 11 | public WrapperPlayClientAbilities() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientAbilities(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'isFlying' 21 | * 22 | * @return 'isFlying' 23 | */ 24 | public boolean getIsFlying() { 25 | return this.handle.getBooleans().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'isFlying' 30 | * 31 | * @param value New value for field 'isFlying' 32 | */ 33 | public void setIsFlying(boolean value) { 34 | this.handle.getBooleans().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientArmAnimation.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.Hand; 7 | 8 | public class WrapperPlayClientArmAnimation extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.ARM_ANIMATION; 11 | 12 | public WrapperPlayClientArmAnimation() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientArmAnimation(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'hand' 22 | * 23 | * @return 'hand' 24 | */ 25 | public Hand getHand() { 26 | return this.handle.getHands().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'hand' 31 | * 32 | * @param value New value for field 'hand' 33 | */ 34 | public void setHand(Hand value) { 35 | this.handle.getHands().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientAutoRecipe.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.MinecraftKey; 7 | 8 | public class WrapperPlayClientAutoRecipe extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.AUTO_RECIPE; 11 | 12 | public WrapperPlayClientAutoRecipe() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientAutoRecipe(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'containerId' 22 | * 23 | * @return 'containerId' 24 | */ 25 | public int getContainerId() { 26 | return this.handle.getIntegers().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'containerId' 31 | * 32 | * @param value New value for field 'containerId' 33 | */ 34 | public void setContainerId(int value) { 35 | this.handle.getIntegers().write(0, value); 36 | } 37 | 38 | /** 39 | * Retrieves the value of field 'recipe' 40 | * 41 | * @return 'recipe' 42 | */ 43 | public MinecraftKey getRecipe() { 44 | return this.handle.getMinecraftKeys().read(0); 45 | } 46 | 47 | /** 48 | * Sets the value of field 'recipe' 49 | * 50 | * @param value New value for field 'recipe' 51 | */ 52 | public void setRecipe(MinecraftKey value) { 53 | this.handle.getMinecraftKeys().write(0, value); 54 | } 55 | 56 | /** 57 | * Retrieves the value of field 'shiftDown' 58 | * 59 | * @return 'shiftDown' 60 | */ 61 | public boolean getShiftDown() { 62 | return this.handle.getBooleans().read(0); 63 | } 64 | 65 | /** 66 | * Sets the value of field 'shiftDown' 67 | * 68 | * @param value New value for field 'shiftDown' 69 | */ 70 | public void setShiftDown(boolean value) { 71 | this.handle.getBooleans().write(0, value); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientBeacon.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BukkitConverters; 7 | import org.bukkit.potion.PotionEffect; 8 | 9 | import javax.annotation.Nullable; 10 | import java.util.Optional; 11 | 12 | public class WrapperPlayClientBeacon extends AbstractPacket { 13 | 14 | public static final PacketType TYPE = PacketType.Play.Client.BEACON; 15 | 16 | public WrapperPlayClientBeacon() { 17 | super(TYPE); 18 | } 19 | 20 | public WrapperPlayClientBeacon(PacketContainer packet) { 21 | super(packet, TYPE); 22 | } 23 | 24 | /** 25 | * /* Retrieves the value of field 'primary' 26 | * /* @return 'primary' 27 | */ 28 | public Optional getPrimary() { 29 | return this.handle.getOptionals(BukkitConverters.getPotionEffectConverter()).read(0); 30 | } 31 | 32 | /** 33 | * Sets the value of field 'primary' 34 | * @param value New value for field 'primary' 35 | */ 36 | public void setPrimary(@Nullable PotionEffect value) { 37 | this.handle.getOptionals(BukkitConverters.getPotionEffectConverter()).write(0, Optional.ofNullable(value)); 38 | } 39 | 40 | /** 41 | * Retrieves the value of field 'secondary' 42 | * @return 'secondary' 43 | */ 44 | public Optional getSecondary() { 45 | return this.handle.getOptionals(BukkitConverters.getPotionEffectConverter()).read(1); 46 | } 47 | 48 | /** 49 | * Sets the value of field 'secondary' 50 | * @param value New value for field 'secondary' 51 | */ 52 | public void setSecondary(@Nullable PotionEffect value) { 53 | this.handle.getOptionals(BukkitConverters.getPotionEffectConverter()).write(1, Optional.ofNullable(value)); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientBoatMove.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientBoatMove extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.BOAT_MOVE; 10 | 11 | public WrapperPlayClientBoatMove() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientBoatMove(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'left' 21 | * 22 | * @return 'left' 23 | */ 24 | public boolean getLeft() { 25 | return this.handle.getBooleans().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'left' 30 | * 31 | * @param value New value for field 'left' 32 | */ 33 | public void setLeft(boolean value) { 34 | this.handle.getBooleans().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'right' 39 | * 40 | * @return 'right' 41 | */ 42 | public boolean getRight() { 43 | return this.handle.getBooleans().read(1); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'right' 48 | * 49 | * @param value New value for field 'right' 50 | */ 51 | public void setRight(boolean value) { 52 | this.handle.getBooleans().write(1, value); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientChatAck.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientChatAck extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.CHAT_ACK; 10 | 11 | public WrapperPlayClientChatAck() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientChatAck(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'offset' 21 | * 22 | * @return 'offset' 23 | */ 24 | public int getOffset() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'offset' 30 | * 31 | * @param value New value for field 'offset' 32 | */ 33 | public void setOffset(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientChatSessionUpdate.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.packetwrapper.util.TestExclusion; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | import com.comphenix.protocol.wrappers.WrappedRemoteChatSessionData; 8 | 9 | public class WrapperPlayClientChatSessionUpdate extends AbstractPacket { 10 | 11 | public static final PacketType TYPE = PacketType.Play.Client.CHAT_SESSION_UPDATE; 12 | 13 | public WrapperPlayClientChatSessionUpdate() { 14 | super(TYPE); 15 | } 16 | 17 | public WrapperPlayClientChatSessionUpdate(PacketContainer packet) { 18 | super(packet, TYPE); 19 | } 20 | 21 | /** 22 | * Retrieves the value of field 'chatSession' 23 | * 24 | * @return 'chatSession' 25 | */ 26 | public WrappedRemoteChatSessionData getChatSession() { 27 | return this.handle.getRemoteChatSessionData().read(0); 28 | } 29 | 30 | /** 31 | * Sets the value of field 'chatSession' 32 | * 33 | * @param value New value for field 'chatSession' 34 | */ 35 | @TestExclusion 36 | public void setChatSession(WrappedRemoteChatSessionData value) { 37 | this.handle.getRemoteChatSessionData().write(0, value); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientClientCommand.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.ClientCommand; 7 | 8 | public class WrapperPlayClientClientCommand extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.CLIENT_COMMAND; 11 | 12 | public WrapperPlayClientClientCommand() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientClientCommand(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the action to perform 22 | * 23 | * @return 'action' 24 | */ 25 | public ClientCommand getAction() { 26 | return this.handle.getClientCommands().read(0); 27 | } 28 | 29 | /** 30 | * Sets the action to perform 31 | * 32 | * @param value New value for field 'action' 33 | */ 34 | public void setAction(ClientCommand value) { 35 | this.handle.getClientCommands().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientCloseWindow.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientCloseWindow extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.CLOSE_WINDOW; 10 | 11 | public WrapperPlayClientCloseWindow() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientCloseWindow(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'containerId' 21 | * 22 | * @return 'containerId' 23 | */ 24 | public int getContainerId() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'containerId' 30 | * 31 | * @param value New value for field 'containerId' 32 | */ 33 | public void setContainerId(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientCustomPayload.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.packetwrapper.util.TestExclusion; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.InternalStructure; 7 | import com.comphenix.protocol.events.PacketContainer; 8 | import com.comphenix.protocol.utility.MinecraftReflection; 9 | import com.comphenix.protocol.wrappers.MinecraftKey; 10 | import io.netty.buffer.ByteBuf; 11 | 12 | public class WrapperPlayClientCustomPayload extends AbstractPacket { 13 | 14 | public static final PacketType TYPE = PacketType.Play.Client.CUSTOM_PAYLOAD; 15 | 16 | public WrapperPlayClientCustomPayload() { 17 | super(TYPE); 18 | } 19 | 20 | public WrapperPlayClientCustomPayload(PacketContainer packet) { 21 | super(packet, TYPE); 22 | } 23 | 24 | /** 25 | * Retrieves the value of field 'identifier' 26 | * 27 | * @return 'identifier' 28 | */ 29 | public MinecraftKey getIdentifier() { 30 | return this.handle.getMinecraftKeys().read(0); 31 | } 32 | 33 | /** 34 | * Sets the value of field 'identifier' 35 | * 36 | * @param value New value for field 'identifier' 37 | */ 38 | public void setIdentifier(MinecraftKey value) { 39 | this.handle.getMinecraftKeys().write(0, value); 40 | } 41 | 42 | /** 43 | * Retrieves the value of field 'data' 44 | * 45 | * @return 'data' 46 | */ 47 | @TestExclusion 48 | public ByteBuf getData() { 49 | return this.handle.getStructures().read(1).getModifier().withType(ByteBuf.class).read(0); 50 | } 51 | 52 | /** 53 | * Sets the value of field 'data' 54 | * 55 | * @param value New value for field 'data' 56 | */ 57 | public void setData(ByteBuf value) { 58 | InternalStructure structure = InternalStructure.getConverter().getSpecific(MinecraftReflection.getPacketDataSerializer(value)); 59 | this.handle.getStructures().write(1, structure); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientDifficultyChange.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.Difficulty; 7 | 8 | public class WrapperPlayClientDifficultyChange extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.DIFFICULTY_CHANGE; 11 | 12 | public WrapperPlayClientDifficultyChange() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientDifficultyChange(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'difficulty' 22 | * 23 | * @return 'difficulty' 24 | */ 25 | public Difficulty getDifficulty() { 26 | return this.handle.getDifficulties().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'difficulty' 31 | * 32 | * @param value New value for field 'difficulty' 33 | */ 34 | public void setDifficulty(Difficulty value) { 35 | this.handle.getDifficulties().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientDifficultyLock.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientDifficultyLock extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.DIFFICULTY_LOCK; 10 | 11 | public WrapperPlayClientDifficultyLock() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientDifficultyLock(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'locked' 21 | * 22 | * @return 'locked' 23 | */ 24 | public boolean getLocked() { 25 | return this.handle.getBooleans().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'locked' 30 | * 31 | * @param value New value for field 'locked' 32 | */ 33 | public void setLocked(boolean value) { 34 | this.handle.getBooleans().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientEnchantItem.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientEnchantItem extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.ENCHANT_ITEM; 10 | 11 | public WrapperPlayClientEnchantItem() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientEnchantItem(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'containerId' 21 | * 22 | * @return 'containerId' 23 | */ 24 | public int getContainerId() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'containerId' 30 | * 31 | * @param value New value for field 'containerId' 32 | */ 33 | public void setContainerId(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'buttonId' 39 | * 40 | * @return 'buttonId' 41 | */ 42 | public int getButtonId() { 43 | return this.handle.getIntegers().read(1); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'buttonId' 48 | * 49 | * @param value New value for field 'buttonId' 50 | */ 51 | public void setButtonId(int value) { 52 | this.handle.getIntegers().write(1, value); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientEntityAction.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.PlayerAction; 7 | 8 | public class WrapperPlayClientEntityAction extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.ENTITY_ACTION; 11 | 12 | public WrapperPlayClientEntityAction() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientEntityAction(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'id' 22 | * 23 | * @return 'id' 24 | */ 25 | public int getId() { 26 | return this.handle.getIntegers().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'id' 31 | * 32 | * @param value New value for field 'id' 33 | */ 34 | public void setId(int value) { 35 | this.handle.getIntegers().write(0, value); 36 | } 37 | 38 | /** 39 | * Retrieves the value of field 'action' 40 | * 41 | * @return 'action' 42 | */ 43 | public PlayerAction getAction() { 44 | return this.handle.getPlayerActions().read(0); 45 | } 46 | 47 | /** 48 | * Sets the value of field 'action' 49 | * 50 | * @param value New value for field 'action' 51 | */ 52 | public void setAction(PlayerAction value) { 53 | this.handle.getPlayerActions().write(0, value); 54 | } 55 | 56 | /** 57 | * Retrieves the value of field 'data' 58 | * 59 | * @return 'data' 60 | */ 61 | public int getData() { 62 | return this.handle.getIntegers().read(1); 63 | } 64 | 65 | /** 66 | * Sets the value of field 'data' 67 | * 68 | * @param value New value for field 'data' 69 | */ 70 | public void setData(int value) { 71 | this.handle.getIntegers().write(1, value); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientEntityNbtQuery.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientEntityNbtQuery extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.ENTITY_NBT_QUERY; 10 | 11 | public WrapperPlayClientEntityNbtQuery() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientEntityNbtQuery(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'transactionId' 21 | * 22 | * @return 'transactionId' 23 | */ 24 | public int getTransactionId() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'transactionId' 30 | * 31 | * @param value New value for field 'transactionId' 32 | */ 33 | public void setTransactionId(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'entityId' 39 | * 40 | * @return 'entityId' 41 | */ 42 | public int getEntityId() { 43 | return this.handle.getIntegers().read(1); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'entityId' 48 | * 49 | * @param value New value for field 'entityId' 50 | */ 51 | public void setEntityId(int value) { 52 | this.handle.getIntegers().write(1, value); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientHeldItemSlot.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientHeldItemSlot extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.HELD_ITEM_SLOT; 10 | 11 | public WrapperPlayClientHeldItemSlot() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientHeldItemSlot(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'slot' 21 | * 22 | * @return 'slot' 23 | */ 24 | public int getSlot() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'slot' 30 | * 31 | * @param value New value for field 'slot' 32 | */ 33 | public void setSlot(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientItemName.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientItemName extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.ITEM_NAME; 10 | 11 | public WrapperPlayClientItemName() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientItemName(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'name' 21 | * 22 | * @return 'name' 23 | */ 24 | public String getName() { 25 | return this.handle.getStrings().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'name' 30 | * 31 | * @param value New value for field 'name' 32 | */ 33 | public void setName(String value) { 34 | this.handle.getStrings().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientJigsawGenerate.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BlockPosition; 7 | 8 | public class WrapperPlayClientJigsawGenerate extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.JIGSAW_GENERATE; 11 | 12 | public WrapperPlayClientJigsawGenerate() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientJigsawGenerate(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'pos' 22 | * 23 | * @return 'pos' 24 | */ 25 | public BlockPosition getPos() { 26 | return this.handle.getBlockPositionModifier().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'pos' 31 | * 32 | * @param value New value for field 'pos' 33 | */ 34 | public void setPos(BlockPosition value) { 35 | this.handle.getBlockPositionModifier().write(0, value); 36 | } 37 | 38 | /** 39 | * Retrieves the value of field 'levels' 40 | * 41 | * @return 'levels' 42 | */ 43 | public int getLevels() { 44 | return this.handle.getIntegers().read(0); 45 | } 46 | 47 | /** 48 | * Sets the value of field 'levels' 49 | * 50 | * @param value New value for field 'levels' 51 | */ 52 | public void setLevels(int value) { 53 | this.handle.getIntegers().write(0, value); 54 | } 55 | 56 | /** 57 | * Retrieves the value of field 'keepJigsaws' 58 | * 59 | * @return 'keepJigsaws' 60 | */ 61 | public boolean getKeepJigsaws() { 62 | return this.handle.getBooleans().read(0); 63 | } 64 | 65 | /** 66 | * Sets the value of field 'keepJigsaws' 67 | * 68 | * @param value New value for field 'keepJigsaws' 69 | */ 70 | public void setKeepJigsaws(boolean value) { 71 | this.handle.getBooleans().write(0, value); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientKeepAlive.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientKeepAlive extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.KEEP_ALIVE; 10 | 11 | public WrapperPlayClientKeepAlive() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientKeepAlive(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'id' 21 | * 22 | * @return 'id' 23 | */ 24 | public long getId() { 25 | return this.handle.getLongs().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'id' 30 | * 31 | * @param value New value for field 'id' 32 | */ 33 | public void setId(long value) { 34 | this.handle.getLongs().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientPickItem.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientPickItem extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.PICK_ITEM; 10 | 11 | public WrapperPlayClientPickItem() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientPickItem(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'slot' 21 | * 22 | * @return 'slot' 23 | */ 24 | public int getSlot() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'slot' 30 | * 31 | * @param value New value for field 'slot' 32 | */ 33 | public void setSlot(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientPong.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientPong extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.PONG; 10 | 11 | public WrapperPlayClientPong() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientPong(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'id' 21 | * 22 | * @return 'id' 23 | */ 24 | public int getId() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'id' 30 | * 31 | * @param value New value for field 'id' 32 | */ 33 | public void setId(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientRecipeDisplayed.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.MinecraftKey; 7 | 8 | public class WrapperPlayClientRecipeDisplayed extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.RECIPE_DISPLAYED; 11 | 12 | public WrapperPlayClientRecipeDisplayed() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientRecipeDisplayed(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'recipe' 22 | * 23 | * @return 'recipe' 24 | */ 25 | public MinecraftKey getRecipe() { 26 | return this.handle.getMinecraftKeys().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'recipe' 31 | * 32 | * @param value New value for field 'recipe' 33 | */ 34 | public void setRecipe(MinecraftKey value) { 35 | this.handle.getMinecraftKeys().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientResourcePackStatus.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.ResourcePackStatus; 7 | 8 | public class WrapperPlayClientResourcePackStatus extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.RESOURCE_PACK_STATUS; 11 | 12 | public WrapperPlayClientResourcePackStatus() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientResourcePackStatus(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'action' 22 | * 23 | * @return 'action' 24 | */ 25 | public ResourcePackStatus getAction() { 26 | return this.handle.getResourcePackStatus().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'action' 31 | * 32 | * @param value New value for field 'action' 33 | */ 34 | public void setAction(ResourcePackStatus value) { 35 | this.handle.getResourcePackStatus().write(0, value); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientSetCommandMinecart.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientSetCommandMinecart extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.SET_COMMAND_MINECART; 10 | 11 | public WrapperPlayClientSetCommandMinecart() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientSetCommandMinecart(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'entity' 21 | * 22 | * @return 'entity' 23 | */ 24 | public int getEntity() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'entity' 30 | * 31 | * @param value New value for field 'entity' 32 | */ 33 | public void setEntity(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'command' 39 | * 40 | * @return 'command' 41 | */ 42 | public String getCommand() { 43 | return this.handle.getStrings().read(0); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'command' 48 | * 49 | * @param value New value for field 'command' 50 | */ 51 | public void setCommand(String value) { 52 | this.handle.getStrings().write(0, value); 53 | } 54 | 55 | /** 56 | * Retrieves the value of field 'trackOutput' 57 | * 58 | * @return 'trackOutput' 59 | */ 60 | public boolean getTrackOutput() { 61 | return this.handle.getBooleans().read(0); 62 | } 63 | 64 | /** 65 | * Sets the value of field 'trackOutput' 66 | * 67 | * @param value New value for field 'trackOutput' 68 | */ 69 | public void setTrackOutput(boolean value) { 70 | this.handle.getBooleans().write(0, value); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientSetCreativeSlot.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | public class WrapperPlayClientSetCreativeSlot extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.SET_CREATIVE_SLOT; 11 | 12 | public WrapperPlayClientSetCreativeSlot() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientSetCreativeSlot(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'slotNum' 22 | * 23 | * @return 'slotNum' 24 | */ 25 | public int getSlotNum() { 26 | return this.handle.getIntegers().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'slotNum' 31 | * 32 | * @param value New value for field 'slotNum' 33 | */ 34 | public void setSlotNum(int value) { 35 | this.handle.getIntegers().write(0, value); 36 | } 37 | 38 | /** 39 | * Retrieves the value of field 'itemStack' 40 | * 41 | * @return 'itemStack' 42 | */ 43 | public ItemStack getItemStack() { 44 | return this.handle.getItemModifier().read(0); 45 | } 46 | 47 | /** 48 | * Sets the value of field 'itemStack' 49 | * 50 | * @param value New value for field 'itemStack' 51 | */ 52 | public void setItemStack(ItemStack value) { 53 | this.handle.getItemModifier().write(0, value); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientSpectate.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | import java.util.UUID; 8 | 9 | /** 10 | * Send by the client to the server if the player (in spectator mode) wants to teleport to a target player 11 | */ 12 | public class WrapperPlayClientSpectate extends AbstractPacket { 13 | 14 | public static final PacketType TYPE = PacketType.Play.Client.SPECTATE; 15 | 16 | public WrapperPlayClientSpectate() { 17 | super(TYPE); 18 | } 19 | 20 | public WrapperPlayClientSpectate(PacketContainer packet) { 21 | super(packet, TYPE); 22 | } 23 | 24 | /** 25 | * Retrieves the uuid of the target player 26 | * 27 | * @return 'uuid' of target players 28 | */ 29 | public UUID getUuid() { 30 | return this.handle.getUUIDs().read(0); 31 | } 32 | 33 | /** 34 | * Sets the uuid of the target player 35 | * 36 | * @param value uuid of target player 37 | */ 38 | public void setUuid(UUID value) { 39 | this.handle.getUUIDs().write(0, value); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientTabComplete.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientTabComplete extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.TAB_COMPLETE; 10 | 11 | public WrapperPlayClientTabComplete() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientTabComplete(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'id' 21 | * 22 | * @return 'id' 23 | */ 24 | public int getId() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'id' 30 | * 31 | * @param value New value for field 'id' 32 | */ 33 | public void setId(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | /** 38 | * Retrieves the value of field 'command' 39 | * 40 | * @return 'command' 41 | */ 42 | public String getCommand() { 43 | return this.handle.getStrings().read(0); 44 | } 45 | 46 | /** 47 | * Sets the value of field 'command' 48 | * 49 | * @param value New value for field 'command' 50 | */ 51 | public void setCommand(String value) { 52 | this.handle.getStrings().write(0, value); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientTeleportAccept.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientTeleportAccept extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.TELEPORT_ACCEPT; 10 | 11 | public WrapperPlayClientTeleportAccept() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientTeleportAccept(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'id' 21 | * 22 | * @return 'id' 23 | */ 24 | public int getId() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'id' 30 | * 31 | * @param value New value for field 'id' 32 | */ 33 | public void setId(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientTileNbtQuery.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BlockPosition; 7 | 8 | public class WrapperPlayClientTileNbtQuery extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.TILE_NBT_QUERY; 11 | 12 | public WrapperPlayClientTileNbtQuery() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientTileNbtQuery(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'transactionId' 22 | * 23 | * @return 'transactionId' 24 | */ 25 | public int getTransactionId() { 26 | return this.handle.getIntegers().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'transactionId' 31 | * 32 | * @param value New value for field 'transactionId' 33 | */ 34 | public void setTransactionId(int value) { 35 | this.handle.getIntegers().write(0, value); 36 | } 37 | 38 | /** 39 | * Retrieves the value of field 'pos' 40 | * 41 | * @return 'pos' 42 | */ 43 | public BlockPosition getPos() { 44 | return this.handle.getBlockPositionModifier().read(0); 45 | } 46 | 47 | /** 48 | * Sets the value of field 'pos' 49 | * 50 | * @param value New value for field 'pos' 51 | */ 52 | public void setPos(BlockPosition value) { 53 | this.handle.getBlockPositionModifier().write(0, value); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientTrSel.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperPlayClientTrSel extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Play.Client.TR_SEL; 10 | 11 | public WrapperPlayClientTrSel() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperPlayClientTrSel(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'item' 21 | * 22 | * @return 'item' 23 | */ 24 | public int getItem() { 25 | return this.handle.getIntegers().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'item' 30 | * 31 | * @param value New value for field 'item' 32 | */ 33 | public void setItem(int value) { 34 | this.handle.getIntegers().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientUpdateSign.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.BlockPosition; 7 | 8 | public class WrapperPlayClientUpdateSign extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.UPDATE_SIGN; 11 | 12 | public WrapperPlayClientUpdateSign() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientUpdateSign(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'pos' 22 | * 23 | * @return 'pos' 24 | */ 25 | public BlockPosition getPos() { 26 | return this.handle.getBlockPositionModifier().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'pos' 31 | * 32 | * @param value New value for field 'pos' 33 | */ 34 | public void setPos(BlockPosition value) { 35 | this.handle.getBlockPositionModifier().write(0, value); 36 | } 37 | 38 | /** 39 | * Gets the face of the sign to update 40 | * @since 1.20 41 | * @return whether the front (true) or on the back (false) of the sign is updated 42 | */ 43 | public boolean getFrontText() { 44 | return this.handle.getBooleans().read(0); 45 | } 46 | 47 | /** 48 | * Sets the face of the sign to update 49 | * @since 1.20 50 | * @param value whether the front (true) or on the back (false) of the sign is updated 51 | */ 52 | public void setFrontText(boolean value) { 53 | this.handle.getBooleans().write(0, value); 54 | } 55 | 56 | /** 57 | * Retrieves the value of field 'lines' 58 | * 59 | * @return 'lines' 60 | */ 61 | public String[] getLines() { 62 | return this.handle.getStringArrays().read(0); 63 | } 64 | 65 | /** 66 | * Sets the value of field 'lines' 67 | * 68 | * @param value New value for field 'lines' 69 | */ 70 | public void setLines(String[] value) { 71 | this.handle.getStringArrays().write(0, value); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientUseItem.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | import com.comphenix.protocol.wrappers.EnumWrappers.Hand; 7 | 8 | public class WrapperPlayClientUseItem extends AbstractPacket { 9 | 10 | public static final PacketType TYPE = PacketType.Play.Client.USE_ITEM; 11 | 12 | public WrapperPlayClientUseItem() { 13 | super(TYPE); 14 | } 15 | 16 | public WrapperPlayClientUseItem(PacketContainer packet) { 17 | super(packet, TYPE); 18 | } 19 | 20 | /** 21 | * Retrieves the value of field 'hand' 22 | * 23 | * @return 'hand' 24 | */ 25 | public Hand getHand() { 26 | return this.handle.getHands().read(0); 27 | } 28 | 29 | /** 30 | * Sets the value of field 'hand' 31 | * 32 | * @param value New value for field 'hand' 33 | */ 34 | public void setHand(Hand value) { 35 | this.handle.getHands().write(0, value); 36 | } 37 | 38 | /** 39 | * Retrieves the value of field 'sequence' 40 | * 41 | * @return 'sequence' 42 | */ 43 | public int getSequence() { 44 | return this.handle.getIntegers().read(0); 45 | } 46 | 47 | /** 48 | * Sets the value of field 'sequence' 49 | * 50 | * @param value New value for field 'sequence' 51 | */ 52 | public void setSequence(int value) { 53 | this.handle.getIntegers().write(0, value); 54 | } 55 | 56 | /** 57 | * Retrieves the value of field 'timestamp' 58 | * 59 | * @return 'timestamp' 60 | */ 61 | public long getTimestamp() { 62 | return this.handle.getLongs().read(0); 63 | } 64 | 65 | /** 66 | * Sets the value of field 'timestamp' 67 | * 68 | * @param value New value for field 'timestamp' 69 | */ 70 | public void setTimestamp(long value) { 71 | this.handle.getLongs().write(0, value); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/status/clientbound/WrapperStatusServerPong.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.status.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperStatusServerPong extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Status.Server.PONG; 10 | 11 | public WrapperStatusServerPong() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperStatusServerPong(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'time' 21 | * 22 | * @return 'time' 23 | */ 24 | public long getTime() { 25 | return this.handle.getLongs().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'time' 30 | * 31 | * @param value New value for field 'time' 32 | */ 33 | public void setTime(long value) { 34 | this.handle.getLongs().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/status/clientbound/WrapperStatusServerServerInfo.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.status.clientbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.packetwrapper.util.TestExclusion; 5 | import com.comphenix.protocol.PacketType; 6 | import com.comphenix.protocol.events.PacketContainer; 7 | import com.comphenix.protocol.wrappers.WrappedServerPing; 8 | 9 | public class WrapperStatusServerServerInfo extends AbstractPacket { 10 | 11 | public static final PacketType TYPE = PacketType.Status.Server.SERVER_INFO; 12 | 13 | public WrapperStatusServerServerInfo() { 14 | super(TYPE); 15 | } 16 | 17 | public WrapperStatusServerServerInfo(PacketContainer packet) { 18 | super(packet, TYPE); 19 | } 20 | 21 | /** 22 | * Retrieves the value of field 'status' 23 | * 24 | * @return 'status' 25 | */ 26 | public WrappedServerPing getStatus() { 27 | return this.handle.getServerPings().read(0); 28 | } 29 | 30 | /** 31 | * Sets the value of field 'status' 32 | * 33 | * @param value New value for field 'status' 34 | */ 35 | @TestExclusion 36 | public void setStatus(WrappedServerPing value) { 37 | this.handle.getServerPings().write(0, value); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/status/serverbound/WrapperStatusClientPing.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.status.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperStatusClientPing extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Status.Client.PING; 10 | 11 | public WrapperStatusClientPing() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperStatusClientPing(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | /** 20 | * Retrieves the value of field 'time' 21 | * 22 | * @return 'time' 23 | */ 24 | public long getTime() { 25 | return this.handle.getLongs().read(0); 26 | } 27 | 28 | /** 29 | * Sets the value of field 'time' 30 | * 31 | * @param value New value for field 'time' 32 | */ 33 | public void setTime(long value) { 34 | this.handle.getLongs().write(0, value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/comphenix/packetwrapper/wrappers/status/serverbound/WrapperStatusClientStart.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.status.serverbound; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | import com.comphenix.protocol.PacketType; 5 | import com.comphenix.protocol.events.PacketContainer; 6 | 7 | public class WrapperStatusClientStart extends AbstractPacket { 8 | 9 | public static final PacketType TYPE = PacketType.Status.Client.START; 10 | 11 | public WrapperStatusClientStart() { 12 | super(TYPE); 13 | } 14 | 15 | public WrapperStatusClientStart(PacketContainer packet) { 16 | super(packet, TYPE); 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: PacketWrapper 2 | main: com.comphenix.packetwrapper.PacketWrapper 3 | 4 | description: Contains wrappers for each packet in Minecraft. 5 | authors: [dmulloy2, Comphenix, lukas81298] 6 | version: ${project.version} 7 | api-version: '1.20' 8 | 9 | depend: [ProtocolLib] 10 | -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/BaseTestInitialization.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper; 2 | 3 | import com.comphenix.packetwrapper.util.BukkitInitialization; 4 | import org.junit.jupiter.api.extension.BeforeAllCallback; 5 | import org.junit.jupiter.api.extension.ExtensionContext; 6 | 7 | import java.util.concurrent.atomic.AtomicBoolean; 8 | 9 | /** 10 | * @author Lukas Alt 11 | * @since 08.05.2023 12 | */ 13 | public class BaseTestInitialization implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { 14 | private final static AtomicBoolean started = new AtomicBoolean(false); 15 | 16 | @Override 17 | public void beforeAll(ExtensionContext extensionContext) { 18 | if(started.compareAndSet(false, true)) { 19 | try { 20 | BukkitInitialization.initializeAll(); 21 | } catch (Throwable t) { 22 | throw new RuntimeException("Failed to initialize bukkit support", t); 23 | } 24 | extensionContext.getRoot().getStore(ExtensionContext.Namespace.GLOBAL).put("bukkit-initialization", this); 25 | } 26 | } 27 | 28 | @Override 29 | public void close() { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/util/MinecraftReflectionTestUtil.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import com.comphenix.protocol.reflect.accessors.Accessors; 4 | import com.comphenix.protocol.utility.MinecraftReflection; 5 | import com.comphenix.protocol.utility.MinecraftVersion; 6 | 7 | public class MinecraftReflectionTestUtil { 8 | 9 | public static final String RELEASE_TARGET = "1.20"; 10 | public static final String PACKAGE_VERSION = "v1_20_R1"; 11 | public static final String NMS = "net.minecraft"; 12 | public static final String OBC = "org.bukkit.craftbukkit." + PACKAGE_VERSION; 13 | 14 | public static void init() { 15 | Accessors.getMethodAccessor(MinecraftReflection.class, "setMinecraftPackage", String.class, String.class).invoke(null, NMS, OBC); 16 | MinecraftVersion.setCurrentVersion(MinecraftVersion.LATEST); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/util/PacketWrapperUtils.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import com.comphenix.packetwrapper.wrappers.AbstractPacket; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * @author Lukas Alt 9 | * @since 07.05.2023 10 | */ 11 | public class PacketWrapperUtils { 12 | public static Set> getPacketWrappers() throws Exception { 13 | return Utils.getClassesInPackage("com.comphenix.packetwrapper", AbstractPacket.class); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/util/ProtocolConversionTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | /** 8 | * @author Lukas Alt 9 | * @since 15.05.2023 10 | */ 11 | class ProtocolConversionTest { 12 | @Test 13 | public void testDegreeRotationConversion() { 14 | for(int deg = 0; deg <= 360; deg++) { 15 | 16 | ProtocolConversion.angleToDegrees(ProtocolConversion.degreesToAngle((float) deg)); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/util/Utils.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.util; 2 | 3 | import com.comphenix.protocol.reflect.EquivalentConverter; 4 | import com.google.common.reflect.ClassPath; 5 | 6 | import java.io.IOException; 7 | import java.util.Set; 8 | import java.util.stream.Collectors; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 07.05.2023 13 | */ 14 | public class Utils { 15 | 16 | // https://www.baeldung.com/java-find-all-classes-in-package 17 | public static Set> getClassesInPackage(String packageName, Class parent) throws IOException { 18 | return ClassPath.from(ClassLoader.getSystemClassLoader()) 19 | .getAllClasses() 20 | .stream() 21 | .filter(clazz -> clazz.getPackageName().toLowerCase().startsWith(packageName.toLowerCase())) 22 | .map(clazz -> clazz.load()) 23 | .filter(clazz -> clazz.getSuperclass() != null && clazz.getSuperclass() == parent) 24 | .collect(Collectors.toSet()); 25 | } 26 | 27 | public static K unwrapAndWarp(K v, EquivalentConverter converter) { 28 | return converter.getSpecific(converter.getGeneric(v)); 29 | } 30 | 31 | public static String tryToString(Object object) { 32 | try { 33 | return object.toString(); 34 | } catch (Throwable t) { 35 | return "?"; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/login/clientbound/WrapperLoginServerCustomPayloadTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.login.clientbound.WrapperLoginServerCustomPayload; 5 | import com.comphenix.protocol.wrappers.MinecraftKey; 6 | import io.netty.buffer.Unpooled; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.ExtendWith; 9 | 10 | import static org.junit.jupiter.api.Assertions.*; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 12.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperLoginServerCustomPayloadTest { 18 | public static final MinecraftKey DUMMY_KEY = new MinecraftKey("minecraft", "test"); 19 | 20 | @Test 21 | public void test() { 22 | WrapperLoginServerCustomPayload dummy = new WrapperLoginServerCustomPayload(); 23 | dummy.setData(Unpooled.buffer()); 24 | dummy.setTransactionId(1); 25 | dummy.setIdentifier(DUMMY_KEY); 26 | assertNotNull(dummy.getData()); 27 | assertEquals(1, dummy.getTransactionId()); 28 | assertEquals(DUMMY_KEY, dummy.getIdentifier()); 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/login/serverbound/WrapperLoginClientCustomPayloadTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.login.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.login.serverbound.WrapperLoginClientCustomPayload; 5 | import io.netty.buffer.Unpooled; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | import static org.junit.jupiter.api.Assertions.assertNotNull; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 08.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperLoginClientCustomPayloadTest { 18 | @Test 19 | public void test() { 20 | WrapperLoginClientCustomPayload dummy = new WrapperLoginClientCustomPayload(); 21 | dummy.setData(Unpooled.buffer()); 22 | dummy.setTransactionId(1); 23 | assertNotNull(dummy.getData()); 24 | assertEquals(1, dummy.getTransactionId()); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerBundleTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.events.PacketContainer; 5 | import it.unimi.dsi.fastutil.ints.IntArrayList; 6 | import it.unimi.dsi.fastutil.ints.IntList; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.ExtendWith; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | import static org.junit.jupiter.api.Assertions.assertEquals; 15 | /** 16 | * @since 22.05.2023 17 | * @author Lukas Alt 18 | */ 19 | @ExtendWith(BaseTestInitialization.class) 20 | class WrapperPlayServerBundleTest { 21 | @Test 22 | public void test() { 23 | WrapperPlayServerBundle dummy = new WrapperPlayServerBundle(); 24 | WrapperPlayServerEntityDestroy destroy = new WrapperPlayServerEntityDestroy(); 25 | IntList value = new IntArrayList(); 26 | value.add(1); 27 | destroy.setEntityIds(value); 28 | List packets = new ArrayList<>(Collections.singletonList(destroy.getHandle())); 29 | dummy.setPackets(packets); 30 | 31 | List out = new ArrayList<>(); 32 | for (PacketContainer packet : dummy.getPackets()) { 33 | out.add(packet); 34 | } 35 | assertEquals(packets.size(), out.size()); 36 | assertEquals(packets.get(0).getHandle(), out.get(0).getHandle()); 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerChunksBiomesTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.util.Utils; 5 | import com.comphenix.protocol.wrappers.ChunkCoordIntPair; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import java.util.List; 10 | import java.util.Random; 11 | 12 | import static org.junit.jupiter.api.Assertions.*; 13 | 14 | /** 15 | * @author Lukas Alt 16 | * @since 18.05.2023 17 | */ 18 | @ExtendWith(BaseTestInitialization.class) 19 | class WrapperPlayServerChunksBiomesTest { 20 | @Test 21 | public void test() { 22 | WrapperPlayServerChunksBiomes dummy = new WrapperPlayServerChunksBiomes(); 23 | List value = List.of(new WrapperPlayServerChunksBiomes.WrappedChunkBiomeData(new ChunkCoordIntPair(1337, -42), new byte[128])); 24 | dummy.setChunkBiomeData(value); 25 | assertEquals(value, dummy.getChunkBiomeData()); 26 | } 27 | 28 | @Test 29 | public void testChunkBiomeDataConverter() { 30 | final byte[] buffer = new byte[128]; 31 | new Random().nextBytes(buffer); 32 | WrapperPlayServerChunksBiomes.WrappedChunkBiomeData data = new WrapperPlayServerChunksBiomes.WrappedChunkBiomeData(new ChunkCoordIntPair(1337, -42), buffer); 33 | WrapperPlayServerChunksBiomes.WrappedChunkBiomeData result = Utils.unwrapAndWarp(data, WrapperPlayServerChunksBiomes.WrappedChunkBiomeData.CONVERTER); 34 | assertEquals(data, result); 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerCustomChatCompletionsTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import org.junit.jupiter.api.Test; 5 | import org.junit.jupiter.api.extension.ExtendWith; 6 | 7 | import java.util.List; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * @author Lukas Alt 13 | * @since 17.05.2023 14 | */ 15 | @ExtendWith(BaseTestInitialization.class) 16 | class WrapperPlayServerCustomChatCompletionsTest { 17 | @Test 18 | public void test() { 19 | WrapperPlayServerCustomChatCompletions dummy = new WrapperPlayServerCustomChatCompletions(); 20 | dummy.setAction(WrapperPlayServerCustomChatCompletions.Action.REMOVE); 21 | List entries = List.of("a", "b", "c"); 22 | dummy.setEntries(entries); 23 | assertEquals(WrapperPlayServerCustomChatCompletions.Action.REMOVE, dummy.getAction()); 24 | assertEquals(entries, dummy.getEntries()); 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerEntityEffectTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import org.bukkit.potion.PotionEffectType; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 17.05.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayServerEntityEffectTest { 16 | @Test 17 | public void test() { 18 | WrapperPlayServerEntityEffect dummy = new WrapperPlayServerEntityEffect(); 19 | dummy.setEntityId(1); 20 | dummy.setEffectAmplifier((byte) 2); 21 | dummy.setFlags((byte) (0x1 | 0x8)); 22 | dummy.setEffectDurationTicks(1337); 23 | dummy.setEffect(PotionEffectType.ABSORPTION); 24 | dummy.setFactorData(null); 25 | assertNull(dummy.getFactorData()); 26 | WrapperPlayServerEntityEffect.WrappedFactorData factorData = new WrapperPlayServerEntityEffect.WrappedFactorData(); 27 | factorData.setFactorStart(1.3F); 28 | factorData.setHadEffectLastTick(true); 29 | factorData.setFactorPreviousFrame(3); 30 | dummy.setFactorData(factorData); 31 | assertEquals(factorData, dummy.getFactorData()); 32 | assertEquals(PotionEffectType.ABSORPTION, dummy.getEffect()); 33 | 34 | dummy.setFlags((byte) (WrapperPlayServerEntityEffect.FLAG_SHOW_PARTICLE | WrapperPlayServerEntityEffect.FLAG_AMBIENT | WrapperPlayServerEntityEffect.FLAG_SHOW_ICON)); 35 | assertTrue(dummy.isAmbient()); 36 | assertTrue(dummy.isShowIcon()); 37 | assertTrue(dummy.isShowParticles()); 38 | dummy.setAmbient(false); 39 | assertEquals((byte) (WrapperPlayServerEntityEffect.FLAG_SHOW_PARTICLE | WrapperPlayServerEntityEffect.FLAG_SHOW_ICON), dummy.getFlags()); 40 | dummy.setShowIcon(false); 41 | dummy.setShowParticles(false); 42 | assertEquals((byte) 0, dummy.getFlags()); 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerEntityEquipmentTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.wrappers.EnumWrappers; 5 | import com.comphenix.protocol.wrappers.Pair; 6 | import org.bukkit.Material; 7 | import org.bukkit.inventory.ItemStack; 8 | import org.junit.jupiter.api.Test; 9 | import org.junit.jupiter.api.extension.ExtendWith; 10 | 11 | import java.util.List; 12 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals; 14 | import static org.junit.jupiter.api.Assertions.assertTrue; 15 | 16 | /** 17 | * @author Lukas Alt 18 | * @since 15.05.2023 19 | */ 20 | @ExtendWith(BaseTestInitialization.class) 21 | class WrapperPlayServerEntityEquipmentTest { 22 | @Test 23 | public void test() { 24 | WrapperPlayServerEntityEquipment dummy = new WrapperPlayServerEntityEquipment(); 25 | dummy.setEntity(1337); 26 | dummy.setSlots(List.of( 27 | new Pair<>(EnumWrappers.ItemSlot.LEGS, new ItemStack(Material.DIAMOND_BOOTS)), 28 | new Pair<>(EnumWrappers.ItemSlot.CHEST, new ItemStack(Material.CHAINMAIL_CHESTPLATE)), 29 | new Pair<>(EnumWrappers.ItemSlot.OFFHAND, new ItemStack(Material.MAP)) 30 | )); 31 | List> list = dummy.getSlots(); 32 | assertEquals(3, list.size()); 33 | for (Pair itemSlotItemStackPair : list) { 34 | assertTrue(itemSlotItemStackPair.getFirst() == EnumWrappers.ItemSlot.LEGS || itemSlotItemStackPair.getFirst() == EnumWrappers.ItemSlot.CHEST || itemSlotItemStackPair.getFirst() == EnumWrappers.ItemSlot.OFFHAND); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerEntityLookTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.util.ProtocolConversion; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 04.06.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayServerEntityLookTest { 16 | @Test 17 | public void test() { 18 | WrapperPlayServerEntityLook dummy = new WrapperPlayServerEntityLook(); 19 | dummy.setEntityId(1337); 20 | dummy.setYaw(ProtocolConversion.angleToDegrees((byte) 64)); 21 | dummy.setPitch(ProtocolConversion.angleToDegrees((byte) 32)); 22 | dummy.setOnGround(false); 23 | assertEquals(1337, dummy.getEntityId()); 24 | assertEquals(ProtocolConversion.angleToDegrees((byte) 64), dummy.getYaw()); 25 | assertEquals(ProtocolConversion.angleToDegrees((byte) 32), dummy.getPitch()); 26 | assertFalse(dummy.getOnGround()); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerLoginTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.data.ResourceKey; 5 | import com.comphenix.protocol.wrappers.MinecraftKey; 6 | import org.bukkit.Bukkit; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.ExtendWith; 9 | 10 | import java.util.HashSet; 11 | 12 | import static org.junit.jupiter.api.Assertions.assertEquals; 13 | 14 | /** 15 | * @author Lukas Alt 16 | * @since 17.05.2023 17 | */ 18 | @ExtendWith(BaseTestInitialization.class) 19 | class WrapperPlayServerLoginTest { 20 | 21 | @Test 22 | public void test() { 23 | WrapperPlayServerLogin dummy = new WrapperPlayServerLogin(); 24 | dummy.setChunkRadius(16); 25 | dummy.setHardcore(true); 26 | dummy.setIsDebug(true); 27 | dummy.setLevels(new HashSet<>(Bukkit.getWorlds())); 28 | ResourceKey dimensionType = new ResourceKey(new MinecraftKey("minecraft", "dimension_type"), new MinecraftKey("minecraft", "overworld")); 29 | dummy.setDimensionType(dimensionType); 30 | dummy.setDimension(Bukkit.getWorlds().get(0)); 31 | 32 | assertEquals(dimensionType.getLocation().getFullKey(), dummy.getDimensionType().getLocation().getFullKey()); 33 | assertEquals(dimensionType.getLocation().getKey(), dummy.getDimensionType().getLocation().getKey()); 34 | assertEquals(dimensionType.getLocation().getPrefix(), dummy.getDimensionType().getLocation().getPrefix()); 35 | assertEquals(dimensionType.getRegistry().getFullKey(), dummy.getDimensionType().getRegistry().getFullKey()); 36 | assertEquals(dimensionType.getRegistry().getKey(), dummy.getDimensionType().getRegistry().getKey()); 37 | assertEquals(dimensionType.getRegistry().getPrefix(), dummy.getDimensionType().getRegistry().getPrefix()); 38 | // assertEquals(Bukkit.getWorlds().get(0), dummy.getDimension()); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerLookAtTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import org.junit.jupiter.api.Test; 5 | import org.junit.jupiter.api.extension.ExtendWith; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | /** 10 | * @author Lukas Alt 11 | * @since 17.05.2023 12 | */ 13 | @ExtendWith(BaseTestInitialization.class) 14 | class WrapperPlayServerLookAtTest { 15 | @Test 16 | public void test() { 17 | WrapperPlayServerLookAt dummy = new WrapperPlayServerLookAt(); 18 | dummy.setFromAnchor(WrapperPlayServerLookAt.Anchor.EYES); 19 | dummy.setToAnchor(WrapperPlayServerLookAt.Anchor.FEET); 20 | assertEquals(WrapperPlayServerLookAt.Anchor.EYES, dummy.getFromAnchor()); 21 | assertEquals(WrapperPlayServerLookAt.Anchor.FEET, dummy.getToAnchor()); 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPlayerListHeaderFooterTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.wrappers.WrappedChatComponent; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 31.05.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayServerPlayerListHeaderFooterTest { 16 | @Test 17 | public void test() { 18 | WrapperPlayServerPlayerListHeaderFooter dummy = new WrapperPlayServerPlayerListHeaderFooter(); 19 | 20 | WrappedChatComponent header = WrappedChatComponent.fromText("Header"); 21 | WrappedChatComponent footer = WrappedChatComponent.fromText("Footer"); 22 | dummy.setHeader(header); 23 | dummy.setFooter(footer); 24 | assertEquals(header, dummy.getHeader()); 25 | assertEquals(footer, dummy.getFooter()); 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPositionTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import org.junit.jupiter.api.Test; 5 | import org.junit.jupiter.api.extension.ExtendWith; 6 | 7 | import java.util.Set; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * @author Lukas Alt 13 | * @since 15.05.2023 14 | */ 15 | @ExtendWith(BaseTestInitialization.class) 16 | class WrapperPlayServerPositionTest { 17 | @Test 18 | public void test() { 19 | WrapperPlayServerPosition dummy = new WrapperPlayServerPosition(); 20 | dummy.setRelativeArguments(Set.of(WrapperPlayServerPosition.RelativeMovement.X, WrapperPlayServerPosition.RelativeMovement.X_ROT)); 21 | Set restored = dummy.getRelativeArguments(); 22 | assertEquals(2, restored.size()); 23 | assertTrue(restored.contains(WrapperPlayServerPosition.RelativeMovement.X)); 24 | assertTrue(restored.contains(WrapperPlayServerPosition.RelativeMovement.X_ROT)); 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRecipesTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.wrappers.MinecraftKey; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import java.util.List; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertFalse; 11 | import static org.junit.jupiter.api.Assertions.assertTrue; 12 | 13 | /** 14 | * @author Lukas Alt 15 | * @since 15.05.2023 16 | */ 17 | @ExtendWith(BaseTestInitialization.class) 18 | class WrapperPlayServerRecipesTest { 19 | @Test 20 | public void test() { 21 | WrapperPlayServerRecipes dummy = new WrapperPlayServerRecipes(); 22 | dummy.setState(WrapperPlayServerRecipes.Action.ADD); 23 | dummy.setRecipes(List.of(MinecraftKey.fromHandle(new MinecraftKey("a", "b")))); 24 | dummy.setToHighlight(List.of(MinecraftKey.fromHandle(new MinecraftKey("a", "b")))); 25 | WrapperPlayServerRecipes.WrappedRecipeBookSettings value = new WrapperPlayServerRecipes.WrappedRecipeBookSettings(); 26 | for (WrapperPlayServerRecipes.RecipeBookType recipeBookType : WrapperPlayServerRecipes.RecipeBookType.values()) { 27 | value.getSettings(recipeBookType).setOpen(true); 28 | value.getSettings(recipeBookType).setFiltering(false); 29 | } 30 | dummy.setBookSettings(value); 31 | value = dummy.getBookSettings(); 32 | for (WrapperPlayServerRecipes.RecipeBookType recipeBookType : WrapperPlayServerRecipes.RecipeBookType.values()) { 33 | assertTrue(value.getSettings(recipeBookType).isOpen()); 34 | assertFalse(value.getSettings(recipeBookType).isFiltering()); 35 | 36 | } 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRelEntityMoveLookTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.util.ProtocolConversion; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 04.06.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayServerRelEntityMoveLookTest { 16 | 17 | @Test 18 | public void test() { 19 | WrapperPlayServerRelEntityMoveLook dummy = new WrapperPlayServerRelEntityMoveLook(); 20 | dummy.setEntityId(1337); 21 | dummy.setDeltaX((short) 1); 22 | dummy.setDeltaY((short) 2); 23 | dummy.setDeltaZ((short) 3); 24 | dummy.setYaw(ProtocolConversion.angleToDegrees((byte) 64)); 25 | dummy.setPitch(ProtocolConversion.angleToDegrees((byte) 32)); 26 | dummy.setOnGround(false); 27 | assertEquals(1337, dummy.getEntityId()); 28 | assertEquals((short) 1, dummy.getDeltaX()); 29 | assertEquals((short) 2, dummy.getDeltaY()); 30 | assertEquals((short) 3, dummy.getDeltaZ()); 31 | assertEquals(ProtocolConversion.angleToDegrees((byte) 64), dummy.getYaw()); 32 | assertEquals(ProtocolConversion.angleToDegrees((byte) 32), dummy.getPitch()); 33 | assertFalse(dummy.getOnGround()); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRelEntityMoveTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import org.junit.jupiter.api.Test; 5 | import org.junit.jupiter.api.extension.ExtendWith; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertFalse; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 04.06.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayServerRelEntityMoveTest { 16 | @Test 17 | public void test() { 18 | WrapperPlayServerRelEntityMove dummy = new WrapperPlayServerRelEntityMove(); 19 | dummy.setEntityId(1337); 20 | dummy.setDeltaX((short) 1); 21 | dummy.setDeltaY((short) 2); 22 | dummy.setDeltaZ((short) 3); 23 | dummy.setOnGround(false); 24 | assertEquals(1337, dummy.getEntityId()); 25 | assertEquals((short) 1, dummy.getDeltaX()); 26 | assertEquals((short) 2, dummy.getDeltaY()); 27 | assertEquals((short) 3, dummy.getDeltaZ()); 28 | assertFalse(dummy.getOnGround()); 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerRespawnTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.data.ResourceKey; 5 | import com.comphenix.packetwrapper.wrappers.data.Vector3I; 6 | import com.comphenix.protocol.wrappers.EnumWrappers; 7 | import com.comphenix.protocol.wrappers.MinecraftKey; 8 | import org.bukkit.Bukkit; 9 | import org.junit.jupiter.api.Test; 10 | import org.junit.jupiter.api.extension.ExtendWith; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 15.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperPlayServerRespawnTest { 18 | @Test 19 | public void test() { 20 | WrapperPlayServerRespawn dummy = new WrapperPlayServerRespawn(); 21 | 22 | dummy.setDimensionType(new ResourceKey(new MinecraftKey("minecraft", "dimension_type"), new MinecraftKey("minecraft", "overworld"))); 23 | dummy.setDimension(Bukkit.getWorlds().get(0)); 24 | dummy.setSeed(1337); 25 | dummy.setPlayerGameType(EnumWrappers.NativeGameMode.ADVENTURE); 26 | dummy.setPreviousPlayerGameType(EnumWrappers.NativeGameMode.CREATIVE); 27 | dummy.setDataToKeep((byte) 1); 28 | dummy.setIsDebug(false); 29 | dummy.setIsFlat(true); 30 | dummy.setLastDeathLocation(Vector3I.newInstance(1, 3, 6)); 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerScoreboardTeamTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.wrappers.WrappedChatComponent; 5 | import org.bukkit.ChatColor; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | import static org.junit.jupiter.api.Assertions.assertFalse; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 18.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperPlayServerScoreboardTeamTest { 18 | @Test 19 | public void test() { 20 | WrapperPlayServerScoreboardTeam dummy = new WrapperPlayServerScoreboardTeam(); 21 | dummy.setParameters(null); 22 | assertFalse(dummy.getParameters().isPresent()); 23 | dummy.setParameters(createDummyParams()); 24 | assertEquals(createDummyParams(), dummy.getParameters().get()); 25 | } 26 | 27 | private WrapperPlayServerScoreboardTeam.WrappedParameters createDummyParams() { 28 | return new WrapperPlayServerScoreboardTeam.WrappedParameters(WrappedChatComponent.fromText("a"), WrappedChatComponent.fromText("b"), WrappedChatComponent.fromText("c"), 29 | "d", "e", ChatColor.AQUA, 1337); 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerSetCooldownTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.play.clientbound.WrapperPlayServerSetCooldown; 5 | import org.bukkit.Material; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * @author Lukas Alt 13 | * @since 12.05.2023 14 | */ 15 | @ExtendWith(BaseTestInitialization.class) 16 | class WrapperPlayServerSetCooldownTest { 17 | 18 | public static final Material DUMMY_TYPE = Material.BLAST_FURNACE; 19 | public static final int DUMMY_DURATION = 1337; 20 | 21 | @Test 22 | public void test() { 23 | WrapperPlayServerSetCooldown dummy = new WrapperPlayServerSetCooldown(); 24 | dummy.setItem(DUMMY_TYPE); 25 | dummy.setDuration(DUMMY_DURATION); 26 | assertEquals(DUMMY_TYPE, dummy.getItem()); 27 | assertEquals(DUMMY_DURATION, dummy.getDuration()); 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerTagsTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.data.ResourceKey; 5 | import com.comphenix.protocol.wrappers.MinecraftKey; 6 | import it.unimi.dsi.fastutil.ints.IntArrayList; 7 | import it.unimi.dsi.fastutil.ints.IntList; 8 | import org.junit.jupiter.api.Test; 9 | import org.junit.jupiter.api.extension.ExtendWith; 10 | 11 | import java.util.Collections; 12 | import java.util.Map; 13 | import static org.junit.jupiter.api.Assertions.assertEquals; 14 | import static org.junit.jupiter.api.Assertions.assertNotNull; 15 | 16 | /** 17 | * @author Lukas Alt 18 | * @since 18.05.2023 19 | */ 20 | @ExtendWith(BaseTestInitialization.class) 21 | class WrapperPlayServerTagsTest { 22 | @Test 23 | public void test() { 24 | WrapperPlayServerTags dummy = new WrapperPlayServerTags(); 25 | WrapperPlayServerTags.WrappedNetworkPayload payload = new WrapperPlayServerTags.WrappedNetworkPayload(); 26 | final MinecraftKey key = new MinecraftKey("f", "d"); 27 | final IntArrayList list = new IntArrayList(new int[]{ 1, 2, 3 }); 28 | payload.setTags(Collections.singletonMap( 29 | key, 30 | list 31 | )); 32 | ResourceKey resourceKey = new ResourceKey(new MinecraftKey("a", "b"), new MinecraftKey("a", "c")); 33 | dummy.setTags(Collections.singletonMap( 34 | resourceKey, 35 | payload 36 | )); 37 | 38 | Map tags = dummy.getTags(); 39 | WrapperPlayServerTags.WrappedNetworkPayload p = tags.get(resourceKey); 40 | assertNotNull(p); 41 | IntList list0 = p.getTags().get(key); 42 | assertNotNull(list); 43 | assertEquals(list, list0); 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerTileEntityDataTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.clientbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.wrappers.nbt.NbtCompound; 5 | import com.comphenix.protocol.wrappers.nbt.NbtFactory; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import java.util.Collections; 10 | 11 | import static org.junit.jupiter.api.Assertions.*; 12 | 13 | /** 14 | * @author Lukas Alt 15 | * @since 19.06.2023 16 | */ 17 | @ExtendWith(BaseTestInitialization.class) 18 | class WrapperPlayServerTileEntityDataTest { 19 | @Test 20 | public void test() { 21 | WrapperPlayServerTileEntityData dummy = new WrapperPlayServerTileEntityData(); 22 | 23 | NbtCompound nbt = NbtFactory.ofCompound("A"); 24 | nbt.setName("A"); 25 | nbt.setValue(Collections.singletonMap("b", NbtFactory.of("c", 10))); 26 | dummy.setTag(nbt); 27 | 28 | NbtCompound restored = dummy.getTag(); 29 | assertEquals(10, restored.getValue("c").getValue()); 30 | assertNull(restored.getValue("d")); 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientAdvancementsTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientAdvancements; 5 | import com.comphenix.protocol.wrappers.MinecraftKey; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | 11 | /** 12 | * @author Lukas Alt 13 | * @since 08.05.2023 14 | */ 15 | @ExtendWith(BaseTestInitialization.class) 16 | class WrapperPlayClientAdvancementsTest { 17 | 18 | @Test 19 | public void test() { 20 | WrapperPlayClientAdvancements packet = new WrapperPlayClientAdvancements(); 21 | packet.setAction(WrapperPlayClientAdvancements.Action.OPENED_TAB); 22 | assertEquals(WrapperPlayClientAdvancements.Action.OPENED_TAB, packet.getAction()); 23 | packet.setAction(WrapperPlayClientAdvancements.Action.CLOSED_SCREEN); 24 | assertEquals(WrapperPlayClientAdvancements.Action.CLOSED_SCREEN, packet.getAction()); 25 | packet.setTab(new MinecraftKey("a", "b")); 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientChatCommandTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.data.WrappedLastSeenMessagesUpdate; 5 | import com.comphenix.protocol.wrappers.WrappedMessageSignature; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import java.time.Instant; 10 | import java.util.ArrayList; 11 | import java.util.BitSet; 12 | 13 | import static org.junit.jupiter.api.Assertions.assertEquals; 14 | 15 | /** 16 | * @author Lukas Alt 17 | * @since 21.05.2023 18 | */ 19 | @ExtendWith(BaseTestInitialization.class) 20 | class WrapperPlayClientChatCommandTest { 21 | @Test 22 | public void test() { 23 | WrapperPlayClientChatCommand dummy = new WrapperPlayClientChatCommand(); 24 | dummy.setCommand("test"); 25 | dummy.setSalt(1337L); 26 | Instant now = Instant.now(); 27 | dummy.setTimeStamp(now); 28 | WrapperPlayClientChatCommand.WrappedArgumentSignatures value = new WrapperPlayClientChatCommand.WrappedArgumentSignatures(new ArrayList<>()); 29 | value.getArguments().add(new WrapperPlayClientChatCommand.WrappedArgumentSignature("test", new WrappedMessageSignature(new byte[256]))); 30 | dummy.setArgumentSignatures(value); 31 | final BitSet acknowledged = new BitSet(5); 32 | dummy.setLastSeenMessages(new WrappedLastSeenMessagesUpdate(5, acknowledged)); 33 | assertEquals("test", dummy.getCommand()); 34 | assertEquals(1337L, dummy.getSalt()); 35 | assertEquals(now, dummy.getTimeStamp()); 36 | assertEquals("test", dummy.getArgumentSignatures().getArguments().get(0).getName()); 37 | assertEquals(5, dummy.getLastSeenMessages().getOffset()); 38 | assertEquals(acknowledged, dummy.getLastSeenMessages().getAcknowledged()); 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientRecipeSettingsTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientRecipeSettings; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 12.05.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayClientRecipeSettingsTest { 16 | 17 | @Test 18 | public void test() { 19 | WrapperPlayClientRecipeSettings dummy = new WrapperPlayClientRecipeSettings(); 20 | dummy.setBookType(WrapperPlayClientRecipeSettings.RecipeBookType.BLAST_FURNACE); 21 | dummy.setIsFiltering(true); 22 | dummy.setIsOpen(false); 23 | assertEquals(WrapperPlayClientRecipeSettings.RecipeBookType.BLAST_FURNACE, dummy.getBookType()); 24 | assertTrue(dummy.getIsFiltering()); 25 | assertFalse(dummy.getIsOpen()); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientSetCommandBlockTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientSetCommandBlock; 5 | import com.comphenix.protocol.wrappers.BlockPosition; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * @author Lukas Alt 13 | * @since 12.05.2023 14 | */ 15 | @ExtendWith(BaseTestInitialization.class) 16 | class WrapperPlayClientSetCommandBlockTest { 17 | 18 | @Test 19 | public void test() { 20 | WrapperPlayClientSetCommandBlock dummy = new WrapperPlayClientSetCommandBlock(); 21 | dummy.setMode(WrapperPlayClientSetCommandBlock.CommandBlockMode.AUTO); 22 | dummy.setMode(WrapperPlayClientSetCommandBlock.CommandBlockMode.SEQUENCE); 23 | 24 | dummy.setCommand("/test"); 25 | dummy.setAutomatic(false); 26 | dummy.setPos(new BlockPosition(1, 2, 3)); 27 | dummy.setConditional(false); 28 | dummy.setTrackOutput(true); 29 | assertNotEquals(WrapperPlayClientSetCommandBlock.CommandBlockMode.AUTO, dummy.getMode()); 30 | assertEquals(WrapperPlayClientSetCommandBlock.CommandBlockMode.SEQUENCE, dummy.getMode()); 31 | assertEquals("/test", dummy.getCommand()); 32 | assertFalse(dummy.getAutomatic()); 33 | assertEquals(new BlockPosition(1, 2, 3), dummy.getPos()); 34 | assertFalse(dummy.getConditional()); 35 | assertTrue(dummy.getTrackOutput()); 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientSetJigsawTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientSetJigsaw; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 12.05.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayClientSetJigsawTest { 16 | @Test 17 | public void test() { 18 | WrapperPlayClientSetJigsaw dummy = new WrapperPlayClientSetJigsaw(); 19 | dummy.setJoint(WrapperPlayClientSetJigsaw.JointType.ALIGNED); 20 | assertEquals(WrapperPlayClientSetJigsaw.JointType.ALIGNED, dummy.getJoint()); 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientSettingsTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.play.serverbound.WrapperPlayClientSettings; 5 | import org.junit.jupiter.api.Test; 6 | import org.junit.jupiter.api.extension.ExtendWith; 7 | 8 | import static org.junit.jupiter.api.Assertions.*; 9 | 10 | /** 11 | * @author Lukas Alt 12 | * @since 12.05.2023 13 | */ 14 | @ExtendWith(BaseTestInitialization.class) 15 | class WrapperPlayClientSettingsTest { 16 | @Test 17 | public void test() { 18 | WrapperPlayClientSettings dummy = new WrapperPlayClientSettings(); 19 | dummy.setMainHand(WrapperPlayClientSettings.HumanoidArm.LEFT); 20 | dummy.setMainHand(WrapperPlayClientSettings.HumanoidArm.RIGHT); 21 | assertEquals(WrapperPlayClientSettings.HumanoidArm.RIGHT, dummy.getMainHand()); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientStructTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import org.bukkit.block.structure.Mirror; 5 | import org.bukkit.block.structure.StructureRotation; 6 | import org.bukkit.block.structure.UsageMode; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.ExtendWith; 9 | 10 | import static org.junit.jupiter.api.Assertions.*; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 21.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperPlayClientStructTest { 18 | @Test 19 | public void test() { 20 | WrapperPlayClientStruct dummy = new WrapperPlayClientStruct(); 21 | dummy.setRotation(StructureRotation.CLOCKWISE_180); 22 | dummy.setMirror(Mirror.FRONT_BACK); 23 | dummy.setMode(UsageMode.CORNER); 24 | dummy.setUpdateType(WrapperPlayClientStruct.UpdateType.UPDATE_DATA); 25 | 26 | assertEquals(StructureRotation.CLOCKWISE_180, dummy.getRotation()); 27 | assertEquals(Mirror.FRONT_BACK, dummy.getMirror()); 28 | assertEquals(UsageMode.CORNER, dummy.getMode()); 29 | assertEquals(WrapperPlayClientStruct.UpdateType.UPDATE_DATA, dummy.getUpdateType()); 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientUseEntityTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.protocol.wrappers.EnumWrappers; 5 | import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction; 6 | import org.bukkit.util.Vector; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.ExtendWith; 9 | 10 | import static org.junit.jupiter.api.Assertions.*; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 21.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperPlayClientUseEntityTest { 18 | @Test 19 | public void test() { 20 | WrapperPlayClientUseEntity dummy = new WrapperPlayClientUseEntity(); 21 | dummy.setAction(WrappedEnumEntityUseAction.attack()); 22 | assertEquals(EnumWrappers.EntityUseAction.ATTACK, dummy.getAction().getAction()); 23 | dummy.setAction(WrappedEnumEntityUseAction.interact(EnumWrappers.Hand.MAIN_HAND)); 24 | assertEquals(EnumWrappers.EntityUseAction.INTERACT, dummy.getAction().getAction()); 25 | assertEquals(EnumWrappers.Hand.MAIN_HAND, dummy.getAction().getHand()); 26 | dummy.setAction(WrappedEnumEntityUseAction.interactAt(EnumWrappers.Hand.MAIN_HAND, new Vector(1,2,3))); 27 | assertEquals(EnumWrappers.EntityUseAction.INTERACT_AT, dummy.getAction().getAction()); 28 | assertEquals(EnumWrappers.Hand.MAIN_HAND, dummy.getAction().getHand()); 29 | assertEquals(new Vector(1,2,3), dummy.getAction().getPosition()); 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayClientWindowClickTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import it.unimi.dsi.fastutil.ints.Int2ObjectMap; 5 | import org.bukkit.Material; 6 | import org.bukkit.inventory.ItemStack; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.ExtendWith; 9 | 10 | import static org.junit.jupiter.api.Assertions.assertEquals; 11 | 12 | /** 13 | * @author Lukas Alt 14 | * @since 08.05.2023 15 | */ 16 | @ExtendWith(BaseTestInitialization.class) 17 | class WrapperPlayClientWindowClickTest { 18 | 19 | @Test 20 | public void testChangedSlots() { 21 | WrapperPlayClientWindowClick packet = new WrapperPlayClientWindowClick(); 22 | Int2ObjectMap map = packet.getChangedSlots(); 23 | map.put(1, new ItemStack(Material.AIR)); 24 | map.put(3, new ItemStack(Material.STONE)); 25 | packet.setChangedSlots(map); 26 | 27 | packet.setClickType(WrapperPlayClientWindowClick.WrappedClickType.SWAP); 28 | assertEquals(WrapperPlayClientWindowClick.WrappedClickType.SWAP, packet.getClickType()); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/comphenix/packetwrapper/wrappers/play/serverbound/WrapperPlayServerLoginTest.java: -------------------------------------------------------------------------------- 1 | package com.comphenix.packetwrapper.wrappers.play.serverbound; 2 | 3 | import com.comphenix.packetwrapper.BaseTestInitialization; 4 | import com.comphenix.packetwrapper.wrappers.data.Vector3I; 5 | import com.comphenix.packetwrapper.wrappers.play.clientbound.WrapperPlayServerLogin; 6 | import org.junit.jupiter.api.Test; 7 | import org.junit.jupiter.api.extension.ExtendWith; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * @author Lukas Alt 13 | * @since 12.05.2023 14 | */ 15 | @ExtendWith(BaseTestInitialization.class) 16 | class WrapperPlayServerLoginTest { 17 | @Test 18 | public void test() { 19 | WrapperPlayServerLogin dummy = new WrapperPlayServerLogin(); 20 | dummy.setLastDeathLocation(null); 21 | assertNotNull(dummy.getLastDeathLocation()); 22 | assertTrue(dummy.getLastDeathLocation().isEmpty()); 23 | dummy.setLastDeathLocation(Vector3I.newInstance(1, 2, 3)); 24 | assertNotNull(dummy.getLastDeathLocation()); 25 | assertTrue(dummy.getLastDeathLocation().isPresent()); 26 | assertEquals(1, dummy.getLastDeathLocation().get().getX()); 27 | assertEquals(2, dummy.getLastDeathLocation().get().getY()); 28 | assertEquals(3, dummy.getLastDeathLocation().get().getZ()); 29 | 30 | } 31 | } --------------------------------------------------------------------------------