using UnityEngine; using System.Collections.Generic; namespace Oxide.Plugins { [Info("Custom Event Announcements", "klauz24", "1.0.1"), Description("Allows managing event announcements.")] internal class CustomEventAnnouncements : HurtworldPlugin { protected override void LoadDefaultMessages() { lang.RegisterMessages(new Dictionary { {"Events/Iron Meteor Shower", "Iron Meteor is on the way!"}, {"Events/Titranium Meteor Shower", "Titranium Meteor is on the way!"}, {"Events/Mondinium Meteor Shower", "Mondinium Meteor is on the way!"}, {"Events/Ultranium Meteor Shower", "Ultranium Meteor is on the way!"}, {"Events/Amber Meteor Shower", "Amber Meteor is on the way!"}, {"Events/Control Town Event", "Town Control Event has started!"}, {"Events/Loot Frenzy Town Event", "Loot Frenzy Event has started!"}, {"Airdrop", "Cargo Plane is on the way!"} }, this); } private object OnMeteorShowerBroadcast(MeteorShowerEvent shower, string title) { Broadcast(shower.NameKey); return true; } private object OnTownEventBroadcast(BaseTownEvent townEvent, string title) { Broadcast(townEvent.NameKey); return true; } private void OnAirdrop(GameObject obj, AirDropEvent airdrop, List items) => Broadcast("Airdrop"); private void Broadcast(string nameKey) { foreach (var str in lang.GetMessages(lang.GetServerLanguage(), this)) { if (nameKey == str.Key) { foreach (var session in GameManager.Instance.GetSessions().Values) { Player.Message(session, lang.GetMessage(str.Value, this, session.SteamId.ToString())); } break; } } } } }