add movement and packet handlers

This commit is contained in:
Freddie 2023-05-30 21:20:50 +01:00
parent af8b608c15
commit 30728f9bd7
4 changed files with 57 additions and 1 deletions

View File

@ -1,9 +1,9 @@
package lol.vera.spigot;
import lol.vera.spigot.implementation.KnockbackImplementation;
import lol.vera.spigot.implementation.SpigotImplementation;
import lombok.Data;
@Data
public class VeraSpigotAPI {
@ -11,4 +11,8 @@ public class VeraSpigotAPI {
private KnockbackImplementation knockback
= new KnockbackImplementation.DEFAULT();
private SpigotImplementation spigot
= new SpigotImplementation.DEFAULT();
}

View File

@ -0,0 +1,25 @@
package lol.vera.spigot.implementation;
import lol.vera.spigot.packet.MovementHandler;
import lol.vera.spigot.packet.PacketHandler;
import org.bukkit.plugin.java.JavaPlugin;
public interface SpigotImplementation {
void registerPacketHandler(JavaPlugin plugin, PacketHandler handler);
void registerMovementHandler(JavaPlugin plugin, MovementHandler handler);
class DEFAULT implements SpigotImplementation {
@Override
public void registerPacketHandler(JavaPlugin plugin, PacketHandler handler) {
}
@Override
public void registerMovementHandler(JavaPlugin plugin, MovementHandler handler) {
}
}
}

View File

@ -0,0 +1,16 @@
package lol.vera.spigot.packet;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public interface MovementHandler {
/**
* @param player The {@link Player} who has moved
* @param to The {@link Location} the player came from
* @param from The {@link Location} the player is going to
* @param packet The flying packet
*/
void handleMove(Player player, Location to, Location from, Object packet);
}

View File

@ -0,0 +1,11 @@
package lol.vera.spigot.packet;
import org.bukkit.entity.Player;
public interface PacketHandler {
boolean handleSent(Player player, Object packet);
boolean handleReceived(Player player, Object packet);
}