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 override void Use(Player p, string message) { if (message == "") { Help(p); return; } if (message.IndexOf("'") != -1) { Player.SendMessage(p, "Cannot parse request."); return; } DataTable playerDb = MySQL.fillData("SELECT Name FROM Players WHERE IP='" + message + "'"); if (playerDb.Rows.Count == 0) { Player.SendMessage(p, "Could not find anyone with this IP"); return; } string playerNames = "Players with this IP: "; for (int i = 0; i < playerDb.Rows.Count; i++) { playerNames += playerDb.Rows[i]["Name"] + ", "; } playerNames = playerNames.Remove(playerNames.Length - 2); Player.SendMessage(p, playerNames); playerDb.Dispose(); }
public void showMBs(Player p) { p.showMBs = !p.showMBs; DataTable Messages = new DataTable("Messages"); Messages = MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "`"); int i; if (p.showMBs) { for (i = 0; i < Messages.Rows.Count; i++) { p.SendBlockchange((ushort)Messages.Rows[i]["X"], (ushort)Messages.Rows[i]["Y"], (ushort)Messages.Rows[i]["Z"], Block.MsgWhite); } Player.SendMessage(p, "Now showing &a" + i.ToString() + "&g CommandBlocks."); } else { for (i = 0; i < Messages.Rows.Count; i++) { p.SendBlockchange((ushort)Messages.Rows[i]["X"], (ushort)Messages.Rows[i]["Y"], (ushort)Messages.Rows[i]["Z"], p.level.GetTile((ushort)Messages.Rows[i]["X"], (ushort)Messages.Rows[i]["Y"], (ushort)Messages.Rows[i]["Z"])); } Player.SendMessage(p, "Now hiding CommandBlocks."); } Messages.Dispose(); }
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 override void Use(Player p, string message) { if (message == "") { message = p.name; } string originalName = message.ToLower(); message = message.Replace("'", "\\'"); message = message.Replace("--", ""); Player who = Player.Find(message); if (who == null) { Player.SendMessage(p, "Could not find player. Searching Player DB."); DataTable FindIP = MySQL.fillData("SELECT IP FROM Players WHERE Name='" + message + "'"); if (FindIP.Rows.Count == 0) { Player.SendMessage(p, "Could not find any player by the name entered."); FindIP.Dispose(); return; } message = FindIP.Rows[0]["IP"].ToString(); FindIP.Dispose(); } else { message = who.ip; } DataTable Clones = MySQL.fillData("SELECT Name FROM Players WHERE IP='" + message + "'"); if (Clones.Rows.Count == 0) { Player.SendMessage(p, "Could not find any record of the player entered."); return; } List <string> foundPeople = new List <string>(); for (int i = 0; i < Clones.Rows.Count; ++i) { if (!foundPeople.Contains(Clones.Rows[i]["Name"].ToString().ToLower())) { foundPeople.Add(Clones.Rows[i]["Name"].ToString().ToLower()); } } Clones.Dispose(); if (foundPeople.Count <= 1) { Player.SendMessage(p, originalName + " has no clones."); return; } Player.SendMessage(p, "These people have the same IP address:"); Player.SendMessage(p, string.Join(", ", foundPeople.ToArray())); }
public override void Use(Player p, string message) { int bancount = Group.findPerm(LevelPermission.Banned).playerList.All().Count; try { DataTable count = MySQL.fillData("SELECT COUNT(id) FROM players"); Player.SendMessage(p, "A total of " + count.Rows[0]["COUNT(id)"] + " unique players have visited this server."); Player.SendMessage(p, "Of these players, " + bancount + " have been banned."); count.Dispose(); } catch { Player.SendMessage(p, "A total of " + (int)(Player.players.Count + Player.left.Count) + " unique players have visited this server."); Player.SendMessage(p, "Of these players, " + bancount + " have been banned."); } int playerCount = 0; int hiddenCount = 0; foreach (Player pl in Player.players) { if (!pl.hidden || p.group.Permission > LevelPermission.AdvBuilder || Server.devs.Contains(p.name.ToLower())) { playerCount++; if (pl.hidden && (p.group.Permission > LevelPermission.AdvBuilder || Server.devs.Contains(p.name.ToLower()))) { hiddenCount++; } } } if (playerCount == 1) { if (hiddenCount == 0) { Player.SendMessage(p, "There is 1 player currently online."); } else { Player.SendMessage(p, "There is 1 player currently online (" + hiddenCount + " hidden)."); } } else { if (hiddenCount == 0) { Player.SendMessage(p, "There are " + playerCount + " players online."); } else { Player.SendMessage(p, "There are " + playerCount + " players online (" + hiddenCount + " hidden)."); } } }
public override void Use(Player p, string message) { if (!Server.useMySQL) { Player.SendMessage(p, "MySQL has not been configured! Please configure MySQL to use /viewlikes!"); return; } if (!Server.enableMapLiking) { Player.SendMessage(p, "Map liking is disabled."); return; } if (p == null && String.IsNullOrEmpty(message)) { 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; } DataTable likes = MySQL.fillData("SELECT * FROM `Likes" + l.name + "`"); if (likes.Rows.Count == 0) { Player.SendMessage(p, "Nobody likes this level yet!"); } else { string people = ""; int maxcount = (likes.Rows.Count < 3 ? likes.Rows.Count : 3); for (int i = 0; i < maxcount; i++) { people += Group.Find(Group.findPlayer(likes.Rows[i]["Username"].ToString().ToLower())).color + likes.Rows[i]["Username"].ToString() + "&g" + (maxcount >= 2 && i == maxcount - 2 && (likes.Rows.Count == maxcount) ? " and " : (i == maxcount - 1 ? "" : ",") + (i == maxcount - 1 && likes.Rows.Count != maxcount ? "" : " ")); } if (maxcount != likes.Rows.Count) { people += " and " + (likes.Rows.Count - maxcount) + (likes.Rows.Count - maxcount == 1 ? " other person " : " others "); } people += (likes.Rows.Count == 1 ? "likes" : "like") + " this level."; Player.SendMessage(p, people); } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } try { string foundNamesWithIP = ""; try { using (DataTable ip = MySQL.fillData("SELECT Name FROM Players WHERE IP = '" + message + "'")) if (ip.Rows.Count > 0) { for (int i = 0; i < ip.Rows.Count; i++) { foundNamesWithIP += ip.Rows[i]["Name"].ToString() + " "; } } // f*****g no string.join D: } catch (Exception e) { Server.ErrorLog(e); return; } IPAddress outIP = null; bool isIP = IPAddress.TryParse(message, out outIP); if (!isIP) { Command.all.Find("unban").Use(p, message); Command.all.Find("unbanip").Use(p, "@" + message); } else { for (int i = 0; i < foundNamesWithIP.Split(' ').Length; i++) { if (!String.IsNullOrEmpty(foundNamesWithIP.Split(' ')[i])) { Command.all.Find("unban").Use(p, foundNamesWithIP.Split(' ')[i]); Command.all.Find("unbanip").Use(p, foundNamesWithIP.Split(' ')[i]); } } } } catch { } }
public void showPortals(Player p) { p.showPortals = !p.showPortals; DataTable Portals = MySQL.fillData("SELECT * FROM `Portals" + p.level.name + "`"); int i; if (p.showPortals) { for (i = 0; i < Portals.Rows.Count; i++) { if (Portals.Rows[i]["ExitMap"].ToString() == p.level.name) { p.SendBlockchange((ushort)Portals.Rows[i]["ExitX"], (ushort)Portals.Rows[i]["ExitY"], (ushort)Portals.Rows[i]["ExitZ"], Block.orange_portal); } p.SendBlockchange((ushort)Portals.Rows[i]["EntryX"], (ushort)Portals.Rows[i]["EntryY"], (ushort)Portals.Rows[i]["EntryZ"], Block.blue_portal); } Player.SendMessage(p, "Now showing &a" + i.ToString() + "&g portals."); } else { for (i = 0; i < Portals.Rows.Count; i++) { if (Portals.Rows[i]["ExitMap"].ToString() == p.level.name) { p.SendBlockchange((ushort)Portals.Rows[i]["ExitX"], (ushort)Portals.Rows[i]["ExitY"], (ushort)Portals.Rows[i]["ExitZ"], Block.air); } p.SendBlockchange((ushort)Portals.Rows[i]["EntryX"], (ushort)Portals.Rows[i]["EntryY"], (ushort)Portals.Rows[i]["EntryZ"], p.level.GetTile((ushort)Portals.Rows[i]["EntryX"], (ushort)Portals.Rows[i]["EntryY"], (ushort)Portals.Rows[i]["EntryZ"])); } Player.SendMessage(p, "Now hiding portals."); } Portals.Dispose(); }
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; } if (message[0] == '@') { message = message.Remove(0, 1).Trim(); message = message.Replace("'", "\\'"); message = message.Replace("--", ""); Player who = Player.Find(message); if (who == null) { DataTable ip; int tryCounter = 0; rerun : try { ip = MySQL.fillData("SELECT IP FROM Players WHERE Name = '" + message + "'"); } catch (Exception e) { tryCounter++; if (tryCounter < 10) { goto rerun; } else { Server.ErrorLog(e); Player.SendMessage(p, "There was a database error fetching the IP address. It has been logged."); return; } } if (ip.Rows.Count > 0) { message = ip.Rows[0]["IP"].ToString(); } else { Player.SendMessage(p, "Unable to find an IP address for that user."); return; } ip.Dispose(); } else { message = who.ip; } } if (!regex.IsMatch(message)) { Player.SendMessage(p, "Not a valid ip!"); return; } if (p != null) { if (p.ip == message) { Player.SendMessage(p, "You shouldn't be able to use this command..."); return; } } if (!Server.bannedIP.Contains(message)) { Player.SendMessage(p, message + " doesn't seem to be banned..."); return; } Player.GlobalMessage(message + " got &8unip-banned" + "&g!"); Server.bannedIP.Remove(message); Server.bannedIP.Save("banned-ip.txt", false); Server.s.Log("IP-UNBANNED: " + message.ToLower()); }
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) { string usingName = ""; if (message == "") { Help(p); return; } if (message[0] == '@') { usingName = message.Remove(0, 1).Trim(); message = message.Remove(0, 1).Trim(); message = message.Replace("'", "\\'"); message = message.Replace("--", ""); Player who = Player.Find(message); if (Server.devs.Contains(message.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.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.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 == null) { DataTable ip; int tryCounter = 0; rerun : try { ip = MySQL.fillData("SELECT IP FROM Players WHERE Name = '" + message + "'"); } catch (Exception e) { tryCounter++; if (tryCounter < 10) { goto rerun; } else { Server.ErrorLog(e); return; } } if (ip.Rows.Count > 0) { message = ip.Rows[0]["IP"].ToString(); } else { Player.SendMessage(p, "Unable to find an IP address for that user."); return; } ip.Dispose(); } else { message = who.ip; } } else { Player who = Player.Find(message); if (who != null) { message = who.ip; } } if (message.Contains("127.0.0.") || message.Contains("192.168.")) { Player.SendMessage(p, "You can't ip-ban the server!"); return; } if (message.IndexOf('.') == -1) { Player.SendMessage(p, "Invalid IP!"); return; } if (message.Split('.').Length != 4) { Player.SendMessage(p, "Invalid IP!"); return; } if (p != null && p.ip == message) { Player.SendMessage(p, "You can't ip-ban yourself.!"); return; } if (Server.bannedIP.Contains(message)) { Player.SendMessage(p, message + " is already ip-banned."); return; } // Check if IP belongs to an op+ // First get names of active ops+ with that ip List <string> opNamesWithThatIP = (from pl in Player.players where (pl.ip == message && [email protected] >= LevelPermission.Operator) select pl.originalName).ToList(); List <string> devCheck = (from pl in Player.players where (pl.ip == message && (Server.devs.Contains(pl.originalName.ToLower()) || Server.staff.Contains(pl.originalName.ToLower()) || Server.administration.Contains(pl.originalName.ToLower()))) select pl.originalName).ToList(); // Next, add names from the database DataTable dbnames = MySQL.fillData("SELECT Name FROM Players WHERE IP = '" + message + "'"); foreach (DataRow row in dbnames.Rows) { opNamesWithThatIP.Add(row[0].ToString()); } foreach (DataRow row in dbnames.Rows) { devCheck.Add(row[0].ToString()); } if (devCheck != null && devCheck.Count > 0) { foreach (string dev in devCheck) { if (Server.devs.Contains(dev.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(dev.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(dev.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 (opNamesWithThatIP != null && opNamesWithThatIP.Count > 0) { // We have at least one op+ with a matching IP // Check permissions of everybody who matched that IP foreach (string opname in opNamesWithThatIP) { // If one of these guys is a dev, don't allow the ipban to proceed! if (Server.devs.Contains(opname.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(opname.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(opname.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; } // Console can ban anybody else, so skip this section if (p != null) { // If one of these guys matches a player with a higher rank don't allow the ipban to proceed! Group grp = Group.findPlayerGroup(opname); if (grp != null) { if (grp.Permission >= p.group.Permission) { Player.SendMessage(p, "You can only IP-ban IPs of players with a lower rank."); Player.SendMessage(p, Server.DefaultColor + opname + "(" + grp.color + grp.name + Server.DefaultColor + ") also has the IP of " + message + "."); Server.s.Log(p.name + " attempted to IP-ban " + message + " [Player " + opname + "(" + grp.name + ") also has the IP of " + message + "]"); return; } } } } } if (p != null) { IRCBot.Say(message.ToLower() + " is now ip-banned by " + p.name + "."); Server.s.Log("IP-BANNED: " + message.ToLower() + " by " + p.name + "."); Player.GlobalMessage(message + " is now &8ip-banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "."); } else { IRCBot.Say(message.ToLower() + " is now ip-banned by Console."); Server.s.Log("IP-BANNED: " + message.ToLower() + " by Console."); Player.GlobalMessage(message + " is now &8ip-banned" + Server.DefaultColor + " by Console."); } Server.bannedIP.Add(message); Server.bannedIP.Save("banned-ip.txt", false); /*try { * Player.players.ForEach(delegate(Player pl) { * if (((Player.Find(usingName).ip == pl.ip && pl.name.ToLower() != usingName.ToLower()) || (message == pl.ip)) && pl.group.Permission < p.group.Permission) * pl.Kick("Kicked by ip-ban!"); * }); * } * catch { } // try catched for possible enumeration error >.>*/ }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } Player pl = Player.Find(message); if (pl != null && !pl.hidden) { Player.SendMessage(p, pl.color + pl.name + "&g is online, using /whois instead."); Command.all.Find("whois").Use(p, message); return; } if (message.IndexOf("'") != -1) { Player.SendMessage(p, "Cannot parse request."); return; } string FoundRank = Group.findPlayer(message.ToLower()); DataTable playerDb = MySQL.fillData("SELECT * FROM Players WHERE Name='" + message + "'"); if (playerDb.Rows.Count == 0) { Player.SendMessage(p, Group.Find(FoundRank).color + message + "&g has the rank of " + Group.Find(FoundRank).color + FoundRank); return; } Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + "&g has :"); Player.SendMessage(p, "> > the rank of \"" + Group.Find(FoundRank).color + FoundRank); Player.SendMessage(p, "> > the display name of " + playerDb.Rows[0]["displayName"]); Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + "&g " + Server.moneys); Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + "&g times"); Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + "&g blocks."); //int ratio = (int)(Math.Round((decimal)(1 / (Math.Min(Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()), (Convert.ToInt64(playerDb.Rows[0]["totalBlocks"].ToString()) - Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()))) / Math.Max(Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()), (Convert.ToInt64(playerDb.Rows[0]["totalBlocks"].ToString()) - Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()))))))); Int64 builtBlocks = 0; try { builtBlocks = Convert.ToInt64(playerDb.Rows[0]["totalBlocks"].ToString()) - Convert.ToInt64(playerDb.Rows[0]["destroyedBlocks"].ToString()); } catch { builtBlocks = 0; } if (builtBlocks < 0) { builtBlocks = 0; } try { Player.SendMessage(p, "> > destroyed &a" + playerDb.Rows[0]["destroyedBlocks"].ToString() + "&g blocks, and built &a" + builtBlocks + "&g."); } catch { } Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]); try { if (Server.useMaxMind) { Player.SendMessage(p, "> > last logged in from country &a" + playerDb.Rows[0]["countryName"]); } } catch { } Player.SendMessage(p, "> > " + TimeSpent(playerDb.Rows[0]["TimeSpent"].ToString())); Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]); Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + "&g times, &c" + playerDb.Rows[0]["totalKicked"] + "&g of which ended in a kick."); Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards"); if (playerDb.Rows[0]["HasWOM"].ToString().Trim() == "") { Player.SendMessage(p, "> > last logged in without &cWOM Game Client" + "&g."); } else { Player.SendMessage(p, "> > last logged in using &aWOM Game Client" + "&g, Version &a" + playerDb.Rows[0]["HasWOM"].ToString().Trim() + "&g."); } // Last ranked/banned reason: string lastRankReason = playerDb.Rows[0]["lastRankReason"].ToString(); if (lastRankReason.ToLower() != "none" && !String.IsNullOrEmpty(lastRankReason)) { if (Group.findPerm(LevelPermission.Banned).playerList.Contains(message)) { Player.SendMessage(p, "> > last &8banned&g at &a" + lastRankReason.Split(']')[0].Substring(1) + "&g; Reason: &a" + lastRankReason.Substring(lastRankReason.IndexOf("]") + 1).Trim()); } else { Player.SendMessage(p, "> > last &branked&g at &a" + lastRankReason.Split(']')[0].Substring(1) + "&g; Reason: &a" + lastRankReason.Substring(lastRankReason.IndexOf("]") + 1).Trim()); } } bool skip = false; if (p != null) { if (p.group.Permission <= LevelPermission.Operator) { skip = true; } } if (!skip) { if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString())) { playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned"; } Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]); } if (Server.useWhitelist) { if (Server.whiteList.Contains(message.ToLower())) { Player.SendMessage(p, "> > Player is &fWhitelisted"); } } if (Server.devs.Contains(message.ToLower())) { Player.SendMessage(p, "&g> > Player is a &9Developer"); } if (Server.staff.Contains(message.ToLower())) { Player.SendMessage(p, "&g> > Player is a member of &4MCDawn Staff"); } if (Server.administration.Contains(message.ToLower())) { Player.SendMessage(p, "&g> > Player is a &6MCDawn Administrator"); } playerDb.Dispose(); }
public void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type) { if (!p.staticCommands) { p.ClearBlockchange(); } byte b = p.level.GetTile(x, y, z); if (b == Block.Zero) { Player.SendMessage(p, "Invalid Block(" + x + "," + y + "," + z + ")!"); return; } p.SendBlockchange(x, y, z, b); string message = "Block (" + x + "," + y + "," + z + "): "; message += "&f" + b + " = " + Block.Name(b); Player.SendMessage(p, message + "&g."); message = p.level.foundInfo(x, y, z); if (message != "") { Player.SendMessage(p, "Physics information: &a" + message); } DataTable Blocks = MySQL.fillData("SELECT * FROM `Block" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z); string Username, TimePerformed, BlockUsed; bool Deleted, foundOne = false; for (int i = 0; i < Blocks.Rows.Count; i++) { foundOne = true; Username = Blocks.Rows[i]["Username"].ToString(); TimePerformed = DateTime.Parse(Blocks.Rows[i]["TimePerformed"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); BlockUsed = Block.Name((byte)Blocks.Rows[i]["Type"]).ToString(); Deleted = (bool)Blocks.Rows[i]["Deleted"]; if (!Deleted) { Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + "&g, using &3" + BlockUsed); } else { Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + "&g, using &3" + BlockUsed); } Player.SendMessage(p, "Date and time modified: &2" + TimePerformed); } List <Level.BlockPos> inCache = p.level.blockCache.FindAll(bP => bP.x == x && bP.y == y && bP.z == z); for (int i = 0; i < inCache.Count; i++) { foundOne = true; Deleted = inCache[i].deleted; Username = inCache[i].name; TimePerformed = inCache[i].TimePerformed.ToString("yyyy-MM-dd HH:mm:ss"); BlockUsed = Block.Name(inCache[i].type); if (!Deleted) { Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + "&g, using &3" + BlockUsed); } else { Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + "&g, using &3" + BlockUsed); } Player.SendMessage(p, "Date and time modified: &2" + TimePerformed); } if (!foundOne) { Player.SendMessage(p, "This block has not been modified since the map was cleared."); } Blocks.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); }