mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-03 10:33:29 -04:00
Add events for level copy, rename, delete
This commit is contained in:
parent
825ad6f0de
commit
63dc19c640
@ -100,4 +100,31 @@ namespace MCGalaxy.Events.LevelEvents {
|
||||
CallCommon(pl => pl(x, y, z, extraInfo, l));
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void OnLevelRenamed(string srcMap, string dstMap);
|
||||
public sealed class OnLevelRenamedEvent : IEvent<OnLevelRenamed> {
|
||||
|
||||
public static void Call(string srcMap, string dstMap) {
|
||||
if (handlers.Count == 0) return;
|
||||
CallCommon(pl => pl(srcMap, dstMap));
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void OnLevelCopied(string srcMap, string dstMap);
|
||||
public sealed class OnLevelCopiedEvent : IEvent<OnLevelCopied> {
|
||||
|
||||
public static void Call(string srcMap, string dstMap) {
|
||||
if (handlers.Count == 0) return;
|
||||
CallCommon(pl => pl(srcMap, dstMap));
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void OnLevelDeleted(string map);
|
||||
public sealed class OnLevelDeletedEvent : IEvent<OnLevelDeleted> {
|
||||
|
||||
public static void Call(string map) {
|
||||
if (handlers.Count == 0) return;
|
||||
CallCommon(pl => pl(map));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ namespace MCGalaxy {
|
||||
|
||||
RenameDatabaseTables(p, src, dst);
|
||||
BlockDBFile.MoveBackingFile(src, dst);
|
||||
OnLevelRenamedEvent.Call(src, dst);
|
||||
if (players == null) return true;
|
||||
|
||||
// Move all the old players to the renamed map
|
||||
@ -173,6 +174,7 @@ namespace MCGalaxy {
|
||||
DoAll(map, "", action_delete);
|
||||
DeleteDatabaseTables(map);
|
||||
BlockDBFile.DeleteBackingFile(map);
|
||||
OnLevelDeletedEvent.Call(map);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -234,6 +236,7 @@ namespace MCGalaxy {
|
||||
File.Copy(LevelInfo.MapPath(src), LevelInfo.MapPath(dst));
|
||||
DoAll(src, dst, action_copy);
|
||||
CopyDatabaseTables(src, dst);
|
||||
OnLevelCopiedEvent.Call(src, dst);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user