OMD.Events
1.4.0
See the version list below for details.
dotnet add package OMD.Events --version 1.4.0
NuGet\Install-Package OMD.Events -Version 1.4.0
<PackageReference Include="OMD.Events" Version="1.4.0" />
paket add OMD.Events --version 1.4.0
#r "nuget: OMD.Events, 1.4.0"
// Install OMD.Events as a Cake Addin #addin nuget:?package=OMD.Events&version=1.4.0 // Install OMD.Events as a Cake Tool #tool nuget:?package=OMD.Events&version=1.4.0
OMD.Events
An OpenMod / Unturned plugin which implements additional events and allows developers to easily implement their own events interface.
How to install
Run this command: openmod install OMD.Events
How to easily implement your own additional events
You can implement you custom handler classes by inheriting from OMD.Events.Models.EventsHandler
Here's an example on how to do so:
using OMD.Events.Models;
using OMD.Events.Services;
using SDG.Unturned;
using OpenMod.Unturned.Players;
namespace Your.Namespace;
internal sealed class YourCustomEventsHandler : EventsHandler
{
// Make sure you implement a .cctor with IEventsService parameter
internal YourCustomEventsHandler(IEventsService eventsService) : base(eventsService) { }
public override void Subscribe()
{
// Sunscribe to events you want
SomeClass.SomeEvent += Events_Handler;
}
public override void Unsubscribe()
{
// Make sure you unsubscribe from them
SomeClass.SomeEvent -= Events_Handler;
}
private void Events_Handler(Player player)
{
UnturnedPlayer unturnedPlayer = GetUnturnedPlayer(player); // get UnturnedPlayer instance from SDG.Unturned.Player one
YourCustomEvent @event = new YourCustomEvent(unturnedPlayer);
Emit(@event); // emit your event and handle it whereever you want
}
}
The plugin will scan through all types in all loaded plugins. And call Subscribe()
and Unsubscribe()
, so you can focus on creating you plugin.
Built-in events
OMD.Events.Weapons
UnturnedPlayerChangedFiremodeEvent
fired when player changed his weapons fire modeUnturnedPlayer Player
- player's instanceUseableGun Gun
- weapon which player is holdingEFireMode Firemode
- new weapons fire mode
UnturnedPlayerChangedMagazineEvent
fired when player changed his weapons magazineUnturnedPlayer Player
- player's instanceUseableGun Gun
- weapon which player is holdingItemJar ItemJar
- item jar of new weapons magazine
UnturnedPlayerInspectingWeaponEvent
fired when player start to inspect his weaponUnturnedPlayer Player
- player's instanceUseableGun Gun
- weapon which player is holding
UnturnedPlayerSpawnedBulletEvent
- fired when player shoot from his weaponUnturnedPlayer Player
- player's instanceUseableGun Gun
- weapon which player is holdingBulletInfo BulletInfo
- information about the fired bullet
OMD.Events.Useable
UnturnedPlayerUseableConsumedEvent
fired when player ate, drank or used any medicine on himself or other playerUnturnedPlayer Player
- instigator's instanceUnturnedPlayer Target
- instance of player on whom useable has been usedItemConsumeableAsset Asset
- asset info of useable which has been used
UnturnedPlayerUseableConsumingEvent
fired before player ate, drank or used any medicine on himself or other playerUnturnedPlayer Player
- instigator's instanceUnturnedPlayer Target
- instance of player on whom useable is going to be usedItemConsumeableAsset Asset
- asset info of useable which is going to be usedbool IsCancelled
- property, which defines, does the execution of consuming is going to be terminated
OMD.Events.Permissions | Works only with rocketmodIntegration:permissionSystem
set to OpenMod
in openmod.unturned.yaml
| Might change it in future
UnturnedPlayerPermissionAddedEvent
fired when player got a permissionUnturnedPlayer Player
- player's instancestring Permission
- permission which has been granted
UnturnedPlayerPermissionRemovedEvent
fired when player's permission has been taken awayUnturnedPlayer Player
- player's instancestring Permission
- permission which has been taken away
OMD.Events.NPC
UnturnedPlayerNPCEventTriggeredEvent
fired when player triggered NPC eventUnturnedPlayer Player
- player's instancestring EventId
- Id of triggered event
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net481 is compatible. |
-
.NETFramework 4.8.1
- Lib.Harmony (>= 2.2.2)
- OpenMod.Unturned (>= 3.7.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OMD.Events:
Package | Downloads |
---|---|
OMD.PlayersFeatures
A plugin for Unturned/OpenMod, which allows you to use improved God and Vanish modes. |
|
OMD.Zones
An OpenMod / Unturned plugin which implements optimized zones using server-side colliders. |
GitHub repositories
This package is not used by any popular GitHub repositories.