mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
update data file when players leave and join
This commit is contained in:
parent
4b1a7c87f8
commit
8b80ab0ed3
@ -15,14 +15,20 @@ public class SessionDataUtils implements Listener {
|
|||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On player Join and Leave,
|
||||||
|
* Remove Session data and do an async save of the data file
|
||||||
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinEvent(PlayerJoinEvent e) {
|
public void onJoinEvent(PlayerJoinEvent e) {
|
||||||
removeSessionData(e.getPlayer());
|
removeSessionData(e.getPlayer());
|
||||||
|
ctx.dataLoader.saveDataFileAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuitEvent(PlayerQuitEvent e) {
|
public void onQuitEvent(PlayerQuitEvent e) {
|
||||||
removeSessionData(e.getPlayer());
|
removeSessionData(e.getPlayer());
|
||||||
|
ctx.dataLoader.saveDataFileAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeSessionData(Player p){
|
private void removeSessionData(Player p){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user