Skip to content

Commit

Permalink
docs: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Mar 22, 2024
1 parent 478193f commit 6b67354
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/example_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class ExamplePlugin : public endstone::Plugin {
command->setExecutor(std::make_unique<FibonacciCommandExecutor>());
}

// You can register an event handler directly in the Plugin class.
registerEventHandler<endstone::ServerLoadEvent>(&ExamplePlugin::onServerLoad, *this);

// You can also create a separate class (e.g. ExampleListener) and register the event handler from that class.
listener_ = std::make_unique<ExampleListener>(*this);
registerEventHandler<endstone::ServerLoadEvent>(&ExampleListener::onServerLoad, *listener_,
endstone::EventPriority::HIGH);
Expand Down

0 comments on commit 6b67354

Please sign in to comment.