diff --git a/MCGalaxy/CorePlugin/ConnectHandler.cs b/MCGalaxy/CorePlugin/ConnectHandler.cs
index 61bd98517..8674bc6dd 100644
--- a/MCGalaxy/CorePlugin/ConnectHandler.cs
+++ b/MCGalaxy/CorePlugin/ConnectHandler.cs
@@ -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);
diff --git a/MCGalaxy/Player/Group/Group.cs b/MCGalaxy/Player/Group/Group.cs
index bca2137ec..75d82b2a1 100644
--- a/MCGalaxy/Player/Group/Group.cs
+++ b/MCGalaxy/Player/Group/Group.cs
@@ -107,14 +107,14 @@ namespace MCGalaxy {
for (int i = 0; i < CanModify.Length; i++)
CanModify[i] = BlockPerms.CanModify(Permission, (byte)i);
}
-
+
+ /// Returns true if players in this group can use the given command.
public bool CanExecute(string cmdName) {
- return commands.Contains(Command.all.Find(cmdName));
+ Command cmd = Command.all.Find(cmdName);
+ return cmd != null && commands.Contains(cmd);
}
- /// Check to see if this group can excute cmd
- /// The command object to check
- /// True if this group can use it, false if they cant
+ /// Returns true if players in this group can use the given command.
public bool CanExecute(Command cmd) { return commands.Contains(cmd); }
public static List GroupList = new List();
diff --git a/MCGalaxy/Player/Player.Login.cs b/MCGalaxy/Player/Player.Login.cs
index df44941a3..d71bb6cd4 100644
--- a/MCGalaxy/Player/Player.Login.cs
+++ b/MCGalaxy/Player/Player.Login.cs
@@ -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");
diff --git a/MCGalaxy/Server/Server.Init.cs b/MCGalaxy/Server/Server.Init.cs
index 335aa8325..6635ec772 100644
--- a/MCGalaxy/Server/Server.Init.cs
+++ b/MCGalaxy/Server/Server.Init.cs
@@ -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 {