diff --git a/GUI/Window/Window.Designer.cs b/GUI/Window/Window.Designer.cs
index a61749509..503e9b712 100644
--- a/GUI/Window/Window.Designer.cs
+++ b/GUI/Window/Window.Designer.cs
@@ -369,21 +369,21 @@ namespace MCGalaxy.Gui
//
this.icon_openConsole.Name = "icon_openConsole";
this.icon_openConsole.Size = new System.Drawing.Size(157, 22);
- this.icon_openConsole.Text = "Open Console";
+ this.icon_openConsole.Text = "Open console";
this.icon_openConsole.Click += new System.EventHandler(this.openConsole_Click);
//
// icon_shutdown
//
this.icon_shutdown.Name = "icon_shutdown";
this.icon_shutdown.Size = new System.Drawing.Size(157, 22);
- this.icon_shutdown.Text = "Shutdown Server";
+ this.icon_shutdown.Text = "Shutdown server";
this.icon_shutdown.Click += new System.EventHandler(this.shutdownServer_Click);
//
// icon_restart
//
this.icon_restart.Name = "icon_restart";
this.icon_restart.Size = new System.Drawing.Size(157, 22);
- this.icon_restart.Text = "Restart Server";
+ this.icon_restart.Text = "Restart server";
this.icon_restart.Click += new System.EventHandler(this.icon_restart_Click);
//
// main_btnProps
diff --git a/GUI/Window/Window.Players.cs b/GUI/Window/Window.Players.cs
index af366684a..3073ba588 100644
--- a/GUI/Window/Window.Players.cs
+++ b/GUI/Window/Window.Players.cs
@@ -22,10 +22,12 @@ namespace MCGalaxy.Gui {
public partial class Window : Form {
PlayerProperties playerProps;
- public void UpdatePlayersListBox() {
+ void UpdatePlayers() {
RunOnUiThread(
delegate {
pl_listBox.Items.Clear();
+ UpdateNotifyIconText();
+
Player[] players = PlayerInfo.Online.Items;
foreach (Player p in players)
pl_listBox.Items.Add(p.name);
diff --git a/GUI/Window/Window.cs b/GUI/Window/Window.cs
index 9e1548831..8e791ad6d 100644
--- a/GUI/Window/Window.cs
+++ b/GUI/Window/Window.cs
@@ -74,12 +74,17 @@ namespace MCGalaxy.Gui {
}
- void MakeNotifyIcon() {
- notifyIcon.Text = Server.name.Truncate(63);
+ void UpdateNotifyIconText() {
+ int playerCount = PlayerInfo.Online.Count;
+ string players = " (" + playerCount + " players)";
+ notifyIcon.Text = (Server.name + players).Truncate(63);
+ }
+
+ void MakeNotifyIcon() {
+ UpdateNotifyIconText();
notifyIcon.ContextMenuStrip = this.icon_context;
notifyIcon.Icon = this.Icon;
notifyIcon.Visible = true;
- notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(notifyIcon1_MouseClick);
}
void InitServer() {
@@ -114,11 +119,11 @@ namespace MCGalaxy.Gui {
public void RunOnUiThread(Action act) { Invoke(act); }
void Player_PlayerConnect(Player p) {
- UpdatePlayersListBox();
+ UpdatePlayers();
}
void Player_PlayerDisconnect(Player p, string reason) {
- UpdatePlayersListBox();
+ UpdatePlayers();
}
void Player_OnSendMap(Player p, byte[] buffer) {
@@ -149,7 +154,7 @@ namespace MCGalaxy.Gui {
Invoke(new VoidDelegate(SettingsUpdate));
} else {
Text = Server.name + " - " + Server.SoftwareNameVersioned;
- notifyIcon.Text = Server.name.Truncate(63);
+ UpdateNotifyIconText();
}
}
@@ -193,6 +198,7 @@ namespace MCGalaxy.Gui {
Invoke(new PlayerListCallback(UpdateClientList), playerList); return;
}
+ UpdateNotifyIconText();
if (main_Players.DataSource == null)
main_Players.DataSource = pc;
@@ -303,7 +309,7 @@ namespace MCGalaxy.Gui {
MCGalaxy.Gui.App.ExitProgram(false);
notifyIcon.Dispose();
}
-
+
if (Server.shuttingDown || MessageBox.Show("Really shutdown the server? All players will be disconnected!", "Exit", MessageBoxButtons.OKCancel) == DialogResult.OK) {
if (!Server.shuttingDown) MCGalaxy.Gui.App.ExitProgram(false);
notifyIcon.Dispose();
@@ -328,12 +334,6 @@ namespace MCGalaxy.Gui {
ShowInTaskbar = WindowState != FormWindowState.Minimized;
}
- void notifyIcon1_MouseClick(object sender, MouseEventArgs e) {
- Show();
- BringToFront();
- WindowState = FormWindowState.Normal;
- }
-
void openConsole_Click(object sender, EventArgs e) {
Show();
BringToFront();
@@ -347,7 +347,7 @@ namespace MCGalaxy.Gui {
void tabs_Click(object sender, EventArgs e) {
try { UpdateUnloadedList(); }
catch { }
- try { UpdatePlayersListBox(); }
+ try { UpdatePlayers(); }
catch { }
try {
diff --git a/MCGalaxy/Commands/Moderation/CmdUndoPlayer.cs b/MCGalaxy/Commands/Moderation/CmdUndoPlayer.cs
index b5f8d12d8..7288ecf8c 100644
--- a/MCGalaxy/Commands/Moderation/CmdUndoPlayer.cs
+++ b/MCGalaxy/Commands/Moderation/CmdUndoPlayer.cs
@@ -29,7 +29,6 @@ namespace MCGalaxy.Commands.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 override bool SuperUseable { get { return false; } } // TODO: fix this to work from IRC and Console
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("xundo", null, "all"),
new CommandAlias("undoarea", "area"), new CommandAlias("ua", "area") }; }
diff --git a/MCGalaxy/Database/Undo/UndoFormat.cs b/MCGalaxy/Database/Undo/UndoFormat.cs
index a4754cc82..566b7abe4 100644
--- a/MCGalaxy/Database/Undo/UndoFormat.cs
+++ b/MCGalaxy/Database/Undo/UndoFormat.cs
@@ -101,9 +101,9 @@ namespace MCGalaxy.Undo {
/// Arguments provided to an UndoFormat for retrieving undo data.
public class UndoFormatArgs {
-
- /// Player associated with this undo, can be console or IRC.
- internal readonly Player Player;
+
+ /// Level to retrieve undo data on.
+ internal readonly string LevelName;
/// Small work buffer, used to avoid memory allocations.
internal byte[] Temp;
@@ -115,15 +115,13 @@ namespace MCGalaxy.Undo {
/// First instance in time that undo data should be retrieved back to.
internal readonly DateTime Start;
- public UndoFormatArgs(Player p, DateTime start) {
- Player = p; Start = start;
+ public UndoFormatArgs(string lvlName, DateTime start) {
+ LevelName = lvlName; Start = start;
}
}
public struct UndoFormatEntry {
- public string LevelName;
- public DateTime Time;
-
+ public DateTime Time;
public ushort X, Y, Z;
public ExtBlock Block;
public ExtBlock NewBlock;
diff --git a/MCGalaxy/Database/Undo/UndoFormatBin.cs b/MCGalaxy/Database/Undo/UndoFormatBin.cs
index 838cb6f1b..e2571e793 100644
--- a/MCGalaxy/Database/Undo/UndoFormatBin.cs
+++ b/MCGalaxy/Database/Undo/UndoFormatBin.cs
@@ -31,7 +31,6 @@ namespace MCGalaxy.Undo {
public override IEnumerable GetEntries(Stream s, UndoFormatArgs args) {
List list = new List();
UndoFormatEntry pos;
- bool super = Player.IsSuper(args.Player);
DateTime start = args.Start;
ReadHeaders(list, s);
@@ -40,8 +39,7 @@ namespace MCGalaxy.Undo {
// Can we safely discard the entire chunk?
bool inRange = chunk.BaseTime.AddTicks(65536 * TimeSpan.TicksPerSecond) >= start;
if (!inRange) { args.Stop = true; yield break; }
- if (!super && !args.Player.level.name.CaselessEq(chunk.LevelName)) continue;
- pos.LevelName = chunk.LevelName;
+ if (!args.LevelName.CaselessEq(chunk.LevelName)) continue;
s.Seek(chunk.DataPosition, SeekOrigin.Begin);
if (args.Temp == null)
diff --git a/MCGalaxy/Database/Undo/UndoFormatCBin.cs b/MCGalaxy/Database/Undo/UndoFormatCBin.cs
index 052f6bd80..8f9ed09a8 100644
--- a/MCGalaxy/Database/Undo/UndoFormatCBin.cs
+++ b/MCGalaxy/Database/Undo/UndoFormatCBin.cs
@@ -31,7 +31,6 @@ namespace MCGalaxy.Undo {
public override IEnumerable GetEntries(Stream s, UndoFormatArgs args) {
List list = new List();
UndoFormatEntry pos;
- bool super = Player.IsSuper(args.Player);
DateTime start = args.Start;
ReadHeaders(list, s);
@@ -40,8 +39,7 @@ namespace MCGalaxy.Undo {
// Can we safely discard the entire chunk?
bool inRange = chunk.BaseTime.AddTicks((65536 >> 2) * TimeSpan.TicksPerSecond) >= start;
if (!inRange) { args.Stop = true; yield break; }
- if (!super && !args.Player.level.name.CaselessEq(chunk.LevelName)) continue;
- pos.LevelName = chunk.LevelName;
+ if (!args.LevelName.CaselessEq(chunk.LevelName)) continue;
s.Seek(chunk.DataPosition, SeekOrigin.Begin);
if (args.Temp == null)
diff --git a/MCGalaxy/Database/Undo/UndoFormatText.cs b/MCGalaxy/Database/Undo/UndoFormatText.cs
index 8469e7a12..c08a964d0 100644
--- a/MCGalaxy/Database/Undo/UndoFormatText.cs
+++ b/MCGalaxy/Database/Undo/UndoFormatText.cs
@@ -30,8 +30,6 @@ namespace MCGalaxy.Undo {
public override IEnumerable GetEntries(Stream s, UndoFormatArgs args) {
UndoFormatEntry pos = default(UndoFormatEntry);
string[] lines = new StreamReader(s).ReadToEnd().SplitSpaces();
- Player p = args.Player;
- bool super = Player.IsSuper(p);
DateTime start = args.Start;
// because we have space to end of each entry, need to subtract one otherwise we'll start at a "".
@@ -43,8 +41,7 @@ namespace MCGalaxy.Undo {
if (pos.Time < start) { args.Stop = true; yield break; }
string map = lines[(i * items) - 7];
- if (!super && !p.level.name.CaselessEq(map)) continue;
- pos.LevelName = map;
+ if (!args.LevelName.CaselessEq(map)) continue;
pos.X = ushort.Parse(lines[(i * items) - 6]);
pos.Y = ushort.Parse(lines[(i * items) - 5]);
diff --git a/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs b/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs
index 55b572d02..1374af268 100644
--- a/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs
+++ b/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs
@@ -67,7 +67,7 @@ namespace MCGalaxy.Drawing.Ops {
}
}
- UndoFormatArgs args = new UndoFormatArgs(Player, Start);
+ UndoFormatArgs args = new UndoFormatArgs(Level.name, Start);
DoOldHighlight(args);
}
diff --git a/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs b/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs
index 26707eb62..2b658be37 100644
--- a/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs
+++ b/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs
@@ -71,7 +71,7 @@ namespace MCGalaxy.Drawing.Ops {
}
}
- UndoFormatArgs args = new UndoFormatArgs(Player, Start);
+ UndoFormatArgs args = new UndoFormatArgs(Level.name, Start);
DoOldUndo(args);
}
@@ -107,17 +107,13 @@ namespace MCGalaxy.Drawing.Ops {
}
void DoOldUndo(Stream s, UndoFormat format, UndoFormatArgs args) {
- Level lvl = args.Player == null ? null : args.Player.level;
- string lastMap = null;
- DrawOpBlock block;
-
+ DrawOpBlock block;
foreach (UndoFormatEntry P in format.GetEntries(s, args)) {
- if (P.LevelName != lastMap) lvl = LevelInfo.FindExact(P.LevelName);
- if (lvl == null || P.Time > End) continue;
+ if (P.Time > End) continue;
if (P.X < Min.X || P.Y < Min.Y || P.Z < Min.Z) continue;
if (P.X > Max.X || P.Y > Max.Y || P.Z > Max.Z) continue;
- byte lvlBlock = lvl.GetTile(P.X, P.Y, P.Z);
+ byte lvlBlock = Level.GetTile(P.X, P.Y, P.Z);
if (lvlBlock == P.NewBlock.BlockID || Block.Convert(lvlBlock) == Block.water
|| Block.Convert(lvlBlock) == Block.lava || lvlBlock == Block.grass) {