Get rid of those try{} catch{} and instead rely on the generic command try{} catch{} handler which prints more detailed information.

This commit is contained in:
UnknownShadow200 2016-02-11 16:54:42 +11:00
parent 0b8cbfe91f
commit 395a59a182
10 changed files with 818 additions and 868 deletions

View File

@ -1,20 +1,20 @@
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy.Commands
{
@ -29,132 +29,129 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
try
if (message == "")
{
if (message == "")
Player.SendMessage(p, "Basic blocks: ");
for (byte i = 0; i < 50; i++)
{
Player.SendMessage(p, "Basic blocks: ");
for (byte i = 0; i < 50; i++)
{
message += ", " + Block.Name(i);
}
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "&d/blocks all <0/1/2/3/4> " + Server.DefaultColor + "will show the rest.");
message += ", " + Block.Name(i);
}
else if (message.ToLower() == "all")
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "&d/blocks all <0/1/2/3/4> " + Server.DefaultColor + "will show the rest.");
}
else if (message.ToLower() == "all")
{
Player.SendMessage(p, "Complex blocks: ");
for (byte i = 50; i < 255; i++)
{
Player.SendMessage(p, "Complex blocks: ");
for (byte i = 50; i < 255; i++)
{
if (Block.Name(i).ToLower() != "unknown") message += ", " + Block.Name(i);
}
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "Use &d/blocks all <0/1/2/3/4> " + Server.DefaultColor + "for a readable list.");
if (Block.Name(i).ToLower() != "unknown") message += ", " + Block.Name(i);
}
else if (message.ToLower().IndexOf(' ') != -1 && message.Split(' ')[0] == "all")
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "Use &d/blocks all <0/1/2/3/4> " + Server.DefaultColor + "for a readable list.");
}
else if (message.ToLower().IndexOf(' ') != -1 && message.Split(' ')[0] == "all")
{
int foundRange = 0;
try { foundRange = int.Parse(message.Split(' ')[1]); }
catch { Player.SendMessage(p, "Incorrect syntax"); return; }
if (foundRange >= 5 || foundRange < 0) { Player.SendMessage(p, "Number must be between 0 and 4"); return; }
message = "";
Player.SendMessage(p, "Blocks between " + foundRange * 51 + " and " + (foundRange + 1) * 51);
for (byte i = (byte)(foundRange * 51); i < (byte)((foundRange + 1) * 51); i++)
{
int foundRange = 0;
try { foundRange = int.Parse(message.Split(' ')[1]); }
catch { Player.SendMessage(p, "Incorrect syntax"); return; }
if (foundRange >= 5 || foundRange < 0) { Player.SendMessage(p, "Number must be between 0 and 4"); return; }
message = "";
Player.SendMessage(p, "Blocks between " + foundRange * 51 + " and " + (foundRange + 1) * 51);
for (byte i = (byte)(foundRange * 51); i < (byte)((foundRange + 1) * 51); i++)
{
if (Block.Name(i).ToLower() != "unknown") message += ", " + Block.Name(i);
}
Player.SendMessage(p, message.Remove(0, 2));
if (Block.Name(i).ToLower() != "unknown") message += ", " + Block.Name(i);
}
else
Player.SendMessage(p, message.Remove(0, 2));
}
else
{
string printMessage = ">>>&b";
if (Block.Byte(message) != Block.Zero)
{
string printMessage = ">>>&b";
if (Block.Byte(message) != Block.Zero)
byte b = Block.Byte(message);
if (b < 51)
{
byte b = Block.Byte(message);
if (b < 51)
for (byte i = 51; i < 255; i++)
{
for (byte i = 51; i < 255; i++)
{
if (Block.Convert(i) == b)
printMessage += Block.Name(i) + ", ";
}
if (printMessage != ">>>&b")
{
Player.SendMessage(p, "Blocks which look like \"" + message + "\":");
Player.SendMessage(p, printMessage.Remove(printMessage.Length - 2));
}
else Player.SendMessage(p, "No Complex Blocks look like \"" + message + "\"");
}
else
{
Player.SendMessage(p, "&bComplex information for \"" + message + "\":");
Player.SendMessage(p, "&cBlock will appear as a \"" + Block.Name(Block.Convert(b)) + "\" block");
if (Block.LightPass(b, 0, BlockDefinition.GlobalDefs))
Player.SendMessage(p, "Block will allow light through");
if (Block.Physics(b)) Player.SendMessage(p, "Block affects physics in some way"); //AFFECT!
else Player.SendMessage(p, "Block will not affect physics in any way"); //It's AFFECT!
if (Block.NeedRestart(b)) Player.SendMessage(p, "The block's physics will auto-start");
if (Block.OPBlocks(b)) Player.SendMessage(p, "Block is unaffected by explosions");
if (Block.AllowBreak(b)) Player.SendMessage(p, "Anybody can activate the block");
if (Block.Walkthrough(b)) Player.SendMessage(p, "Block can be walked through");
if (Block.Death(b)) Player.SendMessage(p, "Walking through block will kill you");
if (Block.DoorAirs(b) != (byte)0) Player.SendMessage(p, "Block is an ordinary door");
if (Block.tDoor(b)) Player.SendMessage(p, "Block is a tdoor, which allows other blocks through when open");
if (Block.odoor(b) != Block.Zero) Player.SendMessage(p, "Block is an odoor, which toggles (GLITCHY)");
if (Block.Mover(b)) Player.SendMessage(p, "Block can be activated by walking through it");
}
}
else if (Group.Find(message) != null)
{
LevelPermission Perm = Group.Find(message).Permission;
foreach (Block.Blocks bL in Block.BlockList)
{
if (Block.canPlace(Perm, bL.type) && Block.Name(bL.type).ToLower() != "unknown") printMessage += Block.Name(bL.type) + ", ";
if (Block.Convert(i) == b)
printMessage += Block.Name(i) + ", ";
}
if (printMessage != ">>>&b")
{
Player.SendMessage(p, "Blocks which " + Group.Find(message).color + Group.Find(message).name + Server.DefaultColor + " can place: ");
Player.SendMessage(p, "Blocks which look like \"" + message + "\":");
Player.SendMessage(p, printMessage.Remove(printMessage.Length - 2));
}
else Player.SendMessage(p, "No blocks are specific to this rank");
}
else if (message.IndexOf(' ') == -1)
{
if (message.ToLower() == "count") Player.SendMessage(p, "Blocks in this map: " + p.level.blocks.Length);
else Help(p);
}
else if (message.Split(' ')[0].ToLower() == "count")
{
int foundNum = 0; byte foundBlock = Block.Byte(message.Split(' ')[1]);
if (foundBlock == Block.Zero) { Player.SendMessage(p, "Could not find block specified"); return; }
for (int i = 0; i < p.level.blocks.Length; i++)
{
if (foundBlock == p.level.blocks[i]) foundNum++;
}
if (foundNum == 0) Player.SendMessage(p, "No blocks were of type \"" + message.Split(' ')[1] + "\"");
else if (foundNum == 1) Player.SendMessage(p, "1 block was of type \"" + message.Split(' ')[1] + "\"");
else Player.SendMessage(p, foundNum.ToString() + " blocks were of type \"" + message.Split(' ')[1] + "\"");
else Player.SendMessage(p, "No Complex Blocks look like \"" + message + "\"");
}
else
{
Player.SendMessage(p, "Unable to find block or rank");
Player.SendMessage(p, "&bComplex information for \"" + message + "\":");
Player.SendMessage(p, "&cBlock will appear as a \"" + Block.Name(Block.Convert(b)) + "\" block");
if (Block.LightPass(b, 0, BlockDefinition.GlobalDefs))
Player.SendMessage(p, "Block will allow light through");
if (Block.Physics(b)) Player.SendMessage(p, "Block affects physics in some way"); //AFFECT!
else Player.SendMessage(p, "Block will not affect physics in any way"); //It's AFFECT!
if (Block.NeedRestart(b)) Player.SendMessage(p, "The block's physics will auto-start");
if (Block.OPBlocks(b)) Player.SendMessage(p, "Block is unaffected by explosions");
if (Block.AllowBreak(b)) Player.SendMessage(p, "Anybody can activate the block");
if (Block.Walkthrough(b)) Player.SendMessage(p, "Block can be walked through");
if (Block.Death(b)) Player.SendMessage(p, "Walking through block will kill you");
if (Block.DoorAirs(b) != (byte)0) Player.SendMessage(p, "Block is an ordinary door");
if (Block.tDoor(b)) Player.SendMessage(p, "Block is a tdoor, which allows other blocks through when open");
if (Block.odoor(b) != Block.Zero) Player.SendMessage(p, "Block is an odoor, which toggles (GLITCHY)");
if (Block.Mover(b)) Player.SendMessage(p, "Block can be activated by walking through it");
}
}
else if (Group.Find(message) != null)
{
LevelPermission Perm = Group.Find(message).Permission;
foreach (Block.Blocks bL in Block.BlockList)
{
if (Block.canPlace(Perm, bL.type) && Block.Name(bL.type).ToLower() != "unknown") printMessage += Block.Name(bL.type) + ", ";
}
if (printMessage != ">>>&b")
{
Player.SendMessage(p, "Blocks which " + Group.Find(message).color + Group.Find(message).name + Server.DefaultColor + " can place: ");
Player.SendMessage(p, printMessage.Remove(printMessage.Length - 2));
}
else Player.SendMessage(p, "No blocks are specific to this rank");
}
else if (message.IndexOf(' ') == -1)
{
if (message.ToLower() == "count") Player.SendMessage(p, "Blocks in this map: " + p.level.blocks.Length);
else Help(p);
}
else if (message.Split(' ')[0].ToLower() == "count")
{
int foundNum = 0; byte foundBlock = Block.Byte(message.Split(' ')[1]);
if (foundBlock == Block.Zero) { Player.SendMessage(p, "Could not find block specified"); return; }
for (int i = 0; i < p.level.blocks.Length; i++)
{
if (foundBlock == p.level.blocks[i]) foundNum++;
}
if (foundNum == 0) Player.SendMessage(p, "No blocks were of type \"" + message.Split(' ')[1] + "\"");
else if (foundNum == 1) Player.SendMessage(p, "1 block was of type \"" + message.Split(' ')[1] + "\"");
else Player.SendMessage(p, foundNum.ToString() + " blocks were of type \"" + message.Split(' ')[1] + "\"");
}
else
{
Player.SendMessage(p, "Unable to find block or rank");
}
}
catch (Exception e) { Server.ErrorLog(e); Help(p); }
}
public override void Help(Player p)
{
Player.SendMessage(p, "/blocks - Lists all basic blocks");

View File

@ -11,7 +11,7 @@ software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
*/
using System;
using System.Collections.Generic;
namespace MCGalaxy.Commands
@ -27,210 +27,205 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
try
switch (message.ToLower())
{
switch (message.ToLower())
{
case "":
if (Server.oldHelp)
{
goto case "old";
}
if (Server.menustyle != 1)
{
Player.SendMessage(p, "Use &b/help ranks" + Server.DefaultColor + " for a list of ranks.");
Player.SendMessage(p, "Use &b/help build" + Server.DefaultColor + " for a list of building commands.");
Player.SendMessage(p, "Use &b/help chat" + Server.DefaultColor + " for a list of chat commands.");
Player.SendMessage(p, "Use &b/help economy" + Server.DefaultColor + " for a list of economy commands.");
Player.SendMessage(p, "Use &b/help games" + Server.DefaultColor + " for a list of game commands.");
Player.SendMessage(p, "Use &b/help information" + Server.DefaultColor + " for a list of information commands.");
Player.SendMessage(p, "Use &b/help mod" + Server.DefaultColor + " for a list of moderation commands.");
Player.SendMessage(p, "Use &b/help other" + Server.DefaultColor + " for a list of other commands.");
Player.SendMessage(p, "Use &b/help world" + Server.DefaultColor + " for a list of world/map commands.");
Player.SendMessage(p, "Use &b/help colors" + Server.DefaultColor + " to view the color codes.");
Player.SendMessage(p, "Use &b/help shortcuts" + Server.DefaultColor + " for a list of shortcuts.");
Player.SendMessage(p, "Use &b/help old" + Server.DefaultColor + " to view the Old help menu.");
Player.SendMessage(p, "Use &b/help [command] or /help [block] " + Server.DefaultColor + "to view more info.");
}
else
{
Player.SendMessage(p, Server.DefaultColor + " To see a list of all commands, write %a/Help List");
Player.SendMessage(p, Server.DefaultColor + " To see detailed help for a command, write %a/Help Command");
Player.SendMessage(p, Server.DefaultColor + " To see your stats, write %a/Whois");
Player.SendMessage(p, Server.DefaultColor + " To see loaded maps, write %a/Maps");
Player.SendMessage(p, Server.DefaultColor + " To view your personal world options, use %a/OS");
Player.SendMessage(p, Server.DefaultColor + " To join a Map, write %a/Goto WorldName");
Player.SendMessage(p, Server.DefaultColor + " To send private messages, write %a@PlayerName Message");
}
break;
case "list":
message = "";
Player.SendMessage(p, Server.DefaultColor + " To view all commands in a category, write %a/Help Category");
Player.SendMessage(p, Server.DefaultColor + "Command Categories:");
Player.SendMessage(p, " %aBuilding");
Player.SendMessage(p, " %aChat");
Player.SendMessage(p, " %aEconomy");
Player.SendMessage(p, " %aGames");
Player.SendMessage(p, " %aInfo");
Player.SendMessage(p, " %aModeration");
Player.SendMessage(p, " %aOther");
Player.SendMessage(p, " %aWorld");
case "":
if (Server.oldHelp)
{
goto case "old";
}
if (Server.menustyle != 1)
{
Player.SendMessage(p, "Use &b/help ranks" + Server.DefaultColor + " for a list of ranks.");
Player.SendMessage(p, "Use &b/help build" + Server.DefaultColor + " for a list of building commands.");
Player.SendMessage(p, "Use &b/help chat" + Server.DefaultColor + " for a list of chat commands.");
Player.SendMessage(p, "Use &b/help economy" + Server.DefaultColor + " for a list of economy commands.");
Player.SendMessage(p, "Use &b/help games" + Server.DefaultColor + " for a list of game commands.");
Player.SendMessage(p, "Use &b/help information" + Server.DefaultColor + " for a list of information commands.");
Player.SendMessage(p, "Use &b/help mod" + Server.DefaultColor + " for a list of moderation commands.");
Player.SendMessage(p, "Use &b/help other" + Server.DefaultColor + " for a list of other commands.");
Player.SendMessage(p, "Use &b/help world" + Server.DefaultColor + " for a list of world/map commands.");
Player.SendMessage(p, " %aRanks");
Player.SendMessage(p, " %aColors");
Player.SendMessage(p, " %aShortcuts");
Player.SendMessage(p, " %aOldMenu");
break;
case "ranks":
message = "";
foreach (Group grp in Group.GroupList)
Player.SendMessage(p, "Use &b/help colors" + Server.DefaultColor + " to view the color codes.");
Player.SendMessage(p, "Use &b/help shortcuts" + Server.DefaultColor + " for a list of shortcuts.");
Player.SendMessage(p, "Use &b/help old" + Server.DefaultColor + " to view the Old help menu.");
Player.SendMessage(p, "Use &b/help [command] or /help [block] " + Server.DefaultColor + "to view more info.");
}
else
{
Player.SendMessage(p, Server.DefaultColor + " To see a list of all commands, write %a/Help List");
Player.SendMessage(p, Server.DefaultColor + " To see detailed help for a command, write %a/Help Command");
Player.SendMessage(p, Server.DefaultColor + " To see your stats, write %a/Whois");
Player.SendMessage(p, Server.DefaultColor + " To see loaded maps, write %a/Maps");
Player.SendMessage(p, Server.DefaultColor + " To view your personal world options, use %a/OS");
Player.SendMessage(p, Server.DefaultColor + " To join a Map, write %a/Goto WorldName");
Player.SendMessage(p, Server.DefaultColor + " To send private messages, write %a@PlayerName Message");
}
break;
case "list":
message = "";
Player.SendMessage(p, Server.DefaultColor + " To view all commands in a category, write %a/Help Category");
Player.SendMessage(p, Server.DefaultColor + "Command Categories:");
Player.SendMessage(p, " %aBuilding");
Player.SendMessage(p, " %aChat");
Player.SendMessage(p, " %aEconomy");
Player.SendMessage(p, " %aGames");
Player.SendMessage(p, " %aInfo");
Player.SendMessage(p, " %aModeration");
Player.SendMessage(p, " %aOther");
Player.SendMessage(p, " %aWorld");
Player.SendMessage(p, " %aRanks");
Player.SendMessage(p, " %aColors");
Player.SendMessage(p, " %aShortcuts");
Player.SendMessage(p, " %aOldMenu");
break;
case "ranks":
message = "";
foreach (Group grp in Group.GroupList)
{
if (grp.name != "nobody") // Note that -1 means max undo. Undo anything and everything.
Player.SendMessage(p, grp.color + grp.name + " - &bCmd: " + grp.maxBlocks + " - &2Undo: " + ((grp.maxUndo != -1) ? grp.maxUndo.ToString() : "max") + " - &cPerm: " + (int)grp.Permission);
}
break;
case "build":
case "building":
PrintHelpForGroup(p, "build", "Building" );
break;
case "chat":
PrintHelpForGroup(p, "chat", "Chat" );
break;
case "eco":
case "economy":
PrintHelpForGroup(p, "eco", "Economy" );
break;
case "mod":
case "moderation":
PrintHelpForGroup(p, "mod", "Moderation" );
break;
case "info":
case "information":
PrintHelpForGroup(p, "info", "Information" );
break;
case "game":
case "games":
PrintHelpForGroup(p, "game", "Game" );
break;
case "other":
case "others":
PrintHelpForGroup(p, "other", "Other" );
break;
case "maps":
case "world":
PrintHelpForGroup(p, "world", "World" );
break;
case "short":
case "shortcut":
case "shortcuts":
case "short 1":
case "shortcut 1":
case "shortcuts 1":
case "short 2":
case "shortcut 2":
case "shortcuts 2":
bool list1 = true;
try { if (message.Split()[1] == "2") list1 = false; } catch { }
message = "";
List<string> shortcuts = new List<string>();
foreach (Command comm in Command.all.commands)
if (p == null || p.group.commands.All().Contains(comm))
if (comm.shortcut != "") shortcuts.Add(", &b" + comm.shortcut + " " + Server.DefaultColor + "[" + comm.name + "]");
int top = list1 ? shortcuts.Count / 2 : shortcuts.Count;
for (int i = list1 ? 0 : shortcuts.Count / 2; i < top; i++)
message += shortcuts[i];
if (list1) {
Player.SendMessage(p, "Available shortcuts (1):");
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "%bType %f/help shortcuts 2%b to view the rest of the list ");
} else {
Player.SendMessage(p, "Available shortcuts (2):");
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "%bType %f/help shortcuts 1%b to view the rest of the list ");
}
break;
case "colours":
case "colors":
Player.SendMessage(p, "&fTo use a color simply put a '%' sign symbol before you put the color code.");
Player.SendMessage(p, "Colors Available:");
Player.SendMessage(p, "0 - &0Black " + Server.DefaultColor + "| 8 - &8Gray");
Player.SendMessage(p, "1 - &1Navy " + Server.DefaultColor + "| 9 - &9Blue");
Player.SendMessage(p, "2 - &2Green " + Server.DefaultColor + "| a - &aLime");
Player.SendMessage(p, "3 - &3Teal " + Server.DefaultColor + "| b - &bAqua");
Player.SendMessage(p, "4 - &4Maroon " + Server.DefaultColor + "| c - &cRed");
Player.SendMessage(p, "5 - &5Purple " + Server.DefaultColor + "| d - &dPink");
Player.SendMessage(p, "6 - &6Gold " + Server.DefaultColor + "| e - &eYellow");
Player.SendMessage(p, "7 - &7Silver " + Server.DefaultColor + "| f - &fWhite");
break;
case "old":
case "oldmenu":
case "commands":
case "command":
string commandsFound = "";
foreach (Command comm in Command.all.commands)
if (p == null || p.group.commands.All().Contains(comm))
try { commandsFound += ", " + comm.name; } catch { }
Player.SendMessage(p, "Available commands:");
Player.SendMessage(p, commandsFound.Remove(0, 2));
Player.SendMessage(p, "Type \"/help <command>\" for more help.");
Player.SendMessage(p, "Type \"/help shortcuts\" for shortcuts.");
if (!Server.oldHelp) Player.SendMessage(p, "%bIf you can't see all commands, type %f/help %band choose a help type.");
break;
default:
Command cmd = Command.all.Find(message);
if (cmd != null)
{
cmd.Help(p);
string foundRank = Level.PermissionToName(GrpCommands.allowedCommands.Find(grpComm => grpComm.commandName == cmd.name).lowestRank);
Player.SendMessage(p, "Rank needed: " + getColor(cmd.name) + foundRank);
return;
}
byte b = Block.Byte(message);
if (b != Block.Zero)
{
Player.SendMessage(p, "Block \"" + message + "\" appears as &b" + Block.Name(Block.Convert(b)));
Group foundRank = Group.findPerm(Block.BlockList.Find(bs => bs.type == b).lowestRank);
Player.SendMessage(p, "Rank needed: " + foundRank.color + foundRank.name);
return;
}
Plugin plugin = null;
foreach (Plugin p1 in Plugin.all)
{
if (p1.name.ToLower() == message.ToLower())
{
if (grp.name != "nobody") // Note that -1 means max undo. Undo anything and everything.
Player.SendMessage(p, grp.color + grp.name + " - &bCmd: " + grp.maxBlocks + " - &2Undo: " + ((grp.maxUndo != -1) ? grp.maxUndo.ToString() : "max") + " - &cPerm: " + (int)grp.Permission);
}
break;
case "build":
case "building":
PrintHelpForGroup(p, "build", "Building" );
break;
case "chat":
PrintHelpForGroup(p, "chat", "Chat" );
break;
case "eco":
case "economy":
PrintHelpForGroup(p, "eco", "Economy" );
break;
case "mod":
case "moderation":
PrintHelpForGroup(p, "mod", "Moderation" );
break;
case "info":
case "information":
PrintHelpForGroup(p, "info", "Information" );
break;
case "game":
case "games":
PrintHelpForGroup(p, "game", "Game" );
break;
case "other":
case "others":
PrintHelpForGroup(p, "other", "Other" );
break;
case "maps":
case "world":
PrintHelpForGroup(p, "world", "World" );
break;
case "short":
case "shortcut":
case "shortcuts":
case "short 1":
case "shortcut 1":
case "shortcuts 1":
case "short 2":
case "shortcut 2":
case "shortcuts 2":
bool list1 = true;
try { if (message.Split()[1] == "2") list1 = false; } catch { }
message = "";
List<string> shortcuts = new List<string>();
foreach (Command comm in Command.all.commands)
if (p == null || p.group.commands.All().Contains(comm))
if (comm.shortcut != "") shortcuts.Add(", &b" + comm.shortcut + " " + Server.DefaultColor + "[" + comm.name + "]");
int top = list1 ? shortcuts.Count / 2 : shortcuts.Count;
for (int i = list1 ? 0 : shortcuts.Count / 2; i < top; i++)
message += shortcuts[i];
if (list1) {
Player.SendMessage(p, "Available shortcuts (1):");
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "%bType %f/help shortcuts 2%b to view the rest of the list ");
} else {
Player.SendMessage(p, "Available shortcuts (2):");
Player.SendMessage(p, message.Remove(0, 2));
Player.SendMessage(p, "%bType %f/help shortcuts 1%b to view the rest of the list ");
}
break;
case "colours":
case "colors":
Player.SendMessage(p, "&fTo use a color simply put a '%' sign symbol before you put the color code.");
Player.SendMessage(p, "Colors Available:");
Player.SendMessage(p, "0 - &0Black " + Server.DefaultColor + "| 8 - &8Gray");
Player.SendMessage(p, "1 - &1Navy " + Server.DefaultColor + "| 9 - &9Blue");
Player.SendMessage(p, "2 - &2Green " + Server.DefaultColor + "| a - &aLime");
Player.SendMessage(p, "3 - &3Teal " + Server.DefaultColor + "| b - &bAqua");
Player.SendMessage(p, "4 - &4Maroon " + Server.DefaultColor + "| c - &cRed");
Player.SendMessage(p, "5 - &5Purple " + Server.DefaultColor + "| d - &dPink");
Player.SendMessage(p, "6 - &6Gold " + Server.DefaultColor + "| e - &eYellow");
Player.SendMessage(p, "7 - &7Silver " + Server.DefaultColor + "| f - &fWhite");
plugin = p1;
break;
case "old":
case "oldmenu":
case "commands":
case "command":
string commandsFound = "";
foreach (Command comm in Command.all.commands)
if (p == null || p.group.commands.All().Contains(comm))
try { commandsFound += ", " + comm.name; } catch { }
Player.SendMessage(p, "Available commands:");
Player.SendMessage(p, commandsFound.Remove(0, 2));
Player.SendMessage(p, "Type \"/help <command>\" for more help.");
Player.SendMessage(p, "Type \"/help shortcuts\" for shortcuts.");
if (!Server.oldHelp) Player.SendMessage(p, "%bIf you can't see all commands, type %f/help %band choose a help type.");
break;
default:
Command cmd = Command.all.Find(message);
if (cmd != null)
{
cmd.Help(p);
string foundRank = Level.PermissionToName(GrpCommands.allowedCommands.Find(grpComm => grpComm.commandName == cmd.name).lowestRank);
Player.SendMessage(p, "Rank needed: " + getColor(cmd.name) + foundRank);
return;
}
byte b = Block.Byte(message);
if (b != Block.Zero)
{
Player.SendMessage(p, "Block \"" + message + "\" appears as &b" + Block.Name(Block.Convert(b)));
Group foundRank = Group.findPerm(Block.BlockList.Find(bs => bs.type == b).lowestRank);
Player.SendMessage(p, "Rank needed: " + foundRank.color + foundRank.name);
return;
}
Plugin plugin = null;
foreach (Plugin p1 in Plugin.all)
{
if (p1.name.ToLower() == message.ToLower())
{
plugin = p1;
break;
}
}
if (plugin != null)
{
plugin.Help(p);
}
Player.SendMessage(p, "Could not find command, plugin or block specified.");
break;
}
}
if (plugin != null)
{
plugin.Help(p);
}
Player.SendMessage(p, "Could not find command, plugin or block specified.");
break;
}
catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "An error occured"); }
}
static void PrintHelpForGroup(Player p, string typeName, string typeTitle) {
string message = "";
foreach (Command c in Command.all.commands) {
if (p == null || p.group.commands.All().Contains(c)) {
if (c.type.Contains(typeName))
message += ", " + getColor(c.name) + c.name;
}
}
if (message == "") {
Player.SendMessage(p, "No commands of this type are available to you.");
} else {
Player.SendMessage(p, typeTitle + " commands you may use:");
Player.SendMessage(p, message.Remove(0, 2) + ".");
}
string message = "";
foreach (Command c in Command.all.commands) {
if (p == null || p.group.commands.All().Contains(c)) {
if (c.type.Contains(typeName))
message += ", " + getColor(c.name) + c.name;
}
}
if (message == "") {
Player.SendMessage(p, "No commands of this type are available to you.");
} else {
Player.SendMessage(p, typeTitle + " commands you may use:");
Player.SendMessage(p, message.Remove(0, 2) + ".");
}
}
private static string getColor(string commName)

View File

@ -1,20 +1,20 @@
/*
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using System.IO;
@ -31,68 +31,64 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
try
List<string> levels = new List<string>(Server.levels.Count);
string unloadedLevels = ""; int currentNum = 0; int maxMaps = 0;
if (message != "")
{
List<string> levels = new List<string>(Server.levels.Count);
string unloadedLevels = ""; int currentNum = 0; int maxMaps = 0;
if (message != "")
{
try {
int n = int.Parse(message);
if (n <= 0) { Help(p); return; }
maxMaps = n * 50;
currentNum = maxMaps - 50;
} catch { Help(p); return; }
}
DirectoryInfo di = new DirectoryInfo("levels/");
FileInfo[] fi = di.GetFiles("*.lvl");
foreach (Level l in Server.levels) { levels.Add(l.name.ToLower()); }
if (maxMaps == 0)
{
foreach (FileInfo file in fi)
{
if (!levels.Contains(file.Name.Replace(".lvl", "").ToLower()))
{
string level = file.Name.Replace(".lvl", "");
string visit = GetLoadOnGoto(level) && (p == null || p.group.Permission >= GetPerVisitPermission(level)) ? "%aYes" : "%cNo";
unloadedLevels += ", " + Group.findPerm(GetPerBuildPermission(level)).color + level + " &b[" + visit + "&b]";
}
}
if (unloadedLevels != "")
{
Player.SendMessage(p, "Unloaded levels [Accessible]: ");
Player.SendMessage(p, unloadedLevels.Remove(0, 2));
if (fi.Length > 50) { Player.SendMessage(p, "For a more structured list, use /unloaded <1/2/3/..>"); }
}
else Player.SendMessage(p, "No maps are unloaded");
}
else
{
if (maxMaps > fi.Length) maxMaps = fi.Length;
if (currentNum > fi.Length) { Player.SendMessage(p, "No maps beyond number " + fi.Length); return; }
Player.SendMessage(p, "Unloaded levels [Accessible] (" + currentNum + " to " + maxMaps + "):");
for (int i = currentNum; i < maxMaps; i++)
{
if (!levels.Contains(fi[i].Name.Replace(".lvl", "").ToLower()))
{
string level = fi[i].Name.Replace(".lvl", "");
string visit = GetLoadOnGoto(level) && (p == null || p.group.Permission >= GetPerVisitPermission(level)) ? "%aYes" : "%cNo";
unloadedLevels += ", " + Group.findPerm(GetPerBuildPermission(level)).color + level + " &b[" + visit + "&b]";
}
}
if (unloadedLevels != "")
{
Player.SendMessage(p, unloadedLevels.Remove(0, 2));
}
else Player.SendMessage(p, "No maps are unloaded");
}
try {
int n = int.Parse(message);
if (n <= 0) { Help(p); return; }
maxMaps = n * 50;
currentNum = maxMaps - 50;
} catch { Help(p); return; }
}
DirectoryInfo di = new DirectoryInfo("levels/");
FileInfo[] fi = di.GetFiles("*.lvl");
foreach (Level l in Server.levels) { levels.Add(l.name.ToLower()); }
if (maxMaps == 0)
{
foreach (FileInfo file in fi)
{
if (!levels.Contains(file.Name.Replace(".lvl", "").ToLower()))
{
string level = file.Name.Replace(".lvl", "");
string visit = GetLoadOnGoto(level) && (p == null || p.group.Permission >= GetPerVisitPermission(level)) ? "%aYes" : "%cNo";
unloadedLevels += ", " + Group.findPerm(GetPerBuildPermission(level)).color + level + " &b[" + visit + "&b]";
}
}
if (unloadedLevels != "")
{
Player.SendMessage(p, "Unloaded levels [Accessible]: ");
Player.SendMessage(p, unloadedLevels.Remove(0, 2));
if (fi.Length > 50) { Player.SendMessage(p, "For a more structured list, use /unloaded <1/2/3/..>"); }
}
else Player.SendMessage(p, "No maps are unloaded");
}
else
{
if (maxMaps > fi.Length) maxMaps = fi.Length;
if (currentNum > fi.Length) { Player.SendMessage(p, "No maps beyond number " + fi.Length); return; }
Player.SendMessage(p, "Unloaded levels [Accessible] (" + currentNum + " to " + maxMaps + "):");
for (int i = currentNum; i < maxMaps; i++)
{
if (!levels.Contains(fi[i].Name.Replace(".lvl", "").ToLower()))
{
string level = fi[i].Name.Replace(".lvl", "");
string visit = GetLoadOnGoto(level) && (p == null || p.group.Permission >= GetPerVisitPermission(level)) ? "%aYes" : "%cNo";
unloadedLevels += ", " + Group.findPerm(GetPerBuildPermission(level)).color + level + " &b[" + visit + "&b]";
}
}
if (unloadedLevels != "")
{
Player.SendMessage(p, unloadedLevels.Remove(0, 2));
}
else Player.SendMessage(p, "No maps are unloaded");
}
catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "An error occured"); }
//Exception catching since it needs to be tested on Ocean Flatgrass
}

View File

@ -1,57 +1,50 @@
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy.Commands
{
public sealed class CmdBotRemove : Command
{
namespace MCGalaxy.Commands {
public sealed class CmdBotRemove : Command {
public override string name { get { return "botremove"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Moderation; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public string[,] botlist;
public CmdBotRemove() { }
public override void Use(Player p, string message)
{
public override void Use(Player p, string message) {
if (message == "") { Help(p); return; }
if (p == null) { MessageInGameOnly(p); return; }
try
{
if (message.ToLower() == "all") {
PlayerBot.RemoveAllFromLevel(p.level);
} else {
PlayerBot who = PlayerBot.Find(message);
if (who == null) { Player.SendMessage(p, "There is no bot " + who + "!"); return; }
if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
PlayerBot.Remove(who);
Player.SendMessage(p, "Removed bot.");
}
if (message.ToLower() == "all") {
PlayerBot.RemoveAllFromLevel(p.level);
} else {
PlayerBot who = PlayerBot.Find(message);
if (who == null) { Player.SendMessage(p, "There is no bot " + who + "!"); return; }
if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
PlayerBot.Remove(who);
Player.SendMessage(p, "Removed bot.");
}
catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error caught"); }
}
public override void Help(Player p)
{
public override void Help(Player p) {
Player.SendMessage(p, "/botremove <name> - Remove a bot on the same level as you");
// Player.SendMessage(p, "If All is used, all bots on the current level are removed");
Player.SendMessage(p, "If 'all' is used, all bots on the current level are removed");
}
}
}

View File

@ -1,20 +1,20 @@
/*
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy.Commands
{
@ -22,7 +22,7 @@ namespace MCGalaxy.Commands
{
public override string name { get { return "follow"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Moderation; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public CmdFollow() { }
@ -35,86 +35,83 @@ namespace MCGalaxy.Commands
Player.SendMessage(p, "You're currently being &4possessed" + Server.DefaultColor + "!");
return;
}
try
bool stealth = false;
if (message != "")
{
bool stealth = false;
if (message != "")
if (message == "#")
{
if (message == "#")
if (p.following != "")
{
if (p.following != "")
{
stealth = true;
message = "";
}
else
{
Help(p);
return;
}
stealth = true;
message = "";
}
else if (message.IndexOf(' ') != -1)
else
{
if (message.Split(' ')[0] == "#")
{
if (p.hidden) stealth = true;
message = message.Split(' ')[1];
}
}
}
Player who = PlayerInfo.Find(message);
if (message == "" && p.following == "") {
Help(p);
return;
}
else if (message == "" && p.following != "" || message == p.following)
{
who = PlayerInfo.Find(p.following);
p.following = "";
if (p.hidden)
{
if (who != null)
p.SendSpawn(who.id, who.color + who.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]);
if (!stealth)
{
Command.all.Find("hide").Use(p, "");
}
else
{
if (who != null)
{
Player.SendMessage(p, "You have stopped following " + who.color + who.DisplayName + Server.DefaultColor + " and remained hidden.");
}
else
{
Player.SendMessage(p, "Following stopped.");
}
}
Help(p);
return;
}
}
if (who == null) { Player.SendMessage(p, "Could not find player."); return; }
else if (who == p) { Player.SendMessage(p, "Cannot follow yourself."); return; }
else if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot follow someone of equal or greater rank."); return; }
else if (who.following != "") { Player.SendMessage(p, who.DisplayName + " is already following " + who.following); return; }
if (!p.hidden) Command.all.Find("hide").Use(p, "");
if (p.level != who.level) Command.all.Find("tp").Use(p, who.name);
if (p.following != "")
else if (message.IndexOf(' ') != -1)
{
who = PlayerInfo.Find(p.following);
p.SendSpawn(who.id, who.color + who.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]);
if (message.Split(' ')[0] == "#")
{
if (p.hidden) stealth = true;
message = message.Split(' ')[1];
}
}
who = PlayerInfo.Find(message);
p.following = who.name;
Player.SendMessage(p, "Following " + who.color + who.DisplayName + Server.DefaultColor + ". Use \"/follow\" to stop.");
p.SendDespawn(who.id);
}
catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error occured"); }
Player who = PlayerInfo.Find(message);
if (message == "" && p.following == "") {
Help(p);
return;
}
else if (message == "" && p.following != "" || message == p.following)
{
who = PlayerInfo.Find(p.following);
p.following = "";
if (p.hidden)
{
if (who != null)
p.SendSpawn(who.id, who.color + who.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]);
if (!stealth)
{
Command.all.Find("hide").Use(p, "");
}
else
{
if (who != null)
{
Player.SendMessage(p, "You have stopped following " + who.color + who.DisplayName + Server.DefaultColor + " and remained hidden.");
}
else
{
Player.SendMessage(p, "Following stopped.");
}
}
return;
}
}
if (who == null) { Player.SendMessage(p, "Could not find player."); return; }
else if (who == p) { Player.SendMessage(p, "Cannot follow yourself."); return; }
else if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot follow someone of equal or greater rank."); return; }
else if (who.following != "") { Player.SendMessage(p, who.DisplayName + " is already following " + who.following); return; }
if (!p.hidden) Command.all.Find("hide").Use(p, "");
if (p.level != who.level) Command.all.Find("tp").Use(p, who.name);
if (p.following != "")
{
who = PlayerInfo.Find(p.following);
p.SendSpawn(who.id, who.color + who.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]);
}
who = PlayerInfo.Find(message);
p.following = who.name;
Player.SendMessage(p, "Following " + who.color + who.DisplayName + Server.DefaultColor + ". Use \"/follow\" to stop.");
p.SendDespawn(who.id);
}
public override void Help(Player p)
{
Player.SendMessage(p, "/follow <name> - Follows <name> until the command is cancelled");

View File

@ -1,20 +1,20 @@
/*
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.IO;
namespace MCGalaxy.Commands
@ -98,48 +98,41 @@ namespace MCGalaxy.Commands
}
}
try
DirectoryInfo di;
string[] fileContent;
if (Directory.Exists("extra/undo/" + message.Split(' ')[0]))
{
DirectoryInfo di;
string[] fileContent;
di = new DirectoryInfo("extra/undo/" + message.Split(' ')[0]);
if (Directory.Exists("extra/undo/" + message.Split(' ')[0]))
for (int i = 0; i < di.GetFiles("*.undo").Length; i++)
{
di = new DirectoryInfo("extra/undo/" + message.Split(' ')[0]);
for (int i = 0; i < di.GetFiles("*.undo").Length; i++)
{
fileContent = File.ReadAllText("extra/undo/" + message.Split(' ')[0] + "/" + i + ".undo").Split(' ');
highlightStuff(fileContent, seconds, p);
}
FoundUser = true;
}
if (Directory.Exists("extra/undoPrevious/" + message.Split(' ')[0]))
{
di = new DirectoryInfo("extra/undoPrevious/" + message.Split(' ')[0]);
for (int i = 0; i < di.GetFiles("*.undo").Length; i++)
{
fileContent = File.ReadAllText("extra/undoPrevious/" + message.Split(' ')[0] + "/" + i + ".undo").Split(' ');
highlightStuff(fileContent, seconds, p);
}
FoundUser = true;
}
if (FoundUser)
{
Player.SendMessage(p, "Now highlighting &b" + seconds + Server.DefaultColor + " seconds for " + Server.FindColor(message.Split(' ')[0]) + message.Split(' ')[0]);
Player.SendMessage(p, "&cUse /reveal to un-highlight");
}
else
{
Player.SendMessage(p, "Could not find player specified.");
fileContent = File.ReadAllText("extra/undo/" + message.Split(' ')[0] + "/" + i + ".undo").Split(' ');
highlightStuff(fileContent, seconds, p);
}
FoundUser = true;
}
catch (Exception e)
if (Directory.Exists("extra/undoPrevious/" + message.Split(' ')[0]))
{
Server.ErrorLog(e);
di = new DirectoryInfo("extra/undoPrevious/" + message.Split(' ')[0]);
for (int i = 0; i < di.GetFiles("*.undo").Length; i++)
{
fileContent = File.ReadAllText("extra/undoPrevious/" + message.Split(' ')[0] + "/" + i + ".undo").Split(' ');
highlightStuff(fileContent, seconds, p);
}
FoundUser = true;
}
if (FoundUser)
{
Player.SendMessage(p, "Now highlighting &b" + seconds + Server.DefaultColor + " seconds for " + Server.FindColor(message.Split(' ')[0]) + message.Split(' ')[0]);
Player.SendMessage(p, "&cUse /reveal to un-highlight");
}
else
{
Player.SendMessage(p, "Could not find player specified.");
}
}

View File

@ -1,20 +1,20 @@
/*
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy.Commands
@ -23,7 +23,7 @@ namespace MCGalaxy.Commands
{
public override string name { get { return "possess"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Moderation; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public CmdPossess() { }
@ -32,40 +32,17 @@ namespace MCGalaxy.Commands
{
if (message.Split(' ').Length > 2) { Help(p); return; }
if (p == null) { Player.SendMessage(p, "Console possession? Nope.avi."); return; }
try
string skin = (message.Split(' ').Length == 2) ? message.Split(' ')[1] : "";
message = message.Split(' ')[0];
if (message == "")
{
string skin = (message.Split(' ').Length == 2) ? message.Split(' ')[1] : "";
message = message.Split(' ')[0];
if (message == "")
if (p.possess == "")
{
if (p.possess == "")
{
Help(p);
return;
}
else
{
Player who = PlayerInfo.Find(p.possess);
if (who == null)
{
p.possess = "";
Player.SendMessage(p, "Possession disabled.");
return;
}
who.following = "";
who.canBuild = true;
p.possess = "";
if (!who.MarkPossessed())
{
return;
}
p.invincible = false;
Command.all.Find("hide").Use(p, "");
Player.SendMessage(p, "Stopped possessing " + who.color + who.name + Server.DefaultColor + ".");
return;
}
Help(p);
return;
}
else if (message == p.possess)
else
{
Player who = PlayerInfo.Find(p.possess);
if (who == null)
@ -74,11 +51,6 @@ namespace MCGalaxy.Commands
Player.SendMessage(p, "Possession disabled.");
return;
}
if (who == p)
{
Player.SendMessage(p, "Cannot possess yourself!");
return;
}
who.following = "";
who.canBuild = true;
p.possess = "";
@ -91,68 +63,89 @@ namespace MCGalaxy.Commands
Player.SendMessage(p, "Stopped possessing " + who.color + who.name + Server.DefaultColor + ".");
return;
}
else
{
Player who = PlayerInfo.Find(message);
if (who == null)
{
Player.SendMessage(p, "Could not find player.");
return;
}
if (who.group.Permission >= p.group.Permission)
{
Player.SendMessage(p, "Cannot possess someone of equal or greater rank.");
return;
}
if (who.possess != "")
{
Player.SendMessage(p, "That player is currently possessing someone!");
return;
}
if (who.following != "")
{
Player.SendMessage(p, "That player is either following someone or already possessed.");
return;
}
if (p.possess != "")
{
Player oldwho = PlayerInfo.Find(p.possess);
if (oldwho != null)
{
oldwho.following = "";
oldwho.canBuild = true;
if (!oldwho.MarkPossessed())
{
return;
}
//p.SendSpawn(oldwho.id, oldwho.color + oldwho.name, oldwho.pos[0], oldwho.pos[1], oldwho.pos[2], oldwho.rot[0], oldwho.rot[1]);
}
}
Command.all.Find("tp").Use(p, who.name);
if (!p.hidden)
{
Command.all.Find("hide").Use(p, "");
}
p.possess = who.name;
who.following = p.name;
if (!p.invincible)
{
p.invincible = true;
}
bool result = (skin == "#") ? who.MarkPossessed() : who.MarkPossessed(p.name);
if (!result)
{
return;
}
p.SendDespawn(who.id);
who.canBuild = false;
Player.SendMessage(p, "Successfully possessed " + who.color + who.name + Server.DefaultColor + ".");
}
}
catch (Exception e)
else if (message == p.possess)
{
Server.ErrorLog(e);
Player.SendMessage(p, "There was an error.");
Player who = PlayerInfo.Find(p.possess);
if (who == null)
{
p.possess = "";
Player.SendMessage(p, "Possession disabled.");
return;
}
if (who == p)
{
Player.SendMessage(p, "Cannot possess yourself!");
return;
}
who.following = "";
who.canBuild = true;
p.possess = "";
if (!who.MarkPossessed())
{
return;
}
p.invincible = false;
Command.all.Find("hide").Use(p, "");
Player.SendMessage(p, "Stopped possessing " + who.color + who.name + Server.DefaultColor + ".");
return;
}
else
{
Player who = PlayerInfo.Find(message);
if (who == null)
{
Player.SendMessage(p, "Could not find player.");
return;
}
if (who.group.Permission >= p.group.Permission)
{
Player.SendMessage(p, "Cannot possess someone of equal or greater rank.");
return;
}
if (who.possess != "")
{
Player.SendMessage(p, "That player is currently possessing someone!");
return;
}
if (who.following != "")
{
Player.SendMessage(p, "That player is either following someone or already possessed.");
return;
}
if (p.possess != "")
{
Player oldwho = PlayerInfo.Find(p.possess);
if (oldwho != null)
{
oldwho.following = "";
oldwho.canBuild = true;
if (!oldwho.MarkPossessed())
{
return;
}
//p.SendSpawn(oldwho.id, oldwho.color + oldwho.name, oldwho.pos[0], oldwho.pos[1], oldwho.pos[2], oldwho.rot[0], oldwho.rot[1]);
}
}
Command.all.Find("tp").Use(p, who.name);
if (!p.hidden)
{
Command.all.Find("hide").Use(p, "");
}
p.possess = who.name;
who.following = p.name;
if (!p.invincible)
{
p.invincible = true;
}
bool result = (skin == "#") ? who.MarkPossessed() : who.MarkPossessed(p.name);
if (!result)
{
return;
}
p.SendDespawn(who.id);
who.canBuild = false;
Player.SendMessage(p, "Successfully possessed " + who.color + who.name + Server.DefaultColor + ".");
}
}

View File

@ -1,20 +1,20 @@
/*
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.IO;
using MCGalaxy.SQL;
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands
{
public override string name { get { return "renamelvl"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Moderation; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public CmdRenameLvl() { }
@ -46,78 +46,76 @@ namespace MCGalaxy.Commands
foundLevel.Unload();
File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl");
try
{
File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl");
try
{
File.Move("levels/" + foundLevel.name + ".lvl.backup", "levels/" + newName + ".lvl.backup");
} catch { }
try
{
File.Move("levels/level properties/" + foundLevel.name + ".properties", "levels/level properties/" + newName + ".properties");
}
catch { }
try
{
File.Move("levels/level properties/" + foundLevel.name, "levels/level properties/" + newName + ".properties");
}
catch { }
try {
if (File.Exists("blockdefs/lvl_" + foundLevel.name + ".json"))
File.Move("blockdefs/lvl_" + foundLevel.name + ".json", "blockdefs/lvl_" + newName + ".json");
} catch {}
//Move and rename backups
try
{
string foundLevelDir, newNameDir;
for (int i = 1; ; i++)
{
foundLevelDir = @Server.backupLocation + "/" + foundLevel.name + "/" + i + "/";
newNameDir = @Server.backupLocation + "/" + newName + "/" + i + "/";
if (File.Exists(foundLevelDir + foundLevel.name + ".lvl"))
{
Directory.CreateDirectory(newNameDir);
File.Move(foundLevelDir + foundLevel.name + ".lvl", newNameDir + newName + ".lvl");
if (DirectoryEmpty(foundLevelDir))
Directory.Delete(foundLevelDir);
}
else
{
if (DirectoryEmpty(@Server.backupLocation + "/" + foundLevel.name + "/"))
Directory.Delete(@Server.backupLocation + "/" + foundLevel.name + "/");
break;
}
}
}
catch { }
//safe against SQL injections because foundLevel is being checked and,
//newName is being split and partly checked on illegal characters reserved for Windows.
if (Server.useMySQL)
Database.executeQuery(String.Format("RENAME TABLE `Block{0}` TO `Block{1}`, " +
"`Portals{0}` TO `Portals{1}`, " +
"`Messages{0}` TO `Messages{1}`, " +
"`Zone{0}` TO `Zone{1}`", foundLevel.name.ToLower(), newName.ToLower()));
else {
using (DatabaseTransactionHelper helper = SQLiteTransactionHelper.Create()) { // ensures that it's either all work, or none work.
helper.Execute(String.Format("ALTER TABLE Block{0} RENAME TO Block{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Execute(String.Format("ALTER TABLE Portals{0} RENAME TO Portals{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Execute(String.Format("ALTER TABLE Messages{0} RENAME TO Messages{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Execute(String.Format("ALTER TABLE Zone{0} RENAME TO Zone{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Commit();
}
}
try { Command.all.Find("load").Use(p, newName); }
catch { }
Player.GlobalMessage("Renamed " + foundLevel.name + " to " + newName);
File.Move("levels/" + foundLevel.name + ".lvl.backup", "levels/" + newName + ".lvl.backup");
} catch { }
try
{
File.Move("levels/level properties/" + foundLevel.name + ".properties", "levels/level properties/" + newName + ".properties");
}
catch (Exception e) { Player.SendMessage(p, "Error when renaming."); Server.ErrorLog(e); }
catch { }
try
{
File.Move("levels/level properties/" + foundLevel.name, "levels/level properties/" + newName + ".properties");
}
catch { }
try {
if (File.Exists("blockdefs/lvl_" + foundLevel.name + ".json"))
File.Move("blockdefs/lvl_" + foundLevel.name + ".json", "blockdefs/lvl_" + newName + ".json");
} catch {}
//Move and rename backups
try
{
string foundLevelDir, newNameDir;
for (int i = 1; ; i++)
{
foundLevelDir = @Server.backupLocation + "/" + foundLevel.name + "/" + i + "/";
newNameDir = @Server.backupLocation + "/" + newName + "/" + i + "/";
if (File.Exists(foundLevelDir + foundLevel.name + ".lvl"))
{
Directory.CreateDirectory(newNameDir);
File.Move(foundLevelDir + foundLevel.name + ".lvl", newNameDir + newName + ".lvl");
if (DirectoryEmpty(foundLevelDir))
Directory.Delete(foundLevelDir);
}
else
{
if (DirectoryEmpty(@Server.backupLocation + "/" + foundLevel.name + "/"))
Directory.Delete(@Server.backupLocation + "/" + foundLevel.name + "/");
break;
}
}
}
catch { }
//safe against SQL injections because foundLevel is being checked and,
//newName is being split and partly checked on illegal characters reserved for Windows.
if (Server.useMySQL)
Database.executeQuery(String.Format("RENAME TABLE `Block{0}` TO `Block{1}`, " +
"`Portals{0}` TO `Portals{1}`, " +
"`Messages{0}` TO `Messages{1}`, " +
"`Zone{0}` TO `Zone{1}`", foundLevel.name.ToLower(), newName.ToLower()));
else {
using (DatabaseTransactionHelper helper = SQLiteTransactionHelper.Create()) { // ensures that it's either all work, or none work.
helper.Execute(String.Format("ALTER TABLE Block{0} RENAME TO Block{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Execute(String.Format("ALTER TABLE Portals{0} RENAME TO Portals{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Execute(String.Format("ALTER TABLE Messages{0} RENAME TO Messages{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Execute(String.Format("ALTER TABLE Zone{0} RENAME TO Zone{1}", foundLevel.name.ToLower(), newName.ToLower()));
helper.Commit();
}
}
try { Command.all.Find("load").Use(p, newName); }
catch { }
Player.GlobalMessage("Renamed " + foundLevel.name + " to " + newName);
}
public override void Help(Player p)
{
Player.SendMessage(p, "/renamelvl <level> <new name> - Renames <level> to <new name>");

View File

@ -1,20 +1,20 @@
/*
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.IO;
using System.IO.Compression;
@ -35,64 +35,55 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
string path;
if (message.Split(' ').Length == 1) path = "levels/" + message + ".lvl";
else if (message.Split(' ').Length == 2) try { path = @Server.backupLocation + "/" + message.Split(' ')[0] + "/" + int.Parse(message.Split(' ')[1]) + "/" + message.Split(' ')[0] + ".lvl"; }
catch { Help(p); return; }
catch { Help(p); return; }
else { Help(p); return; }
if (File.Exists(path))
{
try
{
Level level = LvlFile.Load(name, path);
level.setPhysics(0);
Level level = LvlFile.Load(name, path);
level.setPhysics(0);
level.backedup = true;
level.permissionbuild = LevelPermission.Admin;
level.backedup = true;
level.permissionbuild = LevelPermission.Admin;
level.jailx = (ushort)(level.spawnx * 32);
level.jaily = (ushort)(level.spawny * 32);
level.jailz = (ushort)(level.spawnz * 32);
level.jailrotx = level.rotx; level.jailroty = level.roty;
level.jailx = (ushort)(level.spawnx * 32);
level.jaily = (ushort)(level.spawny * 32);
level.jailz = (ushort)(level.spawnz * 32);
level.jailrotx = level.rotx; level.jailroty = level.roty;
p.Loading = true;
foreach (Player pl in PlayerInfo.players) if (p.level == pl.level && p != pl) p.SendDespawn(pl.id);
foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDespawn(b.id);
p.Loading = true;
foreach (Player pl in PlayerInfo.players) if (p.level == pl.level && p != pl) p.SendDespawn(pl.id);
foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDespawn(b.id);
Player.GlobalDespawn(p, true);
Player.GlobalDespawn(p, true);
Level oldLevel = p.level;
p.level = level;
p.SendMotd();
if (!p.SendRawMap(oldLevel, level))
return;
Level oldLevel = p.level;
p.level = level;
p.SendMotd();
if (!p.SendRawMap(oldLevel, level))
return;
ushort x = (ushort)((0.5 + level.spawnx) * 32);
ushort y = (ushort)((1 + level.spawny) * 32);
ushort z = (ushort)((0.5 + level.spawnz) * 32);
ushort x = (ushort)((0.5 + level.spawnx) * 32);
ushort y = (ushort)((1 + level.spawny) * 32);
ushort z = (ushort)((0.5 + level.spawnz) * 32);
p.aiming = false;
Player.GlobalSpawn(p, x, y, z, level.rotx, level.roty, true);
p.ClearBlockchange();
p.Loading = false;
p.aiming = false;
Player.GlobalSpawn(p, x, y, z, level.rotx, level.roty, true);
p.ClearBlockchange();
p.Loading = false;
if (message.IndexOf(' ') == -1)
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + ")";
else
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + " " + message.Split(' ')[1] + ")";
if (message.IndexOf(' ') == -1)
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + ")";
else
level.name = "&cMuseum " + Server.DefaultColor + "(" + message.Split(' ')[0] + " " + message.Split(' ')[1] + ")";
if (!p.hidden)
{
Player.GlobalMessage(p.color + p.prefix + p.name + Server.DefaultColor + " went to the " + level.name);
}
} catch (Exception ex) {
Player.SendMessage(p, "Error loading level.");
Server.ErrorLog(ex);
}
} else {
Player.SendMessage(p, "Level or backup could not be found.");
if (!p.hidden)
Player.GlobalMessage(p.color + p.prefix + p.name + Server.DefaultColor + " went to the " + level.name);
} else {
Player.SendMessage(p, "Level or backup could not be found.");
}
}
public override void Help(Player p)

View File

@ -30,72 +30,69 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message)
{
if (p == null) { MessageInGameOnly(p); return; }
if (p == null) { MessageInGameOnly(p); return; }
if (message.Split(' ').Length < 2) { Help(p); return; }
string foundPath = message.Split(' ')[1].ToLower();
if (!Player.ValidName(foundPath)) { Player.SendMessage(p, "Invalid AI name!"); return; }
if (foundPath == "hunt" || foundPath == "kill") { Player.SendMessage(p, "Reserved for special AI."); return; }
try
switch (message.Split(' ')[0])
{
switch (message.Split(' ')[0])
{
case "add":
if (message.Split(' ').Length == 2) addPoint(p, foundPath);
else if (message.Split(' ').Length == 3) addPoint(p, foundPath, message.Split(' ')[2]);
else if (message.Split(' ').Length == 4) addPoint(p, foundPath, message.Split(' ')[2], message.Split(' ')[3]);
else addPoint(p, foundPath, message.Split(' ')[2], message.Split(' ')[3], message.Split(' ')[4]);
break;
case "del":
if (!Directory.Exists("bots/deleted")) Directory.CreateDirectory("bots/deleted");
case "add":
if (message.Split(' ').Length == 2) addPoint(p, foundPath);
else if (message.Split(' ').Length == 3) addPoint(p, foundPath, message.Split(' ')[2]);
else if (message.Split(' ').Length == 4) addPoint(p, foundPath, message.Split(' ')[2], message.Split(' ')[3]);
else addPoint(p, foundPath, message.Split(' ')[2], message.Split(' ')[3], message.Split(' ')[4]);
break;
case "del":
if (!Directory.Exists("bots/deleted")) Directory.CreateDirectory("bots/deleted");
int currentTry = 0;
if (File.Exists("bots/" + foundPath))
{
int currentTry = 0;
if (File.Exists("bots/" + foundPath))
{
retry: try
{
if (message.Split(' ').Length == 2)
{
if (message.Split(' ').Length == 2)
if (currentTry == 0)
File.Move("bots/" + foundPath, "bots/deleted/" + foundPath);
else
File.Move("bots/" + foundPath, "bots/deleted/" + foundPath + currentTry);
}
else
{
if (message.Split(' ')[2].ToLower() == "last")
{
if (currentTry == 0)
File.Move("bots/" + foundPath, "bots/deleted/" + foundPath);
else
File.Move("bots/" + foundPath, "bots/deleted/" + foundPath + currentTry);
string[] Lines = File.ReadAllLines("bots/" + foundPath);
string[] outLines = new string[Lines.Length - 1];
for (int i = 0; i < Lines.Length - 1; i++)
{
outLines[i] = Lines[i];
}
File.WriteAllLines("bots/" + foundPath, outLines);
Player.SendMessage(p, "Deleted the last waypoint from " + foundPath);
return;
}
else
{
if (message.Split(' ')[2].ToLower() == "last")
{
string[] Lines = File.ReadAllLines("bots/" + foundPath);
string[] outLines = new string[Lines.Length - 1];
for (int i = 0; i < Lines.Length - 1; i++)
{
outLines[i] = Lines[i];
}
File.WriteAllLines("bots/" + foundPath, outLines);
Player.SendMessage(p, "Deleted the last waypoint from " + foundPath);
return;
}
else
{
Help(p); return;
}
Help(p); return;
}
}
catch (IOException) { currentTry++; goto retry; }
Player.SendMessage(p, "Deleted &b" + foundPath);
}
else
{
Player.SendMessage(p, "Could not find specified AI.");
}
break;
catch (IOException) { currentTry++; goto retry; }
Player.SendMessage(p, "Deleted &b" + foundPath);
}
else
{
Player.SendMessage(p, "Could not find specified AI.");
}
break;
default: Help(p); return;
}
}
catch (Exception e) { Server.ErrorLog(e); }
}
public override void Help(Player p)
{
Player.SendMessage(p, "/botai <add/del> [AI name] <extra> - Adds or deletes [AI name]");