diff --git a/build.gradle b/build.gradle index 08d10e9..746b0e8 100644 --- a/build.gradle +++ b/build.gradle @@ -18,14 +18,13 @@ plugins { } group = 'eu.crushedpixel.sponge' -version = '0.1' +version = '0.1.1-SNAPSHOT' sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies { compile 'org.spongepowered:spongeapi:5.1.0' - compile 'org.projectlombok:lombok:1.16.4' } minecraft { diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/api/event/PacketEvent.java b/src/main/java/eu/crushedpixel/sponge/packetgate/api/event/PacketEvent.java index 96c55ef..105741b 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/api/event/PacketEvent.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/api/event/PacketEvent.java @@ -1,7 +1,5 @@ package eu.crushedpixel.sponge.packetgate.api.event; -import lombok.Getter; -import lombok.Setter; import net.minecraft.network.Packet; public class PacketEvent { @@ -11,13 +9,29 @@ public PacketEvent(Packet packet, boolean outgoing) { this.outgoing = outgoing; } - @Getter @Setter private Packet packet; - @Getter @Setter private boolean cancelled = false; - @Getter private final boolean outgoing; + public Packet getPacket() { + return packet; + } + + public void setPacket(Packet packet) { + this.packet = packet; + } + + public boolean isCancelled() { + return cancelled; + } + + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + public boolean isOutgoing() { + return outgoing; + } } diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/api/listener/PacketListener.java b/src/main/java/eu/crushedpixel/sponge/packetgate/api/listener/PacketListener.java index bf77c6a..2c1b198 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/api/listener/PacketListener.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/api/listener/PacketListener.java @@ -2,7 +2,6 @@ import eu.crushedpixel.sponge.packetgate.api.event.PacketEvent; import eu.crushedpixel.sponge.packetgate.api.registry.PacketConnection; -import lombok.Data; public interface PacketListener { @@ -10,10 +9,22 @@ public interface PacketListener { void onPacketWrite(PacketEvent packetEvent, PacketConnection connection); - @Data public class PacketListenerData { private final PacketListener packetListener; private final ListenerPriority priority; + + public PacketListenerData(PacketListener packetListener, ListenerPriority priority) { + this.packetListener = packetListener; + this.priority = priority; + } + + public PacketListener getPacketListener() { + return packetListener; + } + + public ListenerPriority getPriority() { + return priority; + } } public enum ListenerPriority { diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/api/registry/PacketConnection.java b/src/main/java/eu/crushedpixel/sponge/packetgate/api/registry/PacketConnection.java index 05cc63f..220da7d 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/api/registry/PacketConnection.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/api/registry/PacketConnection.java @@ -4,26 +4,25 @@ import eu.crushedpixel.sponge.packetgate.api.listener.PacketListener; import eu.crushedpixel.sponge.packetgate.api.listener.PacketListener.PacketListenerData; import io.netty.channel.Channel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; import net.minecraft.network.Packet; import org.slf4j.Logger; import java.util.List; import java.util.UUID; -@RequiredArgsConstructor public class PacketConnection extends ListenerOwner { private final Logger logger; - @Getter private final Channel channel; - @Getter @Setter private UUID playerUUID; + public PacketConnection(Logger logger, Channel channel) { + this.logger = logger; + this.channel = channel; + } + public void sendPacket(Packet packet) { channel.write(packet); } @@ -43,4 +42,15 @@ public void handlePacketEvent(PacketEvent event) { } } + public Channel getChannel() { + return channel; + } + + public UUID getPlayerUUID() { + return playerUUID; + } + + public void setPlayerUUID(UUID playerUUID) { + this.playerUUID = playerUUID; + } } diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/PluginPacketGate.java b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/PluginPacketGate.java index a0639b8..0a23e4d 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/PluginPacketGate.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/PluginPacketGate.java @@ -17,7 +17,7 @@ public class PluginPacketGate { static final String ID = "packetgate"; - static final String VERSION = "0.1"; + static final String VERSION = "0.1.1"; @Inject private Logger logger; diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/ConnectionHandler.java b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/ConnectionHandler.java index 272ccbc..d1238d4 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/ConnectionHandler.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/ConnectionHandler.java @@ -6,10 +6,8 @@ import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; -import lombok.RequiredArgsConstructor; import net.minecraft.network.login.server.SPacketLoginSuccess; -@RequiredArgsConstructor @ChannelHandler.Sharable class ConnectionHandler extends ChannelDuplexHandler { @@ -18,6 +16,11 @@ class ConnectionHandler extends ChannelDuplexHandler { private boolean injected = false; + public ConnectionHandler(PacketGate packetGate, PacketConnection connection) { + this.packetGate = packetGate; + this.connection = connection; + } + @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { if (!injected) { diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/CustomChannelInitializer.java b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/CustomChannelInitializer.java index 457c378..b16f0d3 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/CustomChannelInitializer.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/CustomChannelInitializer.java @@ -5,15 +5,18 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import lombok.RequiredArgsConstructor; import org.slf4j.Logger; -@RequiredArgsConstructor public class CustomChannelInitializer extends ChannelInboundHandlerAdapter { private final Logger logger; private final PacketGate packetGate; + public CustomChannelInitializer(Logger logger, PacketGate packetGate) { + this.logger = logger; + this.packetGate = packetGate; + } + @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { Channel channel = (Channel)msg; diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/IncomingPacketHandler.java b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/IncomingPacketHandler.java index 585ada9..5d6eb9c 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/IncomingPacketHandler.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/IncomingPacketHandler.java @@ -4,14 +4,16 @@ import eu.crushedpixel.sponge.packetgate.api.registry.PacketConnection; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import lombok.RequiredArgsConstructor; import net.minecraft.network.Packet; -@RequiredArgsConstructor class IncomingPacketHandler extends ChannelInboundHandlerAdapter { private final PacketConnection packetConnection; + public IncomingPacketHandler(PacketConnection packetConnection) { + this.packetConnection = packetConnection; + } + @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof Packet) { diff --git a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/OutgoingPacketHandler.java b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/OutgoingPacketHandler.java index 0414b3c..83f5fb0 100644 --- a/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/OutgoingPacketHandler.java +++ b/src/main/java/eu/crushedpixel/sponge/packetgate/plugin/netty/OutgoingPacketHandler.java @@ -1,18 +1,20 @@ package eu.crushedpixel.sponge.packetgate.plugin.netty; -import eu.crushedpixel.sponge.packetgate.api.registry.PacketConnection; import eu.crushedpixel.sponge.packetgate.api.event.PacketEvent; +import eu.crushedpixel.sponge.packetgate.api.registry.PacketConnection; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPromise; -import lombok.RequiredArgsConstructor; import net.minecraft.network.Packet; -@RequiredArgsConstructor class OutgoingPacketHandler extends ChannelOutboundHandlerAdapter { private final PacketConnection packetConnection; + public OutgoingPacketHandler(PacketConnection packetConnection) { + this.packetConnection = packetConnection; + } + @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof Packet) {