mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 12:42:22 -04:00
Prevent creating MBs with non-existent commands
This commit is contained in:
parent
4725607d56
commit
9ec7f275c7
@ -58,7 +58,9 @@ namespace MCGalaxy.Blocks.Extended {
|
||||
public static bool Validate(Player p, string message, bool allCmds) {
|
||||
string text;
|
||||
List<string> cmds = MessageBlock.GetParts(message, out text);
|
||||
foreach (string cmd in cmds) {
|
||||
|
||||
foreach (string cmd in cmds)
|
||||
{
|
||||
if (!CheckCommand(p, cmd, allCmds)) return false;
|
||||
}
|
||||
return true;
|
||||
@ -70,7 +72,10 @@ namespace MCGalaxy.Blocks.Extended {
|
||||
Command.Search(ref cmdName, ref cmdArgs);
|
||||
|
||||
Command cmd = Command.Find(cmdName);
|
||||
if (cmd == null) return true;
|
||||
if (cmd == null) {
|
||||
p.Message("Unknown command &T/{0} &Scannot be used in a messageblock", cmdName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p.CanUse(cmd) && (allCmds || !cmd.MessageBlockRestricted)) return true;
|
||||
p.Message("You cannot use &T/{0} &Sin a messageblock.", cmd.name);
|
||||
|
@ -18,6 +18,7 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using MCGalaxy.Network;
|
||||
using MCGalaxy.Platform;
|
||||
using MCGalaxy.Tasks;
|
||||
|
||||
namespace MCGalaxy
|
||||
|
Loading…
x
Reference in New Issue
Block a user