public void FlushData() { if (Program.isBeta) { return; } KONNode node = new KONNode("LEVELING_USER"); node.AddValue("id", Id); node.AddValue("xp", CurrentXP); node.AddValue("level", Level); node.AddValue("lastMessageTime", LastMessageTimestamp.ToUnixTimeSeconds()); node.AddValue("mentionForLevelUp", MentionForLevelUp); File.WriteAllText($@"{Utils.levelingDataPath}/Server_{Server.Id}/User_{Id}.cb", SensitiveInformation.EncryptDataFile(KONWriter.Default.Write(node))); }
public void EntityTerminated(IActorRef tref) { if (!IdByRef.TryGetValue(tref, out var id)) { return; } IdByRef = IdByRef.Remove(tref); RefById = RefById.Remove(id); if (PassivateIdleTask != null) { LastMessageTimestamp = LastMessageTimestamp.Remove(id); } if (MessageBuffers.TryGetValue(id, out var buffer) && buffer.Count != 0) { //Note; because we're not persisting the EntityStopped, we don't need // to persist the EntityStarted either. Log.Debug("Starting entity [{0}] again, there are buffered messages for it", id); this.SendMessageBuffer(new Shard.EntityStarted(id)); } else { if (!Passivating.Contains(tref)) { Log.Debug("Entity [{0}] stopped without passivating, will restart after backoff", id); Context.System.Scheduler.ScheduleTellOnce(Settings.TunningParameters.EntityRestartBackoff, Self, new Shard.RestartEntity(id), ActorRefs.NoSender); } else { ProcessChange(new Shard.EntityStopped(id), this.PassivateCompleted); } } Passivating = Passivating.Remove(tref); }