change permissions to tshock.xxx and fix default group creating to reference permissions that exist, and not hardcoded strings.
This commit is contained in:
parent
8980a2155a
commit
b7019d8267
4 changed files with 19 additions and 9 deletions
|
|
@ -267,6 +267,7 @@ namespace TShockAPI
|
|||
|
||||
[Description("The maximum value that a character may have for health.")] public int MaxMana = 400;
|
||||
|
||||
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20;
|
||||
/// <summary>
|
||||
/// Reads a configuration file from a given path
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -53,13 +53,22 @@ namespace TShockAPI.DB
|
|||
LoadPermisions();
|
||||
|
||||
// Add default groups if they don't exist
|
||||
AddDefaultGroup(TShock.Config.DefaultGuestGroupName, "", "canbuild,canregister,canlogin,canpartychat,cantalkinthird");
|
||||
AddDefaultGroup("default", TShock.Config.DefaultGuestGroupName, "warp,canchangepassword");
|
||||
AddDefaultGroup("newadmin", "default", "kick,editspawn,reservedslot");
|
||||
AddDefaultGroup("admin", "newadmin",
|
||||
"ban,unban,whitelist,causeevents,spawnboss,spawnmob,managewarp,time,tp,pvpfun,kill,logs,immunetokick,tphere");
|
||||
AddDefaultGroup("trustedadmin", "admin", "maintenance,cfg,butcher,item,heal,immunetoban,usebanneditem,manageusers");
|
||||
AddDefaultGroup("vip", "default", "reservedslot");
|
||||
AddDefaultGroup(TShock.Config.DefaultGuestGroupName, "",
|
||||
string.Join(",", Permissions.canbuild, Permissions.canregister, Permissions.canlogin, Permissions.canpartychat,
|
||||
Permissions.cantalkinthird));
|
||||
|
||||
AddDefaultGroup("default", TShock.Config.DefaultGuestGroupName, string.Join(",", Permissions.warp, Permissions.canchangepassword));
|
||||
|
||||
AddDefaultGroup("newadmin", "default", string.Join(",", Permissions.kick, Permissions.editspawn, Permissions.reservedslot));
|
||||
|
||||
AddDefaultGroup("admin", "newadmin", string.Join(",", Permissions.ban, Permissions.whitelist, Permissions.causeevents, Permissions.spawnboss,
|
||||
Permissions.spawnmob, Permissions.managewarp, Permissions.time, Permissions.tp, Permissions.pvpfun, Permissions.kill, Permissions.logs,
|
||||
Permissions.immunetokick, Permissions.tphere));
|
||||
|
||||
AddDefaultGroup("trustedadmin", "admin", string.Join(",", Permissions.maintenance, Permissions.cfg, Permissions.butcher, Permissions.item,
|
||||
Permissions.heal, Permissions.immunetoban, Permissions.usebanneditem));
|
||||
|
||||
AddDefaultGroup("vip", "default", string.Join(",", Permissions.reservedslot));
|
||||
|
||||
Group.DefaultGroup = GetGroupByName(TShock.Config.DefaultGuestGroupName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ namespace TShockAPI
|
|||
{
|
||||
foreach (var field in typeof (Permissions).GetFields())
|
||||
{
|
||||
field.SetValue(null, field.Name);
|
||||
field.SetValue(null, String.Format("tshock.{0}", field.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -771,7 +771,7 @@ namespace TShockAPI
|
|||
{
|
||||
var player = new TSPlayer(ply);
|
||||
|
||||
if (Utils.ActivePlayers() + 1 > Config.MaxSlots + 20)
|
||||
if (Utils.ActivePlayers() + 1 > Config.MaxSlots + Config.ReservedSlots)
|
||||
{
|
||||
Utils.ForceKick(player, Config.ServerFullNoReservedReason, true, false);
|
||||
handler.Handled = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue