DropTable triggers should only trigger when drop table conditions are met.

This commit is contained in:
Ethan 2021-02-16 22:19:28 -05:00
parent 3f085b91ec
commit b9ae31467d

View File

@ -6,6 +6,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.block.BlockInfo;
import net.Indyuce.mmocore.api.block.BlockInfo.BlockInfoOption;
import net.Indyuce.mmocore.api.block.VanillaBlockType;
import net.Indyuce.mmocore.api.droptable.condition.ConditionInstance;
import net.Indyuce.mmocore.api.event.CustomBlockMineEvent;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
@ -108,8 +109,10 @@ public class BlockListener implements Listener {
* can give exp to other TOOLS and display HOLOGRAMS
*/
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
PlayerData playerData = PlayerData.get(player);
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
if (!info.hasDropTable() || info.hasDropTable() && info.getDropTable().areConditionsMet(new ConditionInstance(player))) {
PlayerData playerData = PlayerData.get(player);
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
}
}
/*