MCGalaxy/Commands/CommandKeywords.cs
2015-05-20 16:31:40 -04:00

359 lines
22 KiB
C#

/*
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.Collections.Generic;
namespace MCGalaxy.Commands
{
public sealed class CommandKeywords
{
public static List<CommandKeywords> all = new List<CommandKeywords>();
public Command Cmd;
public string[] Keywords;
public CommandKeywords(Command cmd, string key)
{
this.Cmd = cmd;
string keyword = key + " " + cmd.name + " " + cmd.type;
if (cmd.shortcut.Length > 3) { keyword += " " + cmd.shortcut; }
this.Keywords = keyword.Split(' ');
all.Add(this);
}
public static void SetKeyWords()
{
new CommandKeywords((new CmdAbort()), "command action mode");
new CommandKeywords((new CmdAbout()), "info block history grief");
new CommandKeywords((new CmdAdminChat()), "admin chat opchat");
new CommandKeywords((new CmdAfk()), "away dnd");
new CommandKeywords((new CmdAgree()), "accept yes rules");
new CommandKeywords((new CmdAka()), "nick reset user name");
new CommandKeywords((new CmdAlive()), "life health living");
new CommandKeywords((new CmdAllowGuns()), "allow gun missile shoot boom terrorism");
new CommandKeywords((new CmdAscend()), "up level block move player");
new CommandKeywords((new CmdAward()), "reward trophy price");
new CommandKeywords((new CmdAwards()), "price list trophy info");
new CommandKeywords((new CmdAwardMod()), "trophy add del price");
new CommandKeywords((new CmdBan()), "kick mod punish");
new CommandKeywords((new CmdBanEdit()), "reason edit ban");
new CommandKeywords((new CmdBaninfo()), "info ban details");
new CommandKeywords((new CmdBanip()), "ip ban kick mod punish");
new CommandKeywords((new CmdBanlist()), "list ban info mod");
new CommandKeywords((new CmdBind()), "block replace");
new CommandKeywords((new CmdBlocks()), "block info list");
new CommandKeywords((new CmdBlockSet()), "rank mod block");
new CommandKeywords((new CmdBlockSpeed()), "block speed mod setting");
new CommandKeywords((new CmdBotAdd()), "bot add mod fun");
new CommandKeywords((new CmdBotAI()), "bot ai add del remove");
new CommandKeywords((new CmdBotRemove()), "bot remove del");
new CommandKeywords((new CmdBots()), "bot list ai");
new CommandKeywords((new CmdBotSet()), "set bot ai");
new CommandKeywords((new CmdBotSummon()), "summon bot");
new CommandKeywords((new CmdC4()), "tnt c4 explosion");
new CommandKeywords((new CmdCalculate()), "calc number");
new CommandKeywords((new CmdChain()), "grab block mushroom brown");
new CommandKeywords((new CmdChangeLog()), "MCGalaxy change log");
new CommandKeywords((new CmdChatRoom()), "chat room join leave del add remove");
new CommandKeywords((new CmdClearBlockChanges()), "about block change remove del");
new CommandKeywords((new CmdClick()), "block use");
new CommandKeywords((new CmdClones()), "clone ip player info");
new CommandKeywords((new CmdCmdBind()), "bind cmd command shortcut");
new CommandKeywords((new CmdCmdCreate()), "new create command cmd");
new CommandKeywords((new CmdCmdLoad()), "load command cmd custom");
new CommandKeywords((new CmdCmdSet()), "set rank cmd command");
new CommandKeywords((new CmdCmdUnload()), "cmd command unload");
new CommandKeywords((new CmdCompile()), "cmd command custom");
new CommandKeywords((new CmdCompLoad()), "cmd command custom load compile");
new CommandKeywords((new CmdColor()), "user name");
new CommandKeywords((new CmdCopy()), "clipboard blocks save");
new CommandKeywords((new CmdCopyLoadNet()), "new clipboard copy load");
new CommandKeywords((new CmdCopyLVL()), "copy lvl level map");
new CommandKeywords((new CmdCopySaveNet()), "copy save clipboard");
new CommandKeywords((new CmdCountdown()), "count down");
new CommandKeywords((new CmdCrashServer()), "error stop server");
new CommandKeywords((new CmdCTF()), "capture flag");
new CommandKeywords((new CmdCuboid()), "box set area block");
new CommandKeywords((new CmdDelete()), "del mode");
new CommandKeywords((new CmdDeleteLvl()), "delete remove level lvl");
new CommandKeywords((new CmdDelTempRank()), "del remove temp rank");
new CommandKeywords((new CmdDemote()), "rank lower");
new CommandKeywords((new CmdDevs()), "dev MCGalaxy forgeware forgecraft");
new CommandKeywords((new CmdDisagree()), "no rules");
new CommandKeywords((new CmdDescend()), "down below");
new CommandKeywords((new CmdDisInfect()), "infect player");
new CommandKeywords((new CmdDraw()), "cone sphere pyramid create");
new CommandKeywords((new CmdDrill()), "dig distance");
new CommandKeywords((new CmdEconomy()), "money cash " + Server.moneys);
new CommandKeywords((new CmdEllipse()), "create art");
new CommandKeywords((new CmdEmote()), "smiley emoticon");
new CommandKeywords((new CmdEndRound()), "end round game");
new CommandKeywords((new CmdExplode()), "explosion boom");
new CommandKeywords((new CmdFakePay()), "fake troll pay " + Server.moneys);
new CommandKeywords((new CmdFakeRank()), "rank mod fake troll");
new CommandKeywords((new CmdFaq()), "freq ask question");
new CommandKeywords((new CmdFetch()), "summon move");
new CommandKeywords((new CmdFill()), "cuboid edit");
new CommandKeywords((new CmdFixGrass()), "grass fix");
new CommandKeywords((new CmdFlipHead()), "head fix flip troll");
new CommandKeywords((new CmdFlipHeads()), "head fix flip troll");
new CommandKeywords((new CmdFly()), "air ctf glass carpet");
new CommandKeywords((new CmdFollow()), "posses impersonate");
new CommandKeywords((new CmdFreeze()), "ice move player");
new CommandKeywords((new CmdGarbage()), "memory clean unused");
new CommandKeywords((new CmdGive()), "money pay " + Server.moneys);
new CommandKeywords((new CmdGlobal()), "irc MCGalaxy " + Server.ircChannel);
new CommandKeywords((new CmdGlobalCLS()), "clear global chat");
new CommandKeywords((new CmdGoto()), "level lvl change map");
new CommandKeywords((new CmdGun()), "shoot boom terrorism missile");
new CommandKeywords((new CmdHackRank()), "fake rank color set mod");
new CommandKeywords((new CmdHacks()), "hack fake");
new CommandKeywords((new CmdHasirc()), "has " + Server.ircChannel);
new CommandKeywords((new CmdHeartbeat()), "heart server list");
new CommandKeywords((new CmdHelp()), "info commands cmd list");
new CommandKeywords((new CmdHide()), "hidden show invisible");
new CommandKeywords((new CmdHigh5()), "high 5 fun");
new CommandKeywords((new CmdHighlight()), "mod high light block change history");
new CommandKeywords((new CmdHollow()), "block create");
new CommandKeywords((new CmdHost()), "owner server " + Server.server_owner + " " + Server.ZallState);
new CommandKeywords((new CmdIgnore()), "abort chat player");
new CommandKeywords((new CmdImpersonate()), "possess player");
new CommandKeywords((new CmdImport()), "dat imp extra");
new CommandKeywords((new CmdImageprint()), "jpg bmp gif png image print");
new CommandKeywords((new CmdInbox()), "mail box");
new CommandKeywords((new CmdInfect()), "virus inf");
new CommandKeywords((new CmdInfected()), "infect player list");
new CommandKeywords((new CmdInfo()), "server detail");
new CommandKeywords((new CmdInvincible()), "god life inf");
new CommandKeywords((new CmdJail()), "prison punish");
new CommandKeywords((new CmdJoker()), "joke troll fun");
new CommandKeywords((new CmdKick()), "moderate ban player");
new CommandKeywords((new CmdKickban()), "kick ban moderate");
new CommandKeywords((new CmdKill()), "die player murder");
new CommandKeywords((new CmdKillPhysics()), "kill physics level");
new CommandKeywords((new CmdLastCmd()), "cmd command last info");
new CommandKeywords((new CmdLavaSurvival()), "lava surv");
new CommandKeywords((new CmdLevels()), "level map info list");
new CommandKeywords((new CmdLimit()), "lim moderate type");
new CommandKeywords((new CmdLine()), "draw block paint");
new CommandKeywords((new CmdLoad()), "level map lvl");
new CommandKeywords((new CmdLockdown()), "lock down level map lvl player");
new CommandKeywords((new CmdLoginMessage()), "login msg message");
new CommandKeywords((new CmdLogoutMessage()), "logout quit exit stop msg message");
new CommandKeywords((new CmdLowlag()), "low less lag");
new CommandKeywords((new CmdMain()), "default map level lvl");
new CommandKeywords((new CmdMap()), "level lvl info edit");
new CommandKeywords((new CmdMapInfo()), "map info");
new CommandKeywords((new CmdMaze()), "labyrint create");
new CommandKeywords((new CmdMe()), "do action");
new CommandKeywords((new CmdMeasure()), "meas block length distance");
new CommandKeywords((new CmdMegaboid()), "box cuboid mega");
new CommandKeywords((new CmdMessageBlock()), "message block msg");
new CommandKeywords((new CmdMissile()), "gun missil");
new CommandKeywords((new CmdMode()), "block place");
new CommandKeywords((new CmdModerate()), "chat enable disable allow disallow");
new CommandKeywords((new CmdMoney()), "cash " + Server.moneys);
new CommandKeywords((new CmdMove()), "player pos");
new CommandKeywords((new CmdMoveAll()), "move all player pos");
new CommandKeywords((new CmdMuseum()), "musea map lvl level");
new CommandKeywords((new CmdMute()), "voice chat player");
new CommandKeywords((new CmdNewLvl()), "new add lvl level map");
new CommandKeywords((new CmdNews()), "info latest");
new CommandKeywords((new CmdOHide()), "hide rank player invisible");
new CommandKeywords((new CmdOpChat()), "private chat op");
new CommandKeywords((new CmdOpRules()), "op rules info");
new CommandKeywords((new CmdOpStats()), "stats op info");
new CommandKeywords((new CmdOutline()), "out line layer");
new CommandKeywords((new CmdOverseer()), "over see map level lvl");
new CommandKeywords((new CmdOZone()), "zone map lvl level entire");
new CommandKeywords((new CmdP2P()), "tp tele port player move");
new CommandKeywords((new CmdPaint()), "mode block place");
new CommandKeywords((new CmdPass()), "verify password user");
new CommandKeywords((new CmdPaste()), "copy clipboard out");
new CommandKeywords((new CmdPatrol()), "teleport random");
new CommandKeywords((new CmdPause()), "physics reset");
new CommandKeywords((new CmdPay()), "money give " + Server.moneys);
new CommandKeywords((new CmdPlayerBlock()), "player block limit mod edit");
new CommandKeywords((new CmdpCinema()), "cinema gif");
new CommandKeywords((new CmdpCinema2()), "cinema gif");
new CommandKeywords((new CmdPCount()), "player online total number count");
new CommandKeywords((new CmdPCreate()), "create add new plugin");
new CommandKeywords((new CmdPerbuildMax()), "perm build max rank");
new CommandKeywords((new CmdPermissionBuild()), "perm build rank");
new CommandKeywords((new CmdPermissionVisit()), "perm visit rank");
new CommandKeywords((new CmdPervisitMax()), "perm visit max rank");
new CommandKeywords((new CmdPhysics()), "block move");
new CommandKeywords((new CmdPlace()), "block pos");
new CommandKeywords((new CmdPlayerCLS()), "clear del player chat");
new CommandKeywords((new CmdPlayers()), "player list info");
new CommandKeywords((new CmdPLoad()), "plugin load add");
new CommandKeywords((new CmdPortal()), "teleport tp move transport");
new CommandKeywords((new CmdPossess()), "imp control");
new CommandKeywords((new CmdPromote()), "rank up");
new CommandKeywords((new CmdPUnload()), "plugin unload");
new CommandKeywords((new CmdPyramid()), "egypt pyram piram sand");
new CommandKeywords((new CmdQueue()), "zombie");
new CommandKeywords((new CmdQuick()), "fast cuboid box");
new CommandKeywords((new CmdRagequit()), "rage quit exit stop leave");
new CommandKeywords((new CmdRainbow()), "rain bow dash");
new CommandKeywords((new CmdRankInfo()), "rank info display");
new CommandKeywords((new CmdRankMsg()), "rank msg edit set");
new CommandKeywords((new CmdRedo()), "undo edit block change");
new CommandKeywords((new CmdReload()), "level lvl map");
new CommandKeywords((new CmdReferee()), "enable disable ref mode");
new CommandKeywords((new CmdRenameLvl()), "rename lvl level map");
new CommandKeywords((new CmdRepeat()), "rep again");
new CommandKeywords((new CmdReplace()), "block level lvl map");
new CommandKeywords((new CmdReplaceAll()), "all block replace lvl level map");
new CommandKeywords((new CmdReplaceNot()), "not replace block level lvl map");
new CommandKeywords((new CmdReport()), "rep alert");
new CommandKeywords((new CmdResetBot()), "reset bot");
new CommandKeywords((new CmdResetPass()), "reset pass");
new CommandKeywords((new CmdRestart()), "start again over new");
new CommandKeywords((new CmdRestartPhysics()), "restart physics");
new CommandKeywords((new CmdRestore()), "old rest copy");
new CommandKeywords((new CmdRestoreSelection()), "restore select");
new CommandKeywords((new CmdRetrieve()), "copy paste file get block");
new CommandKeywords((new CmdReveal()), "show");
new CommandKeywords((new CmdReview()), "view look judge");
new CommandKeywords((new CmdRide()), "drive train");
new CommandKeywords((new CmdRoll()), "dice gamble");
new CommandKeywords((new CmdRules()), "read prot");
new CommandKeywords((new CmdSave()), "store load");
new CommandKeywords((new CmdSay()), "speak broad cast");
new CommandKeywords((new CmdSCinema()), "cinema show");
new CommandKeywords((new CmdSearch()), "find block command player rank");
new CommandKeywords((new CmdSeen()), "saw last user");
new CommandKeywords((new CmdSend()), "message inbox send msg user player");
new CommandKeywords((new CmdSendCmd()), "send cmd command user player");
new CommandKeywords((new CmdServerReport()), "report server");
new CommandKeywords((new CmdServer()), "setting option");
new CommandKeywords((new CmdSetPass()), "pass set");
new CommandKeywords((new CmdSetRank()), "rank set user player");
new CommandKeywords((new CmdSetspawn()), "spawn set map level lvl");
new CommandKeywords((new CmdShutdown()), "shut down stop exit quit");
new CommandKeywords((new CmdSlap()), "slam facepalm");
new CommandKeywords((new CmdSpawn()), "level lvl map player user");
new CommandKeywords((new CmdSpheroid()), "sphere");
new CommandKeywords((new CmdSpin()), "rotate");
new CommandKeywords((new CmdSPlace()), "measure place");
new CommandKeywords((new CmdStairs()), "stair");
new CommandKeywords((new CmdStatic()), "toggle mode");
new CommandKeywords((new CmdStore()), "selection save");
new CommandKeywords((new CmdSummon()), "move teleport tp player user");
new CommandKeywords((new CmdTake()), "get money");
new CommandKeywords((new CmdTColor()), "title color set");
new CommandKeywords((new CmdTempBan()), "temp ban");
new CommandKeywords((new CmdTempRank()), "temp rank");
new CommandKeywords((new CmdTempRankInfo()), "temp rank info");
new CommandKeywords((new CmdTempRankList()), "temp rank list");
new CommandKeywords((new CmdText()), "write read view able");
new CommandKeywords((new CmdTime()), "server");
new CommandKeywords((new CmdTimer()), "count down");
new CommandKeywords((new CmdTitle()), "set user");
new CommandKeywords((new CmdTnt()), "c4 explo");
new CommandKeywords((new CmdTntWars()), "tnt war c4 explo");
new CommandKeywords((new CmdTopTen()), "top ten user");
new CommandKeywords((new CmdTp()), "teleport move player user");
new CommandKeywords((new CmdTpZone()), "tp zone teleport");
new CommandKeywords((new CmdTranslate()), "trans lang");
new CommandKeywords((new CmdTree()), "log");
new CommandKeywords((new CmdTrust()), "allow agree");
new CommandKeywords((new CmdUBan()), "ban undo kick mod");
new CommandKeywords((new CmdUnban()), "undo ban kick mod");
new CommandKeywords((new CmdUnbanip()), "undo ban ip kick mod");
new CommandKeywords((new CmdUndo()), "redo action block change");
new CommandKeywords((new CmdUnflood()), "flood un restore");
new CommandKeywords((new CmdUnload()), "load un map level lvl");
new CommandKeywords((new CmdUnloaded()), "map level lvl list");
new CommandKeywords((new CmdUnlock()), "lock un level lvl map");
new CommandKeywords((new CmdUpdate()), "server software MCGalaxy");
new CommandKeywords((new CmdView()), "file content player user");
new CommandKeywords((new CmdViewRanks()), "show rank view user player");
new CommandKeywords((new CmdVIP()), "list add remove del");
new CommandKeywords((new CmdVoice()), "speak moderate");
new CommandKeywords((new CmdVote()), "yes no ");
new CommandKeywords((new CmdVoteKick()), "vote kick");
new CommandKeywords((new CmdVoteResults()), "vote result");
new CommandKeywords((new CmdWarn()), "kick user");
new CommandKeywords((new CmdWarp()), "move teleport tp pos");
new CommandKeywords((new CmdWaypoint()), "way point");
new CommandKeywords((new CmdWhisper()), "tell private");
new CommandKeywords((new CmdWhitelist()), "white list allow acces server");
new CommandKeywords((new CmdWhoip()), "who ip info");
new CommandKeywords((new CmdWhois()), "who player info");
new CommandKeywords((new CmdWhowas()), "who player info");
new CommandKeywords((new CmdWrite()), "block text");
new CommandKeywords((new CmdXban()), "ban undo admin");
new CommandKeywords((new CmdXhide()), "hide all extra");
new CommandKeywords((new CmdXJail()), "extra jail undo");
new CommandKeywords((new CmdXmute()), "mute extra");
new CommandKeywords((new CmdXspawn()), "extra spawn");
new CommandKeywords((new CmdXundo()), "undo extra");
new CommandKeywords((new CmdZombieGame()), "zombie game");
new CommandKeywords((new CmdZone()), "area");
new CommandKeywords((new CmdZz()), "static cuboid");
}
public void Addcustom(Command cmd, string keywords)
{
new CommandKeywords(cmd, keywords);
}
public static string[] Find(string word)
{
List<string> returnthing = new List<string>();
bool found = false;
foreach (CommandKeywords ckw in CommandKeywords.all)
{
foreach (string key in ckw.Keywords)
{
if (word.ToLower().Contains(key.ToLower()) && word != "" && key != "")
{
found = true;
returnthing.Add(ckw.Cmd.name);
}
}
}
if (!found) { return null; }
else { return returnthing.ToArray(); }
}
public static string[] Find(string[] words)
{
List<CommandKeywords> returnthing = CommandKeywords.all;
bool found = false;
foreach (string word in words)
{
foreach (CommandKeywords ckw in returnthing.ToArray())
{
bool del = true;
foreach (string key in ckw.Keywords)
{
if (word.ToLower().Contains(key.ToLower()) && word != "" && key != "")
{
del = false;
found = true;
}
}
if (del) { returnthing.Remove(ckw); }
}
}
if (!found) { return null; }
else
{
List<string> k = new List<string>();
foreach (CommandKeywords ck in returnthing) { k.Add(ck.Cmd.name); }
return k.ToArray();
}
}
}
}