Skip to content

Commit

Permalink
Add Vehicle and armor stand as MobTypes. Rename incorrect spelling of…
Browse files Browse the repository at this point in the history
… method.
  • Loading branch information
CitralFlo committed Dec 12, 2023
1 parent 51b83e1 commit 752249a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.ArmorStand;

class MobEntity {

Expand All @@ -23,6 +25,8 @@ boolean isMatch(Entity entity) {
return switch (this.mobType) {
case PASSIVE -> EntityUtil.is(entity, Animals.class);
case AGGRESSIVE -> EntityUtil.is(entity, Monster.class);
case VEHICLE -> EntityUtil.is(entity, Vehicle.class);
case ARMOR_STAND -> EntityUtil.is(entity, ArmorStand.class);
case OTHER -> EntityUtil.is(entity, this.entityClass);
case ALL -> EntityUtil.isMob(entity);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ParseResult<MobEntity> parse(Invocation<CommandSender> invocation, String

@Override
public SuggestionResult suggest(Invocation<CommandSender> invocation, Argument<MobEntity> argument, SuggestionContext context) {
Stream<MobType> mobTypeStream = Stream.of(MobType.values()).filter(MobType::isSuggeestable);
Stream<MobType> mobTypeStream = Stream.of(MobType.values()).filter(MobType::isSuggestable);
Stream<EntityType> entityTypeStream = Stream.of(EntityType.values()).filter(EntityUtil::isMob);

return Stream.concat(entityTypeStream, mobTypeStream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@ enum MobType {

PASSIVE(true, true),
AGGRESSIVE(true, true),
OTHER(false, false),
VEHICLE(true, true),
ARMOR_STAND(true, true),
OTHER(true, false),
ALL(true, true);

private final boolean isParseable;
private final boolean isSuggeestable;
private final boolean isSuggestable;

MobType(boolean isParseable, boolean isSuggeestable) {
MobType(boolean isParseable, boolean isSuggestible) {
this.isParseable = isParseable;
this.isSuggeestable = isSuggeestable;
this.isSuggestable = isSuggestible;
}

boolean isParseable() {
return this.isParseable;
}

boolean isSuggeestable() {
return this.isSuggeestable;
boolean isSuggestable() {
return this.isSuggestable;
}
}

0 comments on commit 752249a

Please sign in to comment.