From a20fb32ef529f44e8e094c9df2e3393ff9a74c69 Mon Sep 17 00:00:00 2001 From: MrGazdag <44264503+MrGazdag@users.noreply.github.com> Date: Tue, 27 Jul 2021 12:11:30 +0200 Subject: [PATCH] fix documentation and add hasFlag --- .../server/play/PlayerAbilitiesPacket.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/net/minestom/server/network/packet/server/play/PlayerAbilitiesPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/PlayerAbilitiesPacket.java index 92e527643..8e90f300f 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/PlayerAbilitiesPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/PlayerAbilitiesPacket.java @@ -29,6 +29,8 @@ public class PlayerAbilitiesPacket implements ServerPacket { /** * Adds a flag to the 'flags' byte. * + * @param flag the flag + * * @see PlayerAbilitiesPacket#FLAG_INVULNERABLE * @see PlayerAbilitiesPacket#FLAG_FLYING * @see PlayerAbilitiesPacket#FLAG_ALLOW_FLYING @@ -41,6 +43,8 @@ public class PlayerAbilitiesPacket implements ServerPacket { /** * Removes a flag from the 'flags' byte. * + * @param flag the flag + * * @see PlayerAbilitiesPacket#FLAG_INVULNERABLE * @see PlayerAbilitiesPacket#FLAG_FLYING * @see PlayerAbilitiesPacket#FLAG_ALLOW_FLYING @@ -49,6 +53,19 @@ public class PlayerAbilitiesPacket implements ServerPacket { public void removeFlag(byte flag) { flags &= ~(flag); } + + /** + * @param flag the flag + * @returns true if the 'flags' byte contains the specified flag + * + * @see PlayerAbilitiesPacket#FLAG_INVULNERABLE + * @see PlayerAbilitiesPacket#FLAG_FLYING + * @see PlayerAbilitiesPacket#FLAG_ALLOW_FLYING + * @see PlayerAbilitiesPacket#FLAG_INSTANT_BREAK + */ + public boolean hasFlag(byte flag) { + return (flags & flag) > 0; + } @Override public void write(@NotNull BinaryWriter writer) {