Addons + Commands on teleport event

This commit is contained in:
SuperRonanCraft
2021-01-20 17:39:08 -05:00
parent 993480df38
commit d7a3bf8e49
14 changed files with 152 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
package me.SuperRonanCraft.BetterRTP.references.customEvents;
public interface RTPEvent {
//Used purely to grab these classes during runtime without distinct class reference
}

View File

@@ -0,0 +1,16 @@
package me.SuperRonanCraft.BetterRTP.references.customEvents;
public enum RTPEvents {
CANCELLED(RTP_CancelledEvent.class),
COMMAND(RTP_CommandEvent.class),
FINDLOCATION(RTP_FindLocationEvent.class),
TELEPORT(RTP_TeleportEvent.class),
TELEPORTPOST(RTP_TeleportPostEvent.class),
TELEPORTPRE(RTP_TeleportPreEvent.class);
public Class cl;
RTPEvents(Class cl) {
this.cl = cl;
}
}

View File

@@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RTP_CancelledEvent extends Event {
public class RTP_CancelledEvent extends Event implements RTPEvent { //Called when a delayed rtp is cancelled cause player moved
Player p;
private static final HandlerList handler = new HandlerList();

View File

@@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RTP_CommandEvent extends Event {
public class RTP_CommandEvent extends Event implements RTPEvent {
CommandSender sendi;
RTPCommand cmd;

View File

@@ -3,12 +3,15 @@ package me.SuperRonanCraft.BetterRTP.references.customEvents;
import me.SuperRonanCraft.BetterRTP.references.worlds.RTPWorld;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RTP_FindLocationEvent {
public class RTP_FindLocationEvent extends Event implements RTPEvent {
Player p;
RTPWorld world;
Location loc = null;
private static final HandlerList handler = new HandlerList();
public RTP_FindLocationEvent(Player p, RTPWorld world) {
this.p = p;
@@ -30,4 +33,13 @@ public class RTP_FindLocationEvent {
public Player getPlayer() {
return p;
}
@Override
public HandlerList getHandlers() {
return handler;
}
public static HandlerList getHandlerList() {
return handler;
}
}

View File

@@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RTP_TeleportEvent extends Event {
public class RTP_TeleportEvent extends Event implements RTPEvent {
Player p;
Location loc;

View File

@@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RTP_TeleportPostEvent extends Event {
public class RTP_TeleportPostEvent extends Event implements RTPEvent {
Player p;
Location loc;

View File

@@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RTP_TeleportPreEvent extends Event {
public class RTP_TeleportPreEvent extends Event implements RTPEvent { //Called upon every rtp call, does not mean player will be teleported
Player p;
private static final HandlerList handler = new HandlerList();

View File

@@ -1,5 +1,5 @@
main: me.SuperRonanCraft.BetterRTP.BetterRTP
version: '3.0.4-1'
version: '3.0.5'
name: BetterRTP
author: SuperRonanCraft
softdepend: