/// <summary> /// Initializes a new instance of the Lang class /// </summary> public Lang() { langFiles = new Dictionary <string, Dictionary <string, string> >(); langData = ProtoStorage.Load <LangData>("oxide.lang") ?? new LangData(); pluginRemovedFromManager = new Dictionary <Plugin, Event.Callback <Plugin, PluginManager> >(); Migrate(); // This should be deleted in a few weeks. (Added Oct 12, 2016) }
internal void PlayerJoin(PlayerSession session) { var id = session.SteamId.ToString(); var name = session.Identity.Name.Sanitize(); PlayerRecord record; if (playerData.TryGetValue(id, out record)) { record.Name = name; playerData[id] = record; allPlayers.Remove(id); allPlayers.Add(id, new HurtworldPlayer(session)); } else { record = new PlayerRecord { Id = (ulong)session.SteamId, Name = name }; playerData.Add(id, record); allPlayers.Add(id, new HurtworldPlayer(session)); } ProtoStorage.Save(playerData, "oxide.covalence"); }
private void NotifyPlayerJoin(BasePlayer player) { // Do they exist? PlayerRecord record; if (playerData.TryGetValue(player.UserIDString, out record)) { // Update record.Name = player.displayName; playerData[player.UserIDString] = record; // Swap out Rust player allPlayers.Remove(player.UserIDString); allPlayers.Add(player.UserIDString, new RustPlayer(player)); } else { // Insert record = new PlayerRecord { Id = player.userID, Name = player.displayName }; playerData.Add(player.UserIDString, record); // Create Rust player allPlayers.Add(player.UserIDString, new RustPlayer(player)); } // Save ProtoStorage.Save(playerData, "oxide.covalence"); }
private void NotifyPlayerJoin(BoltEntity entity) { var steamId = entity.source.RemoteEndPoint.SteamId.Id; var id = entity.source.RemoteEndPoint.SteamId.Id.ToString(); var name = SteamFriends.GetFriendPersonaName(new CSteamID(entity.source.RemoteEndPoint.SteamId.Id)); // Do they exist? PlayerRecord record; if (playerData.TryGetValue(id, out record)) { // Update record.Name = SteamFriends.GetFriendPersonaName(new CSteamID(entity.source.RemoteEndPoint.SteamId.Id)); playerData[id] = record; // Swap out Rust player allPlayers.Remove(id); allPlayers.Add(id, new TheForestPlayer(entity)); } else { // Insert record = new PlayerRecord { Id = steamId, Name = name }; playerData.Add(id, record); // Create Rust player allPlayers.Add(id, new TheForestPlayer(steamId, name)); } // Save ProtoStorage.Save(playerData, "oxide.covalence"); }
private void NotifyPlayerJoin(PlayerSession session) { var id = session.SteamId.ToString(); // Do they exist? PlayerRecord record; if (playerData.TryGetValue(id, out record)) { // Update record.Name = session.Name; playerData[id] = record; // Swap out Rust player allPlayers.Remove(id); allPlayers.Add(id, new HurtworldPlayer(session)); } else { // Insert record = new PlayerRecord { Id = (ulong)session.SteamId, Name = session.Name }; playerData.Add(id, record); // Create Rust player allPlayers.Add(id, new HurtworldPlayer(session)); } // Save ProtoStorage.Save(playerData, "oxide.covalence"); }
internal void PlayerJoin(ulong userId, string name) { var id = userId.ToString(); name = name.Sanitize(); PlayerRecord record; if (playerData.TryGetValue(id, out record)) { record.Name = name; playerData[id] = record; allPlayers.Remove(id); allPlayers.Add(id, new ReignOfKingsPlayer(userId, name)); } else { record = new PlayerRecord { Id = userId, Name = name }; playerData.Add(id, record); allPlayers.Add(id, new ReignOfKingsPlayer(userId, name)); } ProtoStorage.Save(playerData, "oxide.covalence"); }
internal void PlayerJoin(Player player) { var id = player.whoAmI.ToString(); var name = player.name.Sanitize(); PlayerRecord record; if (playerData.TryGetValue(id, out record)) { record.Name = name; playerData[id] = record; allPlayers.Remove(id); allPlayers.Add(id, new TerrariaPlayer(player)); } else { record = new PlayerRecord { Id = id, Name = name }; playerData.Add(id, record); allPlayers.Add(id, new TerrariaPlayer(player)); } ProtoStorage.Save(playerData, "oxide.covalence"); }
internal void PlayerJoin(NetUser netUser) { var id = netUser.userID.ToString(); var name = netUser.displayName.Sanitize(); PlayerRecord record; if (playerData.TryGetValue(id, out record)) { record.Name = name; playerData[id] = record; allPlayers.Remove(id); allPlayers.Add(id, new RustLegacyPlayer(netUser)); } else { record = new PlayerRecord { Id = netUser.userID, Name = name }; playerData.Add(id, record); allPlayers.Add(id, new RustLegacyPlayer(netUser)); } ProtoStorage.Save(playerData, "oxide.covalence"); }
private void NotifyPlayerJoin(PlayerInfos player) { var id = player.account_id; // Do they exist? PlayerRecord record; if (playerData.TryGetValue(id, out record)) { // Update record.Name = player.Nickname; playerData[id] = record; // Swap out Rust player allPlayers.Remove(id); allPlayers.Add(id, new HideHoldOutPlayer(player)); } else { // Insert record = new PlayerRecord { Id = Convert.ToUInt64(id), Name = player.Nickname }; playerData.Add(id, record); // Create Rust player allPlayers.Add(id, new HideHoldOutPlayer(player)); } // Save ProtoStorage.Save(playerData, "oxide.covalence"); }
private void NotifyPlayerJoin(NetUser netUser) { var id = netUser.userID.ToString(); // Do they exist? PlayerRecord record; if (playerData.TryGetValue(id, out record)) { // Update record.Name = netUser.displayName; playerData[id] = record; // Swap out Rust player allPlayers.Remove(id); allPlayers.Add(id, new RustLegacyPlayer(netUser)); } else { // Insert record = new PlayerRecord { Id = netUser.userID, Name = netUser.displayName }; playerData.Add(id, record); // Create Rust player allPlayers.Add(id, new RustLegacyPlayer(netUser)); } // Save ProtoStorage.Save(playerData, "oxide.covalence"); }
private void SaveData() { if (_data == null) { return; } ProtoStorage.Save(_data, nameof(SimpleKillFeed)); }
internal void Initialize() { Utility.DatafileToProto<Dictionary<string, PlayerRecord>>("oxide.covalence"); playerData = ProtoStorage.Load<Dictionary<string, PlayerRecord>>("oxide.covalence") ?? new Dictionary<string, PlayerRecord>(); allPlayers = new Dictionary<string, SpaceEngineersPlayer>(); connectedPlayers = new Dictionary<string, SpaceEngineersPlayer>(); foreach (var pair in playerData) allPlayers.Add(pair.Key, new SpaceEngineersPlayer(pair.Value.Id, pair.Value.Name)); }
internal void Initialize() { Utility.DatafileToProto <Dictionary <string, RustPlayerManager.PlayerRecord> >("oxide.covalence", true); this.playerData = ProtoStorage.Load <Dictionary <string, RustPlayerManager.PlayerRecord> >(new String[] { "oxide.covalence" }) ?? new Dictionary <string, RustPlayerManager.PlayerRecord>(); this.allPlayers = new Dictionary <string, RustPlayer>(); this.connectedPlayers = new Dictionary <string, RustPlayer>(); foreach (KeyValuePair <string, RustPlayerManager.PlayerRecord> playerDatum in this.playerData) { this.allPlayers.Add(playerDatum.Key, new RustPlayer(playerDatum.Value.Id, playerDatum.Value.Name)); } }
internal void Initialize() { playerData = ProtoStorage.Load <Dictionary <string, PlayerRecord> >(dataFileName) ?? new Dictionary <string, PlayerRecord>(); allPlayers = new Dictionary <string, HumanFallFlatPlayer>(); connectedPlayers = new Dictionary <string, HumanFallFlatPlayer>(); foreach (KeyValuePair <string, PlayerRecord> pair in playerData) { allPlayers.Add(pair.Key, new HumanFallFlatPlayer(pair.Value.Id, pair.Value.Name)); } }
internal HurtworldPlayerManager() { // Load player data Utility.DatafileToProto <Dictionary <string, PlayerRecord> >("oxide.covalence.playerdata"); playerData = ProtoStorage.Load <Dictionary <string, PlayerRecord> >("oxide.covalence.playerdata") ?? new Dictionary <string, PlayerRecord>(); players = new Dictionary <string, HurtworldPlayer>(); foreach (var pair in playerData) { players.Add(pair.Key, new HurtworldPlayer(pair.Value.SteamId, pair.Value.Nickname)); } livePlayers = new Dictionary <string, HurtworldLivePlayer>(); }
internal void Initialize() { Utility.DatafileToProto <Dictionary <string, PlayerRecord> >("oxide.covalence"); playerData = ProtoStorage.Load <Dictionary <string, PlayerRecord> >("oxide.covalence") ?? new Dictionary <string, PlayerRecord>(); allPlayers = new Dictionary <string, HurtworldPlayer>(); connectedPlayers = new Dictionary <string, HurtworldPlayer>(); foreach (KeyValuePair <string, PlayerRecord> pair in playerData) { allPlayers.Add(pair.Key, new HurtworldPlayer(pair.Value.Id, pair.Value.Name)); } }
internal TheForestPlayerManager() { // Load player data Utility.DatafileToProto <Dictionary <string, PlayerRecord> >("oxide.covalence"); playerData = ProtoStorage.Load <Dictionary <string, PlayerRecord> >("oxide.covalence") ?? new Dictionary <string, PlayerRecord>(); players = new Dictionary <string, TheForestPlayer>(); foreach (var pair in playerData) { players.Add(pair.Key, new TheForestPlayer(pair.Value.Id, pair.Value.Name)); } livePlayers = new Dictionary <string, TheForestLivePlayer>(); }
private void LoadFromDatafile() { Utility.DatafileToProto <Dictionary <string, UserData> >("oxide.users", true); Utility.DatafileToProto <Dictionary <string, GroupData> >("oxide.groups", true); this.userdata = ProtoStorage.Load <Dictionary <string, UserData> >(new string[] { "oxide.users" }) ?? new Dictionary <string, UserData>(); this.groupdata = ProtoStorage.Load <Dictionary <string, GroupData> >(new string[] { "oxide.groups" }) ?? new Dictionary <string, GroupData>(); foreach (KeyValuePair <string, GroupData> groupdatum in this.groupdata) { if (string.IsNullOrEmpty(groupdatum.Value.ParentGroup) || !this.HasCircularParent(groupdatum.Key, groupdatum.Value.ParentGroup)) { continue; } Interface.Oxide.LogWarning("Detected circular parent group for '{0}'! Removing parent '{1}'", new object[] { groupdatum.Key, groupdatum.Value.ParentGroup }); groupdatum.Value.ParentGroup = null; } this.IsLoaded = true; }
/// <summary> /// Loads all permissions data from the datafile /// </summary> private void LoadFromDatafile() { // Initialize Utility.DatafileToProto <Dictionary <string, UserData> >("oxide.users"); Utility.DatafileToProto <Dictionary <string, GroupData> >("oxide.groups"); userdata = ProtoStorage.Load <Dictionary <string, UserData> >("oxide.users") ?? new Dictionary <string, UserData>(); groupdata = ProtoStorage.Load <Dictionary <string, GroupData> >("oxide.groups") ?? new Dictionary <string, GroupData>(); foreach (var pair in groupdata) { if (!string.IsNullOrEmpty(pair.Value.ParentGroup) && HasCircularParent(pair.Key, pair.Value.ParentGroup)) { Interface.Oxide.LogWarning("Detected circular parent group for '{0}'! Removing parent '{1}'", pair.Key, pair.Value.ParentGroup); pair.Value.ParentGroup = null; } } IsLoaded = true; }