Compare commits

...
25 Commits
Author SHA1 Message Date
Jim C K Flaten 3b04ae153e Merge branch 'release/0.3.0' 2024-08-23 23:11:35 +02:00
Jim C K Flaten f7f723b7c6 Release 0.3.0. 2024-08-23 23:11:30 +02:00
Jim C K Flaten 4e8cb7fdf2 World border (#55)
Introduces per-world configuration and world borders.
2024-08-23 23:02:53 +02:00
Jim C K Flaten 3e49275c63 Drop Forge packet ID on 1.20.4 and below. 2024-08-23 22:58:23 +02:00
Jim C K Flaten d349cd038e Property parsing appears to work client-side now. 2024-08-19 22:27:03 +02:00
Jim C K Flaten 5452cab99a Update config comments. 2024-08-19 21:13:28 +02:00
Jim C K Flaten f22fb514b2 Initialize early. 2024-08-19 20:43:41 +02:00
Jim C K Flaten 3e5fa994dc Log prefix. 2024-08-19 20:43:25 +02:00
Jim C K Flaten e5989134cc Only include patch level from 1.20.5 and up. 2024-08-19 20:39:14 +02:00
Jim C K Flaten 8c830e30ae Only use Paper scheduler for Folia. 2024-08-19 20:22:41 +02:00
dependabot[bot] aca9769658 Bump com.github.technicallycoded:FoliaLib from main-SNAPSHOT to v0.4.3 (#52)
Bumps
[com.github.technicallycoded:FoliaLib](https://github.com/TechnicallyCoded/FoliaLib)
from main-SNAPSHOT to v0.4.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/TechnicallyCoded/FoliaLib/releases">com.github.technicallycoded:FoliaLib's
releases</a>.</em></p>
<blockquote>
<h2>BETA 0.4.3 - Chain Futures, New Methods, and Bug Patches</h2>
<h2>What's Changed</h2>
<ul>
<li>Chain by <a
href="https://github.com/CJCrafter"><code>@​CJCrafter</code></a> in <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/pull/16">TechnicallyCoded/FoliaLib#16</a></li>
<li>Thread check by <a
href="https://github.com/CJCrafter"><code>@​CJCrafter</code></a> in <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/pull/18">TechnicallyCoded/FoliaLib#18</a></li>
<li>Check projectile death state, fixes <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/issues/14">#14</a>
by <a href="https://github.com/PikaMug"><code>@​PikaMug</code></a> in <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/pull/24">TechnicallyCoded/FoliaLib#24</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/CJCrafter"><code>@​CJCrafter</code></a>
made their first contribution in <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/pull/16">TechnicallyCoded/FoliaLib#16</a></li>
<li><a href="https://github.com/PikaMug"><code>@​PikaMug</code></a> made
their first contribution in <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/pull/24">TechnicallyCoded/FoliaLib#24</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/TechnicallyCoded/FoliaLib/compare/v0.3.4...v0.4.3">https://github.com/TechnicallyCoded/FoliaLib/compare/v0.3.4...v0.4.3</a></p>
<h2>BETA 0.3.4 - Add runAtEntityLater and runAtEntityLater &amp;
Fixes</h2>
<p>Changes</p>
<ul>
<li>Add runAtEntityLater and runAtEntityLater. Resolves <a
href="https://redirect.github.com/TechnicallyCoded/FoliaLib/issues/12">#12</a></li>
<li>Fix a few NPEs</li>
</ul>
<h2>BETA 0.3.1 - Relocation Checks, Task Consumers &amp; Tick Duration
Corrections</h2>
<p>Changes:</p>
<ul>
<li>Added relocation (shade plugin) check at startup</li>
<li>Added task consumers</li>
<li>Added better platform detection</li>
<li>Automatically rewrite tick values to be &gt; 0 (Will show a warning
in console unless you call
FoliaLib#disableInvalidTickValueWarning())</li>
<li>Update README with new examples and information</li>
<li>Minor bug fixes</li>
</ul>
<h2>BETA 0.2.5 - Java 8 support, Support ticks as a time unit &amp;
Fixes</h2>
<p>Changes:</p>
<ul>
<li>Migrate the project to being a multi-module project</li>
<li>Move non-Folia classes to be compiled in Java 8</li>
<li>Add support for legacy Minecraft versions (don't load Java 16
classes at runtime if not running on Folia)</li>
<li>Add ability to check is a task is cancelled</li>
<li>Add isCancelled() compatibility with legacy Bukkit versions using
isCurrentlyRunning() and isQueued()</li>
<li>Minor fixes &amp; documentation updates</li>
</ul>
<h2>BETA 0.2.0 - Cancellable tasks, entity tasks &amp; fixes</h2>
<p>Changes:</p>
<ul>
<li>Added cancellable tasks,</li>
<li>Added entity tasks,</li>
<li>Removed scopes and use separate method names instead,</li>
<li>Changed server version checks to use class names instead of version
name</li>
</ul>
<h2>BETA 0.1.1 - Release</h2>
<p>Initial release + minor updates and fixes</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/TechnicallyCoded/FoliaLib/commits/v0.4.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.github.technicallycoded:FoliaLib&package-manager=maven&previous-version=main-SNAPSHOT&new-version=v0.4.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 14:33:50 +02:00
dependabot[bot] 6aa41955fe Bump com.google.guava:guava from 33.2.1-jre to 33.3.0-jre (#53)
Bumps [com.google.guava:guava](https://github.com/google/guava) from
33.2.1-jre to 33.3.0-jre.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/google/guava/releases">com.google.guava:guava's
releases</a>.</em></p>
<blockquote>
<h2>33.3.0</h2>
<h3>Maven</h3>
<pre lang="xml"><code>&lt;dependency&gt;
  &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
  &lt;artifactId&gt;guava&lt;/artifactId&gt;
  &lt;version&gt;33.3.0-jre&lt;/version&gt;
  &lt;!-- or, for Android: --&gt;
  &lt;version&gt;33.3.0-android&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<h3>Jar files</h3>
<ul>
<li><a
href="https://repo1.maven.org/maven2/com/google/guava/guava/33.3.0-jre/guava-33.3.0-jre.jar">33.3.0-jre.jar</a></li>
<li><a
href="https://repo1.maven.org/maven2/com/google/guava/guava/33.3.0-android/guava-33.3.0-android.jar">33.3.0-android.jar</a></li>
</ul>
<p>Guava requires <a
href="https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies">one
runtime dependency</a>, which you can download here:</p>
<ul>
<li><a
href="https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar">failureaccess-1.0.1.jar</a></li>
</ul>
<h3>Javadoc</h3>
<ul>
<li><a
href="https://guava.dev/releases/33.3.0-jre/api/docs/">33.3.0-jre</a></li>
<li><a
href="https://guava.dev/releases/33.3.0-android/api/docs/">33.3.0-android</a></li>
</ul>
<h3>JDiff</h3>
<ul>
<li><a
href="https://guava.dev/releases/33.3.0-jre/api/diffs/">33.3.0-jre vs.
33.2.1-jre</a></li>
<li><a
href="https://guava.dev/releases/33.3.0-android/api/diffs/">33.3.0-android
vs. 33.2.1-android</a></li>
<li><a
href="https://guava.dev/releases/33.3.0-android/api/androiddiffs/">33.3.0-android
vs. 33.3.0-jre</a></li>
</ul>
<h3>Changelog</h3>
<ul>
<li><code>base</code>: Removed <code>@Beta</code> from the
<code>Duration</code> overload of
<code>Suppliers.memoizeWithExpiration</code>.
(76fca99db95ce9c8e55bb9c37fd0e44ef0451a80)</li>
<li><code>cache</code>: Added <code>CacheBuilder</code>
<code>Duration</code> overloads to <code>guava-android</code>.
(a5f9bcafd6)</li>
<li><code>collect</code>: Removed <code>@Beta</code> from the
<code>guava-android</code> <code>Collector</code> APIs.
(c86c09dc3d)</li>
<li><code>collect</code>: Added
<code>ImmutableMultimap.builderWithExpectedKeys</code> and
<code>ImmutableMultimap.Builder.expectedValuesPerKey</code>.
(c3d5b17dc2)</li>
<li><code>graph</code>: Improved <code>Graphs.hasCycle</code> to avoid
causing <code>StackOverflowError</code> for long paths.
(63734b9dfc)</li>
<li><code>net</code>: Added <code>text/markdown</code> to
<code>MediaType</code>. (2466a099ae)</li>
<li><code>net</code>: Deprecated <code>HttpHeaders</code> constant for
<code>Sec-Ch-UA-Form-Factor</code> in favor of
<code>Sec-Ch-UA-Form-Factors</code> to follow the latest spec.
(b310b7e1ee)</li>
<li><code>testing</code>: Changed some test libraries to throw
<code>AssertionError</code> (instead of the more specific
<code>AssertionFailedError</code>) in some cases. (fdfbed1985)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/google/guava/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.guava:guava&package-manager=maven&previous-version=33.2.1-jre&new-version=33.3.0-jre)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 14:33:20 +02:00
Jim C K Flaten 50730d0f11 Option to disable chunk generation when building LODs (#51)
Closes #49
2024-08-18 02:03:49 +02:00
Jim C K Flaten 2f4a070be8 Regional scheduling takes block coordinates, not chunk coordinates. 2024-08-17 22:57:23 +02:00
Jim C K Flaten 0c76ae7748 Fix Folialib shading. 2024-08-17 22:34:23 +02:00
Jim C K Flaten b8b6bd1b84 Build for multiple versions of Minecraft (#48)
![image](https://github.com/user-attachments/assets/36369286-76a5-45cc-88a6-92187c24b38a)

Closes #47
2024-08-14 16:30:49 +02:00
Jim C K Flaten 49beaea384 Update README.md 2024-08-12 03:06:43 +02:00
Jim C K Flaten 1b71004a64 Create FUNDING.yml 2024-08-12 02:55:06 +02:00
Jim C K Flaten 3e530589f4 Add Folia to readme. 2024-08-12 01:01:05 +02:00
Jim C K Flaten 43695a4c22 Folia (#46)
Closes #44
2024-08-12 00:44:39 +02:00
Jim C K Flaten b57d40742f Add level_key_prefix config option. (#45) 2024-08-07 12:13:09 +02:00
Jim C K Flaten 6e78561671 Show DH players in console/log. 2024-08-06 00:54:22 +02:00
Jim C K Flaten d48fe0934f Merge tag '0.2.2' into develop
0.2.2
2024-07-19 00:17:47 +02:00
Jim C K Flaten 7a2992d47c Bump version number. 2024-07-18 23:40:41 +02:00
Jim C K Flaten de03cad4f0 Merge tag '0.2.1' into develop
0.2.1
2024-07-18 23:40:03 +02:00
32 changed files with 771 additions and 57 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
ko_fi: jimckf
+2 -2
View File
@@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
+3
View File
@@ -25,10 +25,13 @@ replay_pid*
# IntelliJ IDEA project config
/.idea
/*.iml
# Maven output
/dependency-reduced-pom.xml
/target
/jars
# Test server
/server
/folia
+5 -3
View File
@@ -1,6 +1,6 @@
# Server-side support for [Distant Horizons](https://gitlab.com/jeseibel/distant-horizons)
DH Support is a Bukkit/Spigot/Paper server plugin that transmits Level Of Detail (LOD) data to connected clients in order to provide a much higher view distance than Minecraft normally would allow. Distant Horizons _will_ work fine without this plugin, but then each client will have to be within normal view distance of chunks to load them, and they will not receive updates for distant chunks when they change.
DH Support is a Bukkit/Spigot/Paper/Folia server plugin that transmits Level Of Detail (LOD) data to players with Distant Horizons installed. Distant Horizons _will_ work fine without this plugin, but then each client will have to be within normal view distance of chunks to load them, and they will not receive updates for distant chunks when they change.
## Installation
@@ -10,10 +10,12 @@ Download the [latest release](https://github.com/Jckf/DH-Support/releases) and d
The default values should be pretty solid, but you may tweak them to better suit your specific needs. Everything you need to know should be in config.yml.
## Compilation
## Building
The project uses Maven, so just run `mvn` in the project directory to compile and package a new JAR.
## Contribution
There are several ways to contribute to this project. You can offer your feedback on [the DH Discord](https://discord.gg/xAB8G4cENx) in [this thread](https://discord.com/channels/881614130614767666/1154490009735417989), report any issues or bugs you find, or attack an open issue and submit a pull request.
There are several ways to contribute to this project. You can offer your feedback on [the DH Discord](https://discord.gg/xAB8G4cENx) in [this thread](https://discord.com/channels/881614130614767666/1154490009735417989), report any issues or bugs you find, attack an open issue and submit a pull request, or even [leave a donation](https://ko-fi.com/jimckf) ❤️
![Plugin usage statistics](https://bstats.org/signatures/bukkit/DH%20Support.svg)
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.16</mc.api-version>
<mc.api-version-patch>.5</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.17</mc.api-version>
<mc.api-version-patch>.1</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.18</mc.api-version>
<mc.api-version-patch>.2</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.19</mc.api-version>
<mc.api-version-patch>.2</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.19</mc.api-version>
<mc.api-version-patch>.4</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.20</mc.api-version>
<mc.api-version-patch>.1</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.20</mc.api-version>
<mc.api-version-patch>.2</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+27
View File
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}${mc.api-version-patch}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.20</mc.api-version>
<mc.api-version-patch>.4</mc.api-version-patch>
<dhs.read-forge-byte>true</dhs.read-forge-byte>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}${mc.api-version-patch}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+25
View File
@@ -0,0 +1,25 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.20.6</mc.api-version>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+25
View File
@@ -0,0 +1,25 @@
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>DHSupport-${mc.api-version}</artifactId>
<parent>
<groupId>no.jckf</groupId>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<relativePath>./pom.xml</relativePath>
</parent>
<properties>
<mc.api-version>1.21</mc.api-version>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${mc.api-version}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+97 -14
View File
@@ -2,14 +2,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>no.jckf</groupId>
<name>dh-support</name>
<version>0.2.2</version>
<artifactId>DHSupport</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<jdk>17</jdk>
<revision>0.3.0</revision>
<jdk>21</jdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.class>no.jckf.dhsupport.bukkit.DhSupportBukkitPlugin</main.class>
<mc.api-version></mc.api-version>
<mc.api-version-patch></mc.api-version-patch>
<dhs.read-forge-byte></dhs.read-forge-byte>
</properties>
<developers>
@@ -30,16 +34,19 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public</url>
</repository>
<repository>
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
@@ -50,7 +57,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.2.1-jre</version>
<version>33.3.0-jre</version>
<scope>compile</scope>
</dependency>
@@ -67,11 +74,17 @@
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.technicallycoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>v0.4.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>${project.artifactId}</finalName>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
@@ -83,6 +96,19 @@
<source>${jdk}</source>
<target>${jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgs>
<arg>-Xplugin:Manifold</arg>
<arg>-AREAD_FORGE_BYTE=${dhs.read-forge-byte}</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-preprocessor</artifactId>
<version>2024.1.30</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
@@ -92,7 +118,7 @@
<version>3.6.0</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedArtifactAttached>false</shadedArtifactAttached>
<shadedClassifierName>all</shadedClassifierName>
<relocations>
@@ -105,6 +131,11 @@
<pattern>org.bstats</pattern>
<shadedPattern>no.jckf.dhsupport.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>com.tcoded.folialib</pattern>
<shadedPattern>no.jckf.dhsupport.folialib</shadedPattern>
</relocation>
</relocations>
</configuration>
@@ -117,16 +148,55 @@
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*</exclude>
</excludes>
</filter>
</filters>
<artifactSet>
<includes>
<include>org.lz4</include>
<include>org.bstats</include>
<include>com.github.technicallycoded</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>jars</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
<destFileName>DHS-${project.version}_for_MC-${mc.api-version}${mc.api-version-patch}.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
@@ -150,4 +220,17 @@
</resource>
</resources>
</build>
<modules>
<module>pom-1.16.5.xml</module>
<module>pom-1.17.1.xml</module>
<module>pom-1.18.2.xml</module>
<module>pom-1.19.2.xml</module>
<module>pom-1.19.4.xml</module>
<module>pom-1.20.1.xml</module>
<module>pom-1.20.2.xml</module>
<module>pom-1.20.4.xml</module>
<module>pom-1.20.6.xml</module>
<module>pom-1.21.xml</module>
</modules>
</project>
@@ -18,12 +18,15 @@
package no.jckf.dhsupport.bukkit;
import no.jckf.dhsupport.core.configuration.Configuration;
import no.jckf.dhsupport.core.configuration.WorldConfiguration;
import no.jckf.dhsupport.core.world.WorldInterface;
import org.bukkit.World;
import org.bukkit.block.Block;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class BukkitWorldInterface implements WorldInterface
{
@@ -31,15 +34,21 @@ public class BukkitWorldInterface implements WorldInterface
protected Block block;
public BukkitWorldInterface(World world)
protected Configuration config;
protected WorldConfiguration worldConfig;
public BukkitWorldInterface(World world, Configuration config)
{
this.world = world;
this.config = config;
this.worldConfig = new WorldConfiguration(this, config);
}
@Override
public WorldInterface newInstance()
{
return new BukkitWorldInterface(this.world);
return new BukkitWorldInterface(this.world, this.config);
}
// Shitty cache :)
@@ -52,6 +61,39 @@ public class BukkitWorldInterface implements WorldInterface
return this.block;
}
@Override
public UUID getId()
{
return this.world.getUID();
}
@Override
public String getName()
{
return this.world.getName();
}
@Override
public boolean chunkExists(int x, int z)
{
int chunkX = (int) Math.floor((double) x / 16);
int chunkZ = (int) Math.floor((double) z / 16);
boolean alreadyLoaded = this.world.isChunkLoaded(chunkX, chunkZ);
if (alreadyLoaded) {
return true;
}
boolean exists = this.world.loadChunk(chunkX, chunkZ, false);
if (exists) {
this.world.unloadChunk(chunkX, chunkZ, false);
}
return exists;
}
@Override
public int getMinY()
{
@@ -135,4 +177,10 @@ public class BukkitWorldInterface implements WorldInterface
{
return this.getBlock(x, y, z).getBlockData().getMaterial().isTransparent();
}
@Override
public Configuration getConfig()
{
return this.worldConfig;
}
}
@@ -18,11 +18,15 @@
package no.jckf.dhsupport.bukkit;
import com.tcoded.folialib.FoliaLib;
import no.jckf.dhsupport.bukkit.handler.ConfigLoader;
import no.jckf.dhsupport.bukkit.handler.Handler;
import no.jckf.dhsupport.bukkit.handler.PluginMessageProxy;
import no.jckf.dhsupport.bukkit.handler.WorldHandler;
import no.jckf.dhsupport.core.DhSupport;
import no.jckf.dhsupport.core.configuration.DhsConfig;
import no.jckf.dhsupport.core.scheduling.GenericScheduler;
import no.jckf.dhsupport.paper.PaperScheduler;
import org.bstats.bukkit.Metrics;
import org.bukkit.plugin.java.JavaPlugin;
@@ -36,6 +40,8 @@ public class DhSupportBukkitPlugin extends JavaPlugin
protected Metrics metrics;
protected FoliaLib foliaLib;
protected final Map<Class<? extends Handler>, Handler> handlers = new HashMap<>()
{{
this.put(ConfigLoader.class, null);
@@ -48,6 +54,8 @@ public class DhSupportBukkitPlugin extends JavaPlugin
this.dhSupport = new DhSupport();
this.dhSupport.setLogger(this.getLogger());
this.foliaLib = new FoliaLib(this);
this.metrics = new Metrics(this, 21843);
for (Class<? extends Handler> className : this.handlers.keySet()) {
@@ -69,6 +77,16 @@ public class DhSupportBukkitPlugin extends JavaPlugin
this.dhSupport.onEnable();
if (this.foliaLib.isFolia()) {
this.getLogger().info("Using Paper scheduler.");
this.dhSupport.setScheduler(new PaperScheduler(this, this.foliaLib));
} else {
this.getLogger().info("Using generic scheduler.");
this.dhSupport.setScheduler(new GenericScheduler(this.getDhSupport().getConfig().getInt(DhsConfig.GENERIC_SCHEDULER_THREADS)));
}
this.getServer().getPluginManager().registerEvents(new WorldHandler(this), this);
this.getLogger().info("Ready 😀");
@@ -41,7 +41,7 @@ public class WorldHandler implements Listener
protected void addWorldInterface(World world)
{
this.plugin.getDhSupport().setWorldInterface(world.getUID(), new BukkitWorldInterface(world));
this.plugin.getDhSupport().setWorldInterface(world.getUID(), new BukkitWorldInterface(world, this.plugin.getDhSupport().getConfig()));
}
protected void removeWorldInterface(World world)
@@ -27,6 +27,7 @@ import no.jckf.dhsupport.core.handler.LodHandler;
import no.jckf.dhsupport.core.handler.PlayerConfigHandler;
import no.jckf.dhsupport.core.handler.PluginMessageHandler;
import no.jckf.dhsupport.core.message.plugin.PluginMessageSender;
import no.jckf.dhsupport.core.scheduling.Scheduler;
import no.jckf.dhsupport.core.world.WorldInterface;
import javax.annotation.Nullable;
@@ -34,8 +35,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
public class DhSupport implements Configurable
@@ -44,15 +44,15 @@ public class DhSupport implements Configurable
protected Logger logger;
protected Scheduler scheduler;
protected Map<UUID, WorldInterface> worldInterfaces = new HashMap<>();
protected PluginMessageHandler pluginMessageHandler;
protected PluginMessageSender pluginMessageSender;
protected ExecutorService executor;
protected Map<UUID, Map<String, byte[]>> lodCache = new HashMap<>();
protected Map<UUID, Map<String, byte[]>> lodCache = new ConcurrentHashMap<>();
public DhSupport()
{
@@ -62,8 +62,6 @@ public class DhSupport implements Configurable
public void onEnable()
{
this.executor = Executors.newFixedThreadPool(4);
(new PlayerConfigHandler(this, this.pluginMessageHandler)).register();
(new LodHandler(this, this.pluginMessageHandler)).register();
@@ -77,6 +75,16 @@ public class DhSupport implements Configurable
}
}
public void setScheduler(Scheduler scheduler)
{
this.scheduler = scheduler;
}
public Scheduler getScheduler()
{
return this.scheduler;
}
public void setWorldInterface(UUID id, @Nullable WorldInterface worldInterface)
{
if (worldInterface == null) {
@@ -149,7 +157,12 @@ public class DhSupport implements Configurable
public CompletableFuture<Lod> queueBuilder(LodBuilder builder)
{
return CompletableFuture.supplyAsync(builder::generate, this.executor);
return this.getScheduler().runRegional(
builder.worldInterface.getId(),
builder.position.getX() * 64,
builder.position.getZ() * 64,
builder::generate
);
}
public CompletableFuture<byte[]> getLodData(UUID worldId, SectionPosition position)
@@ -99,15 +99,15 @@ public class LodBuilder
}
}
String compositeKey = biome + "|" + material;
//String compositeKey = biome + "|" + material + "|" + this.worldInterface.getBlockStateAsStringAt(worldX, worldY, worldZ);
//String compositeKey = biome + "|" + material;
String compositeKey = biome + "|" + material + "|" + this.worldInterface.getBlockStateAsStringAt(worldX, worldY, worldZ);
@Nullable
Integer id = mapMap.get(compositeKey);
if (id == null) {
idMappings.add(new IdMapping(biome, material, null));
//idMappings.add(new IdMapping(biome, material, this.worldInterface.getBlockPropertiesAt(worldX, worldY, worldZ)));
//idMappings.add(new IdMapping(biome, material, null));
idMappings.add(new IdMapping(biome, material, this.worldInterface.getBlockPropertiesAt(worldX, worldY, worldZ)));
id = idMappings.size() - 1;
mapMap.put(compositeKey, id);
}
@@ -38,6 +38,16 @@ public abstract class DhsConfig
public static String LOGIN_DATA_SYNC_RC_LIMIT = "login_data_sync_rc_limit";
public static String GENERIC_SCHEDULER_THREADS = "generic_scheduler_threads";
public static String GENERATE_NEW_CHUNKS = "generate_new_chunks";
public static String LEVEL_KEY_PREFIX = "level_key_prefix";
public static String BORDER_CENTER = "border_center";
public static String BORDER_RADIUS = "border_radius";
public static Collection<String> getKeys()
{
List<String> keys = new ArrayList<>();
@@ -0,0 +1,32 @@
package no.jckf.dhsupport.core.configuration;
import no.jckf.dhsupport.core.world.WorldInterface;
public class WorldConfiguration extends Configuration
{
protected static String WORLD_PREFIX = "worlds.%s.";
protected WorldInterface world;
protected Configuration config;
public WorldConfiguration(WorldInterface world, Configuration config)
{
this.world = world;
this.config = config;
}
@Override
public void set(String key, Object value)
{
this.config.set(WORLD_PREFIX.formatted(this.world.getName()) + key, value);
}
@Override
public Object get(String key)
{
Object specific = this.config.get(WORLD_PREFIX.formatted(this.world.getName()) + key);
return specific == null ? this.config.get(key) : specific;
}
}
@@ -19,9 +19,15 @@
package no.jckf.dhsupport.core.handler;
import no.jckf.dhsupport.core.DhSupport;
import no.jckf.dhsupport.core.configuration.Configuration;
import no.jckf.dhsupport.core.configuration.DhsConfig;
import no.jckf.dhsupport.core.dataobject.Lod;
import no.jckf.dhsupport.core.dataobject.SectionPosition;
import no.jckf.dhsupport.core.message.plugin.ExceptionMessage;
import no.jckf.dhsupport.core.message.plugin.FullDataChunkMessage;
import no.jckf.dhsupport.core.message.plugin.FullDataSourceRequestMessage;
import no.jckf.dhsupport.core.message.plugin.FullDataSourceResponseMessage;
import no.jckf.dhsupport.core.world.WorldInterface;
import org.bukkit.Bukkit;
import java.util.Arrays;
@@ -48,12 +54,73 @@ public class LodHandler
this.pluginMessageHandler.getEventBus().registerHandler(FullDataSourceRequestMessage.class, (requestMessage) -> {
//this.dhSupport.info("LOD request for " + requestMessage.getPosition().getX() + " x " + requestMessage.getPosition().getZ());
int myBufferId = this.bufferId++;
// TODO: Some sort of Player wrapper or interface object. Bukkit classes should not be imported here.
UUID worldUuid = Bukkit.getPlayer(requestMessage.getSender()).getWorld().getUID();
this.dhSupport.getLodData(worldUuid, requestMessage.getPosition())
WorldInterface world = this.dhSupport.getWorldInterface(worldUuid);
Configuration config = world.getConfig();
SectionPosition position = requestMessage.getPosition();
String borderCenter = config.getString(DhsConfig.BORDER_CENTER);
Integer borderRadius =config.getInt(DhsConfig.BORDER_RADIUS);
if (borderCenter != null && borderRadius != null) {
String[] centerXz = borderCenter.split(",");
if (centerXz.length != 2) {
this.dhSupport.warning("Border for world " + world.getName() + " is misconfigured.");
} else {
int centerX = Integer.getInteger(centerXz[0]);
int centerZ = Integer.getInteger(centerXz[1]);
int minX = centerX - borderRadius;
int maxX = centerX + borderRadius;
int minZ = centerZ - borderRadius;
int maxZ = centerZ + borderRadius;
int lowerLodX = position.getX() * 64;
int higherLodX = lowerLodX + 64;
int lowerLodZ = position.getZ() * 64;
int higherLodZ = lowerLodZ + 64;
if (higherLodX < minX || lowerLodX > maxX || higherLodZ < minZ || lowerLodZ > maxZ) {
ExceptionMessage exceptionMessage = new ExceptionMessage();
exceptionMessage.isResponseTo(requestMessage);
exceptionMessage.setTypeId(ExceptionMessage.TYPE_REQUEST_REJECTED);
exceptionMessage.setMessage("World border");
this.pluginMessageHandler.sendPluginMessage(requestMessage.getSender(), exceptionMessage);
return;
}
}
}
boolean generate = config.getBool(DhsConfig.GENERATE_NEW_CHUNKS);
if (!generate) {
for (int relativeChunkX = 0; relativeChunkX < Lod.width / 16; relativeChunkX++) {
for (int relativeChunkZ = 0; relativeChunkZ < Lod.width / 16; relativeChunkZ++) {
int worldX = position.getX() * 64 + relativeChunkX * 16;
int worldZ = position.getZ() * 64 + relativeChunkZ * 16;
if (!world.chunkExists(worldX, worldZ)) {
ExceptionMessage exceptionMessage = new ExceptionMessage();
exceptionMessage.isResponseTo(requestMessage);
exceptionMessage.setTypeId(ExceptionMessage.TYPE_REQUEST_REJECTED);
exceptionMessage.setMessage("Fog of war");
this.pluginMessageHandler.sendPluginMessage(requestMessage.getSender(), exceptionMessage);
return;
}
}
}
}
int myBufferId = this.bufferId++;
this.dhSupport.getLodData(worldUuid, position)
.thenAccept((lod) -> {
int chunkCount = (int) Math.ceil((double) lod.length / CHUNK_SIZE);
@@ -24,6 +24,7 @@ import no.jckf.dhsupport.core.configuration.DhsConfig;
import no.jckf.dhsupport.core.message.plugin.CurrentLevelKeyMessage;
import no.jckf.dhsupport.core.message.plugin.RemotePlayerConfigMessage;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class PlayerConfigHandler
{
@@ -41,19 +42,28 @@ public class PlayerConfigHandler
{
this.pluginMessageHandler.getEventBus().registerHandler(RemotePlayerConfigMessage.class, (configMessage) -> {
// TODO: Some sort of Player wrapper or interface object. Bukkit classes should not be imported here.
// TODO: Should this be unique?
String levelKey = Bukkit.getPlayer(configMessage.getSender()).getWorld().getName();
Player player = Bukkit.getPlayer(configMessage.getSender());
Configuration dhsConfig = this.dhSupport.getWorldInterface(player.getWorld().getUID()).getConfig();
String levelKeyPrefix = dhsConfig.getString(DhsConfig.LEVEL_KEY_PREFIX);
String levelKey = player.getWorld().getName();
if (levelKeyPrefix != null) {
levelKey = levelKeyPrefix + levelKey;
}
this.dhSupport.info("Received DH config for " + player.getName() + " in " + levelKey);
CurrentLevelKeyMessage levelKeyResponse = new CurrentLevelKeyMessage();
levelKeyResponse.setKey(levelKey);
this.pluginMessageHandler.sendPluginMessage(configMessage.getSender(), levelKeyResponse);
Configuration dhsConfig = this.dhSupport.getConfig();
Configuration clientConfig = configMessage.toConfiguration();
// This is not very flexible, but will do for now.
for (String key : DhsConfig.getKeys()) {
//this.dhSupport.getLogger().info("Config key " + key + ":");
for (String key : RemotePlayerConfigMessage.KEYS) {
this.dhSupport.getLogger().info("Config key " + key + ":");
Object dhsValue = dhsConfig.get(key);
Object clientValue = clientConfig.get(key);
@@ -62,15 +72,15 @@ public class PlayerConfigHandler
if (dhsValue instanceof Boolean dhsBool && clientValue instanceof Boolean clientBool) {
keepValue = dhsBool && clientBool;
//this.dhSupport.getLogger().info(" Server " + (dhsBool ? "Y" : "N") + " or client " + (clientBool ? "Y" : "N") + " = " + ((boolean) keepValue ? "Y" : "N"));
this.dhSupport.getLogger().info(" Server " + (dhsBool ? "Y" : "N") + " or client " + (clientBool ? "Y" : "N") + " = " + ((boolean) keepValue ? "Y" : "N"));
} else if (dhsValue instanceof Integer dhsInt && clientValue instanceof Integer clientInt) {
keepValue = dhsInt < clientInt ? dhsInt : clientInt;
//this.dhSupport.getLogger().info(" Server " + dhsInt + " or client " + clientInt + " = " + keepValue);
this.dhSupport.getLogger().info(" Server " + dhsInt + " or client " + clientInt + " = " + keepValue);
} else {
keepValue = null;
//this.dhSupport.getLogger().info(" Uhh... 😵‍💫");
this.dhSupport.getLogger().info(" Uhh... 😵‍💫");
}
clientConfig.set(key, keepValue);
@@ -105,6 +105,10 @@ public class PluginMessageHandler
Decoder decoder = new Decoder(data);
#if READ_FORGE_BYTE == "true"
decoder.readByte();
#endif
// Read the client's protocol version.
short protocolVersion = decoder.readShort();
@@ -25,6 +25,15 @@ import no.jckf.dhsupport.core.configuration.DhsConfig;
public class RemotePlayerConfigMessage extends PluginMessage
{
public static String[] KEYS = {
DhsConfig.RENDER_DISTANCE,
DhsConfig.DISTANT_GENERATION_ENABLED,
DhsConfig.FULL_DATA_REQUEST_CONCURRENCY_LIMIT,
DhsConfig.REAL_TIME_UPDATES_ENABLED,
DhsConfig.LOGIN_DATA_SYNC_ENABLED,
DhsConfig.LOGIN_DATA_SYNC_RC_LIMIT,
};
protected int renderDistance;
protected boolean distantGenerationEnabled;
@@ -0,0 +1,29 @@
package no.jckf.dhsupport.core.scheduling;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Supplier;
public class GenericScheduler implements Scheduler
{
protected ExecutorService executor;
public GenericScheduler(int threads)
{
this.executor = Executors.newFixedThreadPool(threads);
}
@Override
public <U> CompletableFuture<U> run(Supplier<U> supplier)
{
return CompletableFuture.supplyAsync(supplier, this.executor);
}
@Override
public <U> CompletableFuture<U> runRegional(UUID worldId, int x, int z, Supplier<U> supplier)
{
return this.run(supplier);
}
}
@@ -0,0 +1,12 @@
package no.jckf.dhsupport.core.scheduling;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
public interface Scheduler
{
<U> CompletableFuture<U> run(Supplier<U> supplier);
<U> CompletableFuture<U> runRegional(UUID worldId, int x, int z, Supplier<U> supplier);
}
@@ -18,12 +18,21 @@
package no.jckf.dhsupport.core.world;
import java.util.Map;
import no.jckf.dhsupport.core.configuration.Configurable;
public interface WorldInterface
import java.util.Map;
import java.util.UUID;
public interface WorldInterface extends Configurable
{
WorldInterface newInstance();
UUID getId();
String getName();
boolean chunkExists(int x, int z);
int getMinY();
int getMaxY();
@@ -0,0 +1,55 @@
package no.jckf.dhsupport.paper;
import com.tcoded.folialib.FoliaLib;
import no.jckf.dhsupport.core.scheduling.Scheduler;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
public class PaperScheduler implements Scheduler
{
protected JavaPlugin plugin;
protected FoliaLib foliaLib;
public PaperScheduler(JavaPlugin plugin, FoliaLib foliaLib)
{
this.plugin = plugin;
this.foliaLib = foliaLib;
}
@Override
public <U> CompletableFuture<U> run(Supplier<U> supplier)
{
CompletableFuture<U> future = new CompletableFuture<>();
this.foliaLib.getScheduler().runAsync((task) -> {
future.complete(supplier.get());
});
return future;
}
@Override
public <U> CompletableFuture<U> runRegional(UUID worldId, int x, int z, Supplier<U> supplier)
{
CompletableFuture<U> future = new CompletableFuture<>();
Location location = new Location(
this.plugin.getServer().getWorld(worldId),
x,
0,
z
);
this.foliaLib.getScheduler().runAtLocation(
location,
(task) -> future.complete(supplier.get())
);
return future;
}
}
+47 -7
View File
@@ -1,18 +1,58 @@
# Maximum supported render distance. Clients will be capped to this value.
# Required.
# Default: 128
render_distance: 128
# TODO
# Is LOD generation enabled at all?
# Disable if you only want to use the plugin for level key info in a proxied setup.
# Required.
# Default: true
distant_generation_enabled: true
# TODO
# Number of parallel LOD requests per client.
# Required.
# Default: 20
full_data_request_concurrency_limit: 20
# TODO
real_time_updates_enabled: true
# Currently unsupported.
# Required.
# Default: false
real_time_updates_enabled: false
# TODO
login_data_sync_enabled: true
# Currently unsupported.
# Required.
# Default: false
login_data_sync_enabled: false
# TODO
# Currently unsupported.
# Required.
# Default: 50
login_data_sync_rc_limit: 50
# If a client requests LODs with chunks that don't exist, should those chunks be generated?
# Required.
# Default: true
generate_new_chunks: true
# When running DHS on a proxied server, set this to a value that is unique to this specific server.
# Optional.
#level_key_prefix:
# World specific settings.
# You can override any of the above settings on a per-world basis.
worlds:
world:
# Limit LOD generation to within this area.
# Optional.
#border_center: 0,0
#border_radius: 5000
# It might make sense to have a lower view distance in the nether, since visibility will be low simply because of
# the level design anyway.
world_nether:
render_distance: 64
# Number of worker threads used to generate LODs.
# Required, except on Folia.
# Default: 4
generic_scheduler_threads: 4
+6 -3
View File
@@ -1,4 +1,7 @@
name: DHSupport
version: 0.2.2
main: no.jckf.dhsupport.bukkit.DhSupportBukkitPlugin
api-version: 1.21
version: ${project.version}
main: ${main.class}
api-version: ${mc.api-version}
prefix: DHS
load: STARTUP
folia-supported: true