Skip to content

Commit f8a92c7

Browse files
committed
Reformat all WrapperPlayClient* packets
1 parent da93b1a commit f8a92c7

22 files changed

+520
-488
lines changed

PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientAdvancements.java

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -24,54 +24,59 @@
2424

2525
public class WrapperPlayClientAdvancements extends AbstractPacket {
2626

27-
public static final PacketType TYPE = PacketType.Play.Client.ADVANCEMENTS;
28-
29-
public WrapperPlayClientAdvancements() {
30-
super(new PacketContainer(TYPE), TYPE);
31-
handle.getModifier().writeDefaults();
32-
}
33-
34-
public WrapperPlayClientAdvancements(PacketContainer packet) {
35-
super(packet, TYPE);
36-
}
37-
38-
/**
39-
* Retrieve Action.
40-
* <p>
41-
* Notes: 0: Opened tab, 1: Closed screen
42-
* @return The current Action
43-
*/
44-
public Status getAction() {
45-
return handle.getEnumModifier(Status.class, 0).readSafely(0);
46-
}
47-
48-
/**
49-
* Set Action.
50-
* @param value - new value.
51-
*/
52-
public void setAction(Status value) {
53-
handle.getEnumModifier(Status.class, 0).writeSafely(0, value);
54-
}
55-
/**
56-
* Retrieve Tab ID.
57-
* <p>
58-
* Notes: only present if action is Opened tab
59-
* @return The current Tab ID
60-
*/
61-
public MinecraftKey getTabId() {
62-
return handle.getMinecraftKeys().readSafely(0);
63-
}
64-
65-
/**
66-
* Set Tab ID.
67-
* @param value - new value.
68-
*/
69-
public void setTabId(MinecraftKey value) {
70-
handle.getMinecraftKeys().writeSafely(0, value);
71-
}
27+
public static final PacketType TYPE = PacketType.Play.Client.ADVANCEMENTS;
7228

73-
public enum Status {
74-
OPENED_TAB,
75-
CLOSED_SCREEN;
76-
}
29+
public WrapperPlayClientAdvancements() {
30+
super(new PacketContainer(TYPE), TYPE);
31+
handle.getModifier().writeDefaults();
32+
}
33+
34+
public WrapperPlayClientAdvancements(PacketContainer packet) {
35+
super(packet, TYPE);
36+
}
37+
38+
/**
39+
* Retrieve Action.
40+
* <p>
41+
* Notes: 0: Opened tab, 1: Closed screen
42+
*
43+
* @return The current Action
44+
*/
45+
public Status getAction() {
46+
return handle.getEnumModifier(Status.class, 0).readSafely(0);
47+
}
48+
49+
/**
50+
* Set Action.
51+
*
52+
* @param value - new value.
53+
*/
54+
public void setAction(Status value) {
55+
handle.getEnumModifier(Status.class, 0).writeSafely(0, value);
56+
}
57+
58+
/**
59+
* Retrieve Tab ID.
60+
* <p>
61+
* Notes: only present if action is Opened tab
62+
*
63+
* @return The current Tab ID
64+
*/
65+
public MinecraftKey getTabId() {
66+
return handle.getMinecraftKeys().readSafely(0);
67+
}
68+
69+
/**
70+
* Set Tab ID.
71+
*
72+
* @param value - new value.
73+
*/
74+
public void setTabId(MinecraftKey value) {
75+
handle.getMinecraftKeys().writeSafely(0, value);
76+
}
77+
78+
public enum Status {
79+
OPENED_TAB,
80+
CLOSED_SCREEN;
81+
}
7782
}

PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientAutoRecipe.java

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,44 @@
2525
@BackwardsCompatible(sinceMinor = 12)
2626
public class WrapperPlayClientAutoRecipe extends AbstractPacket {
2727

28-
public static final PacketType TYPE = PacketType.Play.Client.AUTO_RECIPE;
29-
30-
public WrapperPlayClientAutoRecipe() {
31-
super(new PacketContainer(TYPE), TYPE);
32-
handle.getModifier().writeDefaults();
33-
}
34-
35-
public WrapperPlayClientAutoRecipe(PacketContainer packet) {
36-
super(packet, TYPE);
37-
}
38-
39-
/**
40-
* Retrieve Window ID.
41-
* <p>
42-
* Notes: the window id.
43-
* @return The current Window ID
44-
*/
45-
public int getWindowId() {
46-
return handle.getIntegers().read(0);
47-
}
48-
49-
/**
50-
* Set Window ID.
51-
* @param value - new value.
52-
*/
53-
public void setWindowId(int value) {
54-
handle.getIntegers().write(0, value);
55-
}
28+
public static final PacketType TYPE = PacketType.Play.Client.AUTO_RECIPE;
5629

57-
// Modifier for recipe can be created upon request
30+
public WrapperPlayClientAutoRecipe() {
31+
super(new PacketContainer(TYPE), TYPE);
32+
handle.getModifier().writeDefaults();
33+
}
5834

59-
public boolean isMakeAll() {
60-
return handle.getBooleans().read(0);
61-
}
35+
public WrapperPlayClientAutoRecipe(PacketContainer packet) {
36+
super(packet, TYPE);
37+
}
6238

63-
public void setMakeAll(boolean value) {
64-
handle.getBooleans().write(0, value);
65-
}
39+
/**
40+
* Retrieve Window ID.
41+
* <p>
42+
* Notes: the window id.
43+
*
44+
* @return The current Window ID
45+
*/
46+
public int getWindowId() {
47+
return handle.getIntegers().read(0);
48+
}
49+
50+
/**
51+
* Set Window ID.
52+
*
53+
* @param value - new value.
54+
*/
55+
public void setWindowId(int value) {
56+
handle.getIntegers().write(0, value);
57+
}
58+
59+
// Modifier for recipe can be created upon request
60+
61+
public boolean isMakeAll() {
62+
return handle.getBooleans().read(0);
63+
}
64+
65+
public void setMakeAll(boolean value) {
66+
handle.getBooleans().write(0, value);
67+
}
6668
}

PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientBeacon.java

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,25 @@ public WrapperPlayClientBeacon(PacketContainer packet) {
4141
* Retrieve Primary Effect.
4242
* <p>
4343
* Notes: a Potion ID. (Was a full Integer for the plugin message)
44+
*
4445
* @return The current Primary Effect
4546
*/
4647
public int getPrimaryEffectId() {
4748
return handle.getIntegers().read(0);
4849
}
4950

51+
/**
52+
* Set Primary Effect.
53+
*
54+
* @param value - new value.
55+
*/
56+
public void setPrimaryEffectId(int value) {
57+
handle.getIntegers().write(0, value);
58+
}
59+
5060
/**
5161
* Retrieve Primary Effect.
62+
*
5263
* @return The current Primary Effect
5364
*/
5465
@SuppressWarnings("deprecation")
@@ -58,14 +69,7 @@ public PotionEffectType getPrimaryEffect() {
5869

5970
/**
6071
* Set Primary Effect.
61-
* @param value - new value.
62-
*/
63-
public void setPrimaryEffectId(int value) {
64-
handle.getIntegers().write(0, value);
65-
}
66-
67-
/**
68-
* Set Primary Effect.
72+
*
6973
* @param value - new value.
7074
*/
7175
public void setPrimaryEffect(PotionEffectType value) {
@@ -76,14 +80,25 @@ public void setPrimaryEffect(PotionEffectType value) {
7680
* Retrieve Secondary Effect.
7781
* <p>
7882
* Notes: a Potion ID. (Was a full Integer for the plugin message)
83+
*
7984
* @return The current Secondary Effect
8085
*/
8186
public int getSecondaryEffectId() {
8287
return handle.getIntegers().read(1);
8388
}
8489

90+
/**
91+
* Set Secondary Effect.
92+
*
93+
* @param value - new value.
94+
*/
95+
public void setSecondaryEffectId(int value) {
96+
handle.getIntegers().write(1, value);
97+
}
98+
8599
/**
86100
* Retrieve Secondary Effect.
101+
*
87102
* @return The current Secondary Effect
88103
*/
89104
@SuppressWarnings("deprecation")
@@ -93,14 +108,7 @@ public PotionEffectType getSecondaryEffect() {
93108

94109
/**
95110
* Set Secondary Effect.
96-
* @param value - new value.
97-
*/
98-
public void setSecondaryEffectId(int value) {
99-
handle.getIntegers().write(1, value);
100-
}
101-
102-
/**
103-
* Set Secondary Effect.
111+
*
104112
* @param value - new value.
105113
*/
106114
@SuppressWarnings("deprecation")

PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayClientBookEdit.java

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,69 @@
2121
import com.comphenix.packetwrapper.util.BackwardsCompatible;
2222
import com.comphenix.protocol.PacketType;
2323
import com.comphenix.protocol.events.PacketContainer;
24-
2524
import com.comphenix.protocol.wrappers.EnumWrappers;
2625
import org.bukkit.inventory.ItemStack;
2726

2827
@BackwardsCompatible(sinceMinor = 13)
2928
public class WrapperPlayClientBookEdit extends AbstractPacket {
3029

31-
public static final PacketType TYPE = PacketType.Play.Client.B_EDIT;
32-
33-
public WrapperPlayClientBookEdit() {
34-
super(new PacketContainer(TYPE), TYPE);
35-
handle.getModifier().writeDefaults();
36-
}
37-
38-
public WrapperPlayClientBookEdit(PacketContainer packet) {
39-
super(packet, TYPE);
40-
}
41-
42-
/**
43-
* Retrieve New book.
44-
* @return The current New book
45-
*/
46-
public ItemStack getNewBook() {
47-
return handle.getItemModifier().read(0);
48-
}
49-
50-
/**
51-
* Set New book.
52-
* @param value - new value.
53-
*/
54-
public void setNewBook(ItemStack value) {
55-
handle.getItemModifier().write(0, value);
56-
}
57-
58-
/**
59-
* Retrieve Is signing.
60-
* <p>
61-
* Notes: true if the player is signing the book; false if the player is saving a draft.
62-
* @return The current Is signing
63-
*/
64-
public boolean getIsSigning() {
65-
return handle.getBooleans().read(0);
66-
}
67-
68-
/**
69-
* Set Is signing.
70-
* @param value - new value.
71-
*/
72-
public void setIsSigning(boolean value) {
73-
handle.getBooleans().write(0, value);
74-
}
30+
public static final PacketType TYPE = PacketType.Play.Client.B_EDIT;
31+
32+
public WrapperPlayClientBookEdit() {
33+
super(new PacketContainer(TYPE), TYPE);
34+
handle.getModifier().writeDefaults();
35+
}
36+
37+
public WrapperPlayClientBookEdit(PacketContainer packet) {
38+
super(packet, TYPE);
39+
}
40+
41+
/**
42+
* Retrieve New book.
43+
*
44+
* @return The current New book
45+
*/
46+
public ItemStack getNewBook() {
47+
return handle.getItemModifier().read(0);
48+
}
49+
50+
/**
51+
* Set New book.
52+
*
53+
* @param value - new value.
54+
*/
55+
public void setNewBook(ItemStack value) {
56+
handle.getItemModifier().write(0, value);
57+
}
58+
59+
/**
60+
* Retrieve Is signing.
61+
* <p>
62+
* Notes: true if the player is signing the book; false if the player is saving a draft.
63+
*
64+
* @return The current Is signing
65+
*/
66+
public boolean getIsSigning() {
67+
return handle.getBooleans().read(0);
68+
}
69+
70+
/**
71+
* Set Is signing.
72+
*
73+
* @param value - new value.
74+
*/
75+
public void setIsSigning(boolean value) {
76+
handle.getBooleans().write(0, value);
77+
}
7578

76-
public EnumWrappers.Hand getHand() {
77-
return MINOR_VERSION >= 16
78-
? handle.getIntegers().read(0) == 0 ? EnumWrappers.Hand.MAIN_HAND : EnumWrappers.Hand.OFF_HAND
79-
: handle.getHands().read(0);
80-
}
79+
public EnumWrappers.Hand getHand() {
80+
return MINOR_VERSION >= 16
81+
? handle.getIntegers().read(0) == 0 ? EnumWrappers.Hand.MAIN_HAND : EnumWrappers.Hand.OFF_HAND
82+
: handle.getHands().read(0);
83+
}
8184

82-
public void setHand(EnumWrappers.Hand value) {
83-
if (MINOR_VERSION >= 16) handle.getIntegers().write(0, value == EnumWrappers.Hand.MAIN_HAND ? 0 : 1);
84-
else handle.getHands().write(0, value);
85-
}
85+
public void setHand(EnumWrappers.Hand value) {
86+
if (MINOR_VERSION >= 16) handle.getIntegers().write(0, value == EnumWrappers.Hand.MAIN_HAND ? 0 : 1);
87+
else handle.getHands().write(0, value);
88+
}
8689
}

0 commit comments

Comments
 (0)