@@ -533,9 +533,9 @@ public void onTeleport(PlayerTeleportEvent event) {
533
533
// to is identical to the plot's home location, and untrusted-visit is true
534
534
// i.e. untrusted-visit can override deny-teleport
535
535
// this is acceptable, because otherwise it wouldn't make sense to have both flags set
536
- if (! result && ! (plot .getFlag (UntrustedVisitFlag .class ) && plot
537
- . getHomeSynchronous ()
538
- . equals ( BukkitUtil . adaptComplete ( to )))) {
536
+ if (result || (plot .getFlag (UntrustedVisitFlag .class ) && plot . getHomeSynchronous (). equals ( BukkitUtil . adaptComplete ( to )))) {
537
+ plotListener . plotEntry ( pp , plot );
538
+ } else {
539
539
pp .sendMessage (
540
540
TranslatableCaption .of ("deny.no_enter" ),
541
541
TagResolver .resolver ("plot" , Tag .inserting (Component .text (plot .toString ())))
@@ -548,6 +548,19 @@ public void onTeleport(PlayerTeleportEvent event) {
548
548
playerMove (event );
549
549
}
550
550
551
+ @ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
552
+ public void onWorldChanged (PlayerChangedWorldEvent event ) {
553
+ Player player = event .getPlayer ();
554
+ BukkitPlayer pp = BukkitUtil .adapt (player );
555
+ if (this .worldEdit != null ) {
556
+ if (!pp .hasPermission (Permission .PERMISSION_WORLDEDIT_BYPASS )) {
557
+ if (pp .getAttribute ("worldedit" )) {
558
+ pp .removeAttribute ("worldedit" );
559
+ }
560
+ }
561
+ }
562
+ }
563
+
551
564
@ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
552
565
public void vehicleMove (VehicleMoveEvent event )
553
566
throws IllegalAccessException {
@@ -887,40 +900,6 @@ public void onChat(AsyncPlayerChatEvent event) {
887
900
}
888
901
}
889
902
890
- @ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
891
- public void onWorldChanged (PlayerChangedWorldEvent event ) {
892
- Player player = event .getPlayer ();
893
- BukkitPlayer pp = BukkitUtil .adapt (player );
894
- // Delete last location
895
- Plot plot ;
896
- try (final MetaDataAccess <Plot > lastPlotAccess =
897
- pp .accessTemporaryMetaData (PlayerMetaDataKeys .TEMPORARY_LAST_PLOT )) {
898
- plot = lastPlotAccess .remove ();
899
- }
900
- try (final MetaDataAccess <Location > lastLocationAccess =
901
- pp .accessTemporaryMetaData (PlayerMetaDataKeys .TEMPORARY_LOCATION )) {
902
- lastLocationAccess .remove ();
903
- }
904
- if (plot != null ) {
905
- plotListener .plotExit (pp , plot );
906
- }
907
- if (this .worldEdit != null ) {
908
- if (!pp .hasPermission (Permission .PERMISSION_WORLDEDIT_BYPASS )) {
909
- if (pp .getAttribute ("worldedit" )) {
910
- pp .removeAttribute ("worldedit" );
911
- }
912
- }
913
- }
914
- Location location = pp .getLocation ();
915
- PlotArea area = location .getPlotArea ();
916
- if (location .isPlotArea ()) {
917
- plot = location .getPlot ();
918
- if (plot != null ) {
919
- plotListener .plotEntry (pp , plot );
920
- }
921
- }
922
- }
923
-
924
903
@ SuppressWarnings ("deprecation" )
925
904
@ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
926
905
public void onInventoryClick (InventoryClickEvent event ) {
0 commit comments