Add HomeListEvent and WarpListEvent

This commit is contained in:
William278 committed 2022-09-04 16:50:27 +03:00
1 parent fbe82a46a0
commit 5f3958bb5b
14 files changed
+310 -70

No files matched your search

@@ -1,11 +1,13 @@
package net.william278.huskhomes.event;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.position.Home;
import net.william278.huskhomes.position.Warp;
import net.william278.huskhomes.teleport.Teleport;
import net.william278.huskhomes.teleport.TimedTeleport;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
@@ -13,7 +15,7 @@ import java.util.concurrent.CompletableFuture;
*/
public interface EventDispatcher {
CompletableFuture<ITeleportEvent> dispatchTeleportEvent(@NotNull Teleport teleport);
void dispatchTeleportEvent(@NotNull Teleport teleport);
CompletableFuture<ITeleportWarmupEvent> dispatchTeleportWarmupEvent(@NotNull TimedTeleport teleport, int duration);
@@ -25,4 +27,9 @@ public interface EventDispatcher {
CompletableFuture<IWarpDeleteEvent> dispatchWarpDeleteEvent(@NotNull Warp warp);
CompletableFuture<IHomeListEvent> dispatchViewHomeListEvent(@NotNull List<Home> homes, @NotNull OnlineUser user,
boolean publicHomeList);
CompletableFuture<IWarpListEvent> dispatchViewWarpListEvent(@NotNull List<Warp> homes, @NotNull OnlineUser user);
}
@@ -0,0 +1,36 @@
package net.william278.huskhomes.event;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.position.Home;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Represents an event that fires when a player requests to view a list of homes
*/
public interface IHomeListEvent extends CancellableEvent {
/**
* Get the list of homes to be displayed
*
* @return the list of homes
*/
List<Home> getHomes();
/**
* Get the player viewing the home list
*
* @return the player viewing the home list
*/
@NotNull
OnlineUser getOnlineUser();
/**
* Indicates if the player has requested to view a list of public homes
*
* @return true if the player has requested to view a list of public homes
*/
boolean getIsPublicHomeList();
}
@@ -0,0 +1,29 @@
package net.william278.huskhomes.event;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.position.Warp;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Represents an event that fires when a player requests to view a list of warps
*/
public interface IWarpListEvent extends CancellableEvent {
/**
* Get the list of warps to be displayed
*
* @return the list of warps
*/
List<Warp> getWarps();
/**
* Get the player viewing the warp list
*
* @return the player viewing the warp list
*/
@NotNull
OnlineUser getOnlineUser();
}