fix documentation and add hasFlag

This commit is contained in:
MrGazdag 2021-07-27 12:11:30 +02:00 committed by GitHub
parent 5b1e06de04
commit a20fb32ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {