Merge branch 'general-devel' into newer-bans
This commit is contained in:
commit
a429d706fa
7 changed files with 65 additions and 25 deletions
|
|
@ -312,6 +312,14 @@ namespace TShockAPI
|
|||
{
|
||||
HelpText = "Temporarily sets another player's group."
|
||||
});
|
||||
add(new Command(Permissions.su, SubstituteUser, "su")
|
||||
{
|
||||
HelpText = "Temporarily elevates you to Super Admin."
|
||||
});
|
||||
add(new Command(Permissions.su, SubstituteUserDo, "sudo")
|
||||
{
|
||||
HelpText = "Executes a command as the super admin."
|
||||
});
|
||||
add(new Command(Permissions.userinfo, GrabUserUserInfo, "userinfo", "ui")
|
||||
{
|
||||
HelpText = "Shows information about a player."
|
||||
|
|
@ -686,6 +694,10 @@ namespace TShockAPI
|
|||
{
|
||||
TShock.Utils.SendLogs(string.Format("{0} tried to execute {1}{2}.", player.Name, Specifier, cmdText), Color.PaleVioletRed, player);
|
||||
player.SendErrorMessage("You do not have access to this command.");
|
||||
if (player.HasPermission(Permissions.su))
|
||||
{
|
||||
player.SendInfoMessage("You can use '{0}sudo {0}{1}' to override this check.", Specifier, cmdText);
|
||||
}
|
||||
}
|
||||
else if (!cmd.AllowServer && !player.RealPlayer)
|
||||
{
|
||||
|
|
@ -1813,10 +1825,48 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
private static void SubstituteUser(CommandArgs args)
|
||||
{
|
||||
|
||||
if (args.Player.tempGroup != null)
|
||||
{
|
||||
args.Player.tempGroup = null;
|
||||
args.Player.tempGroupTimer.Stop();
|
||||
args.Player.SendSuccessMessage("Your previous permission set has been restored.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.tempGroup = new SuperAdminGroup();
|
||||
args.Player.tempGroupTimer = new System.Timers.Timer(600 * 1000);
|
||||
args.Player.tempGroupTimer.Elapsed += args.Player.TempGroupTimerElapsed;
|
||||
args.Player.tempGroupTimer.Start();
|
||||
args.Player.SendSuccessMessage("Your account has been elevated to Super Admin for 10 minutes.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Player Management Commands
|
||||
|
||||
#region Server Maintenence Commands
|
||||
|
||||
// Executes a command as a superuser if you have sudo rights.
|
||||
private static void SubstituteUserDo(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count == 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("Usage: /sudo [command].");
|
||||
args.Player.SendErrorMessage("Example: /sudo /ban add Shank 2d Hacking.");
|
||||
return;
|
||||
}
|
||||
|
||||
string replacementCommand = String.Join(" ", args.Parameters);
|
||||
args.Player.tempGroup = new SuperAdminGroup();
|
||||
HandleCommand(args.Player, replacementCommand);
|
||||
args.Player.tempGroup = null;
|
||||
return;
|
||||
}
|
||||
|
||||
private static void Broadcast(CommandArgs args)
|
||||
{
|
||||
string message = string.Join(" ", args.Parameters);
|
||||
|
|
@ -4841,10 +4891,10 @@ namespace TShockAPI
|
|||
if (args.Player.Group.Name != "superadmin")
|
||||
args.Player.tempGroup = new SuperAdminGroup();
|
||||
|
||||
args.Player.SendInfoMessage("Superadmin has been temporarily given to you. It will be removed on logout.");
|
||||
args.Player.SendInfoMessage("Temporary system access has been given to you, so you can run one command.");
|
||||
args.Player.SendInfoMessage("Please use the following to create a permanent account for you.");
|
||||
args.Player.SendInfoMessage("{0}user add <username> <password> superadmin", Specifier);
|
||||
args.Player.SendInfoMessage("Creates: <username> with the password <password> as part of the superadmin group.");
|
||||
args.Player.SendInfoMessage("{0}user add <username> <password> owner", Specifier);
|
||||
args.Player.SendInfoMessage("Creates: <username> with the password <password> as part of the owner group.");
|
||||
args.Player.SendInfoMessage("Please use {0}login <username> <password> after this process.", Specifier);
|
||||
args.Player.SendInfoMessage("If you understand, please {0}login <username> <password> now, and then type {0}auth.", Specifier);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -78,18 +78,6 @@ namespace TShockAPI
|
|||
[Description("Disables any building / placing of blocks.")]
|
||||
public bool DisableBuild;
|
||||
|
||||
/// <summary>SuperAdminChatRGB - The chat color for the superadmin group.</summary>
|
||||
[Description("#.#.# = Red/Blue/Green - RGB Colors for the Admin Chat Color. Max value: 255.")]
|
||||
public int[] SuperAdminChatRGB = { 255, 0, 0 };
|
||||
|
||||
/// <summary>SuperAdminChatPrefix - The superadmin chat prefix.</summary>
|
||||
[Description("Super admin group chat prefix.")]
|
||||
public string SuperAdminChatPrefix = "(Admin) ";
|
||||
|
||||
/// <summary>SuperAdminChatSuffix - The superadmin chat suffix.</summary>
|
||||
[Description("Super admin group chat suffix.")]
|
||||
public string SuperAdminChatSuffix = "";
|
||||
|
||||
/// <summary>BackupInterval - The backup frequency in minutes.</summary>
|
||||
[Description("Backup frequency in minutes. So, a value of 60 = 60 minutes. Backups are stored in the \\tshock\\backups folder.")]
|
||||
public int BackupInterval;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ namespace TShockAPI.DB
|
|||
string.Join(",", Permissions.maintenance, "tshock.cfg.*", "tshock.world.*", Permissions.butcher, Permissions.item, Permissions.give,
|
||||
Permissions.heal, Permissions.immunetoban, Permissions.usebanneditem));
|
||||
|
||||
AddDefaultGroup("owner", "trustedadmin", string.Join(",", Permissions.su));
|
||||
|
||||
AddDefaultGroup("vip", "default", string.Join(",", Permissions.reservedslot));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -340,11 +340,11 @@ namespace TShockAPI
|
|||
public SuperAdminGroup()
|
||||
: base("superadmin")
|
||||
{
|
||||
R = (byte)TShock.Config.SuperAdminChatRGB[0];
|
||||
G = (byte)TShock.Config.SuperAdminChatRGB[1];
|
||||
B = (byte)TShock.Config.SuperAdminChatRGB[2];
|
||||
Prefix = TShock.Config.SuperAdminChatPrefix;
|
||||
Suffix = TShock.Config.SuperAdminChatSuffix;
|
||||
R = (byte)255;
|
||||
G = (byte)255;
|
||||
B = (byte)255;
|
||||
Prefix = "(Super Admin) ";
|
||||
Suffix = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -221,6 +221,9 @@ namespace TShockAPI
|
|||
[Description("Meant for super admins only.")]
|
||||
public static readonly string user = "tshock.superadmin.user";
|
||||
|
||||
[Description("Allows a user to elevate to superadmin for 10 minutes.")]
|
||||
public static readonly string su = "tshock.su";
|
||||
|
||||
// tshock.tp nodes
|
||||
|
||||
[Description("User can teleport *everyone* to them.")]
|
||||
|
|
|
|||
|
|
@ -549,11 +549,6 @@ namespace TShockAPI
|
|||
get { return (int)(Y / 16); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unused.
|
||||
/// </summary>
|
||||
public bool TpLock;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the player has any inventory slots available.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue