A simple plugin that runs a specified command when a player joins and another command when they last player leaves the server, Should be compatible with most if not all plugins.
Simply run the plugin for the first time and then modify the config file with your desired command!
Config example:
#This Command Runs whenever a player joins the server join-command: "say Welcome! This Server has Last Player Commands Enabled!"
#This command Runs whenever a player leaves the server and there are no other players on the server leave-command: "say Wow This Person really like default configs! To change this add a command with no /"