Conversation
| public ClearCommand(Selector targets, StatusEffect effect) { | ||
| this.targets = targets; | ||
| this.effect = effect; | ||
| this.effect = null; |
There was a problem hiding this comment.
I'm assuming this should be this.effect = effect?
| @@ -100,47 +98,56 @@ public int execute(ServerCommandSource source) { | |||
| } | |||
| duration *= 20; | |||
There was a problem hiding this comment.
Doesn't this multiply the duration with 20 each time?
Maybe do the multiply and the effect.isInstant in the constructor?
There was a problem hiding this comment.
This also gives an error as duration is final
|
|
||
| abstract public class EffectCommand implements Command { | ||
| final Selector targets; | ||
| final StatusEffect effect; |
There was a problem hiding this comment.
EffectCommand needs a constructor to initialize these.
|
|
||
| public GiveCommand(Selector targets, StatusEffect effect, int duration, int amplifier, boolean hideParticles) { | ||
| this.targets = targets; | ||
| this.effect = effect; |
There was a problem hiding this comment.
These should be passed to the super constructor.
|
|
||
| public static ClearCommand read(Reader reader) throws ReaderException { | ||
| Selector targets = Selector.read(reader); | ||
| StatusEffect effect; |
There was a problem hiding this comment.
should be initialized with null in case the if does not execute.
|
|
||
| public static GiveCommand read(Reader reader) throws ReaderException { | ||
| Selector targets = Selector.read(reader); | ||
| Identifier item = Registry.ITEM.get(reader.readIdentifier()); |
There was a problem hiding this comment.
I'll make a readItem that handles the nbt.
|
|
||
| int stackMax = item.getMaxCount(); | ||
| int stackCount = count / stackMax; | ||
| ItemStack stack = ItemStack(item, stackMax); |
| for (Entity entity : entities) { | ||
| if (entity instanceof PlayerEntity) { | ||
| player = (PlayerEntity) entity; | ||
| for (int i = 0; i < stackCount + 1; i++) { |
There was a problem hiding this comment.
i <= stackCount is a bit neater.
| ItemStack stack = ItemStack(item, stackMax); | ||
| // TODO: throw error for 'illegal' item (not found) | ||
|
|
||
| Collection<Entity> entities = targets.getEntities(source); |
| Collection<Entity> entities = targets.getEntities(source); | ||
| for (Entity entity : entities) { | ||
| if (entity instanceof PlayerEntity) { | ||
| player = (PlayerEntity) entity; |
|
will fix soon after i get eclipse |
Merge this after I finish the following commands: