Skip to content

Commit

Permalink
feat: effect command now can remove an effect from entity
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Jun 27, 2024
1 parent 21dbd83 commit 2033c72
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ public void prepareCommandTree(CommandTree tree) {
Collection<EntityPlayer> players = context.getResult(0);
EffectType effectType = context.getResult(1);
int seconds = context.getResult(2);
if (seconds == 0) {
// Remove effect
players.forEach(player -> {
player.removeEffect(effectType);
context.addOutput(
TrKeys.M_COMMANDS_EFFECT_SUCCESS_REMOVED,
effectType.getIdentifier().path(), // TODO: I18N
player.getDisplayName()
);
});
return context.success();
}
int time = seconds * 20; // because effect duration in ticks
int amplifier = context.getResult(3);
boolean hideParticles = context.getResult(4);
Expand Down

0 comments on commit 2033c72

Please sign in to comment.