9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 09:59:20 +00:00

撤回这个提交 :)

This commit is contained in:
halogly
2025-08-24 17:43:16 +08:00
parent 2697f69730
commit 4d7a7ff473

View File

@@ -1,6 +1,5 @@
package net.momirealms.craftengine.core.plugin.context.condition;
import net.momirealms.craftengine.core.block.ImmutableBlockState;
import net.momirealms.craftengine.core.plugin.context.Condition;
import net.momirealms.craftengine.core.plugin.context.Context;
import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters;
@@ -29,12 +28,7 @@ public class MatchBlockTypeCondition<CTX extends Context> implements Condition<C
@Override
public boolean test(CTX ctx) {
Optional<BlockInWorld> block = ctx.getOptionalParameter(DirectContextParameters.BLOCK);
Optional<ImmutableBlockState> customBlock = ctx.getOptionalParameter(DirectContextParameters.CUSTOM_BLOCK_STATE);
return block.filter(blockInWorld -> {
String key = customBlock.map(immutableBlockState ->
immutableBlockState.owner().value().id().asString()).orElseGet(() -> blockInWorld.type().asString());
return MiscUtils.matchRegex(key, this.ids, this.regexMatch);
}).isPresent();
return block.filter(blockInWorld -> MiscUtils.matchRegex(blockInWorld.type().asString(), this.ids, this.regexMatch)).isPresent();
}
public static class FactoryImpl<CTX extends Context> implements ConditionFactory<CTX> {