Skip to content

Commit 196a2a1

Browse files
authored
Fix startup issue with potion providers (#6055)
The LegacyPotionMetaProvider was initializing a map with enums that don't exist on modern versions. Since this was a static variable, this map got initialized when the test method was called, leading to a NoSuchFieldError. Also improved resilience of these provider-type issues again by catching a Throwable rather than an Exception in the ProviderFactory. Fixes #6054
1 parent 69ed07a commit 196a2a1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Essentials/src/main/java/com/earth2me/essentials/ProviderFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void finalizeRegistration() {
6868
highestProvider = provider;
6969
highestProviderData = providerData;
7070
}
71-
} catch (final Exception e) {
71+
} catch (final Throwable e) {
7272
essentials.getLogger().log(Level.SEVERE, "Failed to initialize provider " + provider.getName(), e);
7373
}
7474
}

providers/1_12Provider/src/main/java/net/ess3/provider/providers/LegacyPotionMetaProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@ProviderData(description = "1.9-1.20.4 Potion Meta Provider", weight = 1)
1818
public class LegacyPotionMetaProvider implements PotionMetaProvider {
19-
private static final Map<Integer, PotionType> damageValueToType = ImmutableMap.<Integer, PotionType>builder()
19+
private final Map<Integer, PotionType> damageValueToType = ImmutableMap.<Integer, PotionType>builder()
2020
.put(1, PotionType.REGEN)
2121
.put(2, PotionType.SPEED)
2222
.put(3, PotionType.FIRE_RESISTANCE)

0 commit comments

Comments
 (0)