Only check teleport if any packet adapter is active.

This commit is contained in:
asofold 2016-11-05 21:15:03 +01:00
parent 5e2e11dd10
commit 2cdf5ae8fb
1 changed files with 15 additions and 13 deletions

View File

@ -196,20 +196,22 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
// TODO: Might move to MovingListener.
// TODO: Might still add cancelled UNKNOWN events. TEST IT
final Location to = event.getTo();
if (to == null) {
return;
if (!registeredPacketAdapters.isEmpty()) {
// TODO: Might move to MovingListener.
// TODO: Might still add cancelled UNKNOWN events. TEST IT
final Location to = event.getTo();
if (to == null) {
return;
}
final Player player = event.getPlayer();
final NetConfig cc = configFactory.getConfig(player);
final NetData data = dataFactory.getData(player);
if (cc.flyingFrequencyActive) {
// Register expected location for comparison with outgoing packets.
data.teleportQueue.onTeleportEvent(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
}
data.clearFlyingQueue();
}
final Player player = event.getPlayer();
final NetConfig cc = configFactory.getConfig(player);
final NetData data = dataFactory.getData(player);
if (cc.flyingFrequencyActive) {
// Register expected location for comparison with outgoing packets.
data.teleportQueue.onTeleportEvent(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
}
data.clearFlyingQueue();
}
@EventHandler(priority = EventPriority.LOWEST)