mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-28 07:56:20 -04:00
[Highly experimental, may still have bugs] - minimised memory usage of storing online player undo data.
This commit is contained in:
parent
f8e83786c2
commit
dd9c2a4158
@ -71,7 +71,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
while (node != null) {
|
||||
Level lvl = LevelInfo.FindExact(node.MapName);
|
||||
if (lvl != p.level) continue;
|
||||
if (lvl != p.level) { node = node.Prev; continue; }
|
||||
List<UndoCacheItem> items = node.Items;
|
||||
|
||||
for (int i = items.Count - 1; i >= 0; i--) {
|
||||
|
@ -42,7 +42,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
while (node != null) {
|
||||
Level lvl = LevelInfo.FindExact(node.MapName);
|
||||
if (lvl == null) continue;
|
||||
if (lvl == null) { node = node.Prev; continue; }
|
||||
List<UndoCacheItem> items = node.Items;
|
||||
|
||||
for (int i = items.Count - 1; i >= 0; i--) {
|
||||
|
@ -159,7 +159,7 @@ namespace MCGalaxy.Commands
|
||||
|
||||
while (node != null) {
|
||||
Level lvl = LevelInfo.FindExact(node.MapName);
|
||||
if (lvl == null) continue;
|
||||
if (lvl == null) { node = node.Prev; continue; }
|
||||
saveLvl = lvl;
|
||||
List<UndoCacheItem> items = node.Items;
|
||||
|
||||
|
@ -402,7 +402,7 @@ namespace MCGalaxy {
|
||||
Server.ErrorLog(e);
|
||||
}
|
||||
try {
|
||||
SaveUndo();
|
||||
SaveUndo(this);
|
||||
} catch (Exception e) {
|
||||
Server.s.Log("Error saving undo data.");
|
||||
Server.ErrorLog(e);
|
||||
@ -559,7 +559,7 @@ namespace MCGalaxy {
|
||||
if (name == "") {
|
||||
if (socket != null) CloseSocket();
|
||||
connections.Remove(this);
|
||||
SaveUndo();
|
||||
SaveUndo(this);
|
||||
disconnected = true;
|
||||
return;
|
||||
}
|
||||
@ -637,8 +637,6 @@ namespace MCGalaxy {
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveUndo() { SaveUndo(this); }
|
||||
|
||||
public static void SaveUndo(Player p) {
|
||||
try {
|
||||
UndoFile.SaveUndo(p);
|
||||
|
@ -41,7 +41,7 @@ namespace MCGalaxy.Util {
|
||||
protected abstract string Extension { get; }
|
||||
|
||||
public static void SaveUndo(Player p) {
|
||||
if( p == null || p.UndoBuffer.Count < 1) return;
|
||||
if (p == null || p.UndoBuffer.Count < 1) return;
|
||||
|
||||
CreateDefaultDirectories();
|
||||
if (Directory.GetDirectories(undoDir).Length >= Server.totalUndo) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user