mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Use CanExecute instead of commands.Contains for future extensibility
This commit is contained in:
parent
2c024c32a8
commit
0b5222f325
@ -26,7 +26,7 @@ namespace MCGalaxy.Core {
|
||||
|
||||
internal static void HandleConnect(Player p) {
|
||||
CheckReviewList(p);
|
||||
if (p.group.commands.Contains("reachdistance"))
|
||||
if (p.group.CanExecute("reachdistance"))
|
||||
LoadReach(p);
|
||||
|
||||
LoadWaypoints(p);
|
||||
|
@ -107,14 +107,14 @@ namespace MCGalaxy {
|
||||
for (int i = 0; i < CanModify.Length; i++)
|
||||
CanModify[i] = BlockPerms.CanModify(Permission, (byte)i);
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Returns true if players in this group can use the given command. </summary>
|
||||
public bool CanExecute(string cmdName) {
|
||||
return commands.Contains(Command.all.Find(cmdName));
|
||||
Command cmd = Command.all.Find(cmdName);
|
||||
return cmd != null && commands.Contains(cmd);
|
||||
}
|
||||
|
||||
/// <summary> Check to see if this group can excute cmd </summary>
|
||||
/// <param name="cmd">The command object to check</param>
|
||||
/// <returns>True if this group can use it, false if they cant</returns>
|
||||
/// <summary> Returns true if players in this group can use the given command. </summary>
|
||||
public bool CanExecute(Command cmd) { return commands.Contains(cmd); }
|
||||
|
||||
public static List<Group> GroupList = new List<Group>();
|
||||
|
@ -168,7 +168,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
try {
|
||||
if (group.commands.Contains("inbox") && Database.TableExists("Inbox" + name) ) {
|
||||
if (group.CanExecute("inbox") && Database.TableExists("Inbox" + name) ) {
|
||||
using (DataTable table = Database.Backend.GetRows("Inbox" + name, "*")) {
|
||||
if (table.Rows.Count > 0)
|
||||
SendMessage("You have &a" + table.Rows.Count + " %Smessages in /inbox");
|
||||
|
@ -18,13 +18,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using MCGalaxy.Commands.World;
|
||||
using MCGalaxy.Games;
|
||||
using MCGalaxy.Generator;
|
||||
using MCGalaxy.Tasks;
|
||||
using MCGalaxy.Network;
|
||||
using MCGalaxy.Tasks;
|
||||
|
||||
namespace MCGalaxy {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user