Skip to content

Commit 9210a66

Browse files
committed
Fix mismatch between plugin name & integration identifier
1 parent e2c3a06 commit 9210a66

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/net/earthmc/emcapi/integration/Integrations.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
public 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
}

0 commit comments

Comments
 (0)