Skip to content

Commit ef86af0

Browse files
authored
Add paperweight compatibility section (#9)
* docs: Add paperweight compatibility section * fix(style): prettier reformating
1 parent ab6017f commit ef86af0

File tree

4 files changed

+632
-670
lines changed

4 files changed

+632
-670
lines changed

Diff for: .vitepress/config.mts

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export default defineConfig({
7979
text: "Adventure",
8080
link: "docs/en/user_guide/advanced/adventure",
8181
},
82+
{
83+
text: "Paperweight Compatibility",
84+
link: "docs/en/user_guide/advanced/paperweight",
85+
},
8286
],
8387
},
8488
{

Diff for: docs/en/user_guide/advanced/adventure.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
outline: deep
33
title: Adventure
4-
next: false
54
prev:
65
text: "Create a Custom Server Mock"
76
link: "/docs/en/user_guide/advanced/custom_server_mock"
7+
next:
8+
text: "Compatibility with paperweight"
9+
link: "/docs/en/user_guide/advanced/paperweight"
810
---
911

1012
# Adventure

Diff for: docs/en/user_guide/advanced/paperweight.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
outline: deep
3+
title: Compatibility with paperweight
4+
next: false
5+
prev:
6+
text: "Adventure"
7+
link: "/docs/en/user_guide/advanced/adventure"
8+
---
9+
10+
# Compatibility with paperweight
11+
12+
MockBukkit is not compatible with the paperweight provided artifact (also known as NMS).
13+
Whenever these two artifacts are simultaneously provided at test time, you will stumble uppon
14+
multiple issues that stem from providing two separate server implementations at the same time.
15+
This is not possible to fix without completely rewriting MockBukkit!
16+
17+
## The general pattern of these issues
18+
19+
- Something has not been initialized
20+
- Two service providers can not be provided simultaneously
21+
22+
## The solution
23+
24+
There's no perfect solution, as it's impossible to have both dependencies at test time, but you can
25+
exclude the paperweight provided artifact at test time now with paperweight 2.
26+
27+
```kts
28+
paperweight {
29+
addServerDependencyTo = configurations.named(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME).map { setOf(it) }
30+
}
31+
```
32+
33+
::: warning
34+
With this, you can't use any NMS behavior during tests with MockBukkit
35+
:::

0 commit comments

Comments
 (0)