Skip to content

Add paperweight compatibility section #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export default defineConfig({
text: "Adventure",
link: "docs/en/user_guide/advanced/adventure",
},
{
text: "Paperweight Compatibility",
link: "docs/en/user_guide/advanced/paperweight",
},
],
},
{
Expand Down
4 changes: 3 additions & 1 deletion docs/en/user_guide/advanced/adventure.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
outline: deep
title: Adventure
next: false
prev:
text: "Create a Custom Server Mock"
link: "/docs/en/user_guide/advanced/custom_server_mock"
next:
text: "Compatibility with paperweight"
link: "/docs/en/user_guide/advanced/paperweight"
---

# Adventure
Expand Down
35 changes: 35 additions & 0 deletions docs/en/user_guide/advanced/paperweight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
outline: deep
title: Compatibility with paperweight
next: false
prev:
text: "Adventure"
link: "/docs/en/user_guide/advanced/adventure"
---

# Compatibility with paperweight

MockBukkit is not compatible with the paperweight provided artifact (also known as NMS).
Whenever these two artifacts are simultaneously provided at test time, you will stumble uppon
multiple issues that stem from providing two separate server implementations at the same time.
This is not possible to fix without completely rewriting MockBukkit!

## The general pattern of these issues

- Something has not been initialized
- Two service providers can not be provided simultaneously

## The solution

There's no perfect solution, as it's impossible to have both dependencies at test time, but you can
exclude the paperweight provided artifact at test time now with paperweight 2.

```kts
paperweight {
addServerDependencyTo = configurations.named(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME).map { setOf(it) }
}
```

::: warning
With this, you can't use any NMS behavior during tests with MockBukkit
:::
Loading