Revert "Fix spelling mistake in PacketAdapter"
This reverts commit cc4d035b63
.
Dieser Commit ist enthalten in:
Ursprung
a88b919e60
Commit
ce4779f49d
@ -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 AdapterParameters params) {
|
public PacketAdapter(@Nonnull AdapterParameteters 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
|
||||||
@ -371,8 +371,8 @@ 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 AdapterParameters params() {
|
public static AdapterParameteters params() {
|
||||||
return new AdapterParameters();
|
return new AdapterParameteters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -385,8 +385,8 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* @return Helper object.
|
* @return Helper object.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static AdapterParameters params(Plugin plugin, Integer... packets) {
|
public static AdapterParameteters params(Plugin plugin, Integer... packets) {
|
||||||
return new AdapterParameters().plugin(plugin).packets(packets);
|
return new AdapterParameteters().plugin(plugin).packets(packets);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -397,23 +397,17 @@ 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 AdapterParameters params(Plugin plugin, PacketType... packets) {
|
public static AdapterParameteters params(Plugin plugin, PacketType... packets) {
|
||||||
return new AdapterParameters().plugin(plugin).types(packets);
|
return new AdapterParameteters().plugin(plugin).types(packets);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Name misspelled. Use {@link AdapterParameters}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static class AdapterParameteters extends AdapterParameters {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a builder for passing parameters to the packet adapter constructor.
|
* Represents a builder for passing parameters to the packet adapter constructor.
|
||||||
* <p>
|
* <p>
|
||||||
|
* Note: Never make spelling mistakes in a public API!
|
||||||
* @author Kristian
|
* @author Kristian
|
||||||
*/
|
*/
|
||||||
public static class AdapterParameters {
|
public static class AdapterParameteters {
|
||||||
private Plugin plugin;
|
private Plugin plugin;
|
||||||
private ConnectionSide connectionSide;
|
private ConnectionSide connectionSide;
|
||||||
private PacketType[] packets;
|
private PacketType[] packets;
|
||||||
@ -428,7 +422,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 AdapterParameters plugin(@Nonnull Plugin plugin) {
|
public AdapterParameteters 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;
|
||||||
}
|
}
|
||||||
@ -438,7 +432,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 AdapterParameters connectionSide(@Nonnull ConnectionSide connectionSide) {
|
public AdapterParameteters 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;
|
||||||
}
|
}
|
||||||
@ -447,7 +441,7 @@ 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 AdapterParameters clientSide() {
|
public AdapterParameteters clientSide() {
|
||||||
return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.CLIENT_SIDE));
|
return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.CLIENT_SIDE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +449,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* Set this adapter to also look for server-side packets.
|
* Set this adapter to also look for server-side packets.
|
||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
public AdapterParameters serverSide() {
|
public AdapterParameteters serverSide() {
|
||||||
return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.SERVER_SIDE));
|
return connectionSide(ConnectionSide.add(connectionSide, ConnectionSide.SERVER_SIDE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +460,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 AdapterParameters listenerPriority(@Nonnull ListenerPriority listenerPriority) {
|
public AdapterParameteters 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;
|
||||||
}
|
}
|
||||||
@ -478,7 +472,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 AdapterParameters gamePhase(@Nonnull GamePhase gamePhase) {
|
public AdapterParameteters 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;
|
||||||
}
|
}
|
||||||
@ -487,7 +481,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 AdapterParameters loginPhase() {
|
public AdapterParameteters loginPhase() {
|
||||||
return gamePhase(GamePhase.LOGIN);
|
return gamePhase(GamePhase.LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +492,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 AdapterParameters options(@Nonnull ListenerOptions... options) {
|
public AdapterParameteters 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;
|
||||||
}
|
}
|
||||||
@ -510,7 +504,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 AdapterParameters options(@Nonnull Set<? extends ListenerOptions> options) {
|
public AdapterParameteters options(@Nonnull Set<? extends ListenerOptions> options) {
|
||||||
Preconditions.checkNotNull(options, "options cannot be NULL.");
|
Preconditions.checkNotNull(options, "options cannot be NULL.");
|
||||||
this.options = options.toArray(new ListenerOptions[0]);
|
this.options = options.toArray(new ListenerOptions[0]);
|
||||||
return this;
|
return this;
|
||||||
@ -521,7 +515,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* @param option - the option to add.
|
* @param option - the option to add.
|
||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
private AdapterParameters addOption(ListenerOptions option) {
|
private AdapterParameteters addOption(ListenerOptions option) {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
return options(option);
|
return options(option);
|
||||||
} else {
|
} else {
|
||||||
@ -535,7 +529,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 AdapterParameters optionIntercept() {
|
public AdapterParameteters optionIntercept() {
|
||||||
return addOption(ListenerOptions.INTERCEPT_INPUT_BUFFER);
|
return addOption(ListenerOptions.INTERCEPT_INPUT_BUFFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +539,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* This is no longer relevant in 1.7.2.
|
* This is no longer relevant in 1.7.2.
|
||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
public AdapterParameters optionManualGamePhase() {
|
public AdapterParameteters optionManualGamePhase() {
|
||||||
return addOption(ListenerOptions.DISABLE_GAMEPHASE_DETECTION);
|
return addOption(ListenerOptions.DISABLE_GAMEPHASE_DETECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +549,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* This allows ProtocolLib to perform certain optimizations.
|
* This allows ProtocolLib to perform certain optimizations.
|
||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
public AdapterParameters optionAsync() {
|
public AdapterParameteters optionAsync() {
|
||||||
return addOption(ListenerOptions.ASYNC);
|
return addOption(ListenerOptions.ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +563,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AdapterParameters packets(@Nonnull Integer... packets) {
|
public AdapterParameteters 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];
|
||||||
|
|
||||||
@ -588,7 +582,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AdapterParameters packets(@Nonnull Set<Integer> packets) {
|
public AdapterParameteters packets(@Nonnull Set<Integer> packets) {
|
||||||
return packets(packets.toArray(new Integer[0]));
|
return packets(packets.toArray(new Integer[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +593,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* @param packets - the packet types to look for.
|
* @param packets - the packet types to look for.
|
||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
public AdapterParameters types(@Nonnull PacketType... packets) {
|
public AdapterParameteters 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) {
|
||||||
@ -620,7 +614,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
* @param packets - a set of packet types to look for.
|
* @param packets - a set of packet types to look for.
|
||||||
* @return This builder, for chaining.
|
* @return This builder, for chaining.
|
||||||
*/
|
*/
|
||||||
public AdapterParameters types(@Nonnull Set<PacketType> packets) {
|
public AdapterParameteters types(@Nonnull Set<PacketType> packets) {
|
||||||
return types(packets.toArray(new PacketType[0]));
|
return types(packets.toArray(new PacketType[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -628,7 +622,7 @@ public abstract class PacketAdapter implements PacketListener {
|
|||||||
/**
|
/**
|
||||||
* Determine if the required parameters are set.
|
* Determine if the required parameters are set.
|
||||||
*/
|
*/
|
||||||
private static AdapterParameters checkValidity(AdapterParameters params) {
|
private static AdapterParameteters checkValidity(AdapterParameteters 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)
|
||||||
|
@ -17,12 +17,13 @@ public class NbtConfigurationSerializerTest {
|
|||||||
BukkitInitialization.initializePackage();
|
BukkitInitialization.initializePackage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void testSerialization() {
|
public void testSerialization() {
|
||||||
NbtCompound compound = NbtFactory.ofCompound("hello");
|
NbtCompound compound = NbtFactory.ofCompound("hello");
|
||||||
compound.put("age", (short) 30);
|
compound.put("age", (short) 30);
|
||||||
compound.put("name", "test");
|
compound.put("name", "test");
|
||||||
compound.put("values", new int[] { 1, 2, 3 });
|
compound.put("values", new int[] { 1, 2, 3});
|
||||||
compound.put(NbtFactory.ofList("telephone", "12345678", "81549300"));
|
compound.put(NbtFactory.ofList("telephone", "12345678", "81549300"));
|
||||||
|
|
||||||
compound.put(NbtFactory.ofList("lists", NbtFactory.ofList("", "a", "a", "b", "c")));
|
compound.put(NbtFactory.ofList("lists", NbtFactory.ofList("", "a", "a", "b", "c")));
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren