diff --git a/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java b/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java index 89bd065..c351323 100644 --- a/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java +++ b/sponge/src/main/java/com/griefdefender/GriefDefenderPlugin.java @@ -482,9 +482,6 @@ public void onPreInit(GamePreInitializationEvent event, Logger logger, Path path TrustTypeRegistryModule.getInstance().registerDefaults(); FlagRegistryModule.getInstance().registerDefaults(); ResultTypeRegistryModule.getInstance().registerDefaults(); - EntityTypeRegistryModule.getInstance().registerDefaults(); - BlockTypeRegistryModule.getInstance().registerDefaults(); - ItemTypeRegistryModule.getInstance().registerDefaults(); CreateModeTypeRegistryModule.getInstance().registerDefaults(); GameModeTypeRegistryModule.getInstance().registerDefaults(); WeatherTypeRegistryModule.getInstance().registerDefaults(); @@ -503,6 +500,10 @@ public void onServerAboutToStart(GameAboutToStartServerEvent event) { return; } + // These must be registered here to catch all mod registrations + BlockTypeRegistryModule.getInstance().registerDefaults(); + EntityTypeRegistryModule.getInstance().registerDefaults(); + ItemTypeRegistryModule.getInstance().registerDefaults(); this.loadConfig(); this.registerBaseCommands(); this.executor = Executors.newFixedThreadPool(GriefDefenderPlugin.getGlobalConfig().getConfig().thread.numExecutorThreads); diff --git a/sponge/src/main/java/com/griefdefender/internal/registry/BlockTypeRegistryModule.java b/sponge/src/main/java/com/griefdefender/internal/registry/BlockTypeRegistryModule.java index 19614f7..9bf8d2b 100644 --- a/sponge/src/main/java/com/griefdefender/internal/registry/BlockTypeRegistryModule.java +++ b/sponge/src/main/java/com/griefdefender/internal/registry/BlockTypeRegistryModule.java @@ -27,6 +27,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; + +import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockType; import java.util.Collection; @@ -39,7 +41,6 @@ public final class BlockTypeRegistryModule { protected final Map blockTypeMappings = new HashMap<>(); - private final org.spongepowered.common.registry.type.BlockTypeRegistryModule SPONGE_REGISTRY = org.spongepowered.common.registry.type.BlockTypeRegistryModule.getInstance(); public static BlockTypeRegistryModule getInstance() { return Holder.INSTANCE; @@ -57,7 +58,7 @@ public Collection getAll() { } public void registerDefaults() { - for (BlockType type : SPONGE_REGISTRY.getAll()) { + for (BlockType type : Sponge.getRegistry().getAllOf(BlockType.class)) { this.blockTypeMappings.put(type.getId(), new GDBlockType(type)); } } diff --git a/sponge/src/main/java/com/griefdefender/internal/registry/EntityTypeRegistryModule.java b/sponge/src/main/java/com/griefdefender/internal/registry/EntityTypeRegistryModule.java index ff47079..60940ad 100644 --- a/sponge/src/main/java/com/griefdefender/internal/registry/EntityTypeRegistryModule.java +++ b/sponge/src/main/java/com/griefdefender/internal/registry/EntityTypeRegistryModule.java @@ -30,6 +30,8 @@ import com.google.common.collect.HashBiMap; import com.google.common.collect.ImmutableList; import net.minecraft.entity.EnumCreatureType; + +import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.living.Living; import org.spongepowered.common.entity.SpongeEntityType; @@ -44,7 +46,6 @@ public final class EntityTypeRegistryModule { protected final Map entityTypeMappings = new HashMap<>(); public final BiMap SPAWN_TYPES = HashBiMap.create(); - private final org.spongepowered.common.registry.type.entity.EntityTypeRegistryModule SPONGE_REGISTRY = org.spongepowered.common.registry.type.entity.EntityTypeRegistryModule.getInstance(); public static EntityTypeRegistryModule getInstance() { return Holder.INSTANCE; @@ -74,7 +75,7 @@ public EnumCreatureType getCreatureTypeByName(String name) { } public void registerDefaults() { - for (EntityType type : SPONGE_REGISTRY.getAll()) { + for (EntityType type : Sponge.getRegistry().getAllOf(EntityType.class)) { this.entityTypeMappings.put(type.getId(), new GDEntityType(type)); } SPAWN_TYPES.put("animal", EnumCreatureType.CREATURE); diff --git a/sponge/src/main/java/com/griefdefender/internal/registry/ItemTypeRegistryModule.java b/sponge/src/main/java/com/griefdefender/internal/registry/ItemTypeRegistryModule.java index 8f60776..d28318b 100644 --- a/sponge/src/main/java/com/griefdefender/internal/registry/ItemTypeRegistryModule.java +++ b/sponge/src/main/java/com/griefdefender/internal/registry/ItemTypeRegistryModule.java @@ -27,6 +27,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; + +import org.spongepowered.api.Sponge; import org.spongepowered.api.item.ItemType; import java.util.Collection; @@ -38,8 +40,7 @@ public final class ItemTypeRegistryModule { protected final Map itemTypeMappings = new HashMap<>(); - private final org.spongepowered.common.registry.type.ItemTypeRegistryModule SPONGE_REGISTRY = org.spongepowered.common.registry.type.ItemTypeRegistryModule.getInstance(); - + public static ItemTypeRegistryModule getInstance() { return Holder.INSTANCE; } @@ -56,7 +57,7 @@ public Collection getAll() { } public void registerDefaults() { - for (ItemType type : SPONGE_REGISTRY.getAll()) { + for (ItemType type : Sponge.getRegistry().getAllOf(ItemType.class)) { this.itemTypeMappings.put(type.getId(), new GDItemType(type)); } }