diff --git a/src/main/java/ch/spacebase/mcprotocol/event/DisconnectEvent.java b/src/main/java/ch/spacebase/mcprotocol/event/DisconnectEvent.java index 52804f23..210244f1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/DisconnectEvent.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/DisconnectEvent.java @@ -11,12 +11,12 @@ public class DisconnectEvent extends ProtocolEvent { * The connection that was disconnected. */ private Connection conn; - + /** * The given reason for disconnecting. */ private String reason; - + /** * Creates a new disconnect event instance. * @param conn Connection that is disconnecting. @@ -34,7 +34,7 @@ public class DisconnectEvent extends ProtocolEvent { public Connection getConnection() { return this.conn; } - + /** * Gets the given reason for disconnecting. * @return The reason for disconnecting. @@ -42,7 +42,7 @@ public class DisconnectEvent extends ProtocolEvent { public String getReason() { return this.reason; } - + @Override public void call(ProtocolListener listener) { listener.onDisconnect(this); diff --git a/src/main/java/ch/spacebase/mcprotocol/event/PacketRecieveEvent.java b/src/main/java/ch/spacebase/mcprotocol/event/PacketReceiveEvent.java similarity index 85% rename from src/main/java/ch/spacebase/mcprotocol/event/PacketRecieveEvent.java rename to src/main/java/ch/spacebase/mcprotocol/event/PacketReceiveEvent.java index f875e46e..5b1c3c79 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/PacketRecieveEvent.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/PacketReceiveEvent.java @@ -5,7 +5,7 @@ import ch.spacebase.mcprotocol.packet.Packet; /** * Called when a packet is received. */ -public class PacketRecieveEvent extends ProtocolEvent { +public class PacketReceiveEvent extends ProtocolEvent { /** * The received packet. @@ -16,7 +16,7 @@ public class PacketRecieveEvent extends ProtocolEvent { * Creates a new packet receive event instance. * @param packet Packet being received. */ - public PacketRecieveEvent(Packet packet) { + public PacketReceiveEvent(Packet packet) { this.packet = packet; } @@ -37,7 +37,7 @@ public class PacketRecieveEvent extends ProtocolEvent { public T getPacket(Class clazz) { try { return (T) this.packet; - } catch (ClassCastException e) { + } catch(ClassCastException e) { return null; } } diff --git a/src/main/java/ch/spacebase/mcprotocol/event/PacketSendEvent.java b/src/main/java/ch/spacebase/mcprotocol/event/PacketSendEvent.java index cee642bc..68401472 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/PacketSendEvent.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/PacketSendEvent.java @@ -37,7 +37,7 @@ public class PacketSendEvent extends ProtocolEvent { public T getPacket(Class clazz) { try { return (T) this.packet; - } catch (ClassCastException e) { + } catch(ClassCastException e) { return null; } } diff --git a/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitable.java b/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitable.java index b96feadd..6d8303c7 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitable.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitable.java @@ -7,5 +7,5 @@ package ch.spacebase.mcprotocol.event; */ public interface PacketVisitable { - public void accept(PacketVisitor visitor); + public void accept(PacketVisitor visitor); } diff --git a/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitor.java b/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitor.java index 7fc5f9c8..67f2b1ab 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitor.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitor.java @@ -9,167 +9,167 @@ import ch.spacebase.mcprotocol.standard.packet.*; */ public interface PacketVisitor { - public void visit(PacketKeepAlive packet); + public void visit(PacketKeepAlive packet); - public void visit(PacketLogin packet); + public void visit(PacketLogin packet); - public void visit(PacketHandshake packet); + public void visit(PacketHandshake packet); - public void visit(PacketChat packet); + public void visit(PacketChat packet); - public void visit(PacketTimeUpdate packet); + public void visit(PacketTimeUpdate packet); - public void visit(PacketEntityEquipment packet); + public void visit(PacketEntityEquipment packet); - public void visit(PacketSpawnPosition packet); + public void visit(PacketSpawnPosition packet); - public void visit(PacketUseEntity packet); + public void visit(PacketUseEntity packet); - public void visit(PacketHealthUpdate packet); + public void visit(PacketHealthUpdate packet); - public void visit(PacketRespawn packet); + public void visit(PacketRespawn packet); - public void visit(PacketPlayer packet); + public void visit(PacketPlayer packet); - public void visit(PacketPlayerPosition packet); + public void visit(PacketPlayerPosition packet); - public void visit(PacketPlayerLook packet); + public void visit(PacketPlayerLook packet); - public void visit(PacketPlayerPositionLook packet); + public void visit(PacketPlayerPositionLook packet); - public void visit(PacketPlayerDigging packet); + public void visit(PacketPlayerDigging packet); - public void visit(PacketPlayerBlockPlace packet); + public void visit(PacketPlayerBlockPlace packet); - public void visit(PacketHeldItemChange packet); + public void visit(PacketHeldItemChange packet); - public void visit(PacketUseBed packet); + public void visit(PacketUseBed packet); - public void visit(PacketAnimation packet); + public void visit(PacketAnimation packet); - public void visit(PacketEntityAction packet); + public void visit(PacketEntityAction packet); - public void visit(PacketSpawnNamedEntity packet); + public void visit(PacketSpawnNamedEntity packet); - public void visit(PacketCollectItem packet); + public void visit(PacketCollectItem packet); - public void visit(PacketSpawnObject packet); + public void visit(PacketSpawnObject packet); - public void visit(PacketSpawnMob packet); + public void visit(PacketSpawnMob packet); - public void visit(PacketSpawnPainting packet); + public void visit(PacketSpawnPainting packet); - public void visit(PacketSpawnExpOrb packet); + public void visit(PacketSpawnExpOrb packet); - public void visit(PacketSteerVehicle packet); + public void visit(PacketSteerVehicle packet); - public void visit(PacketEntityVelocity packet); + public void visit(PacketEntityVelocity packet); - public void visit(PacketDestroyEntity packet); + public void visit(PacketDestroyEntity packet); - public void visit(PacketEntity packet); + public void visit(PacketEntity packet); - public void visit(PacketEntityRelativeMove packet); + public void visit(PacketEntityRelativeMove packet); - public void visit(PacketEntityLook packet); + public void visit(PacketEntityLook packet); - public void visit(PacketEntityLookRelativeMove packet); + public void visit(PacketEntityLookRelativeMove packet); - public void visit(PacketEntityTeleport packet); + public void visit(PacketEntityTeleport packet); - public void visit(PacketEntityHeadYaw packet); + public void visit(PacketEntityHeadYaw packet); - public void visit(PacketEntityStatus packet); + public void visit(PacketEntityStatus packet); - public void visit(PacketAttachEntity packet); + public void visit(PacketAttachEntity packet); - public void visit(PacketEntityMetadata packet); + public void visit(PacketEntityMetadata packet); - public void visit(PacketEntityEffect packet); + public void visit(PacketEntityEffect packet); - public void visit(PacketRemoveEntityEffect packet); + public void visit(PacketRemoveEntityEffect packet); - public void visit(PacketSetExperience packet); + public void visit(PacketSetExperience packet); - public void visit(PacketEntityAttributes packet); + public void visit(PacketEntityAttributes packet); - public void visit(PacketMapChunk packet); + public void visit(PacketMapChunk packet); - public void visit(PacketMultiBlockChange packet); + public void visit(PacketMultiBlockChange packet); - public void visit(PacketBlockChange packet); + public void visit(PacketBlockChange packet); - public void visit(PacketBlockAction packet); + public void visit(PacketBlockAction packet); - public void visit(PacketBlockBreakAnimation packet); + public void visit(PacketBlockBreakAnimation packet); - public void visit(PacketMapChunkBulk packet); + public void visit(PacketMapChunkBulk packet); - public void visit(PacketExplosion packet); + public void visit(PacketExplosion packet); - public void visit(PacketEffect packet); + public void visit(PacketEffect packet); - public void visit(PacketNamedSound packet); + public void visit(PacketNamedSound packet); - public void visit(PacketSpawnParticle packet); + public void visit(PacketSpawnParticle packet); - public void visit(PacketGameState packet); + public void visit(PacketGameState packet); - public void visit(PacketLightning packet); + public void visit(PacketLightning packet); - public void visit(PacketOpenWindow packet); + public void visit(PacketOpenWindow packet); - public void visit(PacketCloseWindow packet); + public void visit(PacketCloseWindow packet); - public void visit(PacketWindowClick packet); + public void visit(PacketWindowClick packet); - public void visit(PacketSetSlot packet); + public void visit(PacketSetSlot packet); - public void visit(PacketWindowItems packet); + public void visit(PacketWindowItems packet); - public void visit(PacketWindowProperty packet); + public void visit(PacketWindowProperty packet); - public void visit(PacketConfirmTransaction packet); + public void visit(PacketConfirmTransaction packet); - public void visit(PacketCreativeSlot packet); + public void visit(PacketCreativeSlot packet); - public void visit(PacketEnchantItem packet); + public void visit(PacketEnchantItem packet); - public void visit(PacketUpdateSign packet); + public void visit(PacketUpdateSign packet); - public void visit(PacketItemData packet); + public void visit(PacketItemData packet); - public void visit(PacketUpdateTileEntity packet); + public void visit(PacketUpdateTileEntity packet); - public void visit(PacketOpenTileEditor packet); + public void visit(PacketOpenTileEditor packet); - public void visit(PacketIncrementStatistic packet); + public void visit(PacketIncrementStatistic packet); - public void visit(PacketPlayerListItem packet); + public void visit(PacketPlayerListItem packet); - public void visit(PacketPlayerAbilities packet); + public void visit(PacketPlayerAbilities packet); - public void visit(PacketTabComplete packet); + public void visit(PacketTabComplete packet); - public void visit(PacketClientInfo packet); + public void visit(PacketClientInfo packet); - public void visit(PacketClientStatus packet); + public void visit(PacketClientStatus packet); - public void visit(PacketScoreboardObjective packet); + public void visit(PacketScoreboardObjective packet); - public void visit(PacketUpdateScoreboard packet); + public void visit(PacketUpdateScoreboard packet); - public void visit(PacketDisplayScoreboard packet); + public void visit(PacketDisplayScoreboard packet); - public void visit(PacketTeam packet); + public void visit(PacketTeam packet); - public void visit(PacketPluginMessage packet); + public void visit(PacketPluginMessage packet); - public void visit(PacketKeyResponse packet); + public void visit(PacketKeyResponse packet); - public void visit(PacketKeyRequest packet); + public void visit(PacketKeyRequest packet); - public void visit(PacketServerPing packet); + public void visit(PacketServerPing packet); - public void visit(PacketDisconnect packet); + public void visit(PacketDisconnect packet); } diff --git a/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitorAdapter.java b/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitorAdapter.java index 418c4280..e7d47b8e 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitorAdapter.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/PacketVisitorAdapter.java @@ -84,256 +84,256 @@ import ch.spacebase.mcprotocol.standard.packet.PacketWindowItems; import ch.spacebase.mcprotocol.standard.packet.PacketWindowProperty; /** - * Empty implementation of the PacketVisitor interface for convenience. - * Usually used when most methods are not implemented. + * Empty implementation of the PacketVisitor interface for convenience. Usually + * used when most methods are not implemented. * * @author dconnor */ public class PacketVisitorAdapter implements PacketVisitor { - public void visit(PacketKeepAlive packet) { - } + public void visit(PacketKeepAlive packet) { + } - public void visit(PacketLogin packet) { - } + public void visit(PacketLogin packet) { + } - public void visit(PacketHandshake packet) { - } + public void visit(PacketHandshake packet) { + } - public void visit(PacketChat packet) { - } + public void visit(PacketChat packet) { + } - public void visit(PacketTimeUpdate packet) { - } + public void visit(PacketTimeUpdate packet) { + } - public void visit(PacketEntityEquipment packet) { - } + public void visit(PacketEntityEquipment packet) { + } - public void visit(PacketSpawnPosition packet) { - } + public void visit(PacketSpawnPosition packet) { + } - public void visit(PacketUseEntity packet) { - } + public void visit(PacketUseEntity packet) { + } - public void visit(PacketHealthUpdate packet) { - } + public void visit(PacketHealthUpdate packet) { + } - public void visit(PacketRespawn packet) { - } + public void visit(PacketRespawn packet) { + } - public void visit(PacketPlayer packet) { - } + public void visit(PacketPlayer packet) { + } - public void visit(PacketPlayerPosition packet) { - } + public void visit(PacketPlayerPosition packet) { + } - public void visit(PacketPlayerLook packet) { - } + public void visit(PacketPlayerLook packet) { + } - public void visit(PacketPlayerPositionLook packet) { - } + public void visit(PacketPlayerPositionLook packet) { + } - public void visit(PacketPlayerDigging packet) { - } + public void visit(PacketPlayerDigging packet) { + } - public void visit(PacketPlayerBlockPlace packet) { - } + public void visit(PacketPlayerBlockPlace packet) { + } - public void visit(PacketHeldItemChange packet) { - } + public void visit(PacketHeldItemChange packet) { + } - public void visit(PacketUseBed packet) { - } + public void visit(PacketUseBed packet) { + } - public void visit(PacketAnimation packet) { - } + public void visit(PacketAnimation packet) { + } - public void visit(PacketEntityAction packet) { - } + public void visit(PacketEntityAction packet) { + } - public void visit(PacketSpawnNamedEntity packet) { - } + public void visit(PacketSpawnNamedEntity packet) { + } - public void visit(PacketCollectItem packet) { - } + public void visit(PacketCollectItem packet) { + } - public void visit(PacketSpawnObject packet) { - } + public void visit(PacketSpawnObject packet) { + } - public void visit(PacketSpawnMob packet) { - } + public void visit(PacketSpawnMob packet) { + } - public void visit(PacketSpawnPainting packet) { - } + public void visit(PacketSpawnPainting packet) { + } - public void visit(PacketSpawnExpOrb packet) { - } + public void visit(PacketSpawnExpOrb packet) { + } - public void visit(PacketSteerVehicle packet) { - } + public void visit(PacketSteerVehicle packet) { + } - public void visit(PacketEntityVelocity packet) { - } + public void visit(PacketEntityVelocity packet) { + } - public void visit(PacketDestroyEntity packet) { - } + public void visit(PacketDestroyEntity packet) { + } - public void visit(PacketEntity packet) { - } + public void visit(PacketEntity packet) { + } - public void visit(PacketEntityRelativeMove packet) { - } + public void visit(PacketEntityRelativeMove packet) { + } - public void visit(PacketEntityLook packet) { - } + public void visit(PacketEntityLook packet) { + } - public void visit(PacketEntityLookRelativeMove packet) { - } + public void visit(PacketEntityLookRelativeMove packet) { + } - public void visit(PacketEntityTeleport packet) { - } + public void visit(PacketEntityTeleport packet) { + } - public void visit(PacketEntityHeadYaw packet) { - } + public void visit(PacketEntityHeadYaw packet) { + } - public void visit(PacketEntityStatus packet) { - } + public void visit(PacketEntityStatus packet) { + } - public void visit(PacketAttachEntity packet) { - } + public void visit(PacketAttachEntity packet) { + } - public void visit(PacketEntityMetadata packet) { - } + public void visit(PacketEntityMetadata packet) { + } - public void visit(PacketEntityEffect packet) { - } + public void visit(PacketEntityEffect packet) { + } - public void visit(PacketRemoveEntityEffect packet) { - } + public void visit(PacketRemoveEntityEffect packet) { + } - public void visit(PacketSetExperience packet) { - } + public void visit(PacketSetExperience packet) { + } - public void visit(PacketEntityAttributes packet) { - } + public void visit(PacketEntityAttributes packet) { + } - public void visit(PacketMapChunk packet) { - } + public void visit(PacketMapChunk packet) { + } - public void visit(PacketMultiBlockChange packet) { - } + public void visit(PacketMultiBlockChange packet) { + } - public void visit(PacketBlockChange packet) { - } + public void visit(PacketBlockChange packet) { + } - public void visit(PacketBlockAction packet) { - } + public void visit(PacketBlockAction packet) { + } - public void visit(PacketBlockBreakAnimation packet) { - } + public void visit(PacketBlockBreakAnimation packet) { + } - public void visit(PacketMapChunkBulk packet) { - } + public void visit(PacketMapChunkBulk packet) { + } - public void visit(PacketExplosion packet) { - } + public void visit(PacketExplosion packet) { + } - public void visit(PacketEffect packet) { - } + public void visit(PacketEffect packet) { + } - public void visit(PacketNamedSound packet) { - } + public void visit(PacketNamedSound packet) { + } - public void visit(PacketSpawnParticle packet) { - } + public void visit(PacketSpawnParticle packet) { + } - public void visit(PacketGameState packet) { - } + public void visit(PacketGameState packet) { + } - public void visit(PacketLightning packet) { - } + public void visit(PacketLightning packet) { + } - public void visit(PacketOpenWindow packet) { - } + public void visit(PacketOpenWindow packet) { + } - public void visit(PacketCloseWindow packet) { - } + public void visit(PacketCloseWindow packet) { + } - public void visit(PacketWindowClick packet) { - } + public void visit(PacketWindowClick packet) { + } - public void visit(PacketSetSlot packet) { - } + public void visit(PacketSetSlot packet) { + } - public void visit(PacketWindowItems packet) { - } + public void visit(PacketWindowItems packet) { + } - public void visit(PacketWindowProperty packet) { - } + public void visit(PacketWindowProperty packet) { + } - public void visit(PacketConfirmTransaction packet) { - } + public void visit(PacketConfirmTransaction packet) { + } - public void visit(PacketCreativeSlot packet) { - } + public void visit(PacketCreativeSlot packet) { + } - public void visit(PacketEnchantItem packet) { - } + public void visit(PacketEnchantItem packet) { + } - public void visit(PacketUpdateSign packet) { - } + public void visit(PacketUpdateSign packet) { + } - public void visit(PacketItemData packet) { - } + public void visit(PacketItemData packet) { + } - public void visit(PacketUpdateTileEntity packet) { - } + public void visit(PacketUpdateTileEntity packet) { + } - public void visit(PacketOpenTileEditor packet) { - } + public void visit(PacketOpenTileEditor packet) { + } - public void visit(PacketIncrementStatistic packet) { - } + public void visit(PacketIncrementStatistic packet) { + } - public void visit(PacketPlayerListItem packet) { - } + public void visit(PacketPlayerListItem packet) { + } - public void visit(PacketPlayerAbilities packet) { - } + public void visit(PacketPlayerAbilities packet) { + } - public void visit(PacketTabComplete packet) { - } + public void visit(PacketTabComplete packet) { + } - public void visit(PacketClientInfo packet) { - } + public void visit(PacketClientInfo packet) { + } - public void visit(PacketClientStatus packet) { - } + public void visit(PacketClientStatus packet) { + } - public void visit(PacketScoreboardObjective packet) { - } + public void visit(PacketScoreboardObjective packet) { + } - public void visit(PacketUpdateScoreboard packet) { - } + public void visit(PacketUpdateScoreboard packet) { + } - public void visit(PacketDisplayScoreboard packet) { - } + public void visit(PacketDisplayScoreboard packet) { + } - public void visit(PacketTeam packet) { - } + public void visit(PacketTeam packet) { + } - public void visit(PacketPluginMessage packet) { - } + public void visit(PacketPluginMessage packet) { + } - public void visit(PacketKeyResponse packet) { - } + public void visit(PacketKeyResponse packet) { + } - public void visit(PacketKeyRequest packet) { - } + public void visit(PacketKeyRequest packet) { + } - public void visit(PacketServerPing packet) { - } + public void visit(PacketServerPing packet) { + } - public void visit(PacketDisconnect packet) { - } + public void visit(PacketDisconnect packet) { + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/event/ProtocolListener.java b/src/main/java/ch/spacebase/mcprotocol/event/ProtocolListener.java index 8601dd88..00a714a7 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/ProtocolListener.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/ProtocolListener.java @@ -9,14 +9,14 @@ public abstract class ProtocolListener { * Called when a packet is received. * @param event The called event. */ - public abstract void onPacketReceive(PacketRecieveEvent event); - + public abstract void onPacketReceive(PacketReceiveEvent event); + /** * Called when a packet is sent. * @param event The called event. */ public abstract void onPacketSend(PacketSendEvent event); - + /** * Called when a connection is disconnected. * @param event The called event. diff --git a/src/main/java/ch/spacebase/mcprotocol/event/ServerListener.java b/src/main/java/ch/spacebase/mcprotocol/event/ServerListener.java index 44b1f3ec..b1e379e3 100644 --- a/src/main/java/ch/spacebase/mcprotocol/event/ServerListener.java +++ b/src/main/java/ch/spacebase/mcprotocol/event/ServerListener.java @@ -10,5 +10,5 @@ public abstract class ServerListener { * @param event The called event. */ public abstract void onConnect(ConnectEvent event); - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/net/BaseConnection.java b/src/main/java/ch/spacebase/mcprotocol/net/BaseConnection.java index 53668787..f708fb59 100644 --- a/src/main/java/ch/spacebase/mcprotocol/net/BaseConnection.java +++ b/src/main/java/ch/spacebase/mcprotocol/net/BaseConnection.java @@ -15,17 +15,17 @@ public abstract class BaseConnection implements Connection { * The connection's remote host. */ private String host; - + /** * The connection's remote port. */ private int port; - + /** * The connection's username. */ private String username; - + /** * The connection's packets. */ @@ -35,7 +35,7 @@ public abstract class BaseConnection implements Connection { * Listeners listening to this connection. */ private List listeners = new ArrayList(); - + /** * Creates a new connection. * @param host Host to connect to. @@ -56,26 +56,26 @@ public abstract class BaseConnection implements Connection { public int getRemotePort() { return this.port; } - + @Override public PacketRegistry getPacketRegistry() { return this.packets; } - + @Override public String getUsername() { return this.username; } - + @Override public void setUsername(String name) { if(this.username != null) { return; } - + this.username = name; } - + @Override public void listen(ProtocolListener listener) { this.listeners.add(listener); @@ -89,5 +89,5 @@ public abstract class BaseConnection implements Connection { return event; } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/net/Connection.java b/src/main/java/ch/spacebase/mcprotocol/net/Connection.java index e0a5b0a9..acfbe35b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/net/Connection.java +++ b/src/main/java/ch/spacebase/mcprotocol/net/Connection.java @@ -15,7 +15,7 @@ public interface Connection { * @return The connection's protocol type. */ public abstract PacketRegistry getPacketRegistry(); - + /** * Gets the remote host of this connection. * @return The connection's remote host. @@ -27,7 +27,7 @@ public interface Connection { * @return The connection's remote port. */ public int getRemotePort(); - + /** * Adds a listener to listen to this connection. * @param listener Listener to add. @@ -40,48 +40,49 @@ public interface Connection { * @return The event called. */ public > T call(T event); - + /** * Gets the connection's username. * @return The connection's username. */ public String getUsername(); - + /** - * Sets the connection's username if it isn't already set, ignoring any authentication. + * Sets the connection's username if it isn't already set, ignoring any + * authentication. * @param name The new username. */ public void setUsername(String name); - + /** * Gets whether the connection is connected. * @return True if the connection is connected. */ public boolean isConnected(); - + /** * Connects this connection. * @throws ConnectException If a connection error occurs. */ public void connect() throws ConnectException; - + /** * Disconnects this connection, sending a packet with a reason. * @param reason Reason to disconnect. */ public void disconnect(String reason); - + /** * Disconnects this connection, sending a packet with a reason. * @param reason Reason to disconnect. * @param packet Whether a disconnect packet is necessary. */ public void disconnect(String reason, boolean packet); - + /** * Sends a packet. * @param packet Packet to send. */ public void send(Packet packet); - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/net/PacketRegistry.java b/src/main/java/ch/spacebase/mcprotocol/net/PacketRegistry.java index fcb38a37..f8c47b8a 100644 --- a/src/main/java/ch/spacebase/mcprotocol/net/PacketRegistry.java +++ b/src/main/java/ch/spacebase/mcprotocol/net/PacketRegistry.java @@ -27,9 +27,9 @@ public abstract class PacketRegistry { public Class getPacket(int id) { try { return this.packets[id]; - } catch (ArrayIndexOutOfBoundsException e) { + } catch(ArrayIndexOutOfBoundsException e) { return null; } } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/net/Server.java b/src/main/java/ch/spacebase/mcprotocol/net/Server.java index 465c4e1c..d690d86f 100644 --- a/src/main/java/ch/spacebase/mcprotocol/net/Server.java +++ b/src/main/java/ch/spacebase/mcprotocol/net/Server.java @@ -15,33 +15,33 @@ public abstract class Server { * The server's host to listen on. */ private String host; - + /** * The server's port to listen on. */ private int port; - + /** * Whether auth is enabled. */ private boolean auth; - + /** * Listeners listening to this server. */ private List listeners = new ArrayList(); - + /** * Creates a new server instance. * @param host Host to listen on. * @param port Port to listen on. */ - public Server(String host, int port, boolean auth) { + public Server(String host, int port, boolean auth) { this.host = host; this.port = port; this.auth = auth; } - + /** * Gets the host of this server. * @return The server's host. @@ -57,7 +57,7 @@ public abstract class Server { public int getPort() { return this.port; } - + /** * Gets whether authentication is enabled. * @return Whether auth is enabled. @@ -65,7 +65,7 @@ public abstract class Server { public boolean isAuthEnabled() { return this.auth; } - + /** * Adds a listener to listen to this server. * @param listener Listener to add. @@ -86,27 +86,27 @@ public abstract class Server { return event; } - + /** * Gets whether the server is active. * @return Whether the server is active. */ public abstract boolean isActive(); - + /** * Binds the server to its host and port. */ public abstract void bind(); - + /** * Shuts the server down. */ public abstract void shutdown(); - + /** * Gets a list of connections connected to this server. * @return The server's connections. */ public abstract List getConnections(); - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/net/io/NetInput.java b/src/main/java/ch/spacebase/mcprotocol/net/io/NetInput.java index 7d0f0137..409d69b4 100644 --- a/src/main/java/ch/spacebase/mcprotocol/net/io/NetInput.java +++ b/src/main/java/ch/spacebase/mcprotocol/net/io/NetInput.java @@ -13,70 +13,70 @@ public interface NetInput { * @throws IOException If an I/O error occurs. */ public boolean readBoolean() throws IOException; - + /** * Reads the next byte. * @return The next byte. * @throws IOException If an I/O error occurs. */ public byte readByte() throws IOException; - + /** * Reads the next unsigned byte. * @return The next unsigned byte. * @throws IOException If an I/O error occurs. */ public int readUnsignedByte() throws IOException; - + /** * Reads the next short. * @return The next short. * @throws IOException If an I/O error occurs. */ public short readShort() throws IOException; - + /** * Reads the next unsigned short. * @return The next unsigned short. * @throws IOException If an I/O error occurs. */ public int readUnsignedShort() throws IOException; - + /** * Reads the next char. * @return The next char. * @throws IOException If an I/O error occurs. */ public char readChar() throws IOException; - + /** * Reads the next integer. * @return The next integer. * @throws IOException If an I/O error occurs. */ public int readInt() throws IOException; - + /** * Reads the next long. * @return The next long. * @throws IOException If an I/O error occurs. */ public long readLong() throws IOException; - + /** * Reads the next float. * @return The next float. * @throws IOException If an I/O error occurs. */ public float readFloat() throws IOException; - + /** * Reads the next double. * @return The next double. * @throws IOException If an I/O error occurs. */ public double readDouble() throws IOException; - + /** * Reads the next byte array. * @param The length of the byte array. @@ -84,18 +84,18 @@ public interface NetInput { * @throws IOException If an I/O error occurs. */ public byte[] readBytes(int length) throws IOException; - + /** * Reads the next string. * @return The next string. * @throws IOException If an I/O error occurs. */ public String readString() throws IOException; - + /** * Gets the number of available bytes. * @return The number of available bytes. */ public int available() throws IOException; - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/net/io/NetOutput.java b/src/main/java/ch/spacebase/mcprotocol/net/io/NetOutput.java index 6e91494e..347e8569 100644 --- a/src/main/java/ch/spacebase/mcprotocol/net/io/NetOutput.java +++ b/src/main/java/ch/spacebase/mcprotocol/net/io/NetOutput.java @@ -10,63 +10,63 @@ public interface NetOutput { * @throws IOException If an I/O error occurs. */ public void writeBoolean(boolean b) throws IOException; - + /** * Writes a byte. * @param b Byte to write. * @throws IOException If an I/O error occurs. */ public void writeByte(int b) throws IOException; - + /** * Writes a short. * @param s Short to write. * @throws IOException If an I/O error occurs. */ public void writeShort(int s) throws IOException; - + /** * Writes a char. * @param c Char to write. * @throws IOException If an I/O error occurs. */ public void writeChar(int c) throws IOException; - + /** * Writes a integer. * @param i Integer to write. * @throws IOException If an I/O error occurs. */ public void writeInt(int i) throws IOException; - + /** * Writes a long. * @param l Long to write. * @throws IOException If an I/O error occurs. */ public void writeLong(long l) throws IOException; - + /** * Writes a float. * @param f Float to write. * @throws IOException If an I/O error occurs. */ public void writeFloat(float f) throws IOException; - + /** * Writes a double. * @param d Double to write. * @throws IOException If an I/O error occurs. */ public void writeDouble(double d) throws IOException; - + /** * Writes a byte array. * @param b Byte array to write. * @throws IOException If an I/O error occurs. */ public void writeBytes(byte b[]) throws IOException; - + /** * Writes a byte array, using the given amount of bytes. * @param b Byte array to write. @@ -74,18 +74,18 @@ public interface NetOutput { * @throws IOException If an I/O error occurs. */ public void writeBytes(byte b[], int length) throws IOException; - + /** * Writes a string. * @param s String to write. * @throws IOException If an I/O error occurs. */ public void writeString(String s) throws IOException; - + /** * Flushes the output. * @throws IOException If an I/O error occurs. */ public void flush() throws IOException; - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/packet/Packet.java b/src/main/java/ch/spacebase/mcprotocol/packet/Packet.java index fbb884cc..09dd1ce5 100644 --- a/src/main/java/ch/spacebase/mcprotocol/packet/Packet.java +++ b/src/main/java/ch/spacebase/mcprotocol/packet/Packet.java @@ -48,6 +48,6 @@ public abstract class Packet implements PacketVisitable { * Gets the id of this packet. * @return The packet's id. */ - public abstract int getId(); + public abstract int getId(); } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardClient.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardClient.java index 21df7fb1..f4c84bc1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardClient.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardClient.java @@ -30,12 +30,12 @@ public class StandardClient extends StandardConnection implements Client { * The client's session id. */ private String sessionId; - + /** * Whether the client is logged in. */ private boolean loggedIn; - + /** * Creates a new standard client. * @param host Host to connect to. @@ -44,7 +44,7 @@ public class StandardClient extends StandardConnection implements Client { public StandardClient(String host, int port) { super(host, port); } - + /** * Gets the client's session id. * @return The client's session id. @@ -58,12 +58,12 @@ public class StandardClient extends StandardConnection implements Client { if(this.loggedIn || this.getUsername() != null) { throw new IllegalStateException("Already logged in with username: " + this.getUsername()); } - + URL url = null; try { url = new URL("https://login.minecraft.net/"); - } catch (MalformedURLException e) { + } catch(MalformedURLException e) { throw new LoginException("Login URL is malformed?", e); } @@ -71,7 +71,7 @@ public class StandardClient extends StandardConnection implements Client { try { params = "user=" + URLEncoder.encode(username, "UTF-8") + "&password=" + URLEncoder.encode(password, "UTF-8") + "&version=" + Constants.LAUNCHER_VERSION; - } catch (UnsupportedEncodingException e) { + } catch(UnsupportedEncodingException e) { throw new LoginException("UTF-8 unsupported", e); } @@ -119,7 +119,7 @@ public class StandardClient extends StandardConnection implements Client { this.loggedIn = true; new Thread(new KeepAliveTask()).start(); - } catch (ArrayIndexOutOfBoundsException e) { + } catch(ArrayIndexOutOfBoundsException e) { throw new LoginException("Response contained incorrect amount of parameters: " + result); } @@ -132,20 +132,20 @@ public class StandardClient extends StandardConnection implements Client { throw new LoginException(result.trim()); } } - } catch (IOException e) { + } catch(IOException e) { throw new LoginException("Failed to login", e); } finally { if(conn != null) conn.disconnect(); conn = null; } } - + @Override public void disconnect(String reason, boolean packet) { this.loggedIn = false; super.disconnect(reason, packet); } - + /** * A task that keeps the client's minecraft.net session alive. */ @@ -154,7 +154,7 @@ public class StandardClient extends StandardConnection implements Client { * The minecraft.net session URL. */ private URL url; - + /** * The time when a keep alive was last sent. */ @@ -167,7 +167,7 @@ public class StandardClient extends StandardConnection implements Client { public KeepAliveTask() throws LoginException { try { this.url = new URL("https://login.minecraft.net/"); - } catch (MalformedURLException e) { + } catch(MalformedURLException e) { throw new LoginException("Failed to create keep alive URL!", e); } } @@ -187,7 +187,7 @@ public class StandardClient extends StandardConnection implements Client { conn.setDoOutput(true); conn.setReadTimeout(1000 * 60 * 10); conn.connect(); - } catch (IOException e) { + } catch(IOException e) { Util.logger().severe("Failed to send keep alive to login.minecraft.net!"); e.printStackTrace(); } finally { @@ -195,10 +195,10 @@ public class StandardClient extends StandardConnection implements Client { conn = null; } } - + try { Thread.sleep(2); - } catch (InterruptedException e) { + } catch(InterruptedException e) { } } } @@ -212,11 +212,11 @@ public class StandardClient extends StandardConnection implements Client { sock.setTrafficClass(24); super.connect(sock); this.send(new PacketHandshake(this.getUsername(), this.getRemoteHost(), this.getRemotePort())); - } catch (UnknownHostException e) { + } catch(UnknownHostException e) { throw new ConnectException("Unknown host: " + this.getRemoteHost()); - } catch (IOException e) { + } catch(IOException e) { throw new ConnectException("Failed to open stream: " + this.getRemoteHost(), e); } } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java index e44e38b2..8c5cc453 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardConnection.java @@ -18,7 +18,7 @@ import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.crypto.params.ParametersWithIV; import ch.spacebase.mcprotocol.event.DisconnectEvent; -import ch.spacebase.mcprotocol.event.PacketRecieveEvent; +import ch.spacebase.mcprotocol.event.PacketReceiveEvent; import ch.spacebase.mcprotocol.event.PacketSendEvent; import ch.spacebase.mcprotocol.exception.ConnectException; import ch.spacebase.mcprotocol.net.BaseConnection; @@ -35,42 +35,42 @@ import ch.spacebase.mcprotocol.util.Util; * A connection implementing standard Minecraft protocol. */ public abstract class StandardConnection extends BaseConnection { - + /** * The connection's socket. */ private Socket sock; - + /** * The connection's input stream. */ private StandardInput input; - + /** * The connection's output stream. */ private StandardOutput output; - + /** * The connection's packet write queue. */ private Queue packets = new ConcurrentLinkedQueue(); - + /** * Whether the connection is writing. */ private boolean writing = false; - + /** * Whether the connection is connected. */ private boolean connected = false; - + /** * The connection's secret key. */ private SecretKey key; - + /** * Creates a new standard connection. * @param host Host to connect to. @@ -98,13 +98,13 @@ public abstract class StandardConnection extends BaseConnection { this.connected = true; new ListenThread().start(); new WriteThread().start(); - } catch (UnknownHostException e) { + } catch(UnknownHostException e) { throw new ConnectException("Unknown host: " + this.getRemoteHost()); - } catch (IOException e) { + } catch(IOException e) { throw new ConnectException("Failed to open stream: " + this.getRemoteHost(), e); } } - + @Override public void disconnect(String reason) { this.disconnect(reason, true); @@ -116,7 +116,7 @@ public abstract class StandardConnection extends BaseConnection { if(packet && this.isConnected()) { this.send(new PacketDisconnect(reason)); } - + new CloseThread().start(); this.connected = false; this.call(new DisconnectEvent(this, reason)); @@ -126,7 +126,7 @@ public abstract class StandardConnection extends BaseConnection { public void send(Packet packet) { this.packets.add(packet); } - + /** * Gets the protocol's secret key. * @return The protocol's secret key. @@ -142,7 +142,7 @@ public abstract class StandardConnection extends BaseConnection { public void setSecretKey(SecretKey key) { this.key = key; } - + /** * Enabled AES encryption on the connection. * @param conn Connection to enable AES on. @@ -156,7 +156,7 @@ public abstract class StandardConnection extends BaseConnection { this.input = new StandardInput(new CipherInputStream(this.input.getStream(), in)); this.output = new StandardOutput(new CipherOutputStream(this.output.getStream(), out)); } - + /** * A thread listening for incoming packets. */ @@ -175,10 +175,10 @@ public abstract class StandardConnection extends BaseConnection { disconnect("Bad packet ID: " + opcode); return; } - + Packet packet = getPacketRegistry().getPacket(opcode).newInstance(); packet.read(input); - call(new PacketRecieveEvent(packet)); + call(new PacketReceiveEvent(packet)); if(StandardConnection.this instanceof Client) { packet.handleClient((Client) StandardConnection.this); } else if(StandardConnection.this instanceof ServerConnection) { @@ -186,15 +186,15 @@ public abstract class StandardConnection extends BaseConnection { } } catch(EOFException e) { disconnect("End of Stream"); - } catch (Exception e) { + } catch(Exception e) { Util.logger().severe("Error while listening to connection!"); e.printStackTrace(); disconnect("Error while listening to connection!"); } - + try { Thread.sleep(2); - } catch (InterruptedException e) { + } catch(InterruptedException e) { } } } @@ -211,32 +211,33 @@ public abstract class StandardConnection extends BaseConnection { writing = true; Packet packet = packets.poll(); call(new PacketSendEvent(packet)); - + try { output.writeByte(packet.getId()); packet.write(output); output.flush(); - } catch (Exception e) { + } catch(Exception e) { Util.logger().severe("Error while writing packet \"" + packet.getId() + "\"!"); e.printStackTrace(); disconnect("Error while writing packet."); } - + writing = false; } - + try { Thread.sleep(2); - } catch (InterruptedException e) { + } catch(InterruptedException e) { } - + writing = false; } } } - + /** - * A thread that waits for the connection to finish writing before closing it. + * A thread that waits for the connection to finish writing before closing + * it. */ private class CloseThread extends Thread { @Override @@ -244,17 +245,17 @@ public abstract class StandardConnection extends BaseConnection { while(writing) { try { Thread.sleep(2); - } catch (InterruptedException e) { + } catch(InterruptedException e) { } } - + try { sock.close(); - } catch (IOException e) { + } catch(IOException e) { System.err.println("Failed to close socket."); e.printStackTrace(); } - + connected = false; } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java index e054da39..12b244a1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java @@ -173,5 +173,5 @@ public class StandardPackets extends PacketRegistry { this.registerPacket(254, PacketServerPing.class); this.registerPacket(255, PacketDisconnect.class); } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardServer.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardServer.java index ec714929..f14c984b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardServer.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardServer.java @@ -29,12 +29,12 @@ public class StandardServer extends Server { * The connections connected to the server. */ private List connections = new CopyOnWriteArrayList(); - + /** * The server's key pair. */ private KeyPair keys; - + /** * Creates a new standard server. * @param host Host to listen on. @@ -47,11 +47,10 @@ public class StandardServer extends Server { KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); gen.initialize(1024); this.keys = gen.generateKeyPair(); - } catch (NoSuchAlgorithmException e) { + } catch(NoSuchAlgorithmException e) { e.printStackTrace(); } } - /** * Gets the server's key pair. @@ -72,7 +71,7 @@ public class StandardServer extends Server { ServerSocket sock = new ServerSocket(); sock.bind(new InetSocketAddress(this.getHost(), this.getPort())); new ServerConnectionThread(sock).start(); - } catch (IOException e) { + } catch(IOException e) { Util.logger().severe("Failed to bind to " + this.getHost() + ":" + this.getPort() + "!"); e.printStackTrace(); } @@ -91,7 +90,7 @@ public class StandardServer extends Server { public List getConnections() { return this.connections; } - + /** * Listens for new server connections. */ @@ -119,19 +118,19 @@ public class StandardServer extends Server { conn.connect(); connections.add(conn); call(new ConnectEvent(conn)); - } catch (Exception e) { + } catch(Exception e) { Util.logger().severe("Failed to create server connection!"); e.printStackTrace(); } - } catch (IOException e) { + } catch(IOException e) { Util.logger().severe("Failed to accept connection from client!"); e.printStackTrace(); continue; } - + try { Thread.sleep(2); - } catch (InterruptedException e) { + } catch(InterruptedException e) { } } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardServerConnection.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardServerConnection.java index a36eb819..88a5028d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardServerConnection.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardServerConnection.java @@ -12,37 +12,37 @@ import ch.spacebase.mcprotocol.util.Util; * A server connection for the standard minecraft protocol. */ public class StandardServerConnection extends StandardConnection implements ServerConnection { - + /** * The server this connection belongs to. */ private Server server; - + /** * The connection's temporary socket variable. */ private Socket sock; - + /** * The last time a keep alive was sent. */ private long aliveTime = System.currentTimeMillis(); - + /** * The last sent server keep alive id. */ private int aliveId; - + /** * The protocol's login key. */ private String loginKey; - + /** * The protocol's security token. */ private byte token[]; - + /** * Creates a new server connection. * @param server Server the connection belongs to. @@ -53,7 +53,7 @@ public class StandardServerConnection extends StandardConnection implements Serv this.server = server; this.sock = sock; } - + /** * Gets the last id used in a keep alive to this connection. * @return The last keep alive id. @@ -61,7 +61,7 @@ public class StandardServerConnection extends StandardConnection implements Serv public int getLastAliveId() { return this.aliveId; } - + /** * Gets the last time a keep alive was performed. * @return The last keep alive time. @@ -81,7 +81,7 @@ public class StandardServerConnection extends StandardConnection implements Serv this.sock = null; new KeepAliveThread().start(); } - + /** * Gets the connection's login key. * @return The connection's login key. @@ -113,7 +113,7 @@ public class StandardServerConnection extends StandardConnection implements Serv public void setToken(byte token[]) { this.token = token; } - + /** * A thread that keeps the connection alive. */ @@ -126,13 +126,13 @@ public class StandardServerConnection extends StandardConnection implements Serv aliveId = Util.random().nextInt(); send(new PacketKeepAlive(aliveId)); } - + try { Thread.sleep(2); - } catch (InterruptedException e) { + } catch(InterruptedException e) { } } } } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/data/AttributeModifier.java b/src/main/java/ch/spacebase/mcprotocol/standard/data/AttributeModifier.java index 89d61be2..2722f6f5 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/data/AttributeModifier.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/data/AttributeModifier.java @@ -19,7 +19,7 @@ public class AttributeModifier { * The modifier's operation. */ private int operation; - + /** * Creates a new modifier. * @param uid Unique id of the modifier. @@ -31,7 +31,7 @@ public class AttributeModifier { this.amount = amount; this.operation = operation; } - + /** * Gets the modifier's unique id. * @return The modifier's unique id. @@ -39,7 +39,7 @@ public class AttributeModifier { public UUID getUID() { return this.uid; } - + /** * Gets the modifier's amount. * @return The modifier's amount. @@ -47,7 +47,7 @@ public class AttributeModifier { public double getAmount() { return this.amount; } - + /** * Gets the modifier's operation. * @return The modifier's operation. @@ -55,5 +55,5 @@ public class AttributeModifier { public int getOperation() { return this.operation; } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/data/Coordinates.java b/src/main/java/ch/spacebase/mcprotocol/standard/data/Coordinates.java index 90ac6d90..9d920e27 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/data/Coordinates.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/data/Coordinates.java @@ -9,12 +9,12 @@ public class Coordinates { * The X coordinate. */ private int x; - + /** * The Y coordinate. */ private int y; - + /** * The Z coordinate. */ diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/data/EntityAttribute.java b/src/main/java/ch/spacebase/mcprotocol/standard/data/EntityAttribute.java index c7cd52ef..e796ad0d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/data/EntityAttribute.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/data/EntityAttribute.java @@ -20,7 +20,7 @@ public class EntityAttribute { * The attribute's modifiers. */ private List modifiers; - + /** * Creates a new entity attribute instance. * @param name Name of the attribute. @@ -29,7 +29,7 @@ public class EntityAttribute { public EntityAttribute(String name, double value) { this(name, value, new ArrayList()); } - + /** * Creates a new entity attribute instance. * @param name Name of the attribute. @@ -41,7 +41,7 @@ public class EntityAttribute { this.value = value; this.modifiers = modifiers; } - + /** * Gets the attribute's name. * @return The attribute's name. @@ -49,7 +49,7 @@ public class EntityAttribute { public String getName() { return this.name; } - + /** * Gets the attribute's value. * @return The attribute's value. @@ -57,7 +57,7 @@ public class EntityAttribute { public double getValue() { return this.value; } - + /** * Gets the attribute's modifiers. * @return The attribute's modifiers. @@ -65,7 +65,7 @@ public class EntityAttribute { public List getModifiers() { return this.modifiers; } - + /** * Adds a modifier to the attribute. * @param mod Modifier to add. @@ -73,5 +73,5 @@ public class EntityAttribute { public void addModifier(AttributeModifier mod) { this.modifiers.add(mod); } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/data/StandardItemStack.java b/src/main/java/ch/spacebase/mcprotocol/standard/data/StandardItemStack.java index c4fbae58..da12a14b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/data/StandardItemStack.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/data/StandardItemStack.java @@ -9,17 +9,17 @@ public class StandardItemStack { * Id of the items in the stack. */ private short item; - + /** * The size of the item stack. */ private byte stackSize; - + /** * The damage value of the items in the stack. */ private short damage; - + /** * The compressed NBT data of the item stack. */ @@ -53,7 +53,8 @@ public class StandardItemStack { } /** - * Creates an item stack with the given id, size, damage value, and compressed NBT data. + * Creates an item stack with the given id, size, damage value, and + * compressed NBT data. * @param item Item id of the stack. * @param stackSize Size of the stack. * @param damage Damage value of the stack. @@ -73,7 +74,7 @@ public class StandardItemStack { public short getItem() { return this.item; } - + /** * Sets the item id of the stack. * @param item New item id of the stack. diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/data/WatchableObject.java b/src/main/java/ch/spacebase/mcprotocol/standard/data/WatchableObject.java index c8b0ac02..8e3f9d8b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/data/WatchableObject.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/data/WatchableObject.java @@ -9,12 +9,12 @@ public class WatchableObject { * The type id of the object. */ private int type; - + /** * The id of the object. */ private int id; - + /** * The value of the object. */ diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBot.java b/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBot.java index 126300c7..e3e30146 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBot.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBot.java @@ -3,7 +3,7 @@ package ch.spacebase.mcprotocol.standard.example; import java.text.DecimalFormat; import ch.spacebase.mcprotocol.event.DisconnectEvent; -import ch.spacebase.mcprotocol.event.PacketRecieveEvent; +import ch.spacebase.mcprotocol.event.PacketReceiveEvent; import ch.spacebase.mcprotocol.event.PacketSendEvent; import ch.spacebase.mcprotocol.event.ProtocolListener; import ch.spacebase.mcprotocol.exception.ConnectException; @@ -37,7 +37,7 @@ public class ChatBot { try { this.client.connect(); - } catch (ConnectException e) { + } catch(ConnectException e) { e.printStackTrace(); } } @@ -56,20 +56,20 @@ public class ChatBot { private class Listener extends ProtocolListener { @Override - public void onPacketReceive(PacketRecieveEvent event) { + public void onPacketReceive(PacketReceiveEvent event) { Packet packet = event.getPacket(); switch(event.getPacket().getId()) { - case 0x0D: - onPositionLook((PacketPlayerPositionLook) packet); - break; + case 0x0D: + onPositionLook((PacketPlayerPositionLook) packet); + break; } } - + @Override public void onPacketSend(PacketSendEvent event) { } - + @Override public void onDisconnect(DisconnectEvent event) { Util.logger().info("Disconnected: " + event.getReason()); diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBotVisitor.java b/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBotVisitor.java index 5efea507..fcbaa855 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBotVisitor.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/example/ChatBotVisitor.java @@ -5,7 +5,7 @@ import ch.spacebase.mcprotocol.exception.OutdatedLibraryException; import java.text.DecimalFormat; import ch.spacebase.mcprotocol.event.DisconnectEvent; -import ch.spacebase.mcprotocol.event.PacketRecieveEvent; +import ch.spacebase.mcprotocol.event.PacketReceiveEvent; import ch.spacebase.mcprotocol.event.PacketSendEvent; import ch.spacebase.mcprotocol.event.PacketVisitor; import ch.spacebase.mcprotocol.event.PacketVisitorAdapter; @@ -28,78 +28,77 @@ import java.util.logging.Logger; */ public class ChatBotVisitor { - private static final String USERNAME = ""; - private static final String PASSWORD = ""; - private static final String HOST = "127.0.0.1"; - private static final int PORT = 25565; + private static final String USERNAME = ""; + private static final String PASSWORD = ""; + private static final String HOST = "127.0.0.1"; + private static final int PORT = 25565; - private Client client; - private Listener listener; - private PacketVisitor visitor; - + private Client client; + private Listener listener; + private PacketVisitor visitor; - public ChatBotVisitor(String host, int port) { - this.client = new StandardClient(host, port); - this.listener = new Listener(); + public ChatBotVisitor(String host, int port) { + this.client = new StandardClient(host, port); + this.listener = new Listener(); - this.client.listen(this.listener); - - this.visitor = new Visitor(); - } + this.client.listen(this.listener); - public void login(String username, String password) { - try { - this.client.login(username, password); - } catch (LoginException ex) { - Logger.getLogger("Login Error: " + ex.getLocalizedMessage()); - } catch (OutdatedLibraryException ex) { - Logger.getLogger(ChatBotVisitor.class.getName()).log(Level.SEVERE, null, ex); - } - try { - this.client.connect(); - } catch (ConnectException e) { - e.printStackTrace(); - } - } + this.visitor = new Visitor(); + } - public void say(String text) { - PacketChat chat = new PacketChat(); - chat.message = text; - this.client.send(chat); - } + public void login(String username, String password) { + try { + this.client.login(username, password); + } catch(LoginException ex) { + Logger.getLogger("Login Error: " + ex.getLocalizedMessage()); + } catch(OutdatedLibraryException ex) { + Logger.getLogger(ChatBotVisitor.class.getName()).log(Level.SEVERE, null, ex); + } + try { + this.client.connect(); + } catch(ConnectException e) { + e.printStackTrace(); + } + } - public static void main(String[] args) { - ChatBotVisitor bot = new ChatBotVisitor(HOST, PORT); - Util.logger().info("Logging in..."); - bot.login(USERNAME, PASSWORD); - } + public void say(String text) { + PacketChat chat = new PacketChat(); + chat.message = text; + this.client.send(chat); + } - private class Visitor extends PacketVisitorAdapter { + public static void main(String[] args) { + ChatBotVisitor bot = new ChatBotVisitor(HOST, PORT); + Util.logger().info("Logging in..."); + bot.login(USERNAME, PASSWORD); + } - @Override - public void visit(PacketPlayerPositionLook packet) { - client.send(packet); - DecimalFormat format = new DecimalFormat("#.00"); + private class Visitor extends PacketVisitorAdapter { - ChatBotVisitor.this.say("Hello, this is "+USERNAME+" at coordinate (" + format.format(packet.x) + ", " + format.format(packet.y) + ", " + format.format(packet.z) + ")"); - } - } + @Override + public void visit(PacketPlayerPositionLook packet) { + client.send(packet); + DecimalFormat format = new DecimalFormat("#.00"); - private class Listener extends ProtocolListener { + ChatBotVisitor.this.say("Hello, this is " + USERNAME + " at coordinate (" + format.format(packet.x) + ", " + format.format(packet.y) + ", " + format.format(packet.z) + ")"); + } + } - @Override - public void onPacketReceive(PacketRecieveEvent event) { - Packet packet = event.getPacket(); - packet.accept(visitor); - } + private class Listener extends ProtocolListener { - @Override - public void onPacketSend(PacketSendEvent event) { - } + @Override + public void onPacketReceive(PacketReceiveEvent event) { + Packet packet = event.getPacket(); + packet.accept(visitor); + } - @Override - public void onDisconnect(DisconnectEvent event) { - Util.logger().info("Disconnected: " + event.getReason()); - } - } + @Override + public void onPacketSend(PacketSendEvent event) { + } + + @Override + public void onDisconnect(DisconnectEvent event) { + Util.logger().info("Disconnected: " + event.getReason()); + } + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardInput.java b/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardInput.java index 66bc6f39..a67ed84d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardInput.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardInput.java @@ -15,11 +15,11 @@ import ch.spacebase.mcprotocol.util.Constants; public class StandardInput implements NetInput { private InputStream in; - + public StandardInput(InputStream in) { this.in = in; } - + public InputStream getStream() { return this.in; } @@ -28,7 +28,7 @@ public class StandardInput implements NetInput { public boolean readBoolean() throws IOException { return this.readByte() == 1; } - + @Override public byte readByte() throws IOException { return (byte) this.readUnsignedByte(); @@ -40,7 +40,7 @@ public class StandardInput implements NetInput { if(b < 0) { throw new EOFException(); } - + return b; } @@ -94,17 +94,17 @@ public class StandardInput implements NetInput { if(length < 0) { throw new IndexOutOfBoundsException(); } - + int n = 0; while(n < length) { int count = this.in.read(b, n, length - n); if(count < 0) { throw new EOFException(); } - + n += count; } - + return b; } @@ -118,12 +118,12 @@ public class StandardInput implements NetInput { return new String(characters); } - + @Override public int available() throws IOException { return this.in.available(); } - + /** * Reads an entity's metadata. * @return The read metadata objects. @@ -166,7 +166,7 @@ public class StandardInput implements NetInput { return objects.toArray(new WatchableObject[objects.size()]); } - + /** * Reads an item stack. * @return The read item stack. @@ -185,10 +185,10 @@ public class StandardInput implements NetInput { nbt = this.readBytes(length); } } - + return new StandardItemStack(item, stackSize, damage, nbt); } - + /** * Reads a coordinate group. * @return The read coordinates. @@ -200,5 +200,5 @@ public class StandardInput implements NetInput { int z = this.readInt(); return new Coordinates(x, y, z); } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardOutput.java b/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardOutput.java index 18464f7d..c3b78f1e 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardOutput.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/io/StandardOutput.java @@ -11,15 +11,15 @@ import ch.spacebase.mcprotocol.util.Constants; public class StandardOutput implements NetOutput { private OutputStream out; - + public StandardOutput(OutputStream out) { this.out = out; } - + public OutputStream getStream() { return this.out; } - + @Override public void writeBoolean(boolean b) throws IOException { this.writeByte(b ? 1 : 0); @@ -76,7 +76,7 @@ public class StandardOutput implements NetOutput { public void writeBytes(byte b[]) throws IOException { this.writeBytes(b, b.length); } - + @Override public void writeBytes(byte b[], int length) throws IOException { this.out.write(b, 0, length); @@ -87,7 +87,7 @@ public class StandardOutput implements NetOutput { if(s == null) { throw new IllegalArgumentException("String cannot be null!"); } - + int len = s.length(); if(len >= 65536) { throw new IllegalArgumentException("String too long."); @@ -98,12 +98,12 @@ public class StandardOutput implements NetOutput { this.writeChar(s.charAt(i)); } } - + @Override public void flush() throws IOException { this.out.flush(); } - + /** * Writes an entity's metadata. * @param data Metadata objects to write. @@ -140,7 +140,7 @@ public class StandardOutput implements NetOutput { this.writeByte(127); } - + /** * Writes an item stack. * @param item Item stack to write. @@ -159,7 +159,7 @@ public class StandardOutput implements NetOutput { } } } - + /** * Writes a coordinate group. * @param coords Coordinates to write. @@ -170,5 +170,5 @@ public class StandardOutput implements NetOutput { this.writeInt(coords.getY()); this.writeInt(coords.getZ()); } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAnimation.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAnimation.java index 293a858d..5963beab 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAnimation.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAnimation.java @@ -47,9 +47,9 @@ public class PacketAnimation extends Packet { return 18; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAttachEntity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAttachEntity.java index c15095c0..155083c5 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAttachEntity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketAttachEntity.java @@ -51,9 +51,9 @@ public class PacketAttachEntity extends Packet { return 39; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockAction.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockAction.java index 547e8406..d77ce2c1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockAction.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockAction.java @@ -63,9 +63,9 @@ public class PacketBlockAction extends Packet { return 54; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockBreakAnimation.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockBreakAnimation.java index c01f76e3..b86de4ed 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockBreakAnimation.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockBreakAnimation.java @@ -59,9 +59,9 @@ public class PacketBlockBreakAnimation extends Packet { return 55; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockChange.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockChange.java index 4135d5fa..8072adff 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockChange.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketBlockChange.java @@ -59,9 +59,9 @@ public class PacketBlockChange extends Packet { return 53; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketChat.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketChat.java index 2050894e..e0024ae2 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketChat.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketChat.java @@ -47,9 +47,9 @@ public class PacketChat extends Packet { return 3; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientInfo.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientInfo.java index f3692d83..c0d7607d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientInfo.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientInfo.java @@ -59,9 +59,9 @@ public class PacketClientInfo extends Packet { return 204; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientStatus.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientStatus.java index a05d9533..358a603a 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientStatus.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketClientStatus.java @@ -57,7 +57,7 @@ public class PacketClientStatus extends Packet { BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); response = reader.readLine(); reader.close(); - } catch (IOException e) { + } catch(IOException e) { response = e.toString(); } @@ -80,9 +80,9 @@ public class PacketClientStatus extends Packet { return 205; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCloseWindow.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCloseWindow.java index b44619f6..b6ac14e1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCloseWindow.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCloseWindow.java @@ -43,9 +43,9 @@ public class PacketCloseWindow extends Packet { return 101; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCollectItem.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCollectItem.java index 9f6d4f27..fcccc228 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCollectItem.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCollectItem.java @@ -46,10 +46,10 @@ public class PacketCollectItem extends Packet { public int getId() { return 22; } - - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketConfirmTransaction.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketConfirmTransaction.java index f271e5d2..8d2ef3ed 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketConfirmTransaction.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketConfirmTransaction.java @@ -51,9 +51,9 @@ public class PacketConfirmTransaction extends Packet { return 106; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCreativeSlot.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCreativeSlot.java index 8ba26c57..11464c93 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCreativeSlot.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketCreativeSlot.java @@ -52,9 +52,9 @@ public class PacketCreativeSlot extends Packet { return 107; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDestroyEntity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDestroyEntity.java index d2a2a619..f8876221 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDestroyEntity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDestroyEntity.java @@ -17,12 +17,12 @@ public class PacketDestroyEntity extends Packet { } public PacketDestroyEntity(int... entityIds) { - this.entityIds = entityIds; + this.entityIds = entityIds.clone(); } @Override public void read(NetInput in) throws IOException { - this.entityIds = new int[in.readByte()]; + this.entityIds = new int[in.readUnsignedByte()]; for(int count = 0; count < this.entityIds.length; count++) { this.entityIds[count] = in.readInt(); } @@ -49,9 +49,9 @@ public class PacketDestroyEntity extends Packet { return 29; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisconnect.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisconnect.java index 2a1fd444..fde46f41 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisconnect.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisconnect.java @@ -49,9 +49,9 @@ public class PacketDisconnect extends Packet { return 255; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisplayScoreboard.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisplayScoreboard.java index 7da9c8c3..7a71638f 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisplayScoreboard.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketDisplayScoreboard.java @@ -46,9 +46,9 @@ public class PacketDisplayScoreboard extends Packet { return 208; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java index 7b0f3cd7..ae2229fd 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java @@ -63,9 +63,9 @@ public class PacketEffect extends Packet { return 61; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEnchantItem.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEnchantItem.java index 44433231..ca68fc86 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEnchantItem.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEnchantItem.java @@ -47,9 +47,9 @@ public class PacketEnchantItem extends Packet { return 108; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntity.java index 92651c4d..dcfc1ee1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntity.java @@ -43,9 +43,9 @@ public class PacketEntity extends Packet { return 30; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAction.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAction.java index e52e9482..ff50812a 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAction.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAction.java @@ -21,7 +21,7 @@ public class PacketEntityAction extends Packet { public PacketEntityAction(int entityId, byte action) { this(entityId, action, 0); } - + public PacketEntityAction(int entityId, byte action, int jumpBar) { this.entityId = entityId; this.action = action; @@ -55,9 +55,9 @@ public class PacketEntityAction extends Packet { return 19; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAttributes.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAttributes.java index 54f1f010..331002b9 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAttributes.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityAttributes.java @@ -74,9 +74,9 @@ public class PacketEntityAttributes extends Packet { return 44; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEffect.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEffect.java index 2e5ecc54..d2c8a94b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEffect.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEffect.java @@ -55,9 +55,9 @@ public class PacketEntityEffect extends Packet { return 41; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEquipment.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEquipment.java index 32f31bc9..64fe59db 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEquipment.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityEquipment.java @@ -66,9 +66,9 @@ public class PacketEntityEquipment extends Packet { return 5; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityHeadYaw.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityHeadYaw.java index 9ddba140..70b32c68 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityHeadYaw.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityHeadYaw.java @@ -47,9 +47,9 @@ public class PacketEntityHeadYaw extends Packet { return 35; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLook.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLook.java index 1a678a73..7d168a6b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLook.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLook.java @@ -51,9 +51,9 @@ public class PacketEntityLook extends Packet { return 32; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLookRelativeMove.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLookRelativeMove.java index 699ab208..b8ab24e9 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLookRelativeMove.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityLookRelativeMove.java @@ -63,9 +63,9 @@ public class PacketEntityLookRelativeMove extends Packet { return 33; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityMetadata.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityMetadata.java index 99cda9e8..deebd50c 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityMetadata.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityMetadata.java @@ -50,9 +50,9 @@ public class PacketEntityMetadata extends Packet { return 40; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityRelativeMove.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityRelativeMove.java index 45b131d4..5a271435 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityRelativeMove.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityRelativeMove.java @@ -55,9 +55,9 @@ public class PacketEntityRelativeMove extends Packet { return 31; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityStatus.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityStatus.java index 6c2aca64..443e4c6e 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityStatus.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityStatus.java @@ -47,9 +47,9 @@ public class PacketEntityStatus extends Packet { return 38; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityTeleport.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityTeleport.java index a2e0e967..20896fef 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityTeleport.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityTeleport.java @@ -63,10 +63,9 @@ public class PacketEntityTeleport extends Packet { return 34; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } - } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityVelocity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityVelocity.java index 74606a9a..c65537ed 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityVelocity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEntityVelocity.java @@ -55,9 +55,9 @@ public class PacketEntityVelocity extends Packet { return 28; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketExplosion.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketExplosion.java index 5a87bb97..c9c42392 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketExplosion.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketExplosion.java @@ -72,9 +72,9 @@ public class PacketExplosion extends Packet { return 60; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketGameState.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketGameState.java index 213e086b..b4215e85 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketGameState.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketGameState.java @@ -47,9 +47,9 @@ public class PacketGameState extends Packet { return 70; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHandshake.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHandshake.java index f94e37bf..48d860c9 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHandshake.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHandshake.java @@ -78,9 +78,9 @@ public class PacketHandshake extends Packet { return 2; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHealthUpdate.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHealthUpdate.java index 6cd1e512..2c7dfa71 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHealthUpdate.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHealthUpdate.java @@ -51,9 +51,9 @@ public class PacketHealthUpdate extends Packet { return 8; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHeldItemChange.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHeldItemChange.java index 11359db0..a236acb3 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHeldItemChange.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketHeldItemChange.java @@ -43,9 +43,9 @@ public class PacketHeldItemChange extends Packet { return 16; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketIncrementStatistic.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketIncrementStatistic.java index 0c2ee624..9eea1c30 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketIncrementStatistic.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketIncrementStatistic.java @@ -47,9 +47,9 @@ public class PacketIncrementStatistic extends Packet { return 200; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketItemData.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketItemData.java index 55432bba..7d7207b7 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketItemData.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketItemData.java @@ -52,9 +52,9 @@ public class PacketItemData extends Packet { return 131; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeepAlive.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeepAlive.java index e19b0203..31624fe6 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeepAlive.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeepAlive.java @@ -44,9 +44,9 @@ public class PacketKeepAlive extends Packet { return 0; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyRequest.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyRequest.java index 9dd4b30d..cea61e23 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyRequest.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyRequest.java @@ -111,15 +111,15 @@ public class PacketKeyRequest extends Packet { Cipher cipher = Cipher.getInstance(key.getAlgorithm()); cipher.init(1, key); return cipher.doFinal(bytes); - } catch (InvalidKeyException e) { + } catch(InvalidKeyException e) { e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { + } catch(NoSuchAlgorithmException e) { e.printStackTrace(); - } catch (NoSuchPaddingException e) { + } catch(NoSuchPaddingException e) { e.printStackTrace(); - } catch (IllegalBlockSizeException e) { + } catch(IllegalBlockSizeException e) { e.printStackTrace(); - } catch (BadPaddingException e) { + } catch(BadPaddingException e) { e.printStackTrace(); } @@ -137,11 +137,11 @@ public class PacketKeyRequest extends Packet { X509EncodedKeySpec spec = new X509EncodedKeySpec(key); KeyFactory factory = KeyFactory.getInstance("RSA"); return factory.generatePublic(spec); - } catch (NoSuchAlgorithmException e) { + } catch(NoSuchAlgorithmException e) { Util.logger().warning("Failed to get public key from array!"); e.printStackTrace(); return null; - } catch (InvalidKeySpecException e) { + } catch(InvalidKeySpecException e) { Util.logger().warning("Failed to get public key from array!"); e.printStackTrace(); return null; @@ -155,14 +155,14 @@ public class PacketKeyRequest extends Packet { String response = reader.readLine(); reader.close(); return response; - } catch (IOException e) { + } catch(IOException e) { return e.toString(); } } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyResponse.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyResponse.java index 0438285a..cae6d18b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyResponse.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketKeyResponse.java @@ -90,24 +90,24 @@ public class PacketKeyResponse extends Packet { Cipher cipher = Cipher.getInstance(key.getAlgorithm()); cipher.init(2, key); return cipher.doFinal(bytes); - } catch (InvalidKeyException e) { + } catch(InvalidKeyException e) { e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { + } catch(NoSuchAlgorithmException e) { e.printStackTrace(); - } catch (NoSuchPaddingException e) { + } catch(NoSuchPaddingException e) { e.printStackTrace(); - } catch (IllegalBlockSizeException e) { + } catch(IllegalBlockSizeException e) { e.printStackTrace(); - } catch (BadPaddingException e) { + } catch(BadPaddingException e) { e.printStackTrace(); } return null; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLightning.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLightning.java index 8005c176..e3dd5ae0 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLightning.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLightning.java @@ -59,9 +59,9 @@ public class PacketLightning extends Packet { return 71; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLogin.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLogin.java index 68b62a09..b6c2486d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLogin.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketLogin.java @@ -12,7 +12,7 @@ import ch.spacebase.mcprotocol.packet.Packet; public class PacketLogin extends Packet { public static boolean FORGE = false; - + public int entityId; public String levelType; public byte gameMode; @@ -44,7 +44,7 @@ public class PacketLogin extends Packet { } else { this.dimension = in.readByte(); } - + this.difficulty = in.readByte(); this.unused = in.readByte(); this.maxPlayers = in.readByte(); @@ -78,9 +78,9 @@ public class PacketLogin extends Packet { return 1; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunk.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunk.java index 1630a88b..9f72baff 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunk.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunk.java @@ -62,7 +62,7 @@ public class PacketMapChunk extends Packet { try { inflater.inflate(this.data); - } catch (DataFormatException e) { + } catch(DataFormatException e) { throw new IOException("Bad compressed data format"); } finally { inflater.end(); @@ -82,7 +82,7 @@ public class PacketMapChunk extends Packet { } finally { deflater.end(); } - + out.writeInt(this.x); out.writeInt(this.z); out.writeBoolean(this.groundUp); @@ -105,9 +105,9 @@ public class PacketMapChunk extends Packet { return 51; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunkBulk.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunkBulk.java index 47d4f1d8..3c84b60d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunkBulk.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMapChunkBulk.java @@ -65,7 +65,7 @@ public class PacketMapChunkBulk extends Packet { try { inflater.inflate(decompressed); - } catch (DataFormatException e) { + } catch(DataFormatException e) { throw new IOException("Bad compressed data format"); } finally { inflater.end(); @@ -117,9 +117,9 @@ public class PacketMapChunkBulk extends Packet { return 56; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMultiBlockChange.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMultiBlockChange.java index 2a5c37e3..1a71ae60 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMultiBlockChange.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketMultiBlockChange.java @@ -63,9 +63,9 @@ public class PacketMultiBlockChange extends Packet { return 52; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java index a1326874..daecab2f 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java @@ -63,9 +63,9 @@ public class PacketNamedSound extends Packet { return 62; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenTileEditor.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenTileEditor.java index 01cf7230..b6e1d5e7 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenTileEditor.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenTileEditor.java @@ -55,9 +55,9 @@ public class PacketOpenTileEditor extends Packet { return 133; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenWindow.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenWindow.java index 615ca4e0..6cba00b3 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenWindow.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketOpenWindow.java @@ -21,7 +21,7 @@ public class PacketOpenWindow extends Packet { public PacketOpenWindow() { } - + public PacketOpenWindow(byte id, byte type, String name, byte slots, boolean useTitle) { this(id, type, name, slots, useTitle, 0); } @@ -72,9 +72,9 @@ public class PacketOpenWindow extends Packet { return 100; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayer.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayer.java index f7f21894..55bacc7f 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayer.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayer.java @@ -43,9 +43,9 @@ public class PacketPlayer extends Packet { return 10; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerAbilities.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerAbilities.java index 70d0db8d..27e93649 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerAbilities.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerAbilities.java @@ -67,9 +67,9 @@ public class PacketPlayerAbilities extends Packet { return 202; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerBlockPlace.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerBlockPlace.java index edb042e2..82b8757d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerBlockPlace.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerBlockPlace.java @@ -59,7 +59,7 @@ public class PacketPlayerBlockPlace extends Packet { if(this.item != null) { ((StandardOutput) out).writeItem(this.item); } - + out.writeByte(this.cursorX); out.writeByte(this.cursorY); out.writeByte(this.cursorZ); @@ -78,9 +78,9 @@ public class PacketPlayerBlockPlace extends Packet { return 15; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerDigging.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerDigging.java index 6500f87e..20ceea44 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerDigging.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerDigging.java @@ -59,9 +59,9 @@ public class PacketPlayerDigging extends Packet { return 14; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerListItem.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerListItem.java index b24509d9..35995032 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerListItem.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerListItem.java @@ -51,9 +51,9 @@ public class PacketPlayerListItem extends Packet { return 201; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerLook.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerLook.java index 433ca7e3..47e3124d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerLook.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerLook.java @@ -51,9 +51,9 @@ public class PacketPlayerLook extends Packet { return 12; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPosition.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPosition.java index f3d65db8..016108ff 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPosition.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPosition.java @@ -59,9 +59,9 @@ public class PacketPlayerPosition extends Packet { return 11; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPositionLook.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPositionLook.java index d6142c20..d7784bff 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPositionLook.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPlayerPositionLook.java @@ -67,9 +67,9 @@ public class PacketPlayerPositionLook extends Packet { return 13; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPluginMessage.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPluginMessage.java index 9f813e91..5df25202 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPluginMessage.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketPluginMessage.java @@ -48,9 +48,9 @@ public class PacketPluginMessage extends Packet { return 250; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRemoveEntityEffect.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRemoveEntityEffect.java index 36f5c351..97c46e92 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRemoveEntityEffect.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRemoveEntityEffect.java @@ -47,9 +47,9 @@ public class PacketRemoveEntityEffect extends Packet { return 42; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRespawn.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRespawn.java index db5d4444..1577f491 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRespawn.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketRespawn.java @@ -59,9 +59,9 @@ public class PacketRespawn extends Packet { return 9; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketScoreboardObjective.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketScoreboardObjective.java index 05a1bc3f..8001c42d 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketScoreboardObjective.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketScoreboardObjective.java @@ -50,9 +50,9 @@ public class PacketScoreboardObjective extends Packet { return 206; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketServerPing.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketServerPing.java index e0ab3aab..916b4a74 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketServerPing.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketServerPing.java @@ -1,6 +1,5 @@ package ch.spacebase.mcprotocol.standard.packet; -import ch.spacebase.mcprotocol.event.PacketVisitor; import ch.spacebase.mcprotocol.event.PacketVisitor; import ch.spacebase.mcprotocol.net.io.NetInput; import ch.spacebase.mcprotocol.net.io.NetOutput; @@ -41,9 +40,9 @@ public class PacketServerPing extends Packet { return 254; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetExperience.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetExperience.java index e1ca7d0e..117b9f4e 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetExperience.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetExperience.java @@ -51,9 +51,9 @@ public class PacketSetExperience extends Packet { return 43; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetSlot.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetSlot.java index c68f245f..5896025a 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetSlot.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSetSlot.java @@ -56,9 +56,9 @@ public class PacketSetSlot extends Packet { return 103; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnExpOrb.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnExpOrb.java index 4180f92f..1dd28529 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnExpOrb.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnExpOrb.java @@ -59,9 +59,9 @@ public class PacketSpawnExpOrb extends Packet { return 26; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnMob.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnMob.java index cc012839..d17191f0 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnMob.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnMob.java @@ -90,9 +90,9 @@ public class PacketSpawnMob extends Packet { return 24; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnNamedEntity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnNamedEntity.java index ae0e1037..9b9a5595 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnNamedEntity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnNamedEntity.java @@ -78,9 +78,9 @@ public class PacketSpawnNamedEntity extends Packet { return 20; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnObject.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnObject.java index 62d17557..16475c2c 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnObject.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnObject.java @@ -87,9 +87,9 @@ public class PacketSpawnObject extends Packet { return 23; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPainting.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPainting.java index c9b4eb8d..cd6901d1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPainting.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPainting.java @@ -63,9 +63,9 @@ public class PacketSpawnPainting extends Packet { return 25; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java index 656c705c..8ab072ae 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java @@ -72,9 +72,9 @@ public class PacketSpawnParticle extends Packet { return 63; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPosition.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPosition.java index 18176d42..5740c40b 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPosition.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnPosition.java @@ -51,9 +51,9 @@ public class PacketSpawnPosition extends Packet { return 6; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSteerVehicle.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSteerVehicle.java index 3db2d9de..229a9f1c 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSteerVehicle.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSteerVehicle.java @@ -55,9 +55,9 @@ public class PacketSteerVehicle extends Packet { return 27; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTabComplete.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTabComplete.java index ca0bc589..c0087b29 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTabComplete.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTabComplete.java @@ -43,9 +43,9 @@ public class PacketTabComplete extends Packet { return 203; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTeam.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTeam.java index 1998155c..c0aff786 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTeam.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTeam.java @@ -29,7 +29,7 @@ public class PacketTeam extends Packet { this.name = name; this.action = 1; } - + /** * Creates a packet for adding or removing a team member. * @param name Name of the team. @@ -41,7 +41,7 @@ public class PacketTeam extends Packet { this.players = players; this.action = add ? (byte) 3 : 4; } - + /** * Creates a packet for updating a team. * @param name Name of the team. @@ -58,7 +58,7 @@ public class PacketTeam extends Packet { this.friendlyFire = friendlyFire; this.action = 2; } - + /** * Creates a packet for adding a team. * @param name Name of the team. @@ -92,7 +92,7 @@ public class PacketTeam extends Packet { for(int ind = 0; ind < this.players.length; ind++) { this.players[ind] = in.readString(); } - + break; case 1: break; @@ -108,7 +108,7 @@ public class PacketTeam extends Packet { for(int ind = 0; ind < this.players.length; ind++) { this.players[ind] = in.readString(); } - + break; } } @@ -127,7 +127,7 @@ public class PacketTeam extends Packet { for(int ind = 0; ind < this.players.length; ind++) { out.writeString(this.players[ind]); } - + break; case 1: break; @@ -143,7 +143,7 @@ public class PacketTeam extends Packet { for(int ind = 0; ind < this.players.length; ind++) { out.writeString(this.players[ind]); } - + break; } } @@ -161,9 +161,9 @@ public class PacketTeam extends Packet { return 209; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTimeUpdate.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTimeUpdate.java index eb98c819..73102a28 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTimeUpdate.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketTimeUpdate.java @@ -47,9 +47,9 @@ public class PacketTimeUpdate extends Packet { return 4; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateScoreboard.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateScoreboard.java index ec2605cc..9ff79de1 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateScoreboard.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateScoreboard.java @@ -58,9 +58,9 @@ public class PacketUpdateScoreboard extends Packet { return 207; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateSign.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateSign.java index 6e211695..15c1447e 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateSign.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateSign.java @@ -63,9 +63,9 @@ public class PacketUpdateSign extends Packet { return 130; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateTileEntity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateTileEntity.java index 5eca1942..77342fb2 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateTileEntity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUpdateTileEntity.java @@ -62,9 +62,9 @@ public class PacketUpdateTileEntity extends Packet { return 132; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseBed.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseBed.java index 8d13ec03..311d9491 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseBed.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseBed.java @@ -59,9 +59,9 @@ public class PacketUseBed extends Packet { return 17; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseEntity.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseEntity.java index bd462908..55147943 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseEntity.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketUseEntity.java @@ -51,9 +51,9 @@ public class PacketUseEntity extends Packet { return 7; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowClick.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowClick.java index 2b661ee7..16eba853 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowClick.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowClick.java @@ -18,18 +18,18 @@ public class PacketWindowClick extends Packet { public short slot; public byte mousebutton; public short action; - public boolean shift; + public byte type; public StandardItemStack clicked; public PacketWindowClick() { } - public PacketWindowClick(byte id, short slot, byte mousebutton, short action, boolean shift, StandardItemStack clicked) { + public PacketWindowClick(byte id, short slot, byte mousebutton, short action, byte type, StandardItemStack clicked) { this.id = id; this.slot = slot; this.mousebutton = mousebutton; this.action = action; - this.shift = shift; + this.type = type; this.clicked = clicked; } @@ -39,7 +39,7 @@ public class PacketWindowClick extends Packet { this.slot = in.readShort(); this.mousebutton = in.readByte(); this.action = in.readShort(); - this.shift = in.readBoolean(); + this.type = in.readByte(); this.clicked = ((StandardInput) in).readItem(); } @@ -49,7 +49,7 @@ public class PacketWindowClick extends Packet { out.writeShort(this.slot); out.writeByte(this.mousebutton); out.writeShort(this.action); - out.writeBoolean(this.shift); + out.writeByte(this.type); if(this.clicked != null) { ((StandardOutput) out).writeItem(this.clicked); } @@ -68,9 +68,9 @@ public class PacketWindowClick extends Packet { return 102; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowItems.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowItems.java index 38f27540..22020a23 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowItems.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowItems.java @@ -56,9 +56,9 @@ public class PacketWindowItems extends Packet { return 104; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowProperty.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowProperty.java index d774bcfa..dcc94ce0 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowProperty.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketWindowProperty.java @@ -51,9 +51,9 @@ public class PacketWindowProperty extends Packet { return 105; } - @Override - public void accept(PacketVisitor visitor) { - visitor.visit(this); - } + @Override + public void accept(PacketVisitor visitor) { + visitor.visit(this); + } } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageBuilder.java b/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageBuilder.java index c20f8574..15a8e439 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageBuilder.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageBuilder.java @@ -16,7 +16,7 @@ public class PluginMessageBuilder { * The channel of the plugin message. */ private String channel; - + /** * The internal output used in building the data. */ @@ -43,7 +43,7 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } @@ -59,7 +59,7 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } @@ -75,7 +75,7 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } @@ -106,7 +106,7 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } @@ -122,7 +122,7 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } @@ -138,7 +138,7 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } @@ -154,12 +154,13 @@ public class PluginMessageBuilder { Util.logger().severe("Failed to write to plugin message"); e.printStackTrace(); } - + return this; } /** - * Writes a byte array to the plugin message data, prepending the array length. + * Writes a byte array to the plugin message data, prepending the array + * length. * @param b Bytes to write. * @return This plugin message builder. */ diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageReader.java b/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageReader.java index a5146ac1..f79ced4e 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageReader.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/util/PluginMessageReader.java @@ -15,7 +15,7 @@ public class PluginMessageReader { * The internal stream used to read data. */ private StandardInput in; - + /** * The array being read from. */ diff --git a/src/main/java/ch/spacebase/mcprotocol/util/Constants.java b/src/main/java/ch/spacebase/mcprotocol/util/Constants.java index fef83ec3..b022a2df 100644 --- a/src/main/java/ch/spacebase/mcprotocol/util/Constants.java +++ b/src/main/java/ch/spacebase/mcprotocol/util/Constants.java @@ -20,17 +20,17 @@ public class Constants { * The current protocol version. */ public static final byte PROTOCOL_VERSION = 74; - + /** * The current game version. */ public static final String MINECRAFT_VERSION = "1.6.2"; - + /** * The server list ping magic value. */ public static final byte PING_MAGIC = 1; - + /** * Contains animation ids. */ @@ -44,7 +44,7 @@ public class Constants { public static final byte CROUCH = 104; public static final byte UNCROUCH = 105; } - + /** * Contains view distance ids. */ @@ -54,7 +54,7 @@ public class Constants { public static final byte SHORT = 2; public static final byte TINY = 3; } - + /** * Contains difficulty ids. */ @@ -64,7 +64,7 @@ public class Constants { public static final byte NORMAL = 2; public static final byte HARD = 3; } - + /** * Contains client status ids. */ @@ -72,7 +72,7 @@ public class Constants { public static final byte INITIAL_SPAWN = 0; public static final byte RESPAWN = 1; } - + /** * Contains entity action ids. */ @@ -83,7 +83,7 @@ public class Constants { public static final byte START_SPRINTING = 4; public static final byte STOP_SPRINTING = 5; } - + /** * Contains entity status ids. */ @@ -95,8 +95,18 @@ public class Constants { public static final byte SHAKING_WATER = 8; public static final byte EATING_ACCEPT = 9; public static final byte SHEEP_EATING = 10; + public static final byte IRON_GOLEM_ROSE = 11; + public static final byte SPAWN_HEART_PARTICLES = 12; + public static final byte SPAWN_ANGRY_PARTICLES = 13; + public static final byte SPAWN_LOVE_PARTICLES = 14; + public static final byte SPAWN_MAGIC_PARTICLES = 15; + public static final byte ZOMBIE_INTO_VILLAGER = 16; + public static final byte EXPLODING_FIREWORK = 17; + public static final byte MOVE_TO_REPLICAPARTITION = 125; + public static final byte CONVERT_TO_AUTHORITATIVE = 126; + public static final byte CONVERT_TO_REPLICA = 127; } - + /** * Contains game state ids. */ @@ -107,7 +117,7 @@ public class Constants { public static final byte CHANGE_GAMEMODE = 3; public static final byte ENTER_CREDITS = 4; } - + /** * Contains game mode ids. */ @@ -116,7 +126,7 @@ public class Constants { public static final byte CREATIVE = 1; public static final byte ADVENTURE = 2; } - + /** * Contains dimension ids. */ @@ -125,7 +135,7 @@ public class Constants { public static final byte NORMAL = 0; public static final byte END = 1; } - + /** * Contains window type ids. */ @@ -143,7 +153,7 @@ public class Constants { public static final byte DROPPER = 10; public static final byte HORSE = 11; } - + /** * Contains scoreboard objective ids. */ @@ -152,7 +162,7 @@ public class Constants { public static final byte REMOVE = 1; public static final byte UPDATE_TEXT = 2; } - + /** * Contains team action ids. */ @@ -163,7 +173,7 @@ public class Constants { public static final byte ADD_PLAYER = 3; public static final byte REMOVE_PLAYER = 4; } - + /** * Contains friendly fire ids. */ @@ -172,7 +182,7 @@ public class Constants { public static final byte ON = 1; public static final byte SEE_INVISIBLE_TEAMMATES = 3; } - + /** * Contains ids for updating scoreboards. */ @@ -180,14 +190,14 @@ public class Constants { public static final byte CREATE_OR_UPDATE = 0; public static final byte REMOVE = 1; } - + /** * Contains ids for updating tile entities. */ public static class UpdateTileEntityIds { public static final byte SET_MOB = 1; } - + /** * Contains window property ids. */ @@ -198,7 +208,7 @@ public class Constants { public static final byte ENCHANT_SLOT_1 = 1; public static final byte ENCHANT_SLOT_2 = 2; } - + /** * Contains mob ids. */ @@ -232,7 +242,7 @@ public class Constants { public static final byte IRON_GOLEM = 99; public static final byte VILLAGER = 120; } - + /** * Contains object ids. */ @@ -255,7 +265,7 @@ public class Constants { public static final byte XP_BOTTLE = 75; public static final byte FISHING_HOOK = 90; } - + /** * Contains standard plugin channels. */ @@ -273,7 +283,7 @@ public class Constants { public static final String CLIENT_PING_DATA = "MC|PingHost"; public static final String BRAND = "MC|Brand"; } - + /** * Contains entity attribute ids. */ @@ -286,7 +296,7 @@ public class Constants { public static final String HORSE_JUMP_STRENGTH = "horse.jumpStrength"; public static final String ZOMBIE_SPAWN_REINFORCEMENTS = "zombie.spawnReinforcements"; } - + /** * Contains entity attribute modifier operations. */ @@ -295,7 +305,7 @@ public class Constants { public static final int ADD_MULTIPLIED = 1; public static final int MULTIPLY = 2; } - + /** * Contains entity attribute modifier unique ids. */ @@ -304,16 +314,16 @@ public class Constants { public static final UUID ENDERMAN_ATTACK_SPEED_BOOST = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); public static final UUID SPRINT_SPEED_BOOST = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); public static final UUID PIGZOMBIE_ATTACK_SPEED_BOOST = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718"); - public static final UUID WITCH_DRINKING_SPEED_PENALTY = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); + public static final UUID WITCH_DRINKING_SPEED_PENALTY = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); public static final UUID ZOMBIE_BABY_SPEED_BOOST = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); - public static final UUID ITEM_MODIFIER = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + public static final UUID ITEM_MODIFIER = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); public static final UUID SPEED_POTION_MODIFIER = UUID.fromString("91AEAA56-376B-4498-935B-2F7F68070635"); public static final UUID HEALTH_BOOST_POTION_MODIFIER = UUID.fromString("5D6F0BA2-1186-46AC-B896-C61C5CEE99CC"); public static final UUID SLOW_POTION_MODIFIER = UUID.fromString("7107DE5E-7CE8-4030-940E-514C1F160890"); public static final UUID STRENGTH_POTION_MODIFIER = UUID.fromString("648D7064-6A60-4F59-8ABE-C2C23A6DD7A9"); public static final UUID WEAKNESS_POTION_MODIFIER = UUID.fromString("22653B89-116E-49DC-9B6B-9971489B5BE5"); } - + /** * Contains statistic ids. */ @@ -341,12 +351,12 @@ public class Constants { public static final int MOB_KILLS = 2023; public static final int PLAYER_KILLS = 2024; public static final int FISH_CAUGHT = 2025; - + private static final int MINE_BLOCK_BASE = 16777216; private static final int CRAFT_ITEM_BASE = 16842752; private static final int USE_ITEM_BASE = 16908288; private static final int BREAK_ITEM_BASE = 16973824; - + /** * Gets the statistic value for mining a block. * @param block Block mined. @@ -355,7 +365,7 @@ public class Constants { public static int mineBlock(int block) { return MINE_BLOCK_BASE + block; } - + /** * Gets the statistic value for crafting an item. * @param item Item crafted. @@ -364,7 +374,7 @@ public class Constants { public static int craftItem(int item) { return CRAFT_ITEM_BASE + item; } - + /** * Gets the statistic value for using an item. * @param item Item used. @@ -383,7 +393,7 @@ public class Constants { return BREAK_ITEM_BASE + item; } } - + /** * Contains watchable object ids. */ @@ -396,14 +406,14 @@ public class Constants { public static final byte ITEM_STACK = 5; public static final byte COORDINATES = 6; } - + /** * Contains tile editor ids. */ public static class TileEditorIds { public static final byte SIGN = 0; } - + /** * Contains particle names. */ @@ -432,7 +442,7 @@ public class Constants { public static final String SLIME_SPLATTER = "slime"; } } - + /** * Contains constant values relating to classic Minecraft protocol. */ @@ -442,7 +452,7 @@ public class Constants { */ public static final byte PROTOCOL_VERSION = 7; } - + /** * Contains constant values relating to Minecraft Pocket Edition protocol. */ @@ -452,5 +462,5 @@ public class Constants { */ public static final byte[] MAGIC = new byte[] { 0, -1, -1, 0, -2, -2, -2, -2, -3, -3, -3, -3, 18, 52, 86, 120 }; } - + } diff --git a/src/main/java/ch/spacebase/mcprotocol/util/Util.java b/src/main/java/ch/spacebase/mcprotocol/util/Util.java index 15b36896..391b2789 100644 --- a/src/main/java/ch/spacebase/mcprotocol/util/Util.java +++ b/src/main/java/ch/spacebase/mcprotocol/util/Util.java @@ -21,7 +21,7 @@ public class Util { * The library's logger. */ private static final Logger logger = Logger.getLogger("mc-protocol-lib"); - + /** * The library's Random. */ @@ -76,15 +76,15 @@ public class Util { digest.update(secret.getEncoded()); digest.update(key.getEncoded()); return digest.digest(); - } catch (UnsupportedEncodingException e) { + } catch(UnsupportedEncodingException e) { e.printStackTrace(); return null; - } catch (NoSuchAlgorithmException e) { + } catch(NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } - + /** * Formats parameters into a ping response string. * @param motd MOTD of the server. @@ -95,9 +95,10 @@ public class Util { public static String formatPingResponse(String motd, int players, int maxplayers) { return "ยง1\0" + Constants.StandardProtocol.PROTOCOL_VERSION + "\0" + Constants.StandardProtocol.MINECRAFT_VERSION + "\0" + motd + "\0" + players + "\0" + maxplayers; } - + /** - * Prepares a plugin message packet with client data to be sent after a ping request packet. + * Prepares a plugin message packet with client data to be sent after a ping + * request packet. * @param serverIp IP of the server. * @param serverPort Port of the server. * @return The prepared packet. @@ -109,7 +110,7 @@ public class Util { builder.writeInt(serverPort); return builder.build(); } - + /** * Gets the specified bit from the given value. * @param value Value to use.