Pre-1.7 misc. fixes (Waiting for 1.7.2 MCP update)

This commit is contained in:
Steveice10 2013-11-01 17:43:53 -07:00
parent 435a20230e
commit 7112e67607
115 changed files with 945 additions and 934 deletions

View file

@ -5,7 +5,7 @@ import ch.spacebase.mcprotocol.packet.Packet;
/**
* Called when a packet is received.
*/
public class PacketRecieveEvent extends ProtocolEvent<ProtocolListener> {
public class PacketReceiveEvent extends ProtocolEvent<ProtocolListener> {
/**
* The received packet.
@ -16,7 +16,7 @@ public class PacketRecieveEvent extends ProtocolEvent<ProtocolListener> {
* Creates a new packet receive event instance.
* @param packet Packet being received.
*/
public PacketRecieveEvent(Packet packet) {
public PacketReceiveEvent(Packet packet) {
this.packet = packet;
}

View file

@ -84,8 +84,8 @@ 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
*/

View file

@ -9,7 +9,7 @@ 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.

View file

@ -48,7 +48,8 @@ public interface Connection {
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);

View file

@ -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;
@ -178,7 +178,7 @@ public abstract class StandardConnection extends BaseConnection {
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) {
@ -236,7 +236,8 @@ public abstract class StandardConnection extends BaseConnection {
}
/**
* 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

View file

@ -52,7 +52,6 @@ public class StandardServer extends Server {
}
}
/**
* Gets the server's key pair.
* @return The server's key pair.

View file

@ -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.

View file

@ -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;
@ -56,7 +56,7 @@ 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()) {

View file

@ -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;
@ -37,7 +37,6 @@ public class ChatBotVisitor {
private Listener listener;
private PacketVisitor visitor;
public ChatBotVisitor(String host, int port) {
this.client = new StandardClient(host, port);
this.listener = new Listener();
@ -88,7 +87,7 @@ public class ChatBotVisitor {
private class Listener extends ProtocolListener {
@Override
public void onPacketReceive(PacketRecieveEvent event) {
public void onPacketReceive(PacketReceiveEvent event) {
Packet packet = event.getPacket();
packet.accept(visitor);
}

View file

@ -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();
}

View file

@ -68,5 +68,4 @@ public class PacketEntityTeleport extends Packet {
visitor.visit(this);
}
}

View file

@ -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;

View file

@ -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);
}

View file

@ -159,7 +159,8 @@ public class PluginMessageBuilder {
}
/**
* 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.
*/

View file

@ -95,6 +95,16 @@ 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;
}
/**

View file

@ -97,7 +97,8 @@ public class Util {
}
/**
* 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.