Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Rocket.Unturned/Player/UnturnedPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,22 @@ public Color Color
return Palette.ADMIN;
}

RocketPermissionsGroup group = R.Permissions.GetGroups(this,false).Where(g => g.Color != null && g.Color != "white").FirstOrDefault();
var groups = R.Permissions.GetGroups(this, false).Where(g => g.Color != null && g.Color != "white").ToList();
var group = groups.FirstOrDefault();
if (U.Settings.Instance.EnableUnturnedPlayerColorFromPriorityGroup)
{
//group = groups.First(g => g.Priority == groups.Max(g => g.Priority));
var priority = short.MaxValue;
foreach (var item in groups)
{
if (item.Priority < priority)
{
priority = item.Priority;
group = item;
}
}
}

string color = "";
if (group != null) color = group.Color;
return UnturnedChat.GetColorFromName(color, Palette.COLOR_W);
Expand Down
3 changes: 3 additions & 0 deletions Rocket.Unturned/Serialisation/UnturnedSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class UnturnedSettings : IDefaultable

public bool EnableVehicleBlacklist;

public bool EnableUnturnedPlayerColorFromPriorityGroup;


public void LoadDefaults()
{
Expand All @@ -66,6 +68,7 @@ public void LoadDefaults()
EnableItemSpawnLimit = false;
MaxSpawnAmount = 10;
EnableVehicleBlacklist = false;
EnableUnturnedPlayerColorFromPriorityGroup = false;
}
}
}