Skip to content

Commit

Permalink
Only check teleport if any packet adapter is active.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Nov 5, 2016
1 parent 5e2e11d commit 2cdf5ae
Showing 1 changed file with 15 additions and 13 deletions.
Expand Up @@ -196,20 +196,22 @@ public void onPlayerRespawn(final PlayerRespawnEvent event) {

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

@EventHandler(priority = EventPriority.LOWEST)
Expand Down

0 comments on commit 2cdf5ae

Please sign in to comment.