public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } Player who = Player.Find(message.Split(' ')[0]); string whoTo; if (who != null) { whoTo = who.name; } else { whoTo = message.Split(' ')[0]; } message = message.Substring(message.IndexOf(' ') + 1); //DB MySQL.executeQuery("CREATE TABLE if not exists `Inbox" + whoTo + "` (PlayerFrom CHAR(20), TimeSent DATETIME, Contents VARCHAR(255));"); MySQL.executeQuery("INSERT INTO `Inbox" + whoTo + "` (PlayerFrom, TimeSent, Contents) VALUES ('" + p.name + "', '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + message.Replace("'", "\\'") + "')"); //DB Player.SendMessage(p, "Message sent to &5" + whoTo + "."); if (who != null) { who.SendMessage("Message recieved from &5" + p.name + Server.DefaultColor + "."); } }
public override void Use(Player p, string message) { if (!Server.useMySQL) { Player.SendMessage(p, "MySQL has not been configured! Please configure MySQL to use /unlike!"); return; } if (!Server.enableMapLiking) { Player.SendMessage(p, "Map liking is disabled."); return; } if (p == null) { Player.SendMessage(p, "Command not usable from Console."); return; } if (message.Split(' ').Length > 1) { Help(p); return; } Level l = (String.IsNullOrEmpty(message) ? p.level : Level.Find(message)); if (l == null) { Player.SendMessage(p, "Level could not be found or is not loaded."); return; } if (MySQL.fillData("SELECT * FROM `Likes" + l.name + "` WHERE Username='******'").Rows.Count == 0) { Player.SendMessage(p, "You have not liked this map yet."); return; } MySQL.executeQuery("DELETE FROM `Likes" + l.name + "` WHERE Username='******'"); l.likes--; Player.SendMessage(p, "Unliked map &a" + l.name + "&g!"); Command.all.Find("viewlikes").Use(p, ""); }
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type) { p.ClearBlockchange(); CatchPos cpos = (CatchPos)p.blockchangeObject; cpos.message = cpos.message.Replace("'", "\\'"); DataTable Messages = MySQL.fillData("SELECT * FROM `Commandblocks" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z); Messages.Dispose(); if (Messages.Rows.Count == 0) { MySQL.executeQuery("INSERT INTO `Commandblocks" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')"); } else { MySQL.executeQuery("UPDATE `Commandblocks" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z); } Player.SendMessage(p, "Message block placed."); p.level.Blockchange(p, x, y, z, cpos.type); p.SendBlockchange(x, y, z, cpos.type); if (p.staticCommands) { p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); } }
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type) { p.ClearBlockchange(); byte b = p.level.GetTile(x, y, z); p.SendBlockchange(x, y, z, b); CatchPos cpos = (CatchPos)p.blockchangeObject; Level.Zone Zn; Zn.smallX = Math.Min(cpos.x, x); Zn.smallY = Math.Min(cpos.y, y); Zn.smallZ = Math.Min(cpos.z, z); Zn.bigX = Math.Max(cpos.x, x); Zn.bigY = Math.Max(cpos.y, y); Zn.bigZ = Math.Max(cpos.z, z); Zn.Owner = cpos.Owner; p.level.ZoneList.Add(Zn); //DB MySQL.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", '" + Zn.Owner + "')"); //DB Player.SendMessage(p, "Added zone for &b" + cpos.Owner); }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } Level foundLevel = Level.Find(message); if (foundLevel != null) { foundLevel.Unload(); } if (foundLevel == Server.mainLevel) { Player.SendMessage(p, "Cannot delete the main level."); return; } try { if (!Directory.Exists("levels/deleted")) { Directory.CreateDirectory("levels/deleted"); } if (File.Exists("levels/" + message + ".lvl")) { if (File.Exists("levels/deleted/" + message + ".lvl")) { int currentNum = 0; while (File.Exists("levels/deleted/" + message + currentNum + ".lvl")) { currentNum++; } File.Move("levels/" + message + ".lvl", "levels/deleted/" + message + currentNum + ".lvl"); } else { File.Move("levels/" + message + ".lvl", "levels/deleted/" + message + ".lvl"); } Player.SendMessage(p, "Created backup."); try { File.Delete("levels/level properties/" + message + ".properties"); } catch { } try { File.Delete("levels/level properties/" + message); } catch { } MySQL.executeQuery("DROP TABLE `Block" + message + "`, `Portals" + message + "`, `Messages" + message + "`, `Zone" + message + "`"); Player.GlobalMessage("Level " + message + " was deleted."); } else { Player.SendMessage(p, "Could not find specified level."); } } catch (Exception e) { Player.SendMessage(p, "Error when deleting."); Server.ErrorLog(e); } }
public override void Use(Player p, string message) { Level l = Level.Find(message); if (l == null && message != "") { Player.SendMessage(p, "Could not find level."); return; } if (l == null) { l = p.level; } MySQL.executeQuery("TRUNCATE TABLE `Block" + l.name + "`"); Player.SendMessage(p, "Cleared &cALL" + Server.DefaultColor + " recorded block changes in: &d" + l.name); }
public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } Level foundLevel = Level.Find(message.Split(' ')[0]); string newName = message.Split(' ')[1]; if (File.Exists("levels/" + newName)) { Player.SendMessage(p, "Level already exists."); return; } if (foundLevel == Server.mainLevel) { Player.SendMessage(p, "Cannot rename the main level."); return; } if (foundLevel != null) { foundLevel.Unload(); } try { File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl"); 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 { } MySQL.executeQuery("RENAME TABLE `Block" + foundLevel.name.ToLower() + "` TO `Block" + newName.ToLower() + "`, `Portals" + foundLevel.name.ToLower() + "` TO `Portals" + newName.ToLower() + "`, `Messages" + foundLevel.name.ToLower() + "` TO Messages" + newName.ToLower() + "`, `Commandblocks" + foundLevel.name.ToLower() + "` TO Commandblocks" + newName.ToLower() + ", `Zone" + foundLevel.name.ToLower() + "` TO `Zone" + newName.ToLower() + "`"); Player.GlobalMessage("Renamed " + foundLevel.name + " to " + newName); } catch (Exception e) { Player.SendMessage(p, "Error when renaming."); Server.ErrorLog(e); } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } string[] args = message.Split(' '); Player who = Player.Find(args[0]); if (p.group.Permission < LevelPermission.Operator && who != p) { p.SendMessage("Cannot change title color of someone else."); return; } if (who == null) { Player.SendMessage(p, "Could not find player."); return; } if (args.Length == 1) { who.titlecolor = ""; Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " had their title color removed.", false); MySQL.executeQuery("UPDATE Players SET title_color = '' WHERE Name = '" + who.originalName + "'"); who.SetPrefix(); return; } else { string color = c.Parse(args[1]); if (color == "") { Player.SendMessage(p, "There is no color \"" + args[1] + "\"."); return; } else if (color == who.titlecolor) { Player.SendMessage(p, who.name + " already has that title color."); return; } else { MySQL.executeQuery("UPDATE Players SET title_color = '" + c.Name(color) + "' WHERE Name = '" + who.originalName + "'"); Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " had their title color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); who.titlecolor = color; who.SetPrefix(); } } }
public void ExitChange(Player p, ushort x, ushort y, ushort z, byte type) { p.ClearBlockchange(); byte b = p.level.GetTile(x, y, z); p.SendBlockchange(x, y, z, b); portalPos bp = (portalPos)p.blockchangeObject; foreach (portPos pos in bp.port) { DataTable Portals = MySQL.fillData("SELECT * FROM `Portals" + pos.portMapName + "` WHERE EntryX=" + (int)pos.x + " AND EntryY=" + (int)pos.y + " AND EntryZ=" + (int)pos.z); Portals.Dispose(); if (Portals.Rows.Count == 0) { MySQL.executeQuery("INSERT INTO `Portals" + pos.portMapName + "` (EntryX, EntryY, EntryZ, ExitMap, ExitX, ExitY, ExitZ) VALUES (" + (int)pos.x + ", " + (int)pos.y + ", " + (int)pos.z + ", '" + p.level.name + "', " + (int)x + ", " + (int)y + ", " + (int)z + ")"); } else { MySQL.executeQuery("UPDATE `Portals" + pos.portMapName + "` SET ExitMap='" + p.level.name + "', ExitX=" + (int)x + ", ExitY=" + (int)y + ", ExitZ=" + (int)z + " WHERE EntryX=" + (int)pos.x + " AND EntryY=" + (int)pos.y + " AND EntryZ=" + (int)pos.z); } //DB if (pos.portMapName == p.level.name) { p.SendBlockchange(pos.x, pos.y, pos.z, bp.type); } } Player.SendMessage(p, "&3Exit" + "&g block placed"); if (p.staticCommands) { bp.port.Clear(); p.blockchangeObject = bp; p.Blockchange += new Player.BlockchangeEventHandler(EntryChange); } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } int pos = message.IndexOf(' '); Player who = Player.Find(message.Split(' ')[0]); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } if (p != null && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot change the display name of someone of greater rank"); return; } string query; string newName = ""; if (message.Split(' ').Length > 1) { newName = message.Substring(pos + 1); } else { who.displayName = who.originalName; Player.GlobalChat(who, who.color + who.prefix + who.displayName + "&g has reverted their display name to their original name.", false); query = "UPDATE Players SET displayName = '" + who.originalName + "' WHERE Name = '" + who.originalName + "'"; MySQL.executeQuery(query); Player.GlobalDie(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); return; } if (newName.Length > 60) { Player.SendMessage(p, "Display Name must be under 60 letters."); return; } if (p == null || !Server.devs.Contains(p.originalName.ToLower())) { if (Server.devs.Contains(who.originalName.ToLower()) || Server.devs.Contains(Player.RemoveAllColors(newName).Trim().ToLower())) { Player.SendMessage(p, "Can't let you do that, starfox."); return; } } if (newName != "") { Player.GlobalChat(who, who.color + who.displayName + "&g has changed their display name to " + newName + "&g.", false); } if (newName == "") { query = "UPDATE Players SET displayName = '" + who.originalName + "' WHERE Name = '" + who.originalName + "'"; } else { query = "UPDATE Players SET displayName = '" + newName.Replace("'", "\\'") + "' WHERE Name = '" + who.originalName + "'"; } MySQL.executeQuery(query); who.displayName = newName; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); }
public override void Use(Player p, string message) { if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Zones!"); return; } CatchPos cpos; if (message == "") { p.ZoneCheck = true; Player.SendMessage(p, "Place a block where you would like to check for zones."); return; } else if (p.group.Permission < LevelPermission.Operator && p.level.name != Server.HomePrefix.ToLower() + p.name.ToLower()) { Player.SendMessage(p, "Reserved for OP+"); return; } if (message.IndexOf(' ') == -1) { if (p.canBuild == true) { switch (message.ToLower()) { case "del": p.zoneDel = true; Player.SendMessage(p, "Place a block where you would like to delete a zone."); return; default: Help(p); return; } } else { Player.SendMessage(p, "Cannot delete zone of higher rank."); return; } } if (message.ToLower() == "del all") { if (p.group.Permission < LevelPermission.Admin) { Player.SendMessage(p, "Only a " + Group.findPerm(LevelPermission.Admin).name + " may delete all zones at once"); return; } else { for (int i = 0; i < p.level.ZoneList.Count; i++) { Level.Zone Zn = p.level.ZoneList[i]; MySQL.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'"); Player.SendMessage(p, "Zone deleted for &b" + Zn.Owner); p.level.ZoneList.Remove(p.level.ZoneList[i]); if (i == p.level.ZoneList.Count) { Player.SendMessage(p, "Finished removing all zones"); return; } i--; } } } if (p.group.Permission < LevelPermission.Operator && p.level.name != Server.HomePrefix + p.name.ToLower()) { Player.SendMessage(p, "Setting zones is reserved for OP+"); return; } if (Group.Find(message.Split(' ')[1]) != null) { message = message.Split(' ')[0] + " grp" + Group.Find(message.Split(' ')[1]).name; } if (message.Split(' ')[0].ToLower() == "add") { Player foundPlayer = Player.Find(message.Split(' ')[1]); if (foundPlayer == null) { cpos.Owner = message.Split(' ')[1].ToString(); } else { cpos.Owner = foundPlayer.name; } } else { Help(p); return; } if (!Player.ValidName(cpos.Owner)) { Player.SendMessage(p, "INVALID NAME."); return; } cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos; Player.SendMessage(p, "Place two blocks to determine the edges."); Player.SendMessage(p, "Zone for: &b" + cpos.Owner + "."); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); }
public override void Use(Player p, string message) { try { if (message == "") { Help(p); return; } bool stealth = false; bool totalBan = false; if (message[0] == '#') { message = message.Remove(0, 1).Trim(); stealth = true; Server.s.Log("Stealth Ban Attempted"); } else if (message[0] == '@') { totalBan = true; message = message.Remove(0, 1).Trim(); } Player who = Player.Find(message.Split(' ')[0]); if (who == null) { /*if (!Player.ValidName(message)) * { * Player.SendMessage(p, "Invalid name \"" + message + "\"."); * return; * }*/ if (Server.devs.Contains(message.Split(' ')[0].ToLower())) { Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Developer!"); } else { Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Developer!"); } return; } if (Server.staff.Contains(message.Split(' ')[0].ToLower())) { Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Staff Member!"); } else { Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!"); } return; } if (Server.administration.Contains(message.Split(' ')[0].ToLower())) { Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Administrator!"); } else { Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!"); } return; } Group foundGroup = Group.findPlayerGroup(message.Split(' ')[0]); if (foundGroup.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!"); return; } if (foundGroup.Permission == LevelPermission.Banned) { Player.SendMessage(p, message.Split(' ')[0] + " is already banned."); return; } if (p != null && foundGroup.Permission >= p.group.Permission) { Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you."); return; } foundGroup.playerList.Remove(message.Split(' ')[0]); foundGroup.playerList.Save(); if (p != null) { Player.GlobalMessage(message.Split(' ')[0] + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "."); } else { Player.GlobalMessage(message.Split(' ')[0] + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by Console."); } Group.findPerm(LevelPermission.Banned).playerList.Add(message.Split(' ')[0]); if (message.Trim().Split(' ').Length == 1) { message += " No reason given."; } if (p != null) { if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains(p.name.ToLower())) { message += " (" + p.name + ")"; } } else { if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains("console")) { message += " (Console)"; } } MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + message.Substring(message.IndexOf(" ") + 1).Replace("'", "\\'").Trim() + "' WHERE Name = '" + message.Split(' ')[0] + "'"); Player.GlobalChat(null, "&6Reason: &f" + message.Substring(message.IndexOf(" ") + 1).Trim(), false); } else { if (!Player.ValidName(who.name)) { Player.SendMessage(p, "Invalid name \"" + who.name + "\"."); return; } if (Server.devs.Contains(who.originalName.ToLower())) { Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban an MCDawn Developer!"); } else { Player.GlobalMessage("The Console is crazy! Trying to ban an MCDawn Developer!"); } return; } if (Server.staff.Contains(who.originalName.ToLower())) { Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Staff Member!"); } else { Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!"); } return; } if (Server.administration.Contains(who.originalName.ToLower())) { Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!"); if (p != null) { Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Administrator!"); } else { Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!"); } return; } if (who.group.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "You can't ban a " + who.group.name + "!"); return; } if (who.group.Permission == LevelPermission.Banned) { Player.SendMessage(p, who.name + " is already banned."); return; } who.group.playerList.Remove(message.Split(' ')[0]); who.group.playerList.Save(); if (p != null) { if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "."); } else { Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".", false); } } else { if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH &8banned" + Server.DefaultColor + " by Console."); } else { Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by Console.", false); } } if (message.Trim().Split(' ').Length == 1) { message += " No reason given."; } if (p != null) { if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains(p.name.ToLower())) { message += " (" + p.name + ")"; } } else { if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains("console")) { message += " (Console)"; } } MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + message.Substring(message.IndexOf(" ") + 1).Replace("'", "\\'").Trim() + "' WHERE Name = '" + who.name + "'"); who.lastRankReason = "[" + DateTime.Now.ToString() + "] " + message.Substring(message.IndexOf(" ") + 1).Trim(); who.group = Group.findPerm(LevelPermission.Banned); who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Add(who.name); Player.GlobalChat(null, "&6Reason: &f" + message.Substring(message.IndexOf(" ") + 1).Trim(), false); } Group.findPerm(LevelPermission.Banned).playerList.Save(); if (p != null) { IRCBot.Say(message.Split(' ')[0] + " is now banned by " + p.name + "."); Server.s.Log("BANNED: " + message.Split(' ')[0].ToLower() + " by " + p.name + "."); } else { IRCBot.Say(message.Split(' ')[0] + " is now banned by Console."); Server.s.Log("BANNED: " + message.Split(' ')[0].ToLower() + " by Console."); } if (totalBan == true) { Command.all.Find("undo").Use(p, message.Split(' ')[0] + " 0"); Command.all.Find("banip").Use(p, "@ " + message.Split(' ')[0]); } } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { if (message == "" || message.Split(' ').Length > 2) { Help(p); return; } int pos = message.IndexOf(' '); if (pos != -1) { Player who = Player.Find(message.Substring(0, pos)); if (who == null) { Player.SendMessage(p, "There is no player \"" + message.Substring(0, pos) + "\"!"); return; } if (message.Substring(pos + 1) == "del") { MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + who.originalName + "'"); Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false); who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); who.SetPrefix(); return; } string color = c.Parse(message.Substring(pos + 1)); if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); } else if (color == who.color) { Player.SendMessage(p, who.name + " already has that color."); } else { //Player.GlobalChat(who, p.color + "*" + p.name + "&e changed " + who.color + Name(who.name) + // " color to " + color + // c.Name(color) + "&e.", false); MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + who.originalName + "'"); Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); who.color = color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); who.SetPrefix(); } } else { if (message == "del") { MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + p.originalName + "'"); Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false); p.color = p.group.color; Player.GlobalDie(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); return; } string color = c.Parse(message); if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); } else if (color == p.color) { Player.SendMessage(p, "You already have that color."); } else { MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + p.originalName + "'"); Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); p.color = color; Player.GlobalDie(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); } } }
public override void Use(Player p, string message) { try { MySQL.executeQuery("CREATE TABLE if not exists `Inbox" + p.name + "` (PlayerFrom CHAR(20), TimeSent DATETIME, Contents VARCHAR(255));"); if (message == "") { DataTable Inbox = MySQL.fillData("SELECT * FROM `Inbox" + p.name + "` ORDER BY TimeSent"); if (Inbox.Rows.Count == 0) { Player.SendMessage(p, "No messages found."); Inbox.Dispose(); return; } for (int i = 0; i < Inbox.Rows.Count; ++i) { Player.SendMessage(p, i + ": From &5" + Inbox.Rows[i]["PlayerFrom"].ToString() + Server.DefaultColor + " at &a" + Inbox.Rows[i]["TimeSent"].ToString()); } Inbox.Dispose(); } else if (message.Split(' ')[0].ToLower() == "del" || message.Split(' ')[0].ToLower() == "delete") { int FoundRecord = -1; if (message.Split(' ')[1].ToLower() != "all") { try { FoundRecord = int.Parse(message.Split(' ')[1]); } catch { Player.SendMessage(p, "Incorrect number given."); return; } if (FoundRecord < 0) { Player.SendMessage(p, "Cannot delete records below 0"); return; } } DataTable Inbox = MySQL.fillData("SELECT * FROM `Inbox" + p.name + "` ORDER BY TimeSent"); if (Inbox.Rows.Count - 1 < FoundRecord || Inbox.Rows.Count == 0) { Player.SendMessage(p, "\"" + FoundRecord + "\" does not exist."); Inbox.Dispose(); return; } string queryString; if (FoundRecord == -1) { queryString = "TRUNCATE TABLE `Inbox" + p.name + "`"; } else { queryString = "DELETE FROM `Inbox" + p.name + "` WHERE PlayerFrom='" + Inbox.Rows[FoundRecord]["PlayerFrom"] + "' AND TimeSent='" + Convert.ToDateTime(Inbox.Rows[FoundRecord]["TimeSent"]).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } MySQL.executeQuery(queryString); if (FoundRecord == -1) { Player.SendMessage(p, "Deleted all messages."); } else { Player.SendMessage(p, "Deleted message."); } Inbox.Dispose(); } else { int FoundRecord; try { FoundRecord = int.Parse(message); } catch { Player.SendMessage(p, "Incorrect number given."); return; } if (FoundRecord < 0) { Player.SendMessage(p, "Cannot read records below 0"); return; } DataTable Inbox = MySQL.fillData("SELECT * FROM `Inbox" + p.name + "` ORDER BY TimeSent"); if (Inbox.Rows.Count - 1 < FoundRecord || Inbox.Rows.Count == 0) { Player.SendMessage(p, "\"" + FoundRecord + "\" does not exist."); Inbox.Dispose(); return; } Player.SendMessage(p, "Message from &5" + Inbox.Rows[FoundRecord]["PlayerFrom"] + Server.DefaultColor + " sent at &a" + Inbox.Rows[FoundRecord]["TimeSent"] + ":"); Player.SendMessage(p, Inbox.Rows[FoundRecord]["Contents"].ToString()); Inbox.Dispose(); } } catch { Player.SendMessage(p, "Error accessing inbox. You may have no mail, try again."); } }
public override void Use(Player p, string message) { if (message.Split(' ').Length < 2) { Help(p); return; } Player who = Player.Find(message.Split(' ')[0]); Group newRank = Group.Find(message.Split(' ')[1]); string msgGave; if (p != null) { if (message.Split(' ').Length > 2) { msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)) + " (" + p.name + ")"; } else { msgGave = "No reason given. (" + p.name + ")."; } } else if (message.Split(' ').Length > 2) { msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)) + " (Console)"; } else { msgGave = "No reason given. (Console)."; } if (newRank == null) { Player.SendMessage(p, "Could not find specified rank."); return; } Group bannedGroup = Group.findPerm(LevelPermission.Banned); if (who == null) { //if (Server.devs.Contains(message.ToLower())) { p.SendMessage("Can't let you do that, Starfox."); return; } string foundName = message.Split(' ')[0]; if (Group.findPlayerGroup(foundName) == bannedGroup || newRank == bannedGroup) { Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\"."); return; } if (p != null) { if (Group.findPlayerGroup(foundName).Permission >= p.group.Permission || newRank.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot change the rank of someone equal or higher than you"); return; } } Group oldGroup = Group.findPlayerGroup(foundName); oldGroup.playerList.Remove(foundName); oldGroup.playerList.Save(); newRank.playerList.Add(foundName); newRank.playerList.Save(); msgGave = msgGave.Trim(); Player.GlobalMessage(foundName + " &f(offline)" + "&g's rank was set to " + newRank.color + newRank.name); MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + msgGave.Replace("'", "\\'") + "' WHERE Name = '" + foundName + "'"); Player.GlobalChat(null, "&6Reason: &f" + msgGave, false); } else { //if (!Server.devs.Contains(p.name) && Server.devs.Contains(who.name)) { p.SendMessage("Can't let you do that, Starfox."); return; } if (p != null) { if (who.group == bannedGroup || newRank == bannedGroup) { Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\"."); return; } if (who.group.Permission >= p.group.Permission || newRank.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot change the rank of someone equal or higher to yourself."); return; } } who.group.playerList.Remove(who.name); who.group.playerList.Save(); newRank.playerList.Add(who.name); newRank.playerList.Save(); msgGave = msgGave.Trim(); Player.GlobalChat(who, who.color + who.name + "&g's rank was set to " + newRank.color + newRank.name, false); Player.GlobalChat(null, "&6Reason: &f" + msgGave, false); who.group = newRank; who.color = who.group.color; Player.GlobalDie(who, false); who.SendMessage("You are now ranked " + newRank.color + newRank.name + "&g, type /help for your new set of commands."); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); try { if (!Server.cli) { MCDawn.Gui.Window.thisWindow.UpdateClientList(Player.players); } } catch { } MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + msgGave.Replace("'", "\\'") + "' WHERE Name = '" + who.originalName + "'"); who.lastRankReason = "[" + DateTime.Now.ToString() + "] " + msgGave; } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } int pos = message.IndexOf(' '); Player who = Player.Find(message.Split(' ')[0]); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } //if (message.ToLower().Contains("$server") || message.ToLower().Contains("$motd")) { p.SendMessage("Certain Chat Variables are not allowed in titles."); return; } //if (p.group.Permission < LevelPermission.Operator && who != p && p != null) { p.SendMessage("Cannot change title of someone else."); return; } if (p != null && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot change the title of someone of greater rank"); return; } string query; string newTitle = ""; if (message.Split(' ').Length > 1) { newTitle = message.Substring(pos + 1); } else { who.title = ""; who.SetPrefix(); Player.GlobalChat(who, who.color + who.name + "&g had their title removed.", false); query = "UPDATE Players SET Title = '' WHERE Name = '" + who.originalName + "'"; MySQL.executeQuery(query); return; } if (newTitle != "") { newTitle = newTitle.ToString().Trim().Replace("[", ""); newTitle = newTitle.Replace("]", ""); newTitle = newTitle.Replace("--", ""); /* if (newTitle[0].ToString() != "[") newTitle = "[" + newTitle; * if (newTitle.Trim()[newTitle.Trim().Length - 1].ToString() != "]") newTitle = newTitle.Trim() + "]"; * if (newTitle[newTitle.Length - 1].ToString() != " ") newTitle = newTitle + " "; */ } if (Player.RemoveAllColors(newTitle).Length > 17) { Player.SendMessage(p, "Title must be under 17 letters."); return; } if (p == null || !Server.devs.Contains(p.originalName.ToLower())) { if (Server.devs.Contains(who.originalName.ToLower()) || Player.RemoveAllColors(newTitle.ToLower()).Contains("dev")) { Player.SendMessage(p, "Can't let you do that, starfox."); return; } } if (newTitle != "") { Player.GlobalChat(who, who.color + who.name + "&g was given the title of &b[" + newTitle + "]", false); } else { Player.GlobalChat(who, who.color + who.prefix + who.name + "&g had their title removed.", false); } if (newTitle == "") { query = "UPDATE Players SET Title = '' WHERE Name = '" + who.originalName + "'"; } else { query = "UPDATE Players SET Title = '" + newTitle.Replace("'", "\\'") + "' WHERE Name = '" + who.originalName + "'"; } MySQL.executeQuery(query); who.title = newTitle; who.SetPrefix(); }
public override void Use(Player p, string message) { bool anotherPlayer = false; if (message.Split(' ').Length < 3 && (message.ToLower() != "reset" || message.Split(' ')[1].ToLower() != "reset")) { Help(p); return; } if (message.Split(' ').Length > 3) { anotherPlayer = true; } if (message.Split(' ').Length > 4) { Help(p); return; } int days = 0; int hours = 0; int minutes = 0; if (message.ToLower() != "reset" || message.Split(' ')[1].ToLower() != "reset") { try { if (!anotherPlayer) { days = Convert.ToInt32(message.Split(' ')[0]); hours = Convert.ToInt32(message.Split(' ')[1]); minutes = Convert.ToInt32(message.Split(' ')[2]); } else { days = Convert.ToInt32(message.Split(' ')[1]); hours = Convert.ToInt32(message.Split(' ')[2]); minutes = Convert.ToInt32(message.Split(' ')[3]); } if (hours > 23) { Player.SendMessage(p, "Hours cannot be greater than 23."); return; } if (minutes > 59) { Player.SendMessage(p, "Minutes cannot be greater than 59."); return; } } catch { p.SendMessage("Invalid Days/Hours/Minutes."); return; } } if (!anotherPlayer) { p.timeSpent = days + " " + hours + " " + minutes + " 1"; // MySQL Save timeSpent. MySQL.executeQuery("UPDATE Players SET TimeSpent='" + p.timeSpent + "' WHERE Name='" + p.originalName + "'"); p.SendMessage("Your time spent was set at: &a" + days + " Days, " + hours + " Hours, " + minutes + " Minutes."); } else { Player who = Player.Find(message.Split(' ')[0]); if (who == null) { Player.SendMessage(p, "Player could not be found."); return; } if (p != null && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot change player of higher rank's time spent."); return; } who.timeSpent = days + " " + hours + " " + minutes + " 1"; MySQL.executeQuery("UPDATE Players SET TimeSpent = '" + who.timeSpent + "' WHERE Name = '" + who.originalName + "'"); if (who != p) { Player.SendMessage(p, who.color + who.name + "&g's time spent was set at: &a" + days + " Days, " + hours + " Hours, " + minutes + " Minutes."); if (p != null) { Player.SendMessage(who, "Your time spent was set at: &a" + days + " Days, " + hours + " Hours, " + minutes + " Minutes " + "&gby " + p.color + p.name + "&g."); } else { Player.SendMessage(who, "Your time spent was set at: &a" + days + " Days, " + hours + " Hours, " + minutes + " Minutes " + "&gby the Console."); } } else { Player.SendMessage(p, "Your time spent was set at: &a" + days + " Days, " + hours + " Hours, " + minutes + " Minutes."); } } }
public override void Use(Player p, string message) { if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Zones!"); return; } if (message == "") { Help(p); return; } string[] split = message.Split(' '); string target = split[0]; string zoneOwner; if (split.Length == 2) { Level level = Level.Find(target); if (!File.Exists("levels/" + target.ToLower() + ".lvl")) { Player.SendMessage(p, "No such level \"" + target + "\"!"); return; } if (Group.Find(split[1]) != null) { zoneOwner = "grp" + Group.Find(split[1]).name; } else if (Player.Find(split[1]) != null) { zoneOwner = Player.Find(split[1]).name; } else { zoneOwner = split[1]; } MySQL.executeQuery("INSERT INTO `Zone" + target + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + 0 + ", " + 0 + ", " + 0 + ", " + (p.level.width - 1) + ", " + (p.level.depth - 1) + ", " + (p.level.height - 1) + ", '" + zoneOwner + "')"); Player.SendMessage(p, "Zoned entire level " + target + " for &b" + zoneOwner); if (level != null) { Level.Zone Zn; Zn.smallX = 0; Zn.smallY = 0; Zn.smallZ = 0; Zn.bigX = (ushort)(p.level.width - 1); Zn.bigY = (ushort)(p.level.depth - 1); Zn.bigZ = (ushort)(p.level.height - 1); Zn.Owner = zoneOwner; level.ZoneList.Add(Zn); } } else if (split.Length == 1) { if (Group.Find(split[0]) != null) { zoneOwner = "grp" + Group.Find(split[0]).name; } else if (Player.Find(split[0]) != null) { zoneOwner = Player.Find(split[0]).name; } else { zoneOwner = split[0]; } MySQL.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + 0 + ", " + 0 + ", " + 0 + ", " + (p.level.width - 1) + ", " + (p.level.depth - 1) + ", " + (p.level.height - 1) + ", '" + zoneOwner + "')"); Player.SendMessage(p, "Zoned entire level " + p.level.name + " for &b" + zoneOwner); Level.Zone Zn; Zn.smallX = 0; Zn.smallY = 0; Zn.smallZ = 0; Zn.bigX = (ushort)(p.level.width - 1); Zn.bigY = (ushort)(p.level.depth - 1); Zn.bigZ = (ushort)(p.level.height - 1); Zn.Owner = zoneOwner; p.level.ZoneList.Add(Zn); } else { Help(p); return; } }
public override void Use(Player p, string message) { try { if (message == "") { Help(p); return; } string[] args = message.Split(' '); Player who = Player.Find(args[0]); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } if (args.Length == 1) { who.titlebracket = 0; Player.GlobalChat(who, who.color + who.name + "&g had their title bracket set to default.", false); MySQL.executeQuery("UPDATE Players SET titleBracket = 0 WHERE Name = '" + who.name + "'"); who.SetPrefix(); return; } else { int bracket = 0; switch (bracket) { case 0: who.tbracketstart = "["; who.tbracketend = "]"; break; case 1: who.tbracketstart = "("; who.tbracketend = ")"; break; case 2: who.tbracketstart = "{"; who.tbracketend = "}"; break; case 3: who.tbracketstart = "~"; who.tbracketend = "~"; break; case 4: who.tbracketstart = "<"; who.tbracketstart = ">"; break; default: who.tbracketstart = "["; who.tbracketend = "]"; break; } if (bracket != 0 && bracket != 1 && bracket != 2 && bracket != 3 && bracket != 4) { Player.SendMessage(p, "The title brackets \"" + args[1] + "\" are not allowed."); return; } else { MySQL.executeQuery("UPDATE Players SET titleBracket = " + bracket + " WHERE Name = '" + who.name + "'"); who.titlebracket = bracket; who.SetPrefix(); Player.GlobalChat(who, who.color + who.name + "&g had their title bracket changed to " + who.tbracketstart + " and " + who.tbracketend + "&g.", false); who.titlebracket = bracket; who.SetPrefix(); } } } catch (Exception) { p.SendMessage("Error with Title Brackets."); } }