Adds a new StargateTeleportEvent to combine some duplicated code
This commit is contained in:
parent
8a5c094ce1
commit
95293204d5
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* <p>This event can be used to overwrite the location the entity is teleported to.</p>
|
* <p>This event can be used to overwrite the location the entity is teleported to.</p>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class StargateEntityPortalEvent extends StargateEvent {
|
public class StargateEntityPortalEvent extends StargateEvent implements StargateTeleportEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
final Entity travellingEntity;
|
final Entity travellingEntity;
|
||||||
@ -58,6 +58,7 @@ public class StargateEntityPortalEvent extends StargateEvent {
|
|||||||
*
|
*
|
||||||
* @return <p>Location of the exit point</p>
|
* @return <p>Location of the exit point</p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Location getExit() {
|
public Location getExit() {
|
||||||
return exit;
|
return exit;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* <p>This event can be used to overwrite the location the player is teleported to.</p>
|
* <p>This event can be used to overwrite the location the player is teleported to.</p>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class StargatePlayerPortalEvent extends StargatePlayerEvent {
|
public class StargatePlayerPortalEvent extends StargatePlayerEvent implements StargateTeleportEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Portal destination;
|
private final Portal destination;
|
||||||
@ -47,6 +47,7 @@ public class StargatePlayerPortalEvent extends StargatePlayerEvent {
|
|||||||
*
|
*
|
||||||
* @return <p>Location of the exit point</p>
|
* @return <p>Location of the exit point</p>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Location getExit() {
|
public Location getExit() {
|
||||||
return exit;
|
return exit;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package net.knarcraft.stargate.event;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic teleportation event
|
||||||
|
*/
|
||||||
|
public interface StargateTeleportEvent extends Cancellable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the location of the players exit point
|
||||||
|
*
|
||||||
|
* @return <p>Location of the exit point</p>
|
||||||
|
*/
|
||||||
|
Location getExit();
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user