diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs index ff2ba2e96..45086eefb 100644 --- a/TShockAPI/Group.cs +++ b/TShockAPI/Group.cs @@ -20,6 +20,8 @@ You should have received a copy of the GNU General Public License using System.Linq; using System.Collections.Generic; +using Microsoft.Xna.Framework; + namespace TShockAPI { /// @@ -52,17 +54,17 @@ public class Group /// /// The group that this group inherits permissions from. /// - public Group Parent { get; set; } + public virtual Group Parent { get; set; } /// /// The chat prefix for this group. /// - public string Prefix { get; set; } + public virtual string Prefix { get; set; } /// /// The chat suffix for this group. /// - public string Suffix { get; set; } + public virtual string Suffix { get; set; } /// /// The name of the parent, not particularly sure why this is here. @@ -164,6 +166,20 @@ public virtual List TotalPermissions /// public byte B = 255; + /// + /// Simplifies work with the , , properties. + /// + public virtual Color Color + { + get => new Color(R, G, B); + set + { + R = value.R; + G = value.G; + B = value.B; + } + } + /// /// The default group attributed to unregistered users. /// @@ -242,7 +258,7 @@ private bool RealHasPermission(string permission, ref bool negated) /// Adds a permission to the list of negated permissions. /// /// The permission to negate. - public void NegatePermission(string permission) + public virtual void NegatePermission(string permission) { // Avoid duplicates if (!negatedpermissions.Contains(permission)) @@ -256,7 +272,7 @@ public void NegatePermission(string permission) /// Adds a permission to the list of permissions. /// /// The permission to add. - public void AddPermission(string permission) + public virtual void AddPermission(string permission) { if (permission.StartsWith("!")) { @@ -276,7 +292,7 @@ public void AddPermission(string permission) /// will parse "!permission" and add it to the negated permissions. /// /// The new list of permissions to associate with the group. - public void SetPermission(List permission) + public virtual void SetPermission(List permission) { permissions.Clear(); negatedpermissions.Clear(); @@ -288,7 +304,7 @@ public void SetPermission(List permission) /// where "!permission" will remove a negated permission. /// /// - public void RemovePermission(string permission) + public virtual void RemovePermission(string permission) { if (permission.StartsWith("!")) { @@ -302,7 +318,7 @@ public void RemovePermission(string permission) /// Assigns all fields of this instance to another. /// /// The other instance. - public void AssignTo(Group otherGroup) + public virtual void AssignTo(Group otherGroup) { otherGroup.Name = Name; otherGroup.Parent = Parent; diff --git a/docs/changelog.md b/docs/changelog.md index d4ab3cfeb..4b4645c12 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -89,6 +89,7 @@ Use past tense when adding new entries; sign your name off when you add or chang * Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace) * Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace) * Fixed typo in `/gbuff`. (@sgkoishi, #2955) +* Added more modification options to `Group`. (@AgaSpace) ## TShock 5.2 * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK)