Core: Fix not being to /undo an /undo of an online player.

This commit is contained in:
UnknownShadow200 2016-09-16 21:45:18 +10:00
parent 61b18dd9d9
commit 1679c25a1f
4 changed files with 12 additions and 10 deletions

View File

@ -44,25 +44,27 @@ namespace MCGalaxy.Drawing.Ops {
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush, Action<DrawOpBlock> output) {
UndoCache cache = who.UndoBuffer;
using (IDisposable locker = cache.ClearLock.AccquireReadLock()) {
if (UndoBlocks(who)) return;
if (UndoBlocks(p, who)) return;
}
bool found = false;
string target = who.name.ToLower();
if (Min.X != ushort.MaxValue)
if (Min.X != ushort.MaxValue) {
UndoFormat.DoUndoArea(p, target, Start, Min, Max, ref found);
else
} else {
UndoFormat.DoUndo(p, target, Start, End, ref found);
}
}
bool UndoBlocks(Player p) {
bool UndoBlocks(Player p, Player who) {
UndoFormatArgs args = new UndoFormatArgs(p, Start);
UndoFormat format = new UndoFormatOnline(p.UndoBuffer);
UndoFormat format = new UndoFormatOnline(who.UndoBuffer);
if (Min.X != ushort.MaxValue)
if (Min.X != ushort.MaxValue) {
UndoFormat.DoUndoArea(null, Min, Max, format, args);
else
} else {
UndoFormat.DoUndo(null, End, format, args);
}
return args.Stop;
}
}

View File

@ -38,7 +38,7 @@ namespace MCGalaxy.Undo {
protected override IEnumerable<UndoFormatEntry> GetEntries(Stream s, UndoFormatArgs args) {
List<ChunkHeader> list = new List<ChunkHeader>();
UndoFormatEntry pos;
bool super = args.Player == null || args.Player.ircNick != null;
bool super = Player.IsSuper(args.Player);
DateTime start = args.Start;
ReadHeaders(list, s);

View File

@ -102,7 +102,7 @@ namespace MCGalaxy.Undo {
List<ChunkHeader> list = new List<ChunkHeader>();
UndoFormatEntry pos;
UndoCacheItem item = default(UndoCacheItem);
bool super = args.Player == null || args.Player.ircNick != null;
bool super = Player.IsSuper(args.Player);
DateTime start = args.Start;
ReadHeaders(list, s);

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Undo {
if (node == null) yield break;
UndoFormatEntry pos;
bool super = args.Player == null || args.Player.ircNick != null;
bool super = Player.IsSuper(args.Player);
DateTime start = args.Start;
while (node != null) {