File tree Expand file tree Collapse file tree
src/main/java/com/github/abilityapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818import com .github .abilityapi .sequence .SequenceManager ;
1919import com .github .abilityapi .services .AbilityService ;
2020import com .github .abilityapi .services .SequenceService ;
21+ import com .github .abilityapi .services .UserService ;
2122import org .bukkit .plugin .java .JavaPlugin ;
2223
2324import java .util .ArrayList ;
@@ -33,6 +34,7 @@ public class AbilityAPI extends JavaPlugin {
3334 private final MetricService metricService = new MetricService (this );
3435 private final AbilityService abilityService = new AbilityService (this , abilityManager );
3536 private final SequenceService sequenceService = new SequenceService (this , sequenceManager );
37+ private final UserService userService = new UserService (this );
3638
3739 private final List <Service > services = new ArrayList <>();
3840
@@ -47,6 +49,7 @@ public void onEnable() {
4749 services .add (metricService );
4850 services .add (abilityService );
4951 services .add (sequenceService );
52+ services .add (userService );
5053 services .forEach (Service ::start );
5154 }
5255
Original file line number Diff line number Diff line change 1+ package com .github .abilityapi .services ;
2+
3+ import com .github .abilityapi .Service ;
4+ import com .github .abilityapi .user .User ;
5+ import org .bukkit .Bukkit ;
6+ import org .bukkit .entity .Player ;
7+ import org .bukkit .event .EventHandler ;
8+ import org .bukkit .event .HandlerList ;
9+ import org .bukkit .event .Listener ;
10+ import org .bukkit .event .player .PlayerQuitEvent ;
11+ import org .bukkit .plugin .java .JavaPlugin ;
12+
13+ public class UserService implements Service , Listener {
14+
15+ private final JavaPlugin plugin ;
16+
17+ public UserService (JavaPlugin plugin ) {
18+ this .plugin = plugin ;
19+ }
20+
21+ @ Override
22+ public void start () {
23+ Bukkit .getPluginManager ().registerEvents (this , plugin );
24+ }
25+
26+ @ Override
27+ public void stop () {
28+ HandlerList .unregisterAll (this );
29+ }
30+
31+ @ EventHandler
32+ public void onPlayerQuit (PlayerQuitEvent event ) {
33+ Player player = event .getPlayer ();
34+ User .obliterate (player );
35+ }
36+
37+ }
You can’t perform that action at this time.
0 commit comments