command entity fix

This commit is contained in:
Sen 2025-03-26 21:25:25 +01:00
parent e108650cd4
commit b3955729b8
2 changed files with 2 additions and 7 deletions

View file

@ -98,7 +98,7 @@ public class EntityListParser extends EntityParser {
for(WorldServer world : env.getServer().getWorlds()) { for(WorldServer world : env.getServer().getWorlds()) {
for(Entity ent : world.getEntities()) { for(Entity ent : world.getEntities()) {
if((!this.livingOnly || ent instanceof EntityLiving) && if((!this.livingOnly || ent instanceof EntityLiving) &&
(negateOnly || (living != null && living == (ent instanceof EntityLiving)) || (player != null && player == ent.isPlayer()) || types.contains(ent.getType()) || (negateOnly || (living != null && types.isEmpty() && classes.isEmpty() && living == (ent instanceof EntityLiving)) || (player != null && types.isEmpty() && classes.isEmpty() && player == ent.isPlayer()) || types.contains(ent.getType()) ||
classes.contains(ent.getClass())) && classes.contains(ent.getClass())) &&
(living == null || living == (ent instanceof EntityLiving)) && (player == null || player == ent.isPlayer()) && (living == null || living == (ent instanceof EntityLiving)) && (player == null || player == ent.isPlayer()) &&
!ntypes.contains(ent.getType()) && !nclasses.contains(ent.getClass()) && !nentities.contains(ent) && !entities.contains(ent)) !ntypes.contains(ent.getType()) && !nclasses.contains(ent.getClass()) && !nentities.contains(ent) && !entities.contains(ent))

View file

@ -1,7 +1,6 @@
package game.command.commands; package game.command.commands;
import java.util.List; import java.util.List;
import game.collect.Lists;
import game.command.CommandEnvironment; import game.command.CommandEnvironment;
import game.command.Command; import game.command.Command;
import game.command.Executor; import game.command.Executor;
@ -13,12 +12,8 @@ public class CommandPotion extends Command {
public CommandPotion() { public CommandPotion() {
super("potion"); super("potion");
List<Potion> potions = Lists.newArrayList();
for(Potion potion : Potion.values()) {
potions.add(potion);
}
this.addLivingEntityList("entities", true); this.addLivingEntityList("entities", true);
this.addEnum("type", Potion.class, potions); this.addEnum("type", Potion.class, Potion.values());
this.setParamsOptional(); this.setParamsOptional();
this.addInt("duration", 0, 1000000, 1000000); this.addInt("duration", 0, 1000000, 1000000);
this.addInt("strength", 1, 256, 1); this.addInt("strength", 1, 256, 1);