Archiviert
13
0

Merge pull request #17 with spelling corrections from devilboy.

Thanks guys. :)
Dieser Commit ist enthalten in:
Kristian S. Stangeland 2013-12-06 01:38:34 +01:00
Commit d746fcbf6c
19 geänderte Dateien mit 103 neuen und 103 gelöschten Zeilen

Datei anzeigen

@ -39,8 +39,8 @@ public interface AsynchronousManager {
* Use {@link AsyncMarker#incrementProcessingDelay()} to delay a packet until its ready to be transmitted. * Use {@link AsyncMarker#incrementProcessingDelay()} to delay a packet until its ready to be transmitted.
* <p> * <p>
* To start listening asynchronously, pass the getListenerLoop() runnable to a different thread. * To start listening asynchronously, pass the getListenerLoop() runnable to a different thread.
* @param listener - the packet listener that will recieve these asynchronous events. * @param listener - the packet listener that will receive these asynchronous events.
* @return An asynchrouns handler. * @return An asynchronous handler.
*/ */
public abstract AsyncListenerHandler registerAsyncHandler(PacketListener listener); public abstract AsyncListenerHandler registerAsyncHandler(PacketListener listener);
@ -84,7 +84,7 @@ public interface AsynchronousManager {
public abstract Set<Integer> getReceivingFilters(); public abstract Set<Integer> getReceivingFilters();
/** /**
* Retrieves a immutable set containing the types of the recieved client packets that will be * Retrieves a immutable set containing the types of the received client packets that will be
* observed by the asynchronous listeners. * observed by the asynchronous listeners.
* @return Every filtered client packet. * @return Every filtered client packet.
*/ */

Datei anzeigen

@ -33,32 +33,32 @@ import com.comphenix.protocol.events.PacketContainer;
public interface PacketStream { public interface PacketStream {
/** /**
* Send a packet to the given player. * Send a packet to the given player.
* @param reciever - the reciever. * @param receiver - the reciever.
* @param packet - packet to send. * @param packet - packet to send.
* @throws InvocationTargetException - if an error occured when sending the packet. * @throws InvocationTargetException - if an error occured when sending the packet.
*/ */
public void sendServerPacket(Player reciever, PacketContainer packet) public void sendServerPacket(Player receiver, PacketContainer packet)
throws InvocationTargetException; throws InvocationTargetException;
/** /**
* Send a packet to the given player. * Send a packet to the given player.
* @param reciever - the reciever. * @param receiver - the reciever.
* @param packet - packet to send. * @param packet - packet to send.
* @param filters - whether or not to invoke any packet filters below {@link ListenerPriority#MONITOR}. * @param filters - whether or not to invoke any packet filters below {@link ListenerPriority#MONITOR}.
* @throws InvocationTargetException - if an error occured when sending the packet. * @throws InvocationTargetException - if an error occured when sending the packet.
*/ */
public void sendServerPacket(Player reciever, PacketContainer packet, boolean filters) public void sendServerPacket(Player receiver, PacketContainer packet, boolean filters)
throws InvocationTargetException; throws InvocationTargetException;
/** /**
* Send a packet to the given player. * Send a packet to the given player.
* @param reciever - the reciever. * @param receiver - the receiver.
* @param packet - packet to send. * @param packet - packet to send.
* @param marker - the network marker to use. * @param marker - the network marker to use.
* @param filters - whether or not to invoke any packet filters below {@link ListenerPriority#MONITOR}. * @param filters - whether or not to invoke any packet filters below {@link ListenerPriority#MONITOR}.
* @throws InvocationTargetException - if an error occured when sending the packet. * @throws InvocationTargetException - if an error occured when sending the packet.
*/ */
public void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters)
throws InvocationTargetException; throws InvocationTargetException;

Datei anzeigen

@ -86,7 +86,7 @@ public class PacketType implements Serializable {
} }
/** /**
* Packets sent and recieved when logged into the game. * Packets sent and received when logged into the game.
* @author Kristian * @author Kristian
*/ */
public static class Play { public static class Play {
@ -197,7 +197,7 @@ public class PacketType implements Serializable {
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x09, 16); public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x09, 16);
public static final PacketType ARM_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x0A, 18); public static final PacketType ARM_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x0A, 18);
public static final PacketType ENTITY_ACTION = new PacketType(PROTOCOL, SENDER, 0x0B, 19); public static final PacketType ENTITY_ACTION = new PacketType(PROTOCOL, SENDER, 0x0B, 19);
public static final PacketType STEER_VECHICLE = new PacketType(PROTOCOL, SENDER, 0x0C, 27); public static final PacketType STEER_VEHICLE = new PacketType(PROTOCOL, SENDER, 0x0C, 27);
public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x0D, 101); public static final PacketType CLOSE_WINDOW = new PacketType(PROTOCOL, SENDER, 0x0D, 101);
public static final PacketType WINDOW_CLICK = new PacketType(PROTOCOL, SENDER, 0x0E, 102); public static final PacketType WINDOW_CLICK = new PacketType(PROTOCOL, SENDER, 0x0E, 102);
public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x0F, 106); public static final PacketType TRANSACTION = new PacketType(PROTOCOL, SENDER, 0x0F, 106);
@ -229,7 +229,7 @@ public class PacketType implements Serializable {
} }
/** /**
* Packets sent and recieved when querying the server in the multiplayer menu. * Packets sent and received when querying the server in the multiplayer menu.
* @author Kristian * @author Kristian
*/ */
public static class Status { public static class Status {
@ -281,7 +281,7 @@ public class PacketType implements Serializable {
} }
/** /**
* Packets sent and recieved when logging in to the server. * Packets sent and received when logging in to the server.
* @author Kristian * @author Kristian
*/ */
public static class Login { public static class Login {
@ -364,7 +364,7 @@ public class PacketType implements Serializable {
} }
/** /**
* Represens the sender of this packet type. * Represents the sender of this packet type.
* @author Kristian * @author Kristian
* *
*/ */
@ -514,7 +514,7 @@ public class PacketType implements Serializable {
* Note that the registration will be performed on the main thread. * Note that the registration will be performed on the main thread.
* @param type - the type to register. * @param type - the type to register.
* @param name - the name of the packet. * @param name - the name of the packet.
* @return A future telling us if our instance was registrered. * @return A future telling us if our instance was registered.
*/ */
public static Future<Boolean> scheduleRegister(final PacketType type, final String name) { public static Future<Boolean> scheduleRegister(final PacketType type, final String name) {
Callable<Boolean> callable = new Callable<Boolean>() { Callable<Boolean> callable = new Callable<Boolean>() {

Datei anzeigen

@ -45,22 +45,22 @@ public interface ProtocolManager extends PacketStream {
/** /**
* Send a packet to the given player. * Send a packet to the given player.
* <p> * <p>
* Re-sending a previously cancelled packet is discuraged. Use {@link AsyncMarker#incrementProcessingDelay()} * Re-sending a previously cancelled packet is discouraged. Use {@link AsyncMarker#incrementProcessingDelay()}
* to delay a packet until a certain condition has been met. * to delay a packet until a certain condition has been met.
* *
* @param reciever - the reciever. * @param receiver - the receiver.
* @param packet - packet to send. * @param packet - packet to send.
* @param filters - whether or not to invoke any packet filters below {@link ListenerPriority#MONITOR}. * @param filters - whether or not to invoke any packet filters below {@link ListenerPriority#MONITOR}.
* @throws InvocationTargetException - if an error occured when sending the packet. * @throws InvocationTargetException - if an error occurred when sending the packet.
*/ */
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, boolean filters) public void sendServerPacket(Player receiver, PacketContainer packet, boolean filters)
throws InvocationTargetException; throws InvocationTargetException;
/** /**
* Simulate recieving a certain packet from a given player. * Simulate receiving a certain packet from a given player.
* <p> * <p>
* Receiving a previously cancelled packet is discuraged. Use {@link AsyncMarker#incrementProcessingDelay()} * Receiving a previously cancelled packet is discouraged. Use {@link AsyncMarker#incrementProcessingDelay()}
* to delay a packet until a certain condition has been met. * to delay a packet until a certain condition has been met.
* *
* @param sender - the sender. * @param sender - the sender.
@ -81,7 +81,7 @@ public interface ProtocolManager extends PacketStream {
public void broadcastServerPacket(PacketContainer packet); public void broadcastServerPacket(PacketContainer packet);
/** /**
* Broadcast a packet to every player that is recieving information about a given entity. * Broadcast a packet to every player that is receiving information about a given entity.
* <p> * <p>
* This is usually every player in the same world within an observable distance. If the entity is a * This is usually every player in the same world within an observable distance. If the entity is a
* player, it will only be included if <i>includeTracker</i> is TRUE. * player, it will only be included if <i>includeTracker</i> is TRUE.
@ -240,7 +240,7 @@ public interface ProtocolManager extends PacketStream {
public Set<PacketType> getSendingFilterTypes(); public Set<PacketType> getSendingFilterTypes();
/** /**
* Retrieves a immutable set containing the ID of the recieved client packets that will be observed by listeners. * Retrieves a immutable set containing the ID of the received client packets that will be observed by listeners.
* <p> * <p>
* Deprecated: Use {@link #getReceivingFilterTypes()} instead. * Deprecated: Use {@link #getReceivingFilterTypes()} instead.
* @return Every filtered client packet. * @return Every filtered client packet.
@ -249,7 +249,7 @@ public interface ProtocolManager extends PacketStream {
public Set<Integer> getReceivingFilters(); public Set<Integer> getReceivingFilters();
/** /**
* Retrieves a immutable set containing the type of the recieved client packets that will be observed by listeners. * Retrieves a immutable set containing the type of the received client packets that will be observed by listeners.
* @return Every filtered client packet. * @return Every filtered client packet.
*/ */
public Set<PacketType> getReceivingFilterTypes(); public Set<PacketType> getReceivingFilterTypes();
@ -261,14 +261,14 @@ public interface ProtocolManager extends PacketStream {
public MinecraftVersion getMinecraftVersion(); public MinecraftVersion getMinecraftVersion();
/** /**
* Determines whether or not this protocol mananger has been disabled. * Determines whether or not this protocol manager has been disabled.
* @return TRUE if it has, FALSE otherwise. * @return TRUE if it has, FALSE otherwise.
*/ */
public boolean isClosed(); public boolean isClosed();
/** /**
* Retrieve the current asyncronous packet manager. * Retrieve the current asynchronous packet manager.
* @return Asyncronous packet manager. * @return Asynchronous packet manager.
*/ */
public AsynchronousManager getAsynchronousManager(); public AsynchronousManager getAsynchronousManager();
} }

Datei anzeigen

@ -152,9 +152,9 @@ public class AsyncFilterManager implements AsynchronousManager {
* Asynchronous events will only be executed if a synchronous listener with the same packets is registered. * Asynchronous events will only be executed if a synchronous listener with the same packets is registered.
* If you already have a synchronous event, call this method with autoInject set to FALSE. * If you already have a synchronous event, call this method with autoInject set to FALSE.
* *
* @param listener - the packet listener that will recieve these asynchronous events. * @param listener - the packet listener that will receive these asynchronous events.
* @param autoInject - whether or not to automatically create the corresponding synchronous listener, * @param autoInject - whether or not to automatically create the corresponding synchronous listener,
* @return An asynchrouns handler. * @return An asynchronous handler.
*/ */
public AsyncListenerHandler registerAsyncHandler(PacketListener listener, boolean autoInject) { public AsyncListenerHandler registerAsyncHandler(PacketListener listener, boolean autoInject) {
AsyncListenerHandler handler = new AsyncListenerHandler(mainThread, this, listener); AsyncListenerHandler handler = new AsyncListenerHandler(mainThread, this, listener);

Datei anzeigen

@ -43,8 +43,8 @@ public abstract class AbstractConcurrentListenerMultimap<TListener> {
} }
/** /**
* Adds a listener to its requested list of packet recievers. * Adds a listener to its requested list of packet receivers.
* @param listener - listener with a list of packets to recieve notifcations for. * @param listener - listener with a list of packets to receive notifications for.
* @param whitelist - the packet whitelist to use. * @param whitelist - the packet whitelist to use.
*/ */
public void addListener(TListener listener, ListeningWhitelist whitelist) { public void addListener(TListener listener, ListeningWhitelist whitelist) {

Datei anzeigen

@ -32,7 +32,7 @@ import com.comphenix.protocol.injector.packet.PacketRegistry;
import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.FieldAccessException;
/** /**
* Represents a listener that is notified of every sent and recieved packet. * Represents a listener that is notified of every sent and received packet.
* *
* @author Kristian * @author Kristian
*/ */

Datei anzeigen

@ -48,7 +48,7 @@ public abstract class PacketAdapter implements PacketListener {
* Initialize a packet adapter using a collection of parameters. Use {@link #params()} to get an instance to this builder. * Initialize a packet adapter using a collection of parameters. Use {@link #params()} to get an instance to this builder.
* @param params - the parameters. * @param params - the parameters.
*/ */
public PacketAdapter(@Nonnull AdapterParameteters params) { public PacketAdapter(@Nonnull AdapterParameters params) {
this( this(
checkValidity(params).plugin, params.connectionSide, params.listenerPriority, checkValidity(params).plugin, params.connectionSide, params.listenerPriority,
params.gamePhase, params.options, params.packets params.gamePhase, params.options, params.packets
@ -344,23 +344,22 @@ public abstract class PacketAdapter implements PacketListener {
* This is often simpler and better than passing them directly to each constructor. * This is often simpler and better than passing them directly to each constructor.
* @return Helper object. * @return Helper object.
*/ */
public static AdapterParameteters params() { public static AdapterParameters params() {
return new AdapterParameteters(); return new AdapterParameters();
} }
/** /**
* Construct a helper object for passing parameters to the packet adapter. * Construct a helper object for passing parameters to the packet adapter.
* <p> * <p>
* This is often simpler and better than passing them directly to each constructor. * This is often simpler and better than passing them directly to each constructor.
* <p>
* Deprecated: Use {@link #params(Plugin, PacketType...)} instead. * Deprecated: Use {@link #params(Plugin, PacketType...)} instead.
* @param plugin - the plugin that spawned this listener. * @param plugin - the plugin that spawned this listener.
* @param packets - the packet IDs the listener is looking for. * @param packets - the packet IDs the listener is looking for.
* @return Helper object. * @return Helper object.
*/ */
@Deprecated @Deprecated
public static AdapterParameteters params(Plugin plugin, Integer... packets) { public static AdapterParameters params(Plugin plugin, Integer... packets) {
return new AdapterParameteters().plugin(plugin).packets(packets); return new AdapterParameters().plugin(plugin).packets(packets);
} }
/** /**
@ -371,8 +370,8 @@ public abstract class PacketAdapter implements PacketListener {
* @param packets - the packet types the listener is looking for. * @param packets - the packet types the listener is looking for.
* @return Helper object. * @return Helper object.
*/ */
public static AdapterParameteters params(Plugin plugin, PacketType... packets) { public static AdapterParameters params(Plugin plugin, PacketType... packets) {
return new AdapterParameteters().plugin(plugin).types(packets); return new AdapterParameters().plugin(plugin).types(packets);
} }
/** /**
@ -381,7 +380,7 @@ public abstract class PacketAdapter implements PacketListener {
* Note: Never make spelling mistakes in a public API! * Note: Never make spelling mistakes in a public API!
* @author Kristian * @author Kristian
*/ */
public static class AdapterParameteters { public static class AdapterParameters {
private Plugin plugin; private Plugin plugin;
private ConnectionSide connectionSide; private ConnectionSide connectionSide;
private PacketType[] packets; private PacketType[] packets;
@ -396,7 +395,7 @@ public abstract class PacketAdapter implements PacketListener {
* @param plugin - the plugin. * @param plugin - the plugin.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters plugin(@Nonnull Plugin plugin) { public AdapterParameters plugin(@Nonnull Plugin plugin) {
this.plugin = Preconditions.checkNotNull(plugin, "plugin cannot be NULL."); this.plugin = Preconditions.checkNotNull(plugin, "plugin cannot be NULL.");
return this; return this;
} }
@ -406,7 +405,7 @@ public abstract class PacketAdapter implements PacketListener {
* @param connectionSide - the new packet type. * @param connectionSide - the new packet type.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters connectionSide(@Nonnull ConnectionSide connectionSide) { public AdapterParameters connectionSide(@Nonnull ConnectionSide connectionSide) {
this.connectionSide = Preconditions.checkNotNull(connectionSide, "connectionside cannot be NULL."); this.connectionSide = Preconditions.checkNotNull(connectionSide, "connectionside cannot be NULL.");
return this; return this;
} }
@ -415,15 +414,15 @@ public abstract class PacketAdapter implements PacketListener {
* Set this adapter to also look for client-side packets. * Set this adapter to also look for client-side packets.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters clientSide() { public AdapterParameters clientSide() {
return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.CLIENT_SIDE)); return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.CLIENT_SIDE));
} }
/** /**
* Set this adapter to also look for client-side packets. * Set this adapter to also look for server-side packets.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters serverSide() { public AdapterParameters serverSide() {
return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.SERVER_SIDE)); return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.SERVER_SIDE));
} }
@ -434,7 +433,7 @@ public abstract class PacketAdapter implements PacketListener {
* @param listenerPriority - the new event priority. * @param listenerPriority - the new event priority.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters listenerPriority(@Nonnull ListenerPriority listenerPriority) { public AdapterParameters listenerPriority(@Nonnull ListenerPriority listenerPriority) {
this.listenerPriority = Preconditions.checkNotNull(listenerPriority, "listener priority cannot be NULL."); this.listenerPriority = Preconditions.checkNotNull(listenerPriority, "listener priority cannot be NULL.");
return this; return this;
} }
@ -446,7 +445,7 @@ public abstract class PacketAdapter implements PacketListener {
* @param gamePhase - the new game phase. * @param gamePhase - the new game phase.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters gamePhase(@Nonnull GamePhase gamePhase) { public AdapterParameters gamePhase(@Nonnull GamePhase gamePhase) {
this.gamePhase = Preconditions.checkNotNull(gamePhase, "gamePhase cannot be NULL."); this.gamePhase = Preconditions.checkNotNull(gamePhase, "gamePhase cannot be NULL.");
return this; return this;
} }
@ -455,7 +454,7 @@ public abstract class PacketAdapter implements PacketListener {
* Set the game phase to {@link GamePhase#LOGIN}, allowing ProtocolLib to intercept login packets. * Set the game phase to {@link GamePhase#LOGIN}, allowing ProtocolLib to intercept login packets.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters loginPhase() { public AdapterParameters loginPhase() {
return gamePhase(GamePhase.LOGIN); return gamePhase(GamePhase.LOGIN);
} }
@ -466,7 +465,7 @@ public abstract class PacketAdapter implements PacketListener {
* @param options - every option to use. * @param options - every option to use.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters options(@Nonnull ListenerOptions... options) { public AdapterParameters options(@Nonnull ListenerOptions... options) {
this.options = Preconditions.checkNotNull(options, "options cannot be NULL."); this.options = Preconditions.checkNotNull(options, "options cannot be NULL.");
return this; return this;
} }
@ -475,7 +474,7 @@ public abstract class PacketAdapter implements PacketListener {
* Set the listener option to {@link ListenerOptions#INTERCEPT_INPUT_BUFFER}, causing ProtocolLib to read the raw packet data from the network stream. * Set the listener option to {@link ListenerOptions#INTERCEPT_INPUT_BUFFER}, causing ProtocolLib to read the raw packet data from the network stream.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters optionIntercept() { public AdapterParameters optionIntercept() {
return options(ListenerOptions.INTERCEPT_INPUT_BUFFER); return options(ListenerOptions.INTERCEPT_INPUT_BUFFER);
} }
@ -489,7 +488,7 @@ public abstract class PacketAdapter implements PacketListener {
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
@Deprecated @Deprecated
public AdapterParameteters packets(@Nonnull Integer... packets) { public AdapterParameters packets(@Nonnull Integer... packets) {
Preconditions.checkNotNull(packets, "packets cannot be NULL"); Preconditions.checkNotNull(packets, "packets cannot be NULL");
PacketType[] types = new PacketType[packets.length]; PacketType[] types = new PacketType[packets.length];
@ -508,7 +507,7 @@ public abstract class PacketAdapter implements PacketListener {
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
@Deprecated @Deprecated
public AdapterParameteters packets(@Nonnull Set<Integer> packets) { public AdapterParameters packets(@Nonnull Set<Integer> packets) {
return packets(packets.toArray(new Integer[0])); return packets(packets.toArray(new Integer[0]));
} }
@ -516,16 +515,17 @@ public abstract class PacketAdapter implements PacketListener {
* Set the packet types the listener is looking for. * Set the packet types the listener is looking for.
* <p> * <p>
* This parameter is required. * This parameter is required.
* @param packets * @param packets - the packet types to look for.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters types(@Nonnull PacketType... packets) { public AdapterParameters types(@Nonnull PacketType... packets) {
// Set the connection side as well // Set the connection side as well
if (connectionSide == null) { if (connectionSide == null) {
for (PacketType type : packets) { for (PacketType type : packets) {
this.connectionSide = ConnectionSide.add(this.connectionSide, type.getSender().toSide()); this.connectionSide = ConnectionSide.add(this.connectionSide, type.getSender().toSide());
} }
} }
this.packets = Preconditions.checkNotNull(packets, "packets cannot be NULL"); this.packets = Preconditions.checkNotNull(packets, "packets cannot be NULL");
return this; return this;
} }
@ -534,10 +534,10 @@ public abstract class PacketAdapter implements PacketListener {
* Set the packet types the listener is looking for. * Set the packet types the listener is looking for.
* <p> * <p>
* This parameter is required. * This parameter is required.
* @param packets * @param packets - a set of packet types to look for.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public AdapterParameteters types(@Nonnull Set<PacketType> packets) { public AdapterParameters types(@Nonnull Set<PacketType> packets) {
return types(packets.toArray(new PacketType[0])); return types(packets.toArray(new PacketType[0]));
} }
} }
@ -545,7 +545,7 @@ public abstract class PacketAdapter implements PacketListener {
/** /**
* Determine if the required parameters are set. * Determine if the required parameters are set.
*/ */
private static AdapterParameteters checkValidity(AdapterParameteters params) { private static AdapterParameters checkValidity(AdapterParameters params) {
if (params == null) if (params == null)
throw new IllegalArgumentException("params cannot be NULL."); throw new IllegalArgumentException("params cannot be NULL.");
if (params.plugin == null) if (params.plugin == null)

Datei anzeigen

@ -20,7 +20,7 @@ package com.comphenix.protocol.events;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
/** /**
* Represents a listener that recieves notifications when packets are sent or recieved. * Represents a listener that receives notifications when packets are sent or received.
* <p> * <p>
* Use {@link PacketAdapter} for a simple wrapper around this interface. * Use {@link PacketAdapter} for a simple wrapper around this interface.
* @author Kristian * @author Kristian
@ -39,13 +39,13 @@ public interface PacketListener {
public void onPacketSending(PacketEvent event); public void onPacketSending(PacketEvent event);
/** /**
* Invoked right before a recieved packet from a client is being processed. * Invoked right before a received packet from a client is being processed.
* <p> * <p>
* <b>WARNING</b>: </br> * <b>WARNING</b>: </br>
* This method will be called <i>asynchronously</i>! You should synchronize with the main * This method will be called <i>asynchronously</i>! You should synchronize with the main
* thread using {@link org.bukkit.scheduler.BukkitScheduler#scheduleSyncDelayedTask(Plugin, Runnable, long) scheduleSyncDelayedTask} * thread using {@link org.bukkit.scheduler.BukkitScheduler#scheduleSyncDelayedTask(Plugin, Runnable, long) scheduleSyncDelayedTask}
* if you need to call the Bukkit API. * if you need to call the Bukkit API.
* @param event - the packet that has been recieved. * @param event - the packet that has been received.
*/ */
public void onPacketReceiving(PacketEvent event); public void onPacketReceiving(PacketEvent event);

Datei anzeigen

@ -177,21 +177,21 @@ public class DelayedPacketManager implements ProtocolManager, InternalManager {
} }
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet) throws InvocationTargetException {
sendServerPacket(reciever, packet, null, true); sendServerPacket(receiver, packet, null, true);
} }
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, boolean filters) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet, boolean filters) throws InvocationTargetException {
sendServerPacket(reciever, packet, null, filters); sendServerPacket(receiver, packet, null, filters);
} }
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
if (delegate != null) { if (delegate != null) {
delegate.sendServerPacket(reciever, packet, marker, filters); delegate.sendServerPacket(receiver, packet, marker, filters);
} else { } else {
queuedActions.add(queuedAddPacket(ConnectionSide.SERVER_SIDE, reciever, packet, marker, filters)); queuedActions.add(queuedAddPacket(ConnectionSide.SERVER_SIDE, receiver, packet, marker, filters));
} }
} }

Datei anzeigen

@ -738,9 +738,9 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
} }
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
if (reciever == null) if (receiver == null)
throw new IllegalArgumentException("reciever cannot be NULL."); throw new IllegalArgumentException("receiver cannot be NULL.");
if (packet == null) if (packet == null)
throw new IllegalArgumentException("packet cannot be NULL."); throw new IllegalArgumentException("packet cannot be NULL.");
// We may have to enable player injection indefinitely after this // We may have to enable player injection indefinitely after this
@ -749,13 +749,13 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
// Inform the MONITOR packets // Inform the MONITOR packets
if (!filters) { if (!filters) {
PacketEvent event = PacketEvent.fromServer(this, packet, marker, reciever); PacketEvent event = PacketEvent.fromServer(this, packet, marker, receiver);
sendingListeners.invokePacketSending( sendingListeners.invokePacketSending(
reporter, event, ListenerPriority.MONITOR); reporter, event, ListenerPriority.MONITOR);
marker = NetworkMarker.getNetworkMarker(event); marker = NetworkMarker.getNetworkMarker(event);
} }
playerInjection.sendServerPacket(reciever, packet, marker, filters); playerInjection.sendServerPacket(receiver, packet, marker, filters);
} }
@Override @Override

Datei anzeigen

@ -468,7 +468,7 @@ class ChannelInjector extends ByteToMessageDecoder {
try { try {
MinecraftMethods.getNetworkManagerReadPacketMethod().invoke(networkManager, null, packet); MinecraftMethods.getNetworkManagerReadPacketMethod().invoke(networkManager, null, packet);
} catch (Exception e) { } catch (Exception e) {
throw new IllegalArgumentException("Unable to recieve client packet " + packet, e); throw new IllegalArgumentException("Unable to receive client packet " + packet, e);
} }
} }

Datei anzeigen

@ -228,11 +228,11 @@ public class NettyProtocolInjector implements ChannelListener {
/** /**
* Called to inform the event listeners of a queued packet. * Called to inform the event listeners of a queued packet.
* @param packet - the packet that is to be sent. * @param packet - the packet that is to be sent.
* @param reciever - the reciever of this packet. * @param receiver - the receiver of this packet.
* @return The packet event that was used. * @return The packet event that was used.
*/ */
private PacketEvent packetQueued(PacketContainer packet, Player reciever) { private PacketEvent packetQueued(PacketContainer packet, Player receiver) {
PacketEvent event = PacketEvent.fromServer(this, packet, reciever); PacketEvent event = PacketEvent.fromServer(this, packet, receiver);
invoker.invokePacketSending(event); invoker.invokePacketSending(event);
return event; return event;
@ -274,8 +274,8 @@ public class NettyProtocolInjector implements ChannelListener {
} }
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
ChannelInjector.fromPlayer(reciever, listener). ChannelInjector.fromPlayer(receiver, listener).
sendServerPacket(packet.getHandle(), marker, filters); sendServerPacket(packet.getHandle(), marker, filters);
} }

Datei anzeigen

@ -55,7 +55,7 @@ class CaptureInputStream extends FilterInputStream {
} }
/** /**
* Retrieve the output stream that recieves all the read information. * Retrieve the output stream that receives all the read information.
* @return The output stream everything is copied to. * @return The output stream everything is copied to.
*/ */
public OutputStream getOutputStream() { public OutputStream getOutputStream() {

Datei anzeigen

@ -52,7 +52,7 @@ import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.WrappedIntHashMap; import com.comphenix.protocol.wrappers.WrappedIntHashMap;
/** /**
* This class is responsible for adding or removing proxy objects that intercepts recieved packets. * This class is responsible for adding or removing proxy objects that intercepts received packets.
* *
* @author Kristian * @author Kristian
*/ */

Datei anzeigen

@ -114,14 +114,14 @@ public interface PlayerInjectionHandler {
public abstract boolean uninjectPlayer(InetSocketAddress address); public abstract boolean uninjectPlayer(InetSocketAddress address);
/** /**
* Send the given packet to the given reciever. * Send the given packet to the given receiver.
* @param reciever - the player receiver. * @param receiver - the player receiver.
* @param packet - the packet to send. * @param packet - the packet to send.
* @param marker * @param marker
* @param filters - whether or not to invoke the packet filters. * @param filters - whether or not to invoke the packet filters.
* @throws InvocationTargetException If an error occured during sending. * @throws InvocationTargetException If an error occurred during sending.
*/ */
public abstract void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) public abstract void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters)
throws InvocationTargetException; throws InvocationTargetException;
/** /**
@ -161,14 +161,14 @@ public interface PlayerInjectionHandler {
public abstract Set<PacketType> getSendingFilters(); public abstract Set<PacketType> getSendingFilters();
/** /**
* Whether or not this player injection handler can also recieve packets. * Whether or not this player injection handler can also receive packets.
* @return TRUE if it can, FALSE otherwise. * @return TRUE if it can, FALSE otherwise.
*/ */
public abstract boolean canRecievePackets(); public abstract boolean canRecievePackets();
/** /**
* Invoked if this player injection handler can process recieved packets. * Invoked if this player injection handler can process received packets.
* @param packet - the recieved packet. * @param packet - the received packet.
* @param input - the input stream. * @param input - the input stream.
* @param buffered - the buffered packet. * @param buffered - the buffered packet.
* @return The packet event. * @return The packet event.

Datei anzeigen

@ -524,15 +524,15 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
} }
/** /**
* Send the given packet to the given reciever. * Send the given packet to the given receiver.
* @param reciever - the player receiver. * @param receiver - the player receiver.
* @param packet - the packet to send. * @param packet - the packet to send.
* @param filters - whether or not to invoke the packet filters. * @param filters - whether or not to invoke the packet filters.
* @throws InvocationTargetException If an error occured during sending. * @throws InvocationTargetException If an error occured during sending.
*/ */
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
SocketInjector injector = getInjector(reciever); SocketInjector injector = getInjector(receiver);
// Send the packet, or drop it completely // Send the packet, or drop it completely
if (injector != null) { if (injector != null) {
@ -540,7 +540,7 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
} else { } else {
throw new PlayerLoggedOutException(String.format( throw new PlayerLoggedOutException(String.format(
"Unable to send packet %s (%s): Player %s has logged out.", "Unable to send packet %s (%s): Player %s has logged out.",
packet.getType(), packet, reciever packet.getType(), packet, receiver
)); ));
} }
} }
@ -653,7 +653,7 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
@Override @Override
public PacketEvent handlePacketRecieved(PacketContainer packet, InputStream input, byte[] buffered) { public PacketEvent handlePacketRecieved(PacketContainer packet, InputStream input, byte[] buffered) {
throw new UnsupportedOperationException("Proxy injection cannot handle recieved packets."); throw new UnsupportedOperationException("Proxy injection cannot handle received packets.");
} }
/** /**

Datei anzeigen

@ -35,8 +35,8 @@ class DummyPlayerHandler extends AbstractPlayerHandler {
} }
@Override @Override
public void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException { public void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
injector.sendServerPacket(reciever, packet, marker, filters); injector.sendServerPacket(receiver, packet, marker, filters);
} }
@Override @Override

Datei anzeigen

@ -469,11 +469,11 @@ public class SpigotPacketInjector implements SpigotPacketListener {
/** /**
* Called to inform the event listeners of a queued packet. * Called to inform the event listeners of a queued packet.
* @param packet - the packet that is to be sent. * @param packet - the packet that is to be sent.
* @param reciever - the reciever of this packet. * @param receiver - the receiver of this packet.
* @return The packet event that was used. * @return The packet event that was used.
*/ */
PacketEvent packetQueued(PacketContainer packet, Player reciever) { PacketEvent packetQueued(PacketContainer packet, Player receiver) {
PacketEvent event = PacketEvent.fromServer(this, packet, reciever); PacketEvent event = PacketEvent.fromServer(this, packet, receiver);
invoker.invokePacketSending(event); invoker.invokePacketSending(event);
return event; return event;
@ -541,14 +541,14 @@ public class SpigotPacketInjector implements SpigotPacketListener {
} }
/** /**
* Invoked when a plugin wants to sent a packet. * Invoked when a plugin wants to sent a packet.
* @param reciever - the packet receiver. * @param receiver - the packet receiver.
* @param packet - the packet to transmit. * @param packet - the packet to transmit.
* @param marker - the network marker object. * @param marker - the network marker object.
* @param filters - whether or not to invoke the packet listeners. * @param filters - whether or not to invoke the packet listeners.
* @throws InvocationTargetException If anything went wrong. * @throws InvocationTargetException If anything went wrong.
*/ */
void sendServerPacket(Player reciever, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException { void sendServerPacket(Player receiver, PacketContainer packet, NetworkMarker marker, boolean filters) throws InvocationTargetException {
NetworkObjectInjector networkObject = getInjector(reciever, true); NetworkObjectInjector networkObject = getInjector(receiver, true);
// If TRUE, process this packet like any other // If TRUE, process this packet like any other
if (filters) if (filters)