diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitExistingBlock.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitExistingBlock.java index 3013d73d1..38dd8db86 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitExistingBlock.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/world/BukkitExistingBlock.java @@ -83,7 +83,7 @@ public class BukkitExistingBlock implements ExistingBlock { } @Override - public Key type() { + public Key id() { Object blockState = BlockStateUtils.getBlockState(this.block); Optional optionalCustomBlockState = BlockStateUtils.getOptionalCustomBlockState(blockState); if (optionalCustomBlockState.isPresent()) { diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java index 445406954..d9a1eadae 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/CommonConditions.java @@ -10,8 +10,8 @@ public final class CommonConditions { public static final Key ANY_OF = Key.of("craftengine:any_of"); public static final Key INVERTED = Key.of("craftengine:inverted"); public static final Key MATCH_ITEM = Key.of("craftengine:match_item"); - public static final Key MATCH_ENTITY_TYPE = Key.of("craftengine:match_entity_type"); - public static final Key MATCH_BLOCK_TYPE = Key.of("craftengine:match_block_type"); + public static final Key MATCH_ENTITY = Key.of("craftengine:match_entity"); + public static final Key MATCH_BLOCK = Key.of("craftengine:match_block"); public static final Key MATCH_BLOCK_PROPERTY = Key.from("craftengine:match_block_property"); public static final Key TABLE_BONUS = Key.from("craftengine:table_bonus"); public static final Key SURVIVES_EXPLOSION = Key.from("craftengine:survives_explosion"); diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockCondition.java similarity index 81% rename from core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java rename to core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockCondition.java index 9bf6830fa..47a9649dd 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockTypeCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchBlockCondition.java @@ -11,24 +11,24 @@ import net.momirealms.craftengine.core.world.ExistingBlock; import java.util.*; -public class MatchBlockTypeCondition implements Condition { +public class MatchBlockCondition implements Condition { private final Set ids; private final boolean regexMatch; - public MatchBlockTypeCondition(Collection ids, boolean regexMatch) { + public MatchBlockCondition(Collection ids, boolean regexMatch) { this.ids = new HashSet<>(ids); this.regexMatch = regexMatch; } @Override public Key type() { - return CommonConditions.MATCH_BLOCK_TYPE; + return CommonConditions.MATCH_BLOCK; } @Override public boolean test(CTX ctx) { Optional block = ctx.getOptionalParameter(DirectContextParameters.BLOCK); - return block.filter(blockInWorld -> MiscUtils.matchRegex(blockInWorld.type().asString(), this.ids, this.regexMatch)).isPresent(); + return block.filter(blockInWorld -> MiscUtils.matchRegex(blockInWorld.id().asString(), this.ids, this.regexMatch)).isPresent(); } public static class FactoryImpl implements ConditionFactory { @@ -40,7 +40,7 @@ public class MatchBlockTypeCondition implements Condition(ids, regex); + return new MatchBlockCondition<>(ids, regex); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityCondition.java similarity index 85% rename from core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java rename to core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityCondition.java index 925559992..63e178c5f 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityTypeCondition.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/condition/MatchEntityCondition.java @@ -11,18 +11,18 @@ import net.momirealms.craftengine.core.util.ResourceConfigUtils; import java.util.*; -public class MatchEntityTypeCondition implements Condition { +public class MatchEntityCondition implements Condition { private final Set ids; private final boolean regexMatch; - public MatchEntityTypeCondition(Collection ids, boolean regexMatch) { + public MatchEntityCondition(Collection ids, boolean regexMatch) { this.ids = new HashSet<>(ids); this.regexMatch = regexMatch; } @Override public Key type() { - return CommonConditions.MATCH_ENTITY_TYPE; + return CommonConditions.MATCH_ENTITY; } @Override @@ -40,7 +40,7 @@ public class MatchEntityTypeCondition implements Condition< throw new LocalizedResourceConfigException("warning.config.condition.match_entity_type.missing_id"); } boolean regex = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("regex", false), "regex"); - return new MatchEntityTypeCondition<>(ids, regex); + return new MatchEntityCondition<>(ids, regex); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java index 0e3eb288a..c5e0e3c71 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/event/EventConditions.java @@ -17,8 +17,8 @@ public class EventConditions { static { register(CommonConditions.MATCH_ITEM, new MatchItemCondition.FactoryImpl<>()); - register(CommonConditions.MATCH_ENTITY_TYPE, new MatchEntityTypeCondition.FactoryImpl<>()); - register(CommonConditions.MATCH_BLOCK_TYPE, new MatchBlockTypeCondition.FactoryImpl<>()); + register(CommonConditions.MATCH_ENTITY, new MatchEntityCondition.FactoryImpl<>()); + register(CommonConditions.MATCH_BLOCK, new MatchBlockCondition.FactoryImpl<>()); register(CommonConditions.MATCH_BLOCK_PROPERTY, new MatchBlockPropertyCondition.FactoryImpl<>()); register(CommonConditions.TABLE_BONUS, new TableBonusCondition.FactoryImpl<>()); register(CommonConditions.SURVIVES_EXPLOSION, new SurvivesExplosionCondition.FactoryImpl<>()); diff --git a/core/src/main/java/net/momirealms/craftengine/core/world/ExistingBlock.java b/core/src/main/java/net/momirealms/craftengine/core/world/ExistingBlock.java index 5b1bb41f1..947bc664d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/world/ExistingBlock.java +++ b/core/src/main/java/net/momirealms/craftengine/core/world/ExistingBlock.java @@ -39,7 +39,7 @@ public interface ExistingBlock { World world(); - Key type(); + Key id(); int x();