-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ae32fa
commit e3aaeac
Showing
9 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using CommandSystem; | ||
|
||
namespace SCPUtils.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
public class RemovePreviousBadge : ICommand | ||
{ | ||
|
||
public string Command { get; } = "scputils_remove_previous_badge"; | ||
|
||
public string[] Aliases { get; } = new[] { "rpb" }; | ||
|
||
public string Description { get; } = "Removes previous badge!"; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
|
||
if (!CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.handlebadges") && !((CommandSender)sender).FullPermissions) | ||
{ | ||
response = "<color=red> You need a higher administration level to use this command!</color>"; | ||
return false; | ||
} | ||
else if (arguments.Count < 1) | ||
{ | ||
response = $"<color=red>Usage: {Command} <player name/id></color>"; | ||
return false; | ||
} | ||
else | ||
{ | ||
var target = arguments.Array[1].ToString(); | ||
|
||
var databasePlayer = target.GetDatabasePlayer(); | ||
|
||
if (databasePlayer == null) | ||
{ | ||
response = "<color=yellow>Player not found on Database or Player is loading data!</color>"; | ||
return false; | ||
} | ||
|
||
databasePlayer.PreviousBadge = ""; | ||
Database.LiteDatabase.GetCollection<Player>().Update(databasePlayer); | ||
response = $"{target}'s previous badge removed!"; | ||
|
||
return true; | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters