70 | * Notes: the action the player is taking against the block (see below)
71 | *
72 | * @return The current Status
73 | */
74 | public PlayerDigType getStatus() {
75 | return handle.getPlayerDigTypes().read(0);
76 | }
77 |
78 | /**
79 | * Set Status.
80 | *
81 | * @param value - new value.
82 | */
83 | public void setStatus(PlayerDigType value) {
84 | handle.getPlayerDigTypes().write(0, value);
85 | }
86 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientBlockPlace.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import com.comphenix.protocol.wrappers.EnumWrappers.Hand;
24 |
25 | public class WrapperPlayClientBlockPlace extends AbstractPacket {
26 | public static final PacketType TYPE = PacketType.Play.Client.BLOCK_PLACE;
27 |
28 | public WrapperPlayClientBlockPlace() {
29 | super(new PacketContainer(TYPE), TYPE);
30 | handle.getModifier().writeDefaults();
31 | }
32 |
33 | public WrapperPlayClientBlockPlace(PacketContainer packet) {
34 | super(packet, TYPE);
35 | }
36 |
37 | public Hand getHand() {
38 | return handle.getHands().read(0);
39 | }
40 |
41 | public void setHand(Hand value) {
42 | handle.getHands().write(0, value);
43 | }
44 |
45 | public long getTimestamp() {
46 | return handle.getLongs().read(0);
47 | }
48 |
49 | public void setTimestamp(long value) {
50 | handle.getLongs().write(0, value);
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientEntityAction.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 | import com.comphenix.protocol.wrappers.EnumWrappers.PlayerAction;
28 |
29 | public class WrapperPlayClientEntityAction extends AbstractPacket {
30 | public static final PacketType TYPE = PacketType.Play.Client.ENTITY_ACTION;
31 |
32 | public WrapperPlayClientEntityAction() {
33 | super(new PacketContainer(TYPE), TYPE);
34 | handle.getModifier().writeDefaults();
35 | }
36 |
37 | public WrapperPlayClientEntityAction(PacketContainer packet) {
38 | super(packet, TYPE);
39 | }
40 |
41 | /**
42 | * Retrieve Entity ID.
43 | *
44 | * Notes: entity's ID
45 | *
46 | * @return The current Entity ID
47 | */
48 | public int getEntityID() {
49 | return handle.getIntegers().read(0);
50 | }
51 |
52 | /**
53 | * Set Entity ID.
54 | *
55 | * @param value - new value.
56 | */
57 | public void setEntityID(int value) {
58 | handle.getIntegers().write(0, value);
59 | }
60 |
61 | /**
62 | * Retrieve the entity of the painting that will be spawned.
63 | *
64 | * @param world - the current world of the entity.
65 | * @return The spawned entity.
66 | */
67 | public Entity getEntity(World world) {
68 | return handle.getEntityModifier(world).read(0);
69 | }
70 |
71 | /**
72 | * Retrieve the entity of the painting that will be spawned.
73 | *
74 | * @param event - the packet event.
75 | * @return The spawned entity.
76 | */
77 | public Entity getEntity(PacketEvent event) {
78 | return getEntity(event.getPlayer().getWorld());
79 | }
80 |
81 | /**
82 | * Retrieve Action ID.
83 | *
84 | * Notes: the ID of the action, see below.
85 | *
86 | * @return The current Action ID
87 | */
88 | public PlayerAction getAction() {
89 | return handle.getPlayerActions().read(0);
90 | }
91 |
92 | /**
93 | * Set Action ID.
94 | *
95 | * @param value - new value.
96 | */
97 | public void setAction(PlayerAction value) {
98 | handle.getPlayerActions().write(0, value);
99 | }
100 |
101 | /**
102 | * Retrieve Jump Boost.
103 | *
104 | * Notes: horse jump boost. Ranged from 0 -> 100.
105 | *
106 | * @return The current Jump Boost
107 | */
108 | public int getJumpBoost() {
109 | return handle.getIntegers().read(1);
110 | }
111 |
112 | /**
113 | * Set Jump Boost.
114 | *
115 | * @param value - new value.
116 | */
117 | public void setJumpBoost(int value) {
118 | handle.getIntegers().write(1, value);
119 | }
120 |
121 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientHeldItemSlot.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayClientHeldItemSlot extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Client.HELD_ITEM_SLOT;
26 |
27 | public WrapperPlayClientHeldItemSlot() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayClientHeldItemSlot(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Slot.
38 | *
39 | * Notes: the slot which the player has selected (0-8)
40 | *
41 | * @return The current Slot
42 | */
43 | public int getSlot() {
44 | return handle.getIntegers().read(0);
45 | }
46 |
47 | /**
48 | * Set Slot.
49 | *
50 | * @param value - new value.
51 | */
52 | public void setSlot(int value) {
53 | handle.getIntegers().write(0, value);
54 | }
55 |
56 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientKeepAlive.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayClientKeepAlive extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Client.KEEP_ALIVE;
26 |
27 | public WrapperPlayClientKeepAlive() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayClientKeepAlive(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Keep Alive ID.
38 | * @return The current Keep Alive ID
39 | */
40 | public int getKeepAliveId() {
41 | return handle.getIntegers().read(0);
42 | }
43 |
44 | /**
45 | * Set Keep Alive ID.
46 | * @param value - new value.
47 | */
48 | public void setKeepAliveId(int value) {
49 | handle.getIntegers().write(0, value);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientLook.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayClientLook extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Client.LOOK;
26 |
27 | public WrapperPlayClientLook() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayClientLook(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Yaw.
38 | *
39 | * Notes: absolute rotation on the X Axis, in degrees
40 | * @return The current Yaw
41 | */
42 | public float getYaw() {
43 | return handle.getFloat().read(0);
44 | }
45 |
46 | /**
47 | * Set Yaw.
48 | * @param value - new value.
49 | */
50 | public void setYaw(float value) {
51 | handle.getFloat().write(0, value);
52 | }
53 |
54 | /**
55 | * Retrieve Pitch.
56 | *
57 | * Notes: absolute rotation on the Y Axis, in degrees
58 | * @return The current Pitch
59 | */
60 | public float getPitch() {
61 | return handle.getFloat().read(1);
62 | }
63 |
64 | /**
65 | * Set Pitch.
66 | * @param value - new value.
67 | */
68 | public void setPitch(float value) {
69 | handle.getFloat().write(1, value);
70 | }
71 |
72 | /**
73 | * Retrieve On Ground.
74 | *
75 | * Notes: true if the client is on the ground, False otherwise
76 | * @return The current On Ground
77 | */
78 | public boolean getOnGround() {
79 | return handle.getBooleans().read(0);
80 | }
81 |
82 | /**
83 | * Set On Ground.
84 | * @param value - new value.
85 | */
86 | public void setOnGround(boolean value) {
87 | handle.getBooleans().write(0, value);
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientPosition.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayClientPosition extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Client.POSITION;
26 |
27 | public WrapperPlayClientPosition() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayClientPosition(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve X.
38 | *
39 | * Notes: absolute position
40 | * @return The current X
41 | */
42 | public double getX() {
43 | return handle.getDoubles().read(0);
44 | }
45 |
46 | /**
47 | * Set X.
48 | * @param value - new value.
49 | */
50 | public void setX(double value) {
51 | handle.getDoubles().write(0, value);
52 | }
53 |
54 | /**
55 | * Retrieve FeetY.
56 | *
57 | * Notes: absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc
58 | * @return The current FeetY
59 | */
60 | public double getY() {
61 | return handle.getDoubles().read(1);
62 | }
63 |
64 | /**
65 | * Set FeetY.
66 | * @param value - new value.
67 | */
68 | public void setY(double value) {
69 | handle.getDoubles().write(1, value);
70 | }
71 |
72 | /**
73 | * Retrieve Z.
74 | *
75 | * Notes: absolute position
76 | * @return The current Z
77 | */
78 | public double getZ() {
79 | return handle.getDoubles().read(2);
80 | }
81 |
82 | /**
83 | * Set Z.
84 | * @param value - new value.
85 | */
86 | public void setZ(double value) {
87 | handle.getDoubles().write(2, value);
88 | }
89 |
90 | /**
91 | * Retrieve On Ground.
92 | *
93 | * Notes: true if the client is on the ground, False otherwise
94 | * @return The current On Ground
95 | */
96 | public boolean getOnGround() {
97 | return handle.getBooleans().read(0);
98 | }
99 |
100 | /**
101 | * Set On Ground.
102 | * @param value - new value.
103 | */
104 | public void setOnGround(boolean value) {
105 | handle.getBooleans().write(0, value);
106 | }
107 |
108 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientSetCreativeSlot.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | public class WrapperPlayClientSetCreativeSlot extends AbstractPacket {
26 | public static final PacketType TYPE = PacketType.Play.Client.SET_CREATIVE_SLOT;
27 |
28 | public WrapperPlayClientSetCreativeSlot() {
29 | super(new PacketContainer(TYPE), TYPE);
30 | handle.getModifier().writeDefaults();
31 | }
32 |
33 | public WrapperPlayClientSetCreativeSlot(PacketContainer packet) {
34 | super(packet, TYPE);
35 | }
36 |
37 | /**
38 | * Retrieve Slot.
39 | *
40 | * Notes: inventory slot
41 | * @return The current Slot
42 | */
43 | public int getSlot() {
44 | return handle.getIntegers().read(0);
45 | }
46 |
47 | /**
48 | * Set Slot.
49 | * @param value - new value.
50 | */
51 | public void setSlot(int value) {
52 | handle.getIntegers().write(0, value);
53 | }
54 |
55 | /**
56 | * Retrieve Clicked item.
57 | * @return The current Clicked item
58 | */
59 | public ItemStack getClickedItem() {
60 | return handle.getItemModifier().read(0);
61 | }
62 |
63 | /**
64 | * Set Clicked item.
65 | * @param value - new value.
66 | */
67 | public void setClickedItem(ItemStack value) {
68 | handle.getItemModifier().write(0, value);
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientSteerVehicle.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayClientSteerVehicle extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Client.STEER_VEHICLE;
26 |
27 | public WrapperPlayClientSteerVehicle() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayClientSteerVehicle(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Sideways.
38 | *
39 | * Notes: positive to the left of the player
40 | *
41 | * @return The current Sideways
42 | */
43 | public float getSideways() {
44 | return handle.getFloat().read(0);
45 | }
46 |
47 | /**
48 | * Set Sideways.
49 | *
50 | * @param value - new value.
51 | */
52 | public void setSideways(float value) {
53 | handle.getFloat().write(0, value);
54 | }
55 |
56 | /**
57 | * Retrieve Forward.
58 | *
59 | * Notes: positive forward
60 | *
61 | * @return The current Forward
62 | */
63 | public float getForward() {
64 | return handle.getFloat().read(1);
65 | }
66 |
67 | /**
68 | * Set Forward.
69 | *
70 | * @param value - new value.
71 | */
72 | public void setForward(float value) {
73 | handle.getFloat().write(1, value);
74 | }
75 |
76 | public boolean isJump() {
77 | return handle.getBooleans().read(0);
78 | }
79 |
80 | public void setJump(boolean value) {
81 | handle.getBooleans().write(0, value);
82 | }
83 |
84 | public boolean isUnmount() {
85 | return handle.getBooleans().read(1);
86 | }
87 |
88 | public void setUnmount(boolean value) {
89 | handle.getBooleans().write(1, value);
90 | }
91 |
92 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientUseEntity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import com.comphenix.protocol.events.PacketEvent;
24 | import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
25 |
26 | import me.jumper251.replay.utils.VersionUtil;
27 | import me.jumper251.replay.utils.VersionUtil.VersionEnum;
28 |
29 | import org.bukkit.World;
30 | import org.bukkit.entity.Entity;
31 | import org.bukkit.util.Vector;
32 |
33 | public class WrapperPlayClientUseEntity extends AbstractPacket {
34 | public static final PacketType TYPE = PacketType.Play.Client.USE_ENTITY;
35 |
36 | public WrapperPlayClientUseEntity() {
37 | super(new PacketContainer(TYPE), TYPE);
38 | handle.getModifier().writeDefaults();
39 | }
40 |
41 | public WrapperPlayClientUseEntity(PacketContainer packet) {
42 | super(packet, TYPE);
43 | }
44 |
45 | /**
46 | * Retrieve entity ID of the target.
47 | * @return The current entity ID
48 | */
49 | public int getTargetID() {
50 | return handle.getIntegers().read(0);
51 | }
52 |
53 | /**
54 | * Retrieve the entity that was targeted.
55 | * @param world - the current world of the entity.
56 | * @return The targeted entity.
57 | */
58 | public Entity getTarget(World world) {
59 | return handle.getEntityModifier(world).read(0);
60 | }
61 |
62 | /**
63 | * Retrieve the entity that was targeted.
64 | * @param event - the packet event.
65 | * @return The targeted entity.
66 | */
67 | public Entity getTarget(PacketEvent event) {
68 | return getTarget(event.getPlayer().getWorld());
69 | }
70 |
71 | /**
72 | * Set entity ID of the target.
73 | * @param value - new value.
74 | */
75 | public void setTargetID(int value) {
76 | handle.getIntegers().write(0, value);
77 | }
78 |
79 | /**
80 | * Retrieve Type.
81 | * @return The current Type
82 | */
83 | public EntityUseAction getType() {
84 | if (VersionUtil.isAbove(VersionEnum.V1_17))
85 | return handle.getEnumEntityUseActions().read(0).getAction();
86 |
87 | return handle.getEntityUseActions().read(0);
88 | }
89 |
90 | /**
91 | * Set Type.
92 | * @param value - new value.
93 | */
94 | public void setType(EntityUseAction value) {
95 | handle.getEntityUseActions().write(0, value);
96 | }
97 |
98 | /**
99 | * Retrieve the target vector.
100 | *
101 | * Notes: Only if {@link #getType()} is {@link EntityUseAction#INTERACT_AT}.
102 | *
103 | * @return The target vector or null
104 | */
105 | public Vector getTargetVector() {
106 | return handle.getVectors().read(0);
107 | }
108 |
109 | /**
110 | * Set the target vector.
111 | * @param value - new value.
112 | */
113 | public void setTargetVector(Vector value) {
114 | handle.getVectors().write(0, value);
115 | }
116 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientVehicleMove.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayClientVehicleMove extends AbstractPacket {
25 |
26 | public static final PacketType TYPE = PacketType.Play.Client.VEHICLE_MOVE;
27 |
28 | public WrapperPlayClientVehicleMove() {
29 | super(new PacketContainer(TYPE), TYPE);
30 | handle.getModifier().writeDefaults();
31 | }
32 |
33 | public WrapperPlayClientVehicleMove(PacketContainer packet) {
34 | super(packet, TYPE);
35 | }
36 |
37 | /**
38 | * Retrieve X.
39 | *
40 | * Notes: absolute position (X coordinate)
41 | *
42 | * @return The current X
43 | */
44 | public double getX() {
45 | return handle.getDoubles().read(0);
46 | }
47 |
48 | /**
49 | * Set X.
50 | *
51 | * @param value - new value.
52 | */
53 | public void setX(double value) {
54 | handle.getDoubles().write(0, value);
55 | }
56 |
57 | /**
58 | * Retrieve Y.
59 | *
60 | * Notes: absolute position (Y coordinate)
61 | *
62 | * @return The current Y
63 | */
64 | public double getY() {
65 | return handle.getDoubles().read(1);
66 | }
67 |
68 | /**
69 | * Set Y.
70 | *
71 | * @param value - new value.
72 | */
73 | public void setY(double value) {
74 | handle.getDoubles().write(1, value);
75 | }
76 |
77 | /**
78 | * Retrieve Z.
79 | *
80 | * Notes: absolute position (Z coordinate)
81 | *
82 | * @return The current Z
83 | */
84 | public double getZ() {
85 | return handle.getDoubles().read(2);
86 | }
87 |
88 | /**
89 | * Set Z.
90 | *
91 | * @param value - new value.
92 | */
93 | public void setZ(double value) {
94 | handle.getDoubles().write(2, value);
95 | }
96 |
97 | /**
98 | * Retrieve Yaw.
99 | *
100 | * Notes: absolute rotation on the vertical axis, in degrees
101 | *
102 | * @return The current Yaw
103 | */
104 | public float getYaw() {
105 | return handle.getFloat().read(0);
106 | }
107 |
108 | /**
109 | * Set Yaw.
110 | *
111 | * @param value - new value.
112 | */
113 | public void setYaw(float value) {
114 | handle.getFloat().write(0, value);
115 | }
116 |
117 | /**
118 | * Retrieve Pitch.
119 | *
120 | * Notes: absolute rotation on the horizontal axis, in degrees
121 | *
122 | * @return The current Pitch
123 | */
124 | public float getPitch() {
125 | return handle.getFloat().read(1);
126 | }
127 |
128 | /**
129 | * Set Pitch.
130 | *
131 | * @param value - new value.
132 | */
133 | public void setPitch(float value) {
134 | handle.getFloat().write(1, value);
135 | }
136 |
137 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerAnimation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 |
28 | public class WrapperPlayServerAnimation extends AbstractPacket {
29 | public static final PacketType TYPE = PacketType.Play.Server.ANIMATION;
30 |
31 | public WrapperPlayServerAnimation() {
32 | super(new PacketContainer(TYPE), TYPE);
33 | handle.getModifier().writeDefaults();
34 | }
35 |
36 | public WrapperPlayServerAnimation(PacketContainer packet) {
37 | super(packet, TYPE);
38 | }
39 |
40 | /**
41 | * Retrieve Entity ID.
42 | *
43 | * Notes: entity's ID
44 | *
45 | * @return The current Entity ID
46 | */
47 | public int getEntityID() {
48 | return handle.getIntegers().read(0);
49 | }
50 |
51 | /**
52 | * Set Entity ID.
53 | *
54 | * @param value - new value.
55 | */
56 | public void setEntityID(int value) {
57 | handle.getIntegers().write(0, value);
58 | }
59 |
60 | /**
61 | * Retrieve the entity of the painting that will be spawned.
62 | *
63 | * @param world - the current world of the entity.
64 | * @return The spawned entity.
65 | */
66 | public Entity getEntity(World world) {
67 | return handle.getEntityModifier(world).read(0);
68 | }
69 |
70 | /**
71 | * Retrieve the entity of the painting that will be spawned.
72 | *
73 | * @param event - the packet event.
74 | * @return The spawned entity.
75 | */
76 | public Entity getEntity(PacketEvent event) {
77 | return getEntity(event.getPlayer().getWorld());
78 | }
79 |
80 | /**
81 | * Retrieve Animation.
82 | *
83 | * Notes: animation ID
84 | *
85 | * @return The current Animation
86 | */
87 | public int getAnimation() {
88 | return handle.getIntegers().read(1);
89 | }
90 |
91 | /**
92 | * Set Animation.
93 | *
94 | * @param value - new value.
95 | */
96 | public void setAnimation(int value) {
97 | handle.getIntegers().write(1, value);
98 | }
99 |
100 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerBed.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 | import com.comphenix.protocol.wrappers.BlockPosition;
28 |
29 | public class WrapperPlayServerBed extends AbstractPacket {
30 | public static final PacketType TYPE = PacketType.Play.Server.BED;
31 |
32 | public WrapperPlayServerBed() {
33 | super(new PacketContainer(TYPE), TYPE);
34 | handle.getModifier().writeDefaults();
35 | }
36 |
37 | public WrapperPlayServerBed(PacketContainer packet) {
38 | super(packet, TYPE);
39 | }
40 |
41 | /**
42 | * Retrieve Entity ID.
43 | *
44 | * Notes: entity's ID
45 | *
46 | * @return The current Entity ID
47 | */
48 | public int getEntityID() {
49 | return handle.getIntegers().read(0);
50 | }
51 |
52 | /**
53 | * Set Entity ID.
54 | *
55 | * @param value - new value.
56 | */
57 | public void setEntityID(int value) {
58 | handle.getIntegers().write(0, value);
59 | }
60 |
61 | /**
62 | * Retrieve the entity of the painting that will be spawned.
63 | *
64 | * @param world - the current world of the entity.
65 | * @return The spawned entity.
66 | */
67 | public Entity getEntity(World world) {
68 | return handle.getEntityModifier(world).read(0);
69 | }
70 |
71 | /**
72 | * Retrieve the entity of the painting that will be spawned.
73 | *
74 | * @param event - the packet event.
75 | * @return The spawned entity.
76 | */
77 | public Entity getEntity(PacketEvent event) {
78 | return getEntity(event.getPlayer().getWorld());
79 | }
80 |
81 | /**
82 | * Retrieve Location.
83 | *
84 | * Notes: block location of the head part of the bed
85 | *
86 | * @return The current Location
87 | */
88 | public BlockPosition getLocation() {
89 | return handle.getBlockPositionModifier().read(0);
90 | }
91 |
92 | /**
93 | * Set Location.
94 | *
95 | * @param value - new value.
96 | */
97 | public void setLocation(BlockPosition value) {
98 | handle.getBlockPositionModifier().write(0, value);
99 | }
100 |
101 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerBlockBreakAnimation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 | import com.comphenix.protocol.wrappers.BlockPosition;
28 |
29 | public class WrapperPlayServerBlockBreakAnimation extends AbstractPacket {
30 | public static final PacketType TYPE =
31 | PacketType.Play.Server.BLOCK_BREAK_ANIMATION;
32 |
33 | public WrapperPlayServerBlockBreakAnimation() {
34 | super(new PacketContainer(TYPE), TYPE);
35 | handle.getModifier().writeDefaults();
36 | }
37 |
38 | public WrapperPlayServerBlockBreakAnimation(PacketContainer packet) {
39 | super(packet, TYPE);
40 | }
41 |
42 | /**
43 | * Retrieve Entity ID.
44 | *
45 | * Notes: entity's ID
46 | *
47 | * @return The current Entity ID
48 | */
49 | public int getEntityID() {
50 | return handle.getIntegers().read(0);
51 | }
52 |
53 | /**
54 | * Set Entity ID.
55 | *
56 | * @param value - new value.
57 | */
58 | public void setEntityID(int value) {
59 | handle.getIntegers().write(0, value);
60 | }
61 |
62 | /**
63 | * Retrieve the entity of the painting that will be spawned.
64 | *
65 | * @param world - the current world of the entity.
66 | * @return The spawned entity.
67 | */
68 | public Entity getEntity(World world) {
69 | return handle.getEntityModifier(world).read(0);
70 | }
71 |
72 | /**
73 | * Retrieve the entity of the painting that will be spawned.
74 | *
75 | * @param event - the packet event.
76 | * @return The spawned entity.
77 | */
78 | public Entity getEntity(PacketEvent event) {
79 | return getEntity(event.getPlayer().getWorld());
80 | }
81 |
82 | /**
83 | * Retrieve Location.
84 | *
105 | * Notes: 0 - 9
106 | *
107 | * @return The current Destroy Stage
108 | */
109 | public int getDestroyStage() {
110 | return handle.getIntegers().read(1);
111 | }
112 |
113 | /**
114 | * Set Destroy Stage.
115 | *
116 | * @param value - new value.
117 | */
118 | public void setDestroyStage(int value) {
119 | handle.getIntegers().write(1, value);
120 | }
121 |
122 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCamera.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayServerCamera extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Server.CAMERA;
26 |
27 | public WrapperPlayServerCamera() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayServerCamera(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Camera ID.
38 | *
39 | * @return The current Camera ID
40 | */
41 | public int getCameraId() {
42 | return handle.getIntegers().read(0);
43 | }
44 |
45 | /**
46 | * Set Camera ID.
47 | *
48 | * @param value - new value.
49 | */
50 | public void setCameraId(int value) {
51 | handle.getIntegers().write(0, value);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerEntityDestroy.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import me.jumper251.replay.utils.VersionUtil;
24 |
25 | import java.util.ArrayList;
26 | import java.util.List;
27 |
28 | public class WrapperPlayServerEntityDestroy extends AbstractPacket {
29 | public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY;
30 |
31 | public WrapperPlayServerEntityDestroy() {
32 | super(new PacketContainer(TYPE), TYPE);
33 | handle.getModifier().writeDefaults();
34 | }
35 |
36 | public WrapperPlayServerEntityDestroy(PacketContainer packet) {
37 | super(packet, TYPE);
38 | }
39 |
40 | /**
41 | * Retrieve Count.
42 | *
43 | * Notes: length of following array
44 | * @return The current Count
45 | */
46 | public int getCount() {
47 | return getEntityIDs().length;
48 | }
49 |
50 | /**
51 | * Retrieve Entity IDs.
52 | *
53 | * Notes: the list of entities of destroy
54 | * @return The current Entity IDs
55 | */
56 | public int[] getEntityIDs() {
57 | if (VersionUtil.isAbove(VersionUtil.VersionEnum.V1_17)) {
58 | return handle.getIntLists().read(0).stream().mapToInt(Integer::intValue).toArray();
59 | } else {
60 | return handle.getIntegerArrays().read(0);
61 | }
62 | }
63 |
64 | /**
65 | * Set Entity IDs.
66 | * @param value - new value.
67 | */
68 | public void setEntityIds(int[] value) {
69 | if (VersionUtil.isAbove(VersionUtil.VersionEnum.V1_17)) {
70 | List ints = new ArrayList<>(value.length);
71 | for (int i : value) ints.add(i);
72 | handle.getIntLists().write(0, ints);
73 | } else {
74 | handle.getIntegerArrays().write(0, value);
75 | }
76 | }
77 |
78 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerEntityEquipment.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 | import org.bukkit.inventory.ItemStack;
24 |
25 | import com.comphenix.protocol.PacketType;
26 | import com.comphenix.protocol.events.PacketContainer;
27 | import com.comphenix.protocol.events.PacketEvent;
28 | import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
29 |
30 | public class WrapperPlayServerEntityEquipment extends AbstractPacket {
31 | public static final PacketType TYPE =
32 | PacketType.Play.Server.ENTITY_EQUIPMENT;
33 |
34 | public WrapperPlayServerEntityEquipment() {
35 | super(new PacketContainer(TYPE), TYPE);
36 | handle.getModifier().writeDefaults();
37 | }
38 |
39 | public WrapperPlayServerEntityEquipment(PacketContainer packet) {
40 | super(packet, TYPE);
41 | }
42 |
43 | /**
44 | * Retrieve Entity ID.
45 | *
46 | * Notes: entity's ID
47 | *
48 | * @return The current Entity ID
49 | */
50 | public int getEntityID() {
51 | return handle.getIntegers().read(0);
52 | }
53 |
54 | /**
55 | * Set Entity ID.
56 | *
57 | * @param value - new value.
58 | */
59 | public void setEntityID(int value) {
60 | handle.getIntegers().write(0, value);
61 | }
62 |
63 | /**
64 | * Retrieve the entity of the painting that will be spawned.
65 | *
66 | * @param world - the current world of the entity.
67 | * @return The spawned entity.
68 | */
69 | public Entity getEntity(World world) {
70 | return handle.getEntityModifier(world).read(0);
71 | }
72 |
73 | /**
74 | * Retrieve the entity of the painting that will be spawned.
75 | *
76 | * @param event - the packet event.
77 | * @return The spawned entity.
78 | */
79 | public Entity getEntity(PacketEvent event) {
80 | return getEntity(event.getPlayer().getWorld());
81 | }
82 |
83 | public ItemSlot getSlot() {
84 | return handle.getItemSlots().read(0);
85 | }
86 |
87 | public void setSlot(ItemSlot value) {
88 | handle.getItemSlots().write(0, value);
89 | }
90 |
91 | /**
92 | * Retrieve Item.
93 | *
94 | * Notes: item in slot format
95 | *
96 | * @return The current Item
97 | */
98 | public ItemStack getItem() {
99 | return handle.getItemModifier().read(0);
100 | }
101 |
102 | /**
103 | * Set Item.
104 | *
105 | * @param value - new value.
106 | */
107 | public void setItem(ItemStack value) {
108 | handle.getItemModifier().write(0, value);
109 | }
110 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerEntityHeadRotation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 |
28 | public class WrapperPlayServerEntityHeadRotation extends AbstractPacket {
29 | public static final PacketType TYPE =
30 | PacketType.Play.Server.ENTITY_HEAD_ROTATION;
31 |
32 | public WrapperPlayServerEntityHeadRotation() {
33 | super(new PacketContainer(TYPE), TYPE);
34 | handle.getModifier().writeDefaults();
35 | }
36 |
37 | public WrapperPlayServerEntityHeadRotation(PacketContainer packet) {
38 | super(packet, TYPE);
39 | }
40 |
41 | /**
42 | * Retrieve Entity ID.
43 | *
44 | * Notes: entity's ID
45 | *
46 | * @return The current Entity ID
47 | */
48 | public int getEntityID() {
49 | return handle.getIntegers().read(0);
50 | }
51 |
52 | /**
53 | * Set Entity ID.
54 | *
55 | * @param value - new value.
56 | */
57 | public void setEntityID(int value) {
58 | handle.getIntegers().write(0, value);
59 | }
60 |
61 | /**
62 | * Retrieve the entity of the painting that will be spawned.
63 | *
64 | * @param world - the current world of the entity.
65 | * @return The spawned entity.
66 | */
67 | public Entity getEntity(World world) {
68 | return handle.getEntityModifier(world).read(0);
69 | }
70 |
71 | /**
72 | * Retrieve the entity of the painting that will be spawned.
73 | *
74 | * @param event - the packet event.
75 | * @return The spawned entity.
76 | */
77 | public Entity getEntity(PacketEvent event) {
78 | return getEntity(event.getPlayer().getWorld());
79 | }
80 |
81 | /**
82 | * Retrieve Head Yaw.
83 | *
84 | * Notes: head yaw in steps of 2p/256
85 | *
86 | * @return The current Head Yaw
87 | */
88 | public byte getHeadYaw() {
89 | return handle.getBytes().read(0);
90 | }
91 |
92 | /**
93 | * Set Head Yaw.
94 | *
95 | * @param value - new value.
96 | */
97 | public void setHeadYaw(byte value) {
98 | handle.getBytes().write(0, value);
99 | }
100 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import com.comphenix.protocol.events.PacketEvent;
24 | import com.comphenix.protocol.wrappers.WrappedWatchableObject;
25 | import org.bukkit.World;
26 | import org.bukkit.entity.Entity;
27 |
28 | import java.util.List;
29 |
30 | public class WrapperPlayServerEntityMetadata extends AbstractPacket {
31 | public static final PacketType TYPE = PacketType.Play.Server.ENTITY_METADATA;
32 |
33 | public WrapperPlayServerEntityMetadata() {
34 | super(new PacketContainer(TYPE), TYPE);
35 | handle.getModifier().writeDefaults();
36 | }
37 |
38 | public WrapperPlayServerEntityMetadata(PacketContainer packet) {
39 | super(packet, TYPE);
40 | }
41 |
42 | /**
43 | * Retrieve Entity ID.
44 | *
45 | * Notes: entity's ID
46 | * @return The current Entity ID
47 | */
48 | public int getEntityID() {
49 | return handle.getIntegers().read(0);
50 | }
51 |
52 | /**
53 | * Set Entity ID.
54 | * @param value - new value.
55 | */
56 | public void setEntityID(int value) {
57 | handle.getIntegers().write(0, value);
58 | }
59 |
60 | /**
61 | * Retrieve the entity of the painting that will be spawned.
62 | * @param world - the current world of the entity.
63 | * @return The spawned entity.
64 | */
65 | public Entity getEntity(World world) {
66 | return handle.getEntityModifier(world).read(0);
67 | }
68 |
69 | /**
70 | * Retrieve the entity of the painting that will be spawned.
71 | * @param event - the packet event.
72 | * @return The spawned entity.
73 | */
74 | public Entity getEntity(PacketEvent event) {
75 | return getEntity(event.getPlayer().getWorld());
76 | }
77 |
78 | /**
79 | * Retrieve Metadata.
80 | * @return The current Metadata
81 | */
82 | public List getMetadata() {
83 | return handle.getWatchableCollectionModifier().read(0);
84 | }
85 |
86 | /**
87 | * Set Metadata.
88 | * @param value - new value.
89 | */
90 | public void setMetadata(List value) {
91 | handle.getWatchableCollectionModifier().write(0, value);
92 | }
93 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerEntityStatus.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 |
28 | public class WrapperPlayServerEntityStatus extends AbstractPacket {
29 | public static final PacketType TYPE = PacketType.Play.Server.ENTITY_STATUS;
30 |
31 | public WrapperPlayServerEntityStatus() {
32 | super(new PacketContainer(TYPE), TYPE);
33 | handle.getModifier().writeDefaults();
34 | }
35 |
36 | public WrapperPlayServerEntityStatus(PacketContainer packet) {
37 | super(packet, TYPE);
38 | }
39 |
40 | /**
41 | * Retrieve Entity ID.
42 | *
43 | * Notes: entity's ID
44 | *
45 | * @return The current Entity ID
46 | */
47 | public int getEntityID() {
48 | return handle.getIntegers().read(0);
49 | }
50 |
51 | /**
52 | * Set Entity ID.
53 | *
54 | * @param value - new value.
55 | */
56 | public void setEntityID(int value) {
57 | handle.getIntegers().write(0, value);
58 | }
59 |
60 | /**
61 | * Retrieve the entity of the painting that will be spawned.
62 | *
63 | * @param world - the current world of the entity.
64 | * @return The spawned entity.
65 | */
66 | public Entity getEntity(World world) {
67 | return handle.getEntityModifier(world).read(0);
68 | }
69 |
70 | /**
71 | * Retrieve the entity of the painting that will be spawned.
72 | *
73 | * @param event - the packet event.
74 | * @return The spawned entity.
75 | */
76 | public Entity getEntity(PacketEvent event) {
77 | return getEntity(event.getPlayer().getWorld());
78 | }
79 |
80 | /**
81 | * Retrieve Entity Status.
82 | *
83 | * Notes: see below
84 | *
85 | * @return The current Entity Status
86 | */
87 | public byte getEntityStatus() {
88 | return handle.getBytes().read(0);
89 | }
90 |
91 | /**
92 | * Set Entity Status.
93 | *
94 | * @param value - new value.
95 | */
96 | public void setEntityStatus(byte value) {
97 | handle.getBytes().write(0, value);
98 | }
99 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerGameStateChange.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayServerGameStateChange extends AbstractPacket {
25 | public static final PacketType TYPE =
26 | PacketType.Play.Server.GAME_STATE_CHANGE;
27 |
28 | public WrapperPlayServerGameStateChange() {
29 | super(new PacketContainer(TYPE), TYPE);
30 | handle.getModifier().writeDefaults();
31 | }
32 |
33 | public WrapperPlayServerGameStateChange(PacketContainer packet) {
34 | super(packet, TYPE);
35 | }
36 |
37 | /**
38 | * Retrieve Reason.
39 | *
40 | * @return The current Reason
41 | */
42 | public int getReason() {
43 | return handle.getIntegers().read(0);
44 | }
45 |
46 | /**
47 | * Set Reason.
48 | *
49 | * @param value - new value.
50 | */
51 | public void setReason(int value) {
52 | handle.getIntegers().write(0, value);
53 | }
54 |
55 | /**
56 | * Retrieve Value.
57 | *
58 | * Notes: depends on reason
59 | *
60 | * @return The current Value
61 | */
62 | public float getValue() {
63 | return handle.getFloat().read(0);
64 | }
65 |
66 | /**
67 | * Set Value.
68 | *
69 | * @param value - new value.
70 | */
71 | public void setValue(float value) {
72 | handle.getFloat().write(0, value);
73 | }
74 |
75 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerKeepAlive.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayServerKeepAlive extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Server.KEEP_ALIVE;
26 |
27 | public WrapperPlayServerKeepAlive() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayServerKeepAlive(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Keep Alive ID.
38 | * @return The current Keep Alive ID
39 | */
40 | public int getKeepAliveId() {
41 | return handle.getIntegers().read(0);
42 | }
43 |
44 | /**
45 | * Set Keep Alive ID.
46 | * @param value - new value.
47 | */
48 | public void setKeepAliveId(int value) {
49 | handle.getIntegers().write(0, value);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerPlayerInfo.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import com.comphenix.protocol.wrappers.EnumWrappers;
24 | import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
25 | import com.comphenix.protocol.wrappers.PlayerInfoData;
26 | import com.google.common.collect.Sets;
27 | import me.jumper251.replay.utils.VersionUtil;
28 |
29 | import java.util.List;
30 | import java.util.Set;
31 |
32 | public class WrapperPlayServerPlayerInfo extends AbstractPacket {
33 | public static final PacketType TYPE = PacketType.Play.Server.PLAYER_INFO;
34 |
35 | public WrapperPlayServerPlayerInfo() {
36 | super(new PacketContainer(TYPE), TYPE);
37 | handle.getModifier().writeDefaults();
38 | }
39 |
40 | public WrapperPlayServerPlayerInfo(PacketContainer packet) {
41 | super(packet, TYPE);
42 | }
43 |
44 | public PlayerInfoAction getAction() {
45 | return handle.getPlayerInfoAction().read(0);
46 | }
47 |
48 | public void setAction(PlayerInfoAction value) {
49 | if (VersionUtil.isAbove(VersionUtil.VersionEnum.V1_19)) {
50 | Set types = Sets.newHashSet(value);
51 | handle.getPlayerInfoActions().write(0, types);
52 | } else {
53 | handle.getPlayerInfoAction().write(0, value);
54 | }
55 | }
56 |
57 | public List getData() {
58 | return handle.getPlayerInfoDataLists().read(0);
59 | }
60 |
61 | public void setData(List value) {
62 | if (VersionUtil.isAbove(VersionUtil.VersionEnum.V1_19)) {
63 | handle.getPlayerInfoDataLists().write(1, value);
64 | } else {
65 | handle.getPlayerInfoDataLists().write(0, value);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerRelEntityMove.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.protocol.PacketType;
25 | import com.comphenix.protocol.events.PacketContainer;
26 | import com.comphenix.protocol.events.PacketEvent;
27 |
28 | public class WrapperPlayServerRelEntityMove extends AbstractPacket {
29 | public static final PacketType TYPE =
30 | PacketType.Play.Server.REL_ENTITY_MOVE;
31 |
32 | public WrapperPlayServerRelEntityMove() {
33 | super(new PacketContainer(TYPE), TYPE);
34 | handle.getModifier().writeDefaults();
35 | }
36 |
37 | public WrapperPlayServerRelEntityMove(PacketContainer packet) {
38 | super(packet, TYPE);
39 | }
40 |
41 | /**
42 | * Retrieve Entity ID.
43 | *
44 | * Notes: entity's ID
45 | *
46 | * @return The current Entity ID
47 | */
48 | public int getEntityID() {
49 | return handle.getIntegers().read(0);
50 | }
51 |
52 | /**
53 | * Set Entity ID.
54 | *
55 | * @param value - new value.
56 | */
57 | public void setEntityID(int value) {
58 | handle.getIntegers().write(0, value);
59 | }
60 |
61 | /**
62 | * Retrieve the entity of the painting that will be spawned.
63 | *
64 | * @param world - the current world of the entity.
65 | * @return The spawned entity.
66 | */
67 | public Entity getEntity(World world) {
68 | return handle.getEntityModifier(world).read(0);
69 | }
70 |
71 | /**
72 | * Retrieve the entity of the painting that will be spawned.
73 | *
74 | * @param event - the packet event.
75 | * @return The spawned entity.
76 | */
77 | public Entity getEntity(PacketEvent event) {
78 | return getEntity(event.getPlayer().getWorld());
79 | }
80 |
81 | public int getDx() {
82 | return handle.getIntegers().read(1);
83 | }
84 |
85 | public void setDx(int value) {
86 | handle.getIntegers().write(1, value);
87 | }
88 |
89 | public int getDy() {
90 | return handle.getIntegers().read(2);
91 | }
92 |
93 | public void setDy(int value) {
94 | handle.getIntegers().write(2, value);
95 | }
96 |
97 | public int getDz() {
98 | return handle.getIntegers().read(3);
99 | }
100 |
101 | public void setDz(int value) {
102 | handle.getIntegers().write(3, value);
103 | }
104 |
105 | /**
106 | * Retrieve On Ground.
107 | *
108 | * @return The current On Ground
109 | */
110 | public boolean getOnGround() {
111 | return handle.getBooleans().read(0);
112 | }
113 |
114 | /**
115 | * Set On Ground.
116 | *
117 | * @param value - new value.
118 | */
119 | public void setOnGround(boolean value) {
120 | handle.getBooleans().write(0, value);
121 | }
122 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerTitle.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 | import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
24 | import com.comphenix.protocol.wrappers.WrappedChatComponent;
25 |
26 | public class WrapperPlayServerTitle extends AbstractPacket {
27 | public static final PacketType TYPE = PacketType.Play.Server.TITLE;
28 |
29 | public WrapperPlayServerTitle() {
30 | super(new PacketContainer(TYPE), TYPE);
31 | handle.getModifier().writeDefaults();
32 | }
33 |
34 | public WrapperPlayServerTitle(PacketContainer packet) {
35 | super(packet, TYPE);
36 | }
37 |
38 | /**
39 | * Retrieve Action.
40 | *
41 | * @return The current Action
42 | */
43 | public TitleAction getAction() {
44 | return handle.getTitleActions().read(0);
45 | }
46 |
47 | /**
48 | * Set Action.
49 | *
50 | * @param value - new value.
51 | */
52 | public void setAction(TitleAction value) {
53 | handle.getTitleActions().write(0, value);
54 | }
55 |
56 | /**
57 | * Retrieve 0 (TITLE).
58 | *
79 | * Notes: int
80 | *
81 | * @return The current 2 (TIMES)
82 | */
83 | public int getFadeIn() {
84 | return handle.getIntegers().read(0);
85 | }
86 |
87 | /**
88 | * Set 2 (TIMES).
89 | *
90 | * @param value - new value.
91 | */
92 | public void setFadeIn(int value) {
93 | handle.getIntegers().write(0, value);
94 | }
95 |
96 | /**
97 | * Retrieve Stay.
98 | *
99 | * @return The current Stay
100 | */
101 | public int getStay() {
102 | return handle.getIntegers().read(1);
103 | }
104 |
105 | /**
106 | * Set Stay.
107 | *
108 | * @param value - new value.
109 | */
110 | public void setStay(int value) {
111 | handle.getIntegers().write(1, value);
112 | }
113 |
114 | /**
115 | * Retrieve Fade Out.
116 | *
117 | * @return The current Fade Out
118 | */
119 | public int getFadeOut() {
120 | return handle.getIntegers().read(2);
121 | }
122 |
123 | /**
124 | * Set Fade Out.
125 | *
126 | * @param value - new value.
127 | */
128 | public void setFadeOut(int value) {
129 | handle.getIntegers().write(2, value);
130 | }
131 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerUpdateHealth.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperPlayServerUpdateHealth extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Play.Server.UPDATE_HEALTH;
26 |
27 | public WrapperPlayServerUpdateHealth() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperPlayServerUpdateHealth(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Health.
38 | *
39 | * Notes: 0 or less = dead, 20 = full HP
40 | * @return The current Health
41 | */
42 | public float getHealth() {
43 | return handle.getFloat().read(0);
44 | }
45 |
46 | /**
47 | * Set Health.
48 | * @param value - new value.
49 | */
50 | public void setHealth(float value) {
51 | handle.getFloat().write(0, value);
52 | }
53 |
54 | /**
55 | * Retrieve Food.
56 | *
57 | * Notes: 0 - 20
58 | * @return The current Food
59 | */
60 | public int getFood() {
61 | return handle.getIntegers().read(0);
62 | }
63 |
64 | /**
65 | * Set Food.
66 | * @param value - new value.
67 | */
68 | public void setFood(int value) {
69 | handle.getIntegers().write(0, value);
70 | }
71 |
72 | /**
73 | * Retrieve Food Saturation.
74 | *
75 | * Notes: seems to vary from 0.0 to 5.0 in integer increments
76 | * @return The current Food Saturation
77 | */
78 | public float getFoodSaturation() {
79 | return handle.getFloat().read(1);
80 | }
81 |
82 | /**
83 | * Set Food Saturation.
84 | * @param value - new value.
85 | */
86 | public void setFoodSaturation(float value) {
87 | handle.getFloat().write(1, value);
88 | }
89 |
90 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/WrapperStatusClientPing.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper;
20 |
21 | import com.comphenix.protocol.PacketType;
22 | import com.comphenix.protocol.events.PacketContainer;
23 |
24 | public class WrapperStatusClientPing extends AbstractPacket {
25 | public static final PacketType TYPE = PacketType.Status.Client.PING;
26 |
27 | public WrapperStatusClientPing() {
28 | super(new PacketContainer(TYPE), TYPE);
29 | handle.getModifier().writeDefaults();
30 | }
31 |
32 | public WrapperStatusClientPing(PacketContainer packet) {
33 | super(packet, TYPE);
34 | }
35 |
36 | /**
37 | * Retrieve Time.
38 | * @return The current Time
39 | */
40 | public long getTime() {
41 | return handle.getLongs().read(0);
42 | }
43 |
44 | /**
45 | * Set Time.
46 | * @param value - new value.
47 | */
48 | public void setTime(long value) {
49 | handle.getLongs().write(0, value);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/old/WrapperPlayServerEntityHeadRotation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of PacketWrapper.
3 | * Copyright (C) 2012-2015 Kristian S. Strangeland
4 | * Copyright (C) 2015 dmulloy2
5 | *
6 | * PacketWrapper is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * PacketWrapper is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with PacketWrapper. If not, see .
18 | */
19 | package com.comphenix.packetwrapper.old;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.packetwrapper.AbstractPacket;
25 | import com.comphenix.protocol.PacketType;
26 | import com.comphenix.protocol.events.PacketContainer;
27 | import com.comphenix.protocol.events.PacketEvent;
28 |
29 | public class WrapperPlayServerEntityHeadRotation extends AbstractPacket {
30 | public static final PacketType TYPE = PacketType.Play.Server.ENTITY_HEAD_ROTATION;
31 |
32 | public WrapperPlayServerEntityHeadRotation() {
33 | super(new PacketContainer(TYPE), TYPE);
34 | handle.getModifier().writeDefaults();
35 | }
36 |
37 | public WrapperPlayServerEntityHeadRotation(PacketContainer packet) {
38 | super(packet, TYPE);
39 | }
40 |
41 | /**
42 | * Retrieve Entity ID.
43 | *
44 | * Notes: entity's ID
45 | * @return The current Entity ID
46 | */
47 | public int getEntityID() {
48 | return handle.getIntegers().read(0);
49 | }
50 |
51 | /**
52 | * Set Entity ID.
53 | * @param value - new value.
54 | */
55 | public void setEntityID(int value) {
56 | handle.getIntegers().write(0, value);
57 | }
58 |
59 | /**
60 | * Retrieve the entity of the painting that will be spawned.
61 | * @param world - the current world of the entity.
62 | * @return The spawned entity.
63 | */
64 | public Entity getEntity(World world) {
65 | return handle.getEntityModifier(world).read(0);
66 | }
67 |
68 | /**
69 | * Retrieve the entity of the painting that will be spawned.
70 | * @param event - the packet event.
71 | * @return The spawned entity.
72 | */
73 | public Entity getEntity(PacketEvent event) {
74 | return getEntity(event.getPlayer().getWorld());
75 | }
76 |
77 | /**
78 | * Retrieve Head Yaw.
79 | *
80 | * Notes: head yaw in steps of 2p/256
81 | * @return The current Head Yaw
82 | */
83 | public byte getHeadYaw() {
84 | return handle.getBytes().read(0);
85 | }
86 |
87 | /**
88 | * Set Head Yaw.
89 | * @param value - new value.
90 | */
91 | public void setHeadYaw(byte value) {
92 | handle.getBytes().write(0, value);
93 | }
94 | }
--------------------------------------------------------------------------------
/src/main/java/com/comphenix/packetwrapper/v15/WrapperPlayServerRelEntityMove.java:
--------------------------------------------------------------------------------
1 | /**
2 | * PacketWrapper - ProtocolLib wrappers for Minecraft packets
3 | * Copyright (C) dmulloy2
4 | * Copyright (C) Kristian S. Strangeland
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.comphenix.packetwrapper.v15;
20 |
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 |
24 | import com.comphenix.packetwrapper.AbstractPacket;
25 | import com.comphenix.protocol.PacketType;
26 | import com.comphenix.protocol.events.PacketContainer;
27 | import com.comphenix.protocol.events.PacketEvent;
28 |
29 | public class WrapperPlayServerRelEntityMove extends AbstractPacket {
30 | public static final PacketType TYPE =
31 | PacketType.Play.Server.REL_ENTITY_MOVE;
32 |
33 | public WrapperPlayServerRelEntityMove() {
34 | super(new PacketContainer(TYPE), TYPE);
35 | handle.getModifier().writeDefaults();
36 | }
37 |
38 | public WrapperPlayServerRelEntityMove(PacketContainer packet) {
39 | super(packet, TYPE);
40 | }
41 |
42 | /**
43 | * Retrieve Entity ID.
44 | *