mirror of
https://github.com/veralol/VeraSpigotAPI.git
synced 2024-11-13 02:21:33 +01:00
add movement and packet handlers
This commit is contained in:
parent
af8b608c15
commit
30728f9bd7
@ -1,9 +1,9 @@
|
|||||||
package lol.vera.spigot;
|
package lol.vera.spigot;
|
||||||
|
|
||||||
import lol.vera.spigot.implementation.KnockbackImplementation;
|
import lol.vera.spigot.implementation.KnockbackImplementation;
|
||||||
|
import lol.vera.spigot.implementation.SpigotImplementation;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class VeraSpigotAPI {
|
public class VeraSpigotAPI {
|
||||||
|
|
||||||
@ -11,4 +11,8 @@ public class VeraSpigotAPI {
|
|||||||
|
|
||||||
private KnockbackImplementation knockback
|
private KnockbackImplementation knockback
|
||||||
= new KnockbackImplementation.DEFAULT();
|
= new KnockbackImplementation.DEFAULT();
|
||||||
|
|
||||||
|
private SpigotImplementation spigot
|
||||||
|
= new SpigotImplementation.DEFAULT();
|
||||||
|
|
||||||
}
|
}
|
@ -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) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
src/main/java/lol/vera/spigot/packet/MovementHandler.java
Normal file
16
src/main/java/lol/vera/spigot/packet/MovementHandler.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
11
src/main/java/lol/vera/spigot/packet/PacketHandler.java
Normal file
11
src/main/java/lol/vera/spigot/packet/PacketHandler.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user