Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Updated to working example
Browse files Browse the repository at this point in the history
  • Loading branch information
Grover-c13 committed Mar 10, 2018
1 parent 9c0c1f4 commit 072ed2a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
7 changes: 3 additions & 4 deletions ExamplePlugin/ExamplePlugin/ExamplePlugin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Smod.TestPlugin;
using Smod.TestPlugin;
using Smod2;
using Smod2.Attributes;
using Smod2.Events;
Expand All @@ -24,13 +23,13 @@ public override void OnDisable()

public override void OnEnable()
{
Console.WriteLine("On enable :)");
this.Info("Example Plugin has loaded :)");
}

public override void Register()
{
// Register Events
this.AddEventHandler(typeof(IEventRoundStart), new RoundStartEventHandler(), Priority.Highest);
this.AddEventHandler(typeof(IEventRoundStart), new RoundStartHandler(this), Priority.Highest);
// Register Commands
this.AddCommand("hello", new HelloWorldCommand(this));
}
Expand Down
5 changes: 2 additions & 3 deletions ExamplePlugin/ExamplePlugin/HelloWorldCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Smod2.Commands;
using Smod2.Commands;

namespace ExamplePlugin
{
Expand All @@ -21,7 +20,7 @@ public string GetUsage()
return "";
}

public void OnCall(string[] args)
public void OnCall(ICommandManager manger, string[] args)
{
plugin.Info("Hello world!");
}
Expand Down
16 changes: 11 additions & 5 deletions ExamplePlugin/ExamplePlugin/RoundStartEventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
using System;
using Smod2;
using Smod2;
using Smod2.API;
using Smod2.Events;
using Smod2.Game;

namespace Smod.TestPlugin
{
class RoundStartEventHandler: IEventRoundStart
class RoundStartHandler : IEventRoundStart
{
private Plugin plugin;

public RoundStartHandler(Plugin plugin)
{
this.plugin = plugin;
}

public void OnRoundStart(Server server)
{
server.MaxPlayers = 2 ^ 32;
plugin.Info("ROUND START EVENT CALLER");
}
}
}

0 comments on commit 072ed2a

Please sign in to comment.