mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
refactor: Use native platform adventure implementations
This commit is contained in:
12 files changed
+66
-29
No files matched your search
+2
-1
@@ -11,11 +11,12 @@ dependencies {
|
||||
api 'net.william278:PagineDown:1.1'
|
||||
api 'net.william278:DesertWell:2.0.4'
|
||||
api 'dev.dejvokep:boosted-yaml:1.3.1'
|
||||
api 'net.kyori:adventure-api:4.14.0'
|
||||
api('com.zaxxer:HikariCP:5.1.0') {
|
||||
exclude module: 'slf4j-api'
|
||||
}
|
||||
|
||||
compileOnly 'net.kyori:adventure-api:4.15.0'
|
||||
compileOnly 'net.kyori:adventure-platform-api:4.3.1'
|
||||
compileOnly "redis.clients:jedis:$jedis_version"
|
||||
compileOnly "org.xerial:sqlite-jdbc:$sqlite_driver_version"
|
||||
compileOnly "com.mysql:mysql-connector-j:$mysql_driver_version"
|
||||
|
||||
@@ -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