mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Fix /afk list
This commit is contained in:
parent
7be031adfc
commit
2097da26da
@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) {
|
||||
if (!Entities.CanSee(p, pl) || !pl.IsAfk) continue;
|
||||
Player.Message(p, p.name);
|
||||
Player.Message(p, pl.ColoredName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ namespace MCGalaxy.DB {
|
||||
}
|
||||
}
|
||||
|
||||
public override long CountEntries(Stream s) {
|
||||
return (s.Length / BlockDBFile.EntrySize) - BlockDBFile.HeaderEntries;
|
||||
}
|
||||
|
||||
static void WriteEntries(Stream s, byte[] bulk, BlockDBEntry[] entries, int count) {
|
||||
for (int i = 0; i < count; i += BulkEntries) {
|
||||
int bulkCount = Math.Min(BulkEntries, count - i);
|
||||
|
@ -74,6 +74,8 @@ namespace MCGalaxy.DB {
|
||||
/// <returns> whether an entry before start time was reached. </returns>
|
||||
public abstract bool FindChangesBy(Stream s, int[] ids, int start, int end, Action<BlockDBEntry> output);
|
||||
|
||||
/// <summary> Returns number of entries in the backing file. </summary>
|
||||
public abstract long CountEntries(Stream s);
|
||||
|
||||
/// <summary> Deletes the backing file on disc if it exists. </summary>
|
||||
public static void DeleteBackingFile(string map) {
|
||||
@ -95,8 +97,9 @@ namespace MCGalaxy.DB {
|
||||
string path = FilePath(map);
|
||||
if (!File.Exists(path)) return 0;
|
||||
|
||||
using (Stream src = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite))
|
||||
return (src.Length / 16) - 1;
|
||||
using (Stream src = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)) {
|
||||
return V1.CountEntries(src);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user