Created
January 9, 2021 11:07
-
-
Save libhalt/e3f98c717a29514dcc259c6ca9c7f708 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Impostor.Api.Events; | |
using Impostor.Api.Events.Managers; | |
using Impostor.Api.Net.Inner.Objects; | |
using Impostor.Api.Plugins; | |
using Microsoft.Extensions.Logging; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace TestPlugin | |
{ | |
[ImpostorPlugin( | |
package: "net.libhalt", | |
name: "TestPlugin", | |
author: "libhalt", | |
version: "1.0.0")] | |
public class TestPlugin : PluginBase , IEventListener | |
{ | |
private readonly ILogger<TestPlugin> _logger; | |
private readonly IEventManager _eventmanager; | |
public TestPlugin(ILogger<TestPlugin> logger, IEventManager eventManager) | |
{ | |
_eventmanager = eventManager; | |
_logger = logger; | |
} | |
public override ValueTask EnableAsync() | |
{ | |
_eventmanager.RegisterListener(this); | |
return default; | |
} | |
[EventListener] | |
public void OnGameStarting(IGameStartingEvent e) | |
{ | |
List<IInnerPlayerControl> infected = new List<IInnerPlayerControl>(); | |
infected.Add(e.Game.Host.Character); | |
e.Game.SetInfectedAsync(infected); | |
_logger.LogInformation("The host always gets to be the impostor"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment