From f18243242fcf04a15ede101db6ed827544b0e165 Mon Sep 17 00:00:00 2001
From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com>
Date: Tue, 6 Jun 2023 16:12:05 +0700
Subject: [PATCH 1/5] Update Group.cs
---
TShockAPI/Group.cs | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs
index ff2ba2e96..0858dfd48 100644
--- a/TShockAPI/Group.cs
+++ b/TShockAPI/Group.cs
@@ -52,17 +52,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.
@@ -154,15 +154,15 @@ public virtual List TotalPermissions
///
/// The group's chat color red byte.
///
- public byte R = 255;
+ public virtual byte R { get; set; } = 255;
///
/// The group's chat color green byte.
///
- public byte G = 255;
+ public virtual byte G { get; set; } = 255;
///
/// The group's chat color blue byte.
///
- public byte B = 255;
+ public virtual byte B { get; set; } = 255;
///
/// The default group attributed to unregistered users.
@@ -242,7 +242,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 +256,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 +276,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 +288,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 +302,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;
From 121afa963cbff2910f4418851371700dba124651 Mon Sep 17 00:00:00 2001
From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com>
Date: Tue, 6 Jun 2023 16:18:48 +0700
Subject: [PATCH 2/5] Added a `Group.Color`
---
TShockAPI/Group.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs
index 0858dfd48..f0d64b2db 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
{
///
@@ -164,6 +166,17 @@ public virtual List TotalPermissions
///
public virtual byte B { get; set; } = 255;
+ 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.
///
From 73e2440043f172355d537a1ef1fe5a8159caa939 Mon Sep 17 00:00:00 2001
From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com>
Date: Tue, 6 Jun 2023 16:21:52 +0700
Subject: [PATCH 3/5] Added XML documentation.
---
TShockAPI/Group.cs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs
index f0d64b2db..0867a8a02 100644
--- a/TShockAPI/Group.cs
+++ b/TShockAPI/Group.cs
@@ -166,6 +166,9 @@ public virtual List TotalPermissions
///
public virtual byte B { get; set; } = 255;
+ ///
+ /// Simplifies work with the , , properties.
+ ///
public virtual Color Color
{
get => new Color(R, G, B);
From a917beaca0ae3f63774fbb212bce51cd5d0f41e5 Mon Sep 17 00:00:00 2001
From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com>
Date: Wed, 7 Jun 2023 23:44:04 +0700
Subject: [PATCH 4/5] Update changelog.md
---
docs/changelog.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/changelog.md b/docs/changelog.md
index 3f64f3554..ec7f000fe 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -78,7 +78,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
* If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. -->
## Upcoming changes
-Your changes could be here!
+* 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)
From dc817911346ac7c82180553d53a45d3325c5b5ab Mon Sep 17 00:00:00 2001
From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com>
Date: Thu, 8 Jun 2023 12:41:11 +0700
Subject: [PATCH 5/5] Removed RGB properties
---
TShockAPI/Group.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs
index 0867a8a02..45086eefb 100644
--- a/TShockAPI/Group.cs
+++ b/TShockAPI/Group.cs
@@ -156,15 +156,15 @@ public virtual List TotalPermissions
///
/// The group's chat color red byte.
///
- public virtual byte R { get; set; } = 255;
+ public byte R = 255;
///
/// The group's chat color green byte.
///
- public virtual byte G { get; set; } = 255;
+ public byte G = 255;
///
/// The group's chat color blue byte.
///
- public virtual byte B { get; set; } = 255;
+ public byte B = 255;
///
/// Simplifies work with the , , properties.