-
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.
Merge pull request #8 from terminator-97/master
2.4.4
- Loading branch information
Showing
42 changed files
with
1,985 additions
and
894 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using CommandSystem; | ||
|
||
|
||
namespace SCPUtils.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
public class AsnUnWhitelist : ICommand | ||
{ | ||
public string Command { get; } = "scputils_unwhitelist_asn"; | ||
|
||
public string[] Aliases { get; } = new[] { "asnuw" }; | ||
|
||
public string Description { get; } = "Un-Whitelist a player to disallow him access the server even if ASN is blacklisted!"; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.whitelist") || !((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=yellow>Usage: {Command} <player name/id></color>"; | ||
return false; | ||
} | ||
|
||
else | ||
{ | ||
var target = arguments.Array[1]; | ||
var databasePlayer = target.GetDatabasePlayer(); | ||
|
||
if (databasePlayer == null) | ||
{ | ||
response = "<color=yellow>Player not found on Database or Player is loading data!</color>"; | ||
return false; | ||
} | ||
|
||
databasePlayer.ASNWhitelisted = false; | ||
Database.LiteDatabase.GetCollection<Player>().Update(databasePlayer); | ||
response = "Player has been removed from whitelist!"; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using CommandSystem; | ||
|
||
|
||
namespace SCPUtils.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
public class AsnWhitelist : ICommand | ||
{ | ||
public string Command { get; } = "scputils_whitelist_asn"; | ||
|
||
public string[] Aliases { get; } = new[] { "asnw" }; | ||
|
||
public string Description { get; } = "Whitelist a player to make him access the server even if ASN is blacklisted!"; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.whitelist") || !((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=yellow>Usage: {Command} <player name/id></color>"; | ||
return false; | ||
} | ||
|
||
else | ||
{ | ||
var target = arguments.Array[1]; | ||
var databasePlayer = target.GetDatabasePlayer(); | ||
|
||
if (databasePlayer == null) | ||
{ | ||
response = "<color=yellow>Player not found on Database or Player is loading data!</color>"; | ||
return false; | ||
} | ||
|
||
databasePlayer.ASNWhitelisted = true; | ||
Database.LiteDatabase.GetCollection<Player>().Update(databasePlayer); | ||
response = "Player has been whitelisted!"; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Log = Exiled.API.Features.Log; | ||
|
||
namespace SCPUtils.Commands | ||
{ | ||
public static class CommandExtensions | ||
{ | ||
public static bool IsAllowed(string sender, string permission) | ||
{ | ||
Exiled.API.Features.Player player; | ||
return sender != null && (sender == "GAME CONSOLE" || (player = Exiled.API.Features.Player.Get(sender)) == null || Exiled.Permissions.Extensions.Permissions.CheckPermission(player, permission)); | ||
} | ||
} | ||
} |
Oops, something went wrong.