OMD.Events 1.4.0

There is a newer version of this package available.
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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OMD.Events" Version="1.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OMD.Events --version 1.4.0                
#r "nuget: OMD.Events, 1.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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.

Nuget Nuget

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 mode
    • UnturnedPlayer Player - player's instance
    • UseableGun Gun - weapon which player is holding
    • EFireMode Firemode - new weapons fire mode
  • UnturnedPlayerChangedMagazineEvent fired when player changed his weapons magazine
    • UnturnedPlayer Player - player's instance
    • UseableGun Gun - weapon which player is holding
    • ItemJar ItemJar - item jar of new weapons magazine
  • UnturnedPlayerInspectingWeaponEvent fired when player start to inspect his weapon
    • UnturnedPlayer Player - player's instance
    • UseableGun Gun - weapon which player is holding
  • UnturnedPlayerSpawnedBulletEvent - fired when player shoot from his weapon
    • UnturnedPlayer Player - player's instance
    • UseableGun Gun - weapon which player is holding
    • BulletInfo BulletInfo - information about the fired bullet
OMD.Events.Useable
  • UnturnedPlayerUseableConsumedEvent fired when player ate, drank or used any medicine on himself or other player
    • UnturnedPlayer Player - instigator's instance
    • UnturnedPlayer Target - instance of player on whom useable has been used
    • ItemConsumeableAsset Asset - asset info of useable which has been used
  • UnturnedPlayerUseableConsumingEvent fired before player ate, drank or used any medicine on himself or other player
    • UnturnedPlayer Player - instigator's instance
    • UnturnedPlayer Target - instance of player on whom useable is going to be used
    • ItemConsumeableAsset Asset - asset info of useable which is going to be used
    • bool 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 permission
    • UnturnedPlayer Player - player's instance
    • string Permission - permission which has been granted
  • UnturnedPlayerPermissionRemovedEvent fired when player's permission has been taken away
    • UnturnedPlayer Player - player's instance
    • string Permission - permission which has been taken away
OMD.Events.NPC
  • UnturnedPlayerNPCEventTriggeredEvent fired when player triggered NPC event
    • UnturnedPlayer Player - player's instance
    • string EventId - Id of triggered event
Product Compatible and additional computed target framework versions.
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.