mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
Safe check on dupe stat registration
This commit is contained in:
parent
a284fb1a49
commit
4e5e16ccac
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<version>6.9.4-SNAPSHOT</version>
|
||||
<version>6.9.5-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -167,10 +167,19 @@ public class StatManager {
|
||||
* @param stat The stat to register
|
||||
*/
|
||||
public void register(@NotNull ItemStat<?, ?> stat) {
|
||||
|
||||
// Skip disabled stats.
|
||||
if (!stat.isEnabled()) return;
|
||||
|
||||
// Safe check, this can happen with numerous extra RPG plugins
|
||||
if (stats.containsKey(stat.getId())) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not register stat '" + stat.getId() + "' as a stat with the same ID already exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
stats.put(stat.getId(), stat);
|
||||
|
||||
// Custom registries
|
||||
if (stat instanceof DoubleStat && !(stat instanceof GemStoneStat) && stat.isCompatible(Type.GEM_STONE))
|
||||
numeric.add((DoubleStat) stat);
|
||||
if (stat instanceof ItemRestriction) itemRestriction.add((ItemRestriction) stat);
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<version>6.9.4-SNAPSHOT</version>
|
||||
<version>6.9.5-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -30,7 +30,7 @@
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems-API</artifactId>
|
||||
<version>6.9.4-SNAPSHOT</version>
|
||||
<version>6.9.5-SNAPSHOT</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>6.9.4-SNAPSHOT</version>
|
||||
<version>6.9.5-SNAPSHOT</version>
|
||||
|
||||
<modules>
|
||||
<module>MMOItems-API</module>
|
||||
@ -56,7 +56,7 @@
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>MythicLib-dist</artifactId>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<version>1.6.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Jetbrains Annotations -->
|
||||
|
Loading…
Reference in New Issue
Block a user