File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ BasedOnStyle : LLVM
3+ AccessModifierOffset : -4
4+ AllowShortFunctionsOnASingleLine : Empty
5+ AllowShortLambdasOnASingleLine : Empty
6+ AlwaysBreakTemplateDeclarations : Yes
7+ BinPackArguments : false
8+ BinPackParameters : false
9+ BreakBeforeBinaryOperators : All
10+ BreakConstructorInitializers : BeforeColon
11+ ColumnLimit : 80
12+ IncludeBlocks : Regroup
13+ IndentCaseLabels : true
14+ IndentPPDirectives : AfterHash
15+ IndentWidth : 4
16+ Language : Cpp
17+ SpaceAfterCStyleCast : true
18+ Standard : " c++17"
19+ TabWidth : 4
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.25 )
2+
3+ project (cpp_sample_plugin VERSION 1.0.0)
4+
5+ set (CMAKE_CXX_STANDARD 20)
6+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
7+
8+ include (FetchContent )
9+
10+ FetchContent_Declare (
11+ endstone
12+ GIT_REPOSITORY https://github.com/EndstoneMC/Endstone.git
13+ GIT_TAG main
14+ )
15+
16+ FetchContent_MakeAvailable (endstone)
17+
18+ add_library (cpp_sample_plugin SHARED src/sample_plugin.cpp )
19+ target_link_libraries (cpp_sample_plugin endstone::api )
20+ target_include_directories (cpp_sample_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR } /include )
21+ target_compile_definitions (cpp_sample_plugin PRIVATE _ITERATOR_DEBUG_LEVEL=0 )
22+
23+ install (TARGETS cpp_sample_plugin
24+ LIBRARY DESTINATION cpp_sample_plugin
25+ RUNTIME DESTINATION cpp_sample_plugin)
Original file line number Diff line number Diff line change 1+ //
2+ // Created by Vincent on 21/08/2023.
3+ //
4+
5+ #ifndef CPP_SAMPLE_PLUGIN_H
6+ #define CPP_SAMPLE_PLUGIN_H
7+
8+ #include " endstone/plugin/cpp/cpp_plugin.h"
9+
10+ class SamplePlugin : public CppPlugin {
11+ public:
12+ SamplePlugin () = default ;
13+ const PluginDescription &getDescription () const override ;
14+ void onLoad () override ;
15+ void onEnable () override ;
16+ void onDisable () override ;
17+
18+ private:
19+ CppPluginDescription description_{" CppSamplePlugin" , " 1.0.0" };
20+ };
21+
22+ #endif // CPP_SAMPLE_PLUGIN_H
Original file line number Diff line number Diff line change 1+ //
2+ // Created by Vincent on 21/08/2023.
3+ //
4+
5+ #include " sample_plugin.h"
6+
7+ const PluginDescription &SamplePlugin::getDescription () const {
8+ return description_;
9+ }
10+
11+ void SamplePlugin::onLoad () {
12+ getLogger ()->info (" onLoad is called" );
13+ }
14+
15+ void SamplePlugin::onEnable () {
16+ getLogger ()->info (" onEnable is called" );
17+ }
18+
19+ void SamplePlugin::onDisable () {
20+ getLogger ()->info (" onDisable is called" );
21+ }
22+
23+ ENDSTONE_PLUGIN_CLASS (SamplePlugin)
You can’t perform that action at this time.
0 commit comments