5. Search for `Impostor.Api`.
6. Click the `Impostor.Api` result and press install on the right side.
+### Dotnet CLI
+
+> Make sure to grab the latest (pre-)release version from NuGet [here](https://www.nuget.org/packages/Impostor.Api).
+
+1. Open your project folder in command prompt / bash.
+2. Run `dotnet add package Impostor.Api -v "1.2.0-ci.58"`.
+
## 4. The plugin class
Now the `Impostor.Api` is installed, you need to create a class for your plugin. A plugin **must** contain exactly one. See the code below for an example.
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net.Inner.Objects;
-
-namespace Impostor.Api.Events
-{
- public class MeetingEndedEvent : IEvent
- {
- public MeetingEndedEvent(IGame game, IInnerMeetingHud meetingHud)
- {
- Game = game;
- MeetingHud = meetingHud;
- }
-
- public IGame Game { get; }
-
- public IInnerMeetingHud MeetingHud { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net.Inner.Objects;
-
-namespace Impostor.Api.Events
-{
- public class MeetingStartedEvent : IEvent
- {
- public MeetingStartedEvent(IGame game, IInnerMeetingHud meetingHud)
- {
- Game = game;
- MeetingHud = meetingHud;
- }
-
- public IGame Game { get; }
-
- public IInnerMeetingHud MeetingHud { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net.Inner.Objects;
-
-namespace Impostor.Api.Events
-{
- public class PlayerChatEvent : IGameEvent
- {
- public PlayerChatEvent(IGame game, IInnerPlayerControl playerControl, string message)
- {
- Game = game;
- PlayerControl = playerControl;
- Message = message;
- }
-
- public IGame Game { get; }
-
- public IInnerPlayerControl PlayerControl { get; }
-
- public string Message { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net.Inner.Objects;
-
-namespace Impostor.Api.Events.Net
-{
- public class PlayerDestroyedEvent : IGameEvent
- {
- public PlayerDestroyedEvent(IGame game, IInnerPlayerControl playerControl)
- {
- Game = game;
- PlayerControl = playerControl;
- }
-
- public IGame Game { get; }
-
- public IInnerPlayerControl PlayerControl { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net;
-
-namespace Impostor.Api.Events
-{
- public class PlayerJoinedGameEvent : IGameEvent
- {
- public PlayerJoinedGameEvent(IGame game, IClientPlayer player)
- {
- Game = game;
- Player = player;
- }
-
- public IGame Game { get; }
-
- public IClientPlayer Player { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net;
-
-namespace Impostor.Api.Events
-{
- public class PlayerLeftGameEvent : IGameEvent
- {
- public PlayerLeftGameEvent(IGame game, IClientPlayer player, bool isBan)
- {
- Game = game;
- Player = player;
- IsBan = isBan;
- }
-
- public IGame Game { get; }
-
- public IClientPlayer Player { get; }
-
- public bool IsBan { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-
-namespace Impostor.Api.Events
-{
- public class PlayerMovementEvent : IGameEvent
- {
- public PlayerMovementEvent(IGame game)
- {
- Game = game;
- }
-
- public IGame Game { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Impostor.Api.Games;
-using Impostor.Api.Net.Inner.Objects;
-
-namespace Impostor.Api.Events.Net
-{
- public class PlayerSpawnedEvent : IGameEvent
- {
- public PlayerSpawnedEvent(IGame game, IInnerPlayerControl playerControl)
- {
- Game = game;
- PlayerControl = playerControl;
- }
-
- public IGame Game { get; }
-
- public IInnerPlayerControl PlayerControl { get; }
- }
-}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net.Inner.Objects;
+
+namespace Impostor.Api.Events.Meeting
+{
+ public class MeetingEndedEvent : IEvent
+ {
+ public MeetingEndedEvent(IGame game, IInnerMeetingHud meetingHud)
+ {
+ Game = game;
+ MeetingHud = meetingHud;
+ }
+
+ public IGame Game { get; }
+
+ public IInnerMeetingHud MeetingHud { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net.Inner.Objects;
+
+namespace Impostor.Api.Events
+{
+ public class MeetingStartedEvent : IEvent
+ {
+ public MeetingStartedEvent(IGame game, IInnerMeetingHud meetingHud)
+ {
+ Game = game;
+ MeetingHud = meetingHud;
+ }
+
+ public IGame Game { get; }
+
+ public IInnerMeetingHud MeetingHud { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net.Inner.Objects;
+
+namespace Impostor.Api.Events.Player
+{
+ public class PlayerChatEvent : IGameEvent
+ {
+ public PlayerChatEvent(IGame game, IInnerPlayerControl playerControl, string message)
+ {
+ Game = game;
+ PlayerControl = playerControl;
+ Message = message;
+ }
+
+ public IGame Game { get; }
+
+ public IInnerPlayerControl PlayerControl { get; }
+
+ public string Message { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net.Inner.Objects;
+
+namespace Impostor.Api.Events.Player
+{
+ public class PlayerDestroyedEvent : IGameEvent
+ {
+ public PlayerDestroyedEvent(IGame game, IInnerPlayerControl playerControl)
+ {
+ Game = game;
+ PlayerControl = playerControl;
+ }
+
+ public IGame Game { get; }
+
+ public IInnerPlayerControl PlayerControl { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net;
+
+namespace Impostor.Api.Events.Player
+{
+ public class PlayerJoinedGameEvent : IGameEvent
+ {
+ public PlayerJoinedGameEvent(IGame game, IClientPlayer player)
+ {
+ Game = game;
+ Player = player;
+ }
+
+ public IGame Game { get; }
+
+ public IClientPlayer Player { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net;
+
+namespace Impostor.Api.Events.Player
+{
+ public class PlayerLeftGameEvent : IGameEvent
+ {
+ public PlayerLeftGameEvent(IGame game, IClientPlayer player, bool isBan)
+ {
+ Game = game;
+ Player = player;
+ IsBan = isBan;
+ }
+
+ public IGame Game { get; }
+
+ public IClientPlayer Player { get; }
+
+ public bool IsBan { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+
+namespace Impostor.Api.Events.Player
+{
+ public class PlayerMovementEvent : IGameEvent
+ {
+ public PlayerMovementEvent(IGame game)
+ {
+ Game = game;
+ }
+
+ public IGame Game { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Impostor.Api.Games;
+using Impostor.Api.Net.Inner.Objects;
+
+namespace Impostor.Api.Events.Player
+{
+ public class PlayerSpawnedEvent : IGameEvent
+ {
+ public PlayerSpawnedEvent(IGame game, IInnerPlayerControl playerControl)
+ {
+ Game = game;
+ PlayerControl = playerControl;
+ }
+
+ public IGame Game { get; }
+
+ public IInnerPlayerControl PlayerControl { get; }
+ }
+}
\ No newline at end of file
@using Impostor.Api.Events.Managers
@using Impostor.Api.Games.Managers
@using Impostor.Api.Events
+@using Impostor.Api.Events.Player
@implements Impostor.Api.Events.IEventListener
@inject IEventManager EventManager
@inject IGameManager GameManager
using System;
using Impostor.Api.Events;
+using Impostor.Api.Events.Player;
namespace Impostor.Plugins.Example.Handlers
{
using System;
using Impostor.Api.Events;
+using Impostor.Api.Events.Meeting;
namespace Impostor.Plugins.Example.Handlers
{
using System;
using System.Threading.Tasks;
using Impostor.Api.Events;
-using Impostor.Api.Events.Net;
+using Impostor.Api.Events.Player;
namespace Impostor.Plugins.Example.Handlers
{
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
-
+
<ItemGroup>
<ProjectReference Include="..\Impostor.Api\Impostor.Api.csproj"/>
</ItemGroup>
using Impostor.Api;
using Impostor.Api.Events;
using Impostor.Api.Events.Managers;
+using Impostor.Api.Events.Meeting;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;
using Impostor.Server.Net.State;
using Impostor.Api;
using Impostor.Api.Events;
using Impostor.Api.Events.Managers;
-using Impostor.Api.Events.Net;
+using Impostor.Api.Events.Player;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Inner.Objects;
using System.Threading.Tasks;
using Impostor.Api;
using Impostor.Api.Events;
-using Impostor.Api.Events.Net;
+using Impostor.Api.Events.Player;
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Messages;
using Impostor.Api.Net.Messages.S2C;
using System.Threading.Tasks;
using Impostor.Api;
using Impostor.Api.Events;
+using Impostor.Api.Events.Player;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;