Bump to v3.1, rewrite Teleport/TimedTeleport and add TeleportBuilder, expose new Teleport API, remove TeleportManager, minor database utility refactoring

This commit is contained in:
William committed 2022-10-18 17:45:44 +01:00
1 parent e7f8298b12
commit 9630e53613
35 files changed
+1070 -881

No files matched your search

@@ -9,6 +9,7 @@ import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.player.User;
import net.william278.huskhomes.position.Home;
import net.william278.huskhomes.position.Warp;
import net.william278.huskhomes.teleport.TimedTeleport;
import net.william278.paginedown.ListOptions;
import net.william278.paginedown.PaginatedList;
import org.jetbrains.annotations.NotNull;
@@ -57,6 +58,11 @@ public class Cache {
*/
public final HashMap<UUID, PaginatedList> warpLists;
/**
* Cached user UUIDs currently on warmup countdowns for {@link TimedTeleport}s
*/
public final HashSet<UUID> currentlyOnWarmup;
/**
* Plugin event dispatcher
*/
@@ -73,6 +79,7 @@ public class Cache {
this.privateHomeLists = new HashMap<>();
this.publicHomeLists = new HashMap<>();
this.warpLists = new HashMap<>();
this.currentlyOnWarmup = new HashSet<>();
this.eventDispatcher = eventDispatcher;
}
@@ -115,6 +122,17 @@ public class Cache {
}
}
/**
* Returns if the given user is currently warming up to teleport to a home.
*
* @param userUuid The user to check.
* @return If the user is currently warming up.
* @since 3.1
*/
public boolean isWarmingUp(@NotNull UUID userUuid) {
return this.currentlyOnWarmup.contains(userUuid);
}
@NotNull
private ListOptions.Builder getBaseList(@NotNull Locales locales, int itemsPerPage) {
return new ListOptions.Builder().setFooterFormat(locales.getRawLocale("list_footer",