void AddData(Player player, string[] args, bool rule = true, bool command = false, bool notice = false) { string playerId = player.Id.ToString(); if (!hasPermission(player)) { player.SendError(lang.GetMessage("notAllowed", this, playerId)); return; } if (args == null || args.Length == 0) { player.SendError(lang.GetMessage("help", this, playerId)); return; } string text = args[0]; if (rule) { PopUpData.Rules newRule = new PopUpData.Rules { text = text, }; var key = popupData.rules.Count; key++; popupData.rules.Add(key.ToString(), newRule); } if (command) { PopUpData.Commands newCommand = new PopUpData.Commands { text = text, }; var key = popupData.commands.Count; key++; popupData.commands.Add(key.ToString(), newCommand); } if (notice) { PopUpData.Notices newNotice = new PopUpData.Notices { text = text, }; var key = popupData.notices.Count; key++; popupData.notices.Add(key.ToString(), newNotice); } SaveData(); SendReply(player, lang.GetMessage("dataAdded", this, playerId)); }
private void LoadDefaultNoticeList() { foreach (KeyValuePair <string, string> notice in DefaultNoticeList) { PopUpData.Notices newNotice = new PopUpData.Notices { text = notice.Value, }; if (popupData.notices.ContainsKey(notice.Key)) { return; } else { popupData.notices.Add(notice.Key, newNotice); } } SaveData(); }