File tree Expand file tree Collapse file tree
src/main/java/net/earthmc/emcapi/integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212public class Integrations implements Listener {
1313 private static final Map <String , Integration > INTEGRATIONS = new ConcurrentHashMap <>();
14+ private static final Map <String , Integration > PLUGIN_INTEGRATION_MAP = new ConcurrentHashMap <>();
1415
1516 @ SuppressWarnings ("unchecked" )
1617 public static <T extends Integration > T getIntegration (String name ) {
@@ -19,21 +20,22 @@ public static <T extends Integration> T getIntegration(String name) {
1920
2021 public static void addIntegration (String identifier , Integration integration ) {
2122 INTEGRATIONS .put (identifier , integration );
23+ PLUGIN_INTEGRATION_MAP .put (integration .name (), integration );
2224
2325 integration .setEnabled (EMCAPI .instance .getServer ().getPluginManager ().isPluginEnabled (integration .name ()));
2426 }
2527
2628 @ EventHandler
2729 public void onPluginEnable (final PluginEnableEvent event ) {
28- final Integration integration = INTEGRATIONS .get (event .getPlugin ().getName ());
30+ final Integration integration = PLUGIN_INTEGRATION_MAP .get (event .getPlugin ().getName ());
2931 if (integration != null ) {
3032 integration .setEnabled (true );
3133 }
3234 }
3335
3436 @ EventHandler
3537 public void onPluginDisable (final PluginDisableEvent event ) {
36- final Integration integration = INTEGRATIONS .get (event .getPlugin ().getName ());
38+ final Integration integration = PLUGIN_INTEGRATION_MAP .get (event .getPlugin ().getName ());
3739 if (integration != null ) {
3840 integration .setEnabled (false );
3941 }
You can’t perform that action at this time.
0 commit comments