mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
refactor: Use native platform adventure implementations
This commit is contained in:
12 files changed
+66
-29
No files matched your search
@@ -21,6 +21,7 @@ package net.william278.huskhomes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.william278.annotaml.Annotaml;
|
||||
import net.william278.desertwell.util.ThrowingConsumer;
|
||||
@@ -86,6 +87,16 @@ public interface HuskHomes extends Task.Supplier, EventDispatcher, SafetyResolve
|
||||
@NotNull
|
||||
List<OnlineUser> getOnlineUsers();
|
||||
|
||||
|
||||
/**
|
||||
* Get the adventure {@link Audience} for a given {@link UUID}.
|
||||
*
|
||||
* @param user The {@link UUID} of the user to get the {@link Audience} for.
|
||||
* @return The {@link Audience} for the given {@link UUID}.
|
||||
*/
|
||||
@NotNull
|
||||
Audience getAudience(@NotNull UUID user);
|
||||
|
||||
/**
|
||||
* Finds a local {@link OnlineUser} by their name. Auto-completes partially typed names for the closest match
|
||||
*
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.title.Title;
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.config.Locales;
|
||||
import net.william278.huskhomes.position.Location;
|
||||
import net.william278.huskhomes.position.Position;
|
||||
@@ -42,8 +43,11 @@ import java.util.*;
|
||||
*/
|
||||
public abstract class OnlineUser extends User implements Teleportable, CommandUser {
|
||||
|
||||
public OnlineUser(@NotNull UUID uuid, @NotNull String username) {
|
||||
protected final HuskHomes plugin;
|
||||
|
||||
protected OnlineUser(@NotNull UUID uuid, @NotNull String username, @NotNull HuskHomes plugin) {
|
||||
super(uuid, username);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +179,9 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
|
||||
* @return the adventure {@link Audience} for this player
|
||||
*/
|
||||
@NotNull
|
||||
public abstract Audience getAudience();
|
||||
public Audience getAudience() {
|
||||
return plugin.getAudience(getUuid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleport a player to the specified local {@link Location}.
|
||||
|
||||
Reference in new issue
Block a user