@ -26,7 +26,6 @@ import engine.job.JobScheduler; 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.jobs.DeferredPowerJob ;  
					 
					 
					 
					import  engine.jobs.DeferredPowerJob ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.jobs.FinishSpireEffectJob ;  
					 
					 
					 
					import  engine.jobs.FinishSpireEffectJob ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.jobs.NoTimeJob ;  
					 
					 
					 
					import  engine.jobs.NoTimeJob ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.math.Bounds ;  
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.math.FastMath ;  
					 
					 
					 
					import  engine.math.FastMath ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.math.Vector3fImmutable ;  
					 
					 
					 
					import  engine.math.Vector3fImmutable ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.net.ByteBufferWriter ;  
					 
					 
					 
					import  engine.net.ByteBufferWriter ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -174,7 +173,6 @@ public class PlayerCharacter extends AbstractCharacter { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  boolean  isTeleporting  =  false ;   
					 
					 
					 
					    private  boolean  isTeleporting  =  false ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  boolean  dirtyLoad  =  true ;   
					 
					 
					 
					    private  boolean  dirtyLoad  =  true ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  final  ReadWriteLock  dirtyLock  =  new  ReentrantReadWriteLock ( true ) ;   
					 
					 
					 
					    private  final  ReadWriteLock  dirtyLock  =  new  ReentrantReadWriteLock ( true ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  Bounds  playerBounds ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    / * *   
					 
					 
					 
					    / * *   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					     *  No  Id  Constructor   
					 
					 
					 
					     *  No  Id  Constructor   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -208,9 +206,8 @@ public class PlayerCharacter extends AbstractCharacter { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . guildStatus  =  new  AtomicInteger ( 0 ) ;   
					 
					 
					 
					        this . guildStatus  =  new  AtomicInteger ( 0 ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . bindBuildingID  =  - 1 ;   
					 
					 
					 
					        this . bindBuildingID  =  - 1 ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . playerBounds  =  Bounds . borrow ( ) ;   
					 
					 
					 
					        Vector3fImmutable  center  =  new  Vector3fImmutable ( 0 ,  0 ,  0 ) ;   
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					        playerBounds . setBounds ( this . getLoc ( ) ) ;   
					 
					 
					 
					        Vector3fImmutable  extents  =  new  Vector3fImmutable ( 0 . 5f ,  1 . 0f ,  0 . 5f ) ;   
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . playerBounds . setBounds ( this ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    / * *   
					 
					 
					 
					    / * *   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -274,58 +271,6 @@ public class PlayerCharacter extends AbstractCharacter { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . hash  =  rs . getString ( "hash" ) ;   
					 
					 
					 
					        this . hash  =  rs . getString ( "hash" ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . playerBounds  =  Bounds . borrow ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        playerBounds . setBounds ( this . getLoc ( ) ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . playerBounds . setBounds ( this ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // For debugging skills
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // CharacterSkill.printSkills(this);
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    public  void  updateBounds ( )  {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . playerBounds . setBounds ( this ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . checkCollisionsWithOtherPlayers ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    public  void  checkCollisionsWithOtherPlayers ( )  {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        HashSet < AbstractWorldObject >  nearbyObjects  =  WorldGrid . getObjectsInRangePartial ( this ,  MBServerStatics . CHARACTER_LOAD_RANGE ,  MBServerStatics . MASK_PLAYER ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        for  ( AbstractWorldObject  obj  :  nearbyObjects )  {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            if  ( obj  instanceof  PlayerCharacter  & &  obj  ! =  this )  {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                PlayerCharacter  otherPlayer  =  ( PlayerCharacter )  obj ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                if  ( Bounds . collide ( this . getBounds ( ) ,  otherPlayer . getBounds ( ) ,  0 . 1f ) )  {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    System . out . println ( "Collision detected with player: "  +  otherPlayer . getFirstName ( ) ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    ChatManager . chatSystemInfo ( otherPlayer ,  "Has Collided with YOU" ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    // Handle collision with other player
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                    handleCollisionWithPlayer ( otherPlayer ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  void  handleCollisionWithPlayer ( PlayerCharacter  otherPlayer )  {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Vector3fImmutable  myPos  =  this . getLoc ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Vector3fImmutable  otherPlayerPos  =  otherPlayer . getLoc ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // Calculate direction vector
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Vector3fImmutable  direction  =  myPos . subtract ( otherPlayerPos ) . normalize ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // Move players apart
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        float  separationDistance  =  1 . 0f ;  // Adjust this value as needed
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Vector3fImmutable  myNewPos  =  myPos . add ( direction . mult ( separationDistance  /  2 ) ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Vector3fImmutable  otherPlayerNewPos  =  otherPlayerPos . subtract ( direction . mult ( separationDistance  /  2 . 0f ) ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // Update positions
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . setLoc ( myNewPos ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        otherPlayer . setLoc ( otherPlayerNewPos ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // Refresh both players in the world
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        WorldGrid . updateObject ( this ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        WorldGrid . updateObject ( otherPlayer ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        // Refresh both players in the world
   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        WorldGrid . updateObject ( this ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        WorldGrid . updateObject ( otherPlayer ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    public  static  Building  getUpdatedBindBuilding ( PlayerCharacter  player )  {   
					 
					 
					 
					    public  static  Building  getUpdatedBindBuilding ( PlayerCharacter  player )  {   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -4619,9 +4564,6 @@ public class PlayerCharacter extends AbstractCharacter { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . charItemManager  =  new  CharacterItemManager ( this ) ;   
					 
					 
					 
					        this . charItemManager  =  new  CharacterItemManager ( this ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Bounds  playerBounds  =  Bounds . borrow ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        playerBounds . setBounds ( this . getLoc ( ) ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . setBounds ( playerBounds ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					    }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    @Override   
					 
					 
					 
					    @Override   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -4936,7 +4878,6 @@ public class PlayerCharacter extends AbstractCharacter { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    @Override   
					 
					 
					 
					    @Override   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    public  void  updateLocation ( )  {   
					 
					 
					 
					    public  void  updateLocation ( )  {   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . updateBounds ( ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        if  ( ! this . isMoving ( ) )   
					 
					 
					 
					        if  ( ! this . isMoving ( ) )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            return ;   
					 
					 
					 
					            return ;   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -5418,6 +5359,8 @@ public class PlayerCharacter extends AbstractCharacter { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        moveToMsg . setSourceType ( GameObjectType . PlayerCharacter . ordinal ( ) ) ;   
					 
					 
					 
					        moveToMsg . setSourceType ( GameObjectType . PlayerCharacter . ordinal ( ) ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        moveToMsg . setSourceID ( this . getObjectUUID ( ) ) ;   
					 
					 
					 
					        moveToMsg . setSourceID ( this . getObjectUUID ( ) ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        ChatManager . chatSystemInfo ( this ,  "This is a test" ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        Dispatch  dispatch  =  Dispatch . borrow ( this ,  moveToMsg ) ;   
					 
					 
					 
					        Dispatch  dispatch  =  Dispatch . borrow ( this ,  moveToMsg ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        DispatchMessage . dispatchMsgDispatch ( dispatch ,  DispatchChannel . PRIMARY ) ;   
					 
					 
					 
					        DispatchMessage . dispatchMsgDispatch ( dispatch ,  DispatchChannel . PRIMARY ) ;