top 10 reasons to test your code in 2023 (tutorial)

This commit is contained in:
Chipmunk 2023-04-30 21:36:33 -04:00
parent 8beaa3d290
commit 97b7a225fb

View file

@ -45,12 +45,12 @@ public class Client {
this.session = session; this.session = session;
session.addListener(new SessionAdapter () { session.addListener(new SessionAdapter () {
@Override public void packetReceived(Session session, Packet packet) { for (SessionListener listener : listeners) listener.packetReceived(session, packet); } @Override public void packetReceived (Session session, Packet packet) {
@Override public void packetSending (PacketSendingEvent event) { for (SessionListener listener : listeners) listener.packetSending(event); }
@Override public void packetSent (Session session, Packet packet) {
if (packet instanceof ClientboundGameProfilePacket) profile = ((ClientboundGameProfilePacket) packet).getProfile(); if (packet instanceof ClientboundGameProfilePacket) profile = ((ClientboundGameProfilePacket) packet).getProfile();
for (SessionListener listener : listeners) listener.packetSent(session, packet); for (SessionListener listener : listeners) listener.packetReceived(session, packet);
} }
@Override public void packetSending (PacketSendingEvent event) { for (SessionListener listener : listeners) listener.packetSending(event); }
@Override public void packetSent (Session session, Packet packet) { for (SessionListener listener : listeners) listener.packetSent(session, packet); }
@Override public void packetError (PacketErrorEvent event) { @Override public void packetError (PacketErrorEvent event) {
event.getCause().printStackTrace(); event.getCause().printStackTrace();
event.setSuppress(true); event.setSuppress(true);