@@ -785,27 +785,16 @@ public void onPlayerMove(PlayerMoveEvent event) {
785785 return ;
786786 }
787787
788- handleCellChange (event .getPlayer (), event .getFrom (), event .getTo (), event );
789- }
790-
791- //TODO: Remove when we support 1.21.5 and upwards.
792- @ SuppressWarnings ("removal" )
793- private TeleportCause chorusFruitTeleport = MinecraftVersion .CURRENT_VERSION .isOlderThan (MinecraftVersion .MINECRAFT_1_21_5 ) ? TeleportCause .CHORUS_FRUIT : TeleportCause .CONSUMABLE_EFFECT ;
794-
795- @ EventHandler (priority = EventPriority .NORMAL , ignoreCancelled = true )
796- public void onPlayerTeleport (PlayerTeleportEvent event ) {
797- Player player = event .getPlayer ();
798- handleTeleportCellChange (player , event .getCause (), event .getFrom (), event .getTo (), event );
788+ handleCellChange (event .getPlayer (), event .getFrom (), event .getTo ());
799789 }
800790
801791 /**
802792 * Calls the proper events to handle a player changing townblocks.
803793 * @param player The player who is moving.
804794 * @param from The location the player is moving from.
805795 * @param to The location the player is moving to.
806- * @param event The cancellable event that triggered this cell change. This will usually be a PlayerMoveEvent, but it could be a PlayerTeleportEvent if the teleport caused a cell change.
807796 */
808- public void handleCellChange (Player player , Location from , Location to , Cancellable event ) {
797+ public void handleCellChange (Player player , Location from , Location to ) {
809798 /*
810799 * Abort if we haven't really moved, or if the event.getTo() is null (which is allowed...)
811800 */
@@ -832,10 +821,20 @@ public void handleCellChange(Player player, Location from, Location to, Cancella
832821 WorldCoord fromCoord = WorldCoord .parseWorldCoord (from );
833822 WorldCoord toCoord = WorldCoord .parseWorldCoord (to );
834823
835- onPlayerMoveChunk (player , fromCoord , toCoord , event );
824+ onPlayerMoveChunk (player , fromCoord , toCoord );
836825 }
837826 }
838827
828+ //TODO: Remove when we support 1.21.5 and upwards.
829+ @ SuppressWarnings ("removal" )
830+ private TeleportCause chorusFruitTeleport = MinecraftVersion .CURRENT_VERSION .isOlderThan (MinecraftVersion .MINECRAFT_1_21_5 ) ? TeleportCause .CHORUS_FRUIT : TeleportCause .CONSUMABLE_EFFECT ;
831+
832+ @ EventHandler (priority = EventPriority .NORMAL , ignoreCancelled = true )
833+ public void onPlayerTeleport (PlayerTeleportEvent event ) {
834+ Player player = event .getPlayer ();
835+ handleTeleportCellChange (player , event .getCause (), event .getFrom (), event .getTo (), event );
836+ }
837+
839838 /**
840839 * Handles a player moving from one TownBlock to another, including firing the PlayerChangePlotEvent and handling plot notifications.
841840 * This should only be called from teleportation events.
@@ -864,7 +863,7 @@ public void handleTeleportCellChange(Player player, TeleportCause cause, Locatio
864863 boolean isAdmin = !Towny .getPlugin ().hasPlayerMode (player , "adminbypass" ) && (resident .isAdmin () || resident .hasPermissionNode (PermissionNodes .TOWNY_ADMIN_OUTLAW_TELEPORT_BYPASS .getNode ()));
865864 if (isAdmin ) {
866865 // Admins don't get restricted further but they do need to fire the PlayerChangePlotEvent.
867- handleCellChange (player , from , to , event );
866+ handleCellChange (player , from , to );
868867 return ;
869868 }
870869
@@ -925,7 +924,7 @@ public void handleTeleportCellChange(Player player, TeleportCause cause, Locatio
925924 resident .removeRespawnProtection ();
926925
927926 // Send the event to the onPlayerMove so Towny can fire the PlayerChangePlotEvent.
928- handleCellChange (player , from , to , event );
927+ handleCellChange (player , from , to );
929928 }
930929
931930 @ EventHandler (priority = EventPriority .LOWEST )
@@ -997,7 +996,7 @@ public void onEntityExhaustion(EntityExhaustionEvent event) {
997996 /*
998997 * PlayerMoveEvent that can fire the PlayerChangePlotEvent
999998 */
1000- private void onPlayerMoveChunk (Player player , WorldCoord from , WorldCoord to , Cancellable moveEvent ) {
999+ private void onPlayerMoveChunk (Player player , WorldCoord from , WorldCoord to ) {
10011000
10021001 final PlayerCache cache = plugin .getCacheOrNull (player .getUniqueId ());
10031002 if (cache != null )
0 commit comments