File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed 
src/Simonsator/PartyAndFriends Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1010    }
1111  ],
1212  "require" : {
13-     "php" : " ^7.4|^8.0" 
13+     "php" : " ^7.4|^8.0" 
14+     "ext-pdo" : " *" 
1415  },
1516  "require-dev" : {
1617    "roave/security-advisories" : " dev-latest" 
Original file line number Diff line number Diff line change 22
33namespace  Simonsator \PartyAndFriends ;
44
5+ use  DateTime ;
6+ use  Exception ;
7+ 
58class  PAFPlayer
69{
710	private  string  $ uniqueID
@@ -142,11 +145,25 @@ public function getSettingsWorth(int $pSettingsID): int
142145		return  0 ;
143146	}
144147
148+ 	public  function  getLastOnline (): DateTime 
149+ 	{
150+ 		$ stmtgetInstance ()->getConnection ()->prepare (
151+ 			"SELECT last_online   
152+ 				   FROM  {$ this getTablePrefix ()}players  
153+ 				   WHERE player_id = ' {$ this id }' LIMIT 1 "
154+ 		$ stmtexecute ();
155+ 		try  {
156+ 			return  new  DateTime ($ stmtfetch ()['last_online ' ]);
157+ 		} catch  (Exception $ e
158+ 			return  new  DateTime ();
159+ 		}
160+ 	}
161+ 
145162	/** 
146163	 * @param PAFPlayer $player The player which should be the new friend of this player 
147164	 * @return void 
148165	 */ 
149- 	public  function  addFriend (PAFPlayer $ player
166+ 	public  function  addFriend (PAFPlayer $ player:  void 
150167	{
151168		$ stmtgetInstance ()->getConnection ()->prepare (
152169			"INSERT INTO  {$ this getTablePrefix ()}friend_assignment   
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments