mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 06:28:49 +00:00
Add APIv3 and API events
This commit is contained in:
1 parent
0fc56dc758
commit
59249f285a
25 files changed
+985
-100
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
/**
|
||||
* Base interface for a cancellable event
|
||||
*/
|
||||
public interface CancellableEvent {
|
||||
|
||||
/**
|
||||
* Set whether the event should be cancelled
|
||||
*
|
||||
* @param cancelled {@code true} if the event should be cancelled
|
||||
*/
|
||||
void setCancelled(boolean cancelled);
|
||||
|
||||
/**
|
||||
* Check whether the event is cancelled
|
||||
*
|
||||
* @return {@code true} if the event is cancelled
|
||||
*/
|
||||
boolean isCancelled();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.teleport.Teleport;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* An abstract dispatcher of events
|
||||
*/
|
||||
public interface EventDispatcher {
|
||||
|
||||
CompletableFuture<ITeleportEvent> dispatchTeleportEvent(@NotNull Teleport teleport);
|
||||
|
||||
CompletableFuture<IHomeSaveEvent> dispatchHomeSaveEvent(@NotNull Home home);
|
||||
|
||||
CompletableFuture<IHomeDeleteEvent> dispatchHomeDeleteEvent(@NotNull Home home);
|
||||
|
||||
CompletableFuture<IWarpSaveEvent> dispatchWarpSaveEvent(@NotNull Warp warp);
|
||||
|
||||
CompletableFuture<IWarpDeleteEvent> dispatchWarpDeleteEvent(@NotNull Warp warp);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Representation of an event that fires when a home is deleted
|
||||
*/
|
||||
public interface IHomeDeleteEvent extends CancellableEvent {
|
||||
|
||||
/**
|
||||
* Get the home being deleted
|
||||
*
|
||||
* @return the {@link Home} being deleted
|
||||
*/
|
||||
@NotNull
|
||||
Home getHome();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Representation of an event that fires when a home is created or updated
|
||||
*/
|
||||
public interface IHomeSaveEvent extends CancellableEvent {
|
||||
|
||||
/**
|
||||
* Get the home being created or updated
|
||||
*
|
||||
* @return the {@link Home} being saved
|
||||
*/
|
||||
@NotNull
|
||||
Home getHome();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.teleport.Teleport;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Representation of an event that fires when a teleport is about to occur
|
||||
*/
|
||||
public interface ITeleportEvent {
|
||||
|
||||
/**
|
||||
* Get the teleport being carried out
|
||||
*
|
||||
* @return the {@link Teleport} being carried out
|
||||
*/
|
||||
@NotNull
|
||||
Teleport getTeleport();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Representation of an event that fires when a warp is deleted
|
||||
*/
|
||||
public interface IWarpDeleteEvent extends CancellableEvent {
|
||||
|
||||
/**
|
||||
* Get the warp being deleted
|
||||
*
|
||||
* @return the {@link Warp} being deleted
|
||||
*/
|
||||
@NotNull
|
||||
Warp getWarp();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.william278.huskhomes.event;
|
||||
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Representation of an event that fires when a warp is created or updated
|
||||
*/
|
||||
public interface IWarpSaveEvent extends CancellableEvent {
|
||||
|
||||
/**
|
||||
* Get the warp being created or updated
|
||||
*
|
||||
* @return the {@link Warp} being saved
|
||||
*/
|
||||
@NotNull
|
||||
Warp getWarp();
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user