diff --git a/Obsidian.API/_Interfaces/IPlayer.cs b/Obsidian.API/_Interfaces/IPlayer.cs index 33eb6ec0..f7a4e90e 100644 --- a/Obsidian.API/_Interfaces/IPlayer.cs +++ b/Obsidian.API/_Interfaces/IPlayer.cs @@ -1,4 +1,5 @@ -using System.Net; +using Obsidian.API._Types; +using System.Net; namespace Obsidian.API; @@ -21,6 +22,8 @@ public interface IPlayer : ILiving public IPAddress? ClientIP { get; } public Gamemode Gamemode { get; set; } + public PlayerAbility Abilities { get; } + public bool Sleeping { get; set; } public bool InHorseInventory { get; set; } diff --git a/Obsidian.API/_Types/PlayerAbility.cs b/Obsidian.API/_Types/PlayerAbility.cs new file mode 100644 index 00000000..e2d9d23c --- /dev/null +++ b/Obsidian.API/_Types/PlayerAbility.cs @@ -0,0 +1,11 @@ +namespace Obsidian.API._Types; + +[Flags] +public enum PlayerAbility +{ + None = 0x00, + Invulnerable = 0x01, + Flying = 0x02, + AllowFlying = 0x04, + CreativeMode = 0x08 +} diff --git a/Obsidian/Entities/Player.cs b/Obsidian/Entities/Player.cs index b1450d95..d125a311 100644 --- a/Obsidian/Entities/Player.cs +++ b/Obsidian/Entities/Player.cs @@ -1,6 +1,7 @@ // This would be saved in a file called [playeruuid].dat which holds a bunch of NBT data. // https://wiki.vg/Map_Format using Microsoft.Extensions.Logging; +using Obsidian.API._Types; using Obsidian.API.Events; using Obsidian.API.Utilities; using Obsidian.Nbt; @@ -132,7 +133,7 @@ internal set public IPAddress? ClientIP => (client.RemoteEndPoint as IPEndPoint)?.Address; - private Gamemode gamemode = Gamemode.Creative; + private Gamemode gamemode; [SetsRequiredMembers] internal Player(Guid uuid, string username, Client client, World world) diff --git a/Obsidian/Net/Packets/Play/Clientbound/PlayerAbilitiesPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/PlayerAbilitiesPacket.cs index 11ac2d85..211f133e 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/PlayerAbilitiesPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/PlayerAbilitiesPacket.cs @@ -1,17 +1,8 @@ -using Obsidian.Entities; +using Obsidian.API._Types; +using Obsidian.Entities; namespace Obsidian.Net.Packets.Play.Clientbound; -[Flags] -public enum PlayerAbility -{ - None = 0x00, - Invulnerable = 0x01, - Flying = 0x02, - AllowFlying = 0x04, - CreativeMode = 0x08 -} - public class PlayerAbilitiesPacket : IClientboundPacket, IServerboundPacket { public PlayerAbility Abilities { get; set; } = PlayerAbility.None;