Skip to content

Commit

Permalink
Fix rebase errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Jul 21, 2024
1 parent fb58350 commit 5216072
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ else if (lootType.equalsIgnoreCase("command")) {
loot = new CommandLootParser().parse(context, ApiConfigNode.toApi(lootNode));
// Entity loot, mainly for fishing
} else if (lootType.equalsIgnoreCase("entity")) {
loot = new EntityLootParser(manager).parse(context, lootNode);
loot = new EntityLootParser(manager).parse(context, ApiConfigNode.toApi(lootNode));
} else {
// Parse custom loot registered from API
LootParser customParser = manager.getCustomLootParsers().get(lootType);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package dev.aurelium.auraskills.bukkit.loot.parser;

import dev.aurelium.auraskills.api.config.ConfigNode;
import dev.aurelium.auraskills.api.loot.Loot;
import dev.aurelium.auraskills.api.loot.LootParser;
import dev.aurelium.auraskills.api.loot.LootParsingContext;
import dev.aurelium.auraskills.bukkit.loot.LootManager;
import dev.aurelium.auraskills.bukkit.loot.entity.EntitySupplier;
import dev.aurelium.auraskills.bukkit.loot.type.EntityLoot;
import dev.aurelium.auraskills.common.api.implementation.ApiConfigNode;
import dev.aurelium.auraskills.common.util.data.Validate;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.serialize.SerializationException;

public class EntityLootParser implements LootParser {

Expand All @@ -19,14 +20,16 @@ public EntityLootParser(LootManager manager) {
}

@Override
public Loot parse(LootParsingContext context, ConfigurationNode config) throws SerializationException {
String entityType = config.node("entity").getString();
public Loot parse(LootParsingContext context, ConfigNode config) {
ConfigurationNode backing = ((ApiConfigNode) config).getBacking();

String entityType = backing.node("entity").getString();
Validate.notNull(entityType, "Entity loot must specify an entity type");

EntitySupplier entity = null;
for (CustomEntityParser parser : manager.getCustomEntityParsers()) {
if (parser.shouldUseParser(config)) {
entity = parser.getEntitySupplier(config);
if (parser.shouldUseParser(backing)) {
entity = parser.getEntitySupplier(backing);
break;
}
}
Expand Down

0 comments on commit 5216072

Please sign in to comment.