mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
add /pe ip
This commit is contained in:
parent
6f05dd57ee
commit
70593dde6c
@ -17,6 +17,7 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using MCGalaxy.DB;
|
||||
using MCGalaxy.SQL;
|
||||
|
||||
@ -75,6 +76,19 @@ namespace MCGalaxy.Commands.Maintenance {
|
||||
|
||||
PlayerDB.Update(args[0], PlayerData.ColumnTitle, args[2].UnicodeToCp437());
|
||||
MessageDataChanged(p, args[0], args[1], args[2]);
|
||||
} else if (opt == "ip") {
|
||||
if (args.Length < 3) {
|
||||
p.Message("A new IP address must be provided."); return;
|
||||
}
|
||||
|
||||
IPAddress ip;
|
||||
if (!IPAddress.TryParse(args[2], out ip)) {
|
||||
p.Message("%W\"{0}\" is not a valid IP address.", args[2]); return;
|
||||
}
|
||||
|
||||
if (who != null) who.ip = args[2];
|
||||
PlayerDB.Update(args[0], PlayerData.ColumnIP, args[2]);
|
||||
MessageDataChanged(p, args[0], args[1], args[2]);
|
||||
} else if (opt == "modified") {
|
||||
SetInteger(p, args, PlayerData.ColumnTotalBlocks, int.MaxValue, who,
|
||||
v => who.TotalModified = v, type_lo);
|
||||
@ -208,7 +222,7 @@ namespace MCGalaxy.Commands.Maintenance {
|
||||
}
|
||||
|
||||
static void MessageValidTypes(Player p) {
|
||||
p.Message("%HValid types: %SFirstLogin, LastLogin, Logins, Title, Deaths, Money, " +
|
||||
p.Message("%HValid types: %SFirstLogin, LastLogin, Logins, Title, IP, Deaths, Money, " +
|
||||
"Modified, Drawn, Placed, Deleted, TotalKicked, TimeSpent, Color, TitleColor, Messages ");
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,10 @@ namespace MCGalaxy.DB {
|
||||
public const string ColumnTitle = "title";
|
||||
public const string ColumnTColor = "title_color";
|
||||
|
||||
public const string ColumnName = "Name";
|
||||
public const string ColumnIP = "IP";
|
||||
public const string ColumnID = "ID";
|
||||
|
||||
public const string ColumnFirstLogin = "FirstLogin";
|
||||
public const string ColumnLastLogin = "LastLogin";
|
||||
public const string ColumnTimeSpent = "TimeSpent";
|
||||
@ -91,9 +95,9 @@ namespace MCGalaxy.DB {
|
||||
|
||||
internal static PlayerData Parse(IDataRecord record) {
|
||||
PlayerData data = new PlayerData();
|
||||
data.Name = record.GetText("Name");
|
||||
data.IP = record.GetText("IP");
|
||||
data.DatabaseID = record.GetInt("ID");
|
||||
data.Name = record.GetText(ColumnName);
|
||||
data.IP = record.GetText(ColumnIP);
|
||||
data.DatabaseID = record.GetInt(ColumnID);
|
||||
|
||||
// Backwards compatibility with old format
|
||||
string rawTime = record.GetText(ColumnTimeSpent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user