Skip to content

Commit

Permalink
Meh
Browse files Browse the repository at this point in the history
  • Loading branch information
incapable committed Jun 27, 2014
1 parent 2e3538e commit aad9cbe
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/com/infinitasoftware/playerstats/EventListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.infinitasoftware.playerstats;

import com.mbserver.api.events.EventHandler;
import com.mbserver.api.events.Listener;
import com.mbserver.api.events.PostPlayerLoginEvent;
import com.mbserver.api.events.WorldSaveEvent;

public class EventListener implements Listener {
private PlayerStats playerStats;

public EventListener(PlayerStats playerStats) {
this.playerStats = playerStats;
}

@EventHandler
public void onLogin( PostPlayerLoginEvent event ) {
playerStats.getStats().plusPlayer( event.getPlayer() );
}

@EventHandler
public void onWorldSave( WorldSaveEvent event ) {
if ( event.getWorld() == event.getServer().getMainWorld() )
playerStats.saveConfig();
}
}

0 comments on commit aad9cbe

Please sign in to comment.