diff --git a/docs/developers/creating-a-placeholderexpansion.md b/docs/developers/creating-a-placeholderexpansion.md index a58c085..9a0e0b2 100644 --- a/docs/developers/creating-a-placeholderexpansion.md +++ b/docs/developers/creating-a-placeholderexpansion.md @@ -273,6 +273,9 @@ package com.example.plugin; import com.example.plugin.expansion.SomeExpansion; import com.hypixel.hytale.server.core.plugin.JavaPlugin; import com.hypixel.hytale.server.core.plugin.JavaPluginInit; +import com.hypixel.hytale.common.plugin.PluginIdentifier; +import com.hypixel.hytale.server.core.HytaleServer; + public class SomePlugin extends JavaPlugin { @@ -280,7 +283,12 @@ public class SomePlugin extends JavaPlugin { super(init) } - // TODO: Example of checking for PAPI and registering expansion + @Override + protected void start() { + if (HytaleServer.get().getPluginManager().getPlugin(PluginIdentifier.fromString("HelpChat:PlaceholderAPI")) != null) { + new SomeExpansion(this).register(); + } + } } ``` diff --git a/docs/developers/using-placeholderapi.md b/docs/developers/using-placeholderapi.md index 4f2d6de..c199c4d 100644 --- a/docs/developers/using-placeholderapi.md +++ b/docs/developers/using-placeholderapi.md @@ -264,7 +264,7 @@ Starting with version 2.12.0 is it now possible to provide Components from the A In order to use this new feature are the following things required to be true: -- You depend on `placeholderapi-papi` and not just `placeholderapi` +- You depend on `placeholderapi-paper` and not just `placeholderapi` - Your plugin runs on a Paper-based Server. Spigot-based servers will not work! - You use `PAPIComponent` instead of `PlaceholderAPI` to parse Components. /// @@ -341,6 +341,7 @@ import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent; import com.hypixel.hytale.server.core.Message; import com.hypixel.hytale.server.core.plugin.JavaPlugin; import com.hypixel.hytale.server.core.plugin.JavaPluginInit; +import com.hypixel.hytale.server.core.universe.Universe; public class JoinExample extends JavaPlugin { @@ -351,13 +352,14 @@ public class JoinExample extends JavaPlugin { @Override protected void setup() { // (1) - getEventRegistry().registerGlobal(PlayerReadyEvent.class, this::onPlayerReady); + Universe.get().getWorlds().keySet().forEach(name -> getEventRegistry().register(PlayerReadyEvent.class, name, this::onPlayerReady)); } public void onPlayerReady(PlayerReadyEvent event) { Player player = event.getPlayer(); // (2) player.sendMessage(PlaceholderAPI.setPlaceholders(Message.raw("Welcome %player_name%!"), player)) + } } ```