Skip to content

Commit f8ca967

Browse files
committed
docs(for devs): update readme
1 parent a5508b3 commit f8ca967

File tree

5 files changed

+29
-173
lines changed

5 files changed

+29
-173
lines changed

README.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,45 @@ The artifact will be generated in `build/libs/ExtendedHorizons-{version}.jar` re
2626
---
2727
## For developers
2828

29-
You can access ExtendedHorizons services directly via injector.
29+
ExtendedHorizons is built entirely with WinterFramework (Guice), so you can inject its services directly or resolve them statically.
3030

31-
Add this to your `plugin.yml`:
31+
Add this to your `plugin.yml` or `paper-plugin.yml`:
3232
```yaml
33-
softdepend: [ExtendedHorizons]
33+
depend:
34+
- ExtendedHorizons
3435
```
3536
36-
Resolve services like this:
37+
### Accessing Services
38+
39+
The easiest way to obtain core services is through the main plugin class:
40+
3741
```java
3842
import me.mapacheee.extendedhorizons.ExtendedHorizonsPlugin;
39-
import me.mapacheee.extendedhorizons.chunk.FakeChunkService;
40-
import me.mapacheee.extendedhorizons.config.ConfigService;
41-
import org.bukkit.plugin.java.JavaPlugin;
43+
import me.mapacheee.extendedhorizons.config.ConfigFacade;
44+
import me.mapacheee.extendedhorizons.fakechunks.session.SessionRegistry;
45+
import me.mapacheee.extendedhorizons.fakechunks.session.PlayerSession;
4246

43-
ExtendedHorizonsPlugin eh = JavaPlugin.getPlugin(ExtendedHorizonsPlugin.class);
44-
FakeChunkService fakeChunkService = eh.getInjector().getInstance(FakeChunkService.class);
45-
ConfigService configService = eh.getInjector().getInstance(ConfigService.class);
47+
// Retrieve services
48+
SessionRegistry sessionRegistry = ExtendedHorizonsPlugin.getService(SessionRegistry.class);
49+
ConfigFacade configFacade = ExtendedHorizonsPlugin.getService(ConfigFacade.class);
4650
```
4751

48-
You can find a ready-to-use integration example in the `examples` directory.
52+
### What you can do through these services:
4953

50-
What you can do through these services:
51-
- Get the advertised distance for a player with `FakeChunkService#getAdvertisedDistance(UUID)`.
52-
- Apply or override player distance with `FakeChunkService#applyDistancePreference(Player, int)`.
53-
- Trigger fake-chunk refresh for changed chunks with `FakeChunkService#handleRealChunkInteraction(World, int, int)` or `FakeChunkService#handleRealChunkInteraction(UUID, int, int)`.
54-
- Read runtime config with `ConfigService#get()`.
55-
- Check feature flags from config like `fakeChunksEnabledForWorld(worldName)` and `farPlayersEnabled()`.
54+
- **Override view distance:** Set a custom radius for specific players dynamically.
55+
```java
56+
PlayerSession session = sessionRegistry.ensureFor(player, false);
57+
session.playerOverrideDistance(64); // See up to 64 fake chunks
58+
```
59+
- **Reset view distance:** Clear the custom override and allow the plugin to fall back to `world-settings` or `permissions`.
60+
```java
61+
PlayerSession session = sessionRegistry.get(player.getUniqueId());
62+
if (session != null) {
63+
session.resetPlayerOverrideDistance();
64+
}
65+
```
66+
- **Read configuration:** Access world rules, safe factors, and far-player settings dynamically via `configFacade.get()`.
67+
- **Track Far Players:** ExtendedHorizons natively syncs far players. You can read the `trackedFarPlayers()` from a `PlayerSession` to see exactly which entities are being simulated locally.
5668

5769
---
5870
## Contribute

examples/eh-injector-test-plugin/build.gradle

Lines changed: 0 additions & 28 deletions
This file was deleted.

examples/eh-injector-test-plugin/settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/eh-injector-test-plugin/src/main/java/me/mapacheee/examples/ehinjectortest/EhInjectorTestPlugin.java

Lines changed: 0 additions & 111 deletions
This file was deleted.

examples/eh-injector-test-plugin/src/main/resources/plugin.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)