@@ -614,16 +614,16 @@ public void unregister() {
614614 PlotId id = plot .getId ();
615615 int x = id .getX ();
616616 int z = id .getY ();
617- ByteBuffer buffer = ByteBuffer .allocate (13 );
617+ ByteBuffer buffer = ByteBuffer .allocate (14 );
618618 buffer .putShort ((short ) x );
619619 buffer .putShort ((short ) z );
620620 Location location = getLocation ();
621621 buffer .putInt (location .getX ());
622- buffer .put (( byte ) location .getY ());
622+ buffer .putShort (( short ) location .getY ());
623623 buffer .putInt (location .getZ ());
624- setPersistentMeta ("quitLoc " , buffer .array ());
625- } else if (hasPersistentMeta ("quitLoc " )) {
626- removePersistentMeta ("quitLoc " );
624+ setPersistentMeta ("quitLocV2 " , buffer .array ());
625+ } else if (hasPersistentMeta ("quitLocV2 " )) {
626+ removePersistentMeta ("quitLocV2 " );
627627 }
628628 if (plot != null ) {
629629 this .eventDispatcher .callLeave (this , plot );
@@ -700,11 +700,18 @@ public void run(Map<String, byte[]> value) {
700700 return ;
701701 }
702702 PlotArea area = ((SinglePlotAreaManager ) manager ).getArea ();
703+ boolean V2 = false ;
703704 byte [] arr = PlotPlayer .this .getPersistentMeta ("quitLoc" );
704705 if (arr == null ) {
705- return ;
706+ arr = PlotPlayer .this .getPersistentMeta ("quitLocV2" );
707+ if (arr == null ) {
708+ return ;
709+ }
710+ V2 = true ;
711+ removePersistentMeta ("quitLocV2" );
712+ } else {
713+ removePersistentMeta ("quitLoc" );
706714 }
707- removePersistentMeta ("quitLoc" );
708715
709716 if (!getMeta ("teleportOnLogin" , true )) {
710717 return ;
@@ -714,7 +721,7 @@ public void run(Map<String, byte[]> value) {
714721 final int plotZ = quitWorld .getShort ();
715722 PlotId id = PlotId .of (plotX , plotZ );
716723 int x = quitWorld .getInt ();
717- int y = quitWorld .get () & 0xFF ;
724+ int y = V2 ? quitWorld .getShort () : ( quitWorld . get () & 0xFF ) ;
718725 int z = quitWorld .getInt ();
719726 Plot plot = area .getOwnedPlot (id );
720727
@@ -748,10 +755,11 @@ public void run(Map<String, byte[]> value) {
748755 }
749756 }
750757 } catch (Throwable e ) {
751- e . printStackTrace ( );
758+ LOGGER . error ( "Error populating persistent meta for player {}" , PlotPlayer . this . getName (), e );
752759 }
753760 }
754- });
761+ }
762+ );
755763 }
756764 }
757765
0 commit comments