public RustPlugin() { logger = Interface.GetMod().RootLogger; timer = new PluginTimers(this); cmd = Interface.Oxide.GetLibrary <Command>(null); var type = GetType(); foreach (var method in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)) { var info_attributes = method.GetCustomAttributes(typeof(HookMethodAttribute), true); if (info_attributes.Length > 0) { continue; } // Assume all private instance methods which are not explicitly hooked could be hooks if (method.DeclaringType != null && method.DeclaringType.Name == type.Name) { AddHookMethod(method.Name, method); } } SetPluginInfo(type); }
private void OnServerInitialized() { _config = Config.ReadObject <PluginConfiguration>(); PathToResult = Path.Combine(_config.ResultPath.FullPath, $"Map-{ConVar.Server.seed}-{ConVar.Server.worldsize}.png"); var commands = GetLibrary <Command>(); commands.AddConsoleCommand(COMMAND_DRAW, this, DrawMapConsoleCommand); if (File.Exists(PathToResult)) { Interface.CallHook("OnGeneratorMapCreate"); return; } var timer = new PluginTimers(this); timer.Once(_config.DrawDelay, () => { DrawMap(); Interface.CallHook("OnGeneratorMapCreate"); }); }