11package test ;
22
3- import be .seeseemelk .mockbukkit .MockBukkit ;
4- import be .seeseemelk .mockbukkit .ServerMock ;
5- import createcommands .functionsandtags .Main ;
6- import dev .jorel .commandapi .CommandAPI ;
3+ import com .mojang .brigadier .CommandDispatcher ;
74import dev .jorel .commandapi .CommandAPIVersionHandler ;
8- import dev .jorel .commandapi .MockCommandAPIBukkit ;
5+ import dev .jorel .commandapi .MockCommandAPIPaper ;
96import dev .jorel .commandapi .MockCommandAPIPlugin ;
7+ import dev .jorel .commandapi .MockCommandSource ;
8+ import dev .jorel .commandapi .nms .MockPaperNMS ;
9+ import org .bukkit .plugin .java .JavaPlugin ;
1010import org .junit .jupiter .api .BeforeEach ;
11+ import org .mockbukkit .mockbukkit .MockBukkit ;
12+ import org .mockbukkit .mockbukkit .ServerMock ;
13+
14+ import java .io .File ;
15+ import java .io .IOException ;
1116
1217class LoadMockCommandAPI {
18+ class Main extends JavaPlugin {
19+
20+ }
21+
1322 // #region loadMockCommandAPIExample
1423 @ BeforeEach
1524 public void setUp () {
@@ -34,12 +43,11 @@ public void tearDown() {
3443
3544 class CustomExample {
3645 // #region loadCustomCommandAPIPlatformImplementationExample
37- public class CustomMockCommandAPIBukkit extends MockCommandAPIBukkit {
46+ public class CustomMockPaperNMS extends MockPaperNMS {
3847 // Implement a method that usually throws `UnimplementedMethodException`
3948 @ Override
40- public void reloadDataPacks () {
41- CommandAPI .logInfo ("Simulating data pack reload" );
42- // Further logic
49+ public void createDispatcherFile (File file , CommandDispatcher <MockCommandSource > brigadierDispatcher ) throws IOException {
50+ // Whatever logic you need
4351 }
4452 }
4553
@@ -49,7 +57,9 @@ public void setUp() {
4957 MockBukkit .mock ();
5058
5159 // Tell the CommandAPI to use your custom platform implementation
52- CommandAPIVersionHandler .usePlatformImplementation (new CustomMockCommandAPIBukkit ());
60+ CommandAPIVersionHandler .usePlatformImplementation (
61+ config -> new MockCommandAPIPaper (config , new CustomMockPaperNMS ())
62+ );
5363
5464 // Load CommandAPI and your plugin as mentioned above...
5565 }
0 commit comments