Remove unused variable

This commit is contained in:
Dan Mulloy 2014-11-15 14:26:00 -05:00
parent eebcdf3ea1
commit 4043f67610
1 changed files with 9 additions and 13 deletions

View File

@ -11,8 +11,6 @@ import java.util.concurrent.TimeUnit;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.PacketType.Protocol;
import com.comphenix.protocol.PacketType.Sender;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
@ -20,16 +18,16 @@ import com.comphenix.protocol.events.PacketEvent;
public class TestPingPacket {
// Current versions
private static final int PROTOCOL_VERSION = 4;
// Timeout
private static final int TIMEOUT_PING_MS = 10000;
private volatile String source;
private TestPingPacket() {
// Prevent external constructors
}
/**
* Create a new test ping packet test.
* @return The new test.
@ -37,7 +35,7 @@ public class TestPingPacket {
public static TestPingPacket newTest() {
return new TestPingPacket();
}
/**
* Invoked when the test should be started.
* @param plugin - the current plugin.
@ -47,7 +45,7 @@ public class TestPingPacket {
try {
String transmitted = testInterception(plugin).
get(TIMEOUT_PING_MS, TimeUnit.MILLISECONDS);
// Make sure it's the same
System.out.println("Server string: " + transmitted);
assertEquals(source, transmitted);
@ -55,10 +53,8 @@ public class TestPingPacket {
throw e.getCause();
}
}
private Future<String> testInterception(Plugin test) {
PacketType customPacket = PacketType.fromCurrent(Protocol.STATUS, Sender.CLIENT, 3, -1);
ProtocolLibrary.getProtocolManager().addPacketListener(
new PacketAdapter(test, PacketType.Status.Server.OUT_SERVER_INFO) {
@Override
@ -66,7 +62,7 @@ public class TestPingPacket {
source = event.getPacket().getServerPings().read(0).toJson();
}
});
// Invoke the client on a separate thread
return Executors.newSingleThreadExecutor().submit(new Callable<String>() {
@Override
@ -75,7 +71,7 @@ public class TestPingPacket {
String information = client.queryLocalPing();
// Wait for the listener to catch up
for (int i = 0; i < 1000 && (source == null); i++)
for (int i = 0; i < 1000 && (source == null); i++)
Thread.sleep(1);
return information;