New API methods, refactor position object to use static creators

This commit is contained in:
William278 committed 2023-03-22 19:55:59 +00:00
1 parent 42adc13425
commit 6b8c515b61
42 files changed
+587 -232

No files matched your search

@@ -8,6 +8,7 @@ import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.TitlePart;
import net.william278.huskhomes.config.Locales;
import net.william278.huskhomes.position.Location;
import net.william278.huskhomes.position.Position;
import net.william278.huskhomes.teleport.Teleportable;
@@ -98,6 +99,24 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
.replace().toComponent());
}
/**
* Dispatch a MineDown-formatted message to this player
*
* @param mineDown the parsed {@link MineDown} to send
* @param slot the {@link Locales.DisplaySlot} to send the message to
*/
public final void sendMessage(@NotNull MineDown mineDown, @NotNull Locales.DisplaySlot slot) {
if (slot == Locales.DisplaySlot.CHAT) {
sendMessage(mineDown);
} else if (slot == Locales.DisplaySlot.ACTION_BAR) {
sendActionBar(mineDown);
} else if (slot == Locales.DisplaySlot.TITLE) {
sendTitle(mineDown, false);
} else if (slot == Locales.DisplaySlot.SUBTITLE) {
sendTitle(mineDown, true);
}
}
/**
* Dispatch a Minecraft translatable keyed-message to this player
*
@@ -144,6 +163,7 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
/**
* Send a plugin message to the user
*
* @param channel channel to send it on
* @param message byte array of message data
*/