diff --git a/src/main/java/ch/njol/skript/effects/EffChange.java b/src/main/java/ch/njol/skript/effects/EffChange.java index aeabaa17df3..10956b6aa85 100644 --- a/src/main/java/ch/njol/skript/effects/EffChange.java +++ b/src/main/java/ch/njol/skript/effects/EffChange.java @@ -271,22 +271,17 @@ else if (mode == ChangeMode.SET) } @Override - protected void execute(final Event e) { - final Expression changer = this.changer; + protected void execute(Event e) { + Expression changer = this.changer; Object[] delta = changer == null ? null : changer.getArray(e); delta = changer == null ? delta : changer.beforeChange(changed, delta); - if (delta != null && delta.length == 0) - return; - if (delta == null && (mode != ChangeMode.DELETE && mode != ChangeMode.RESET)) + + if ((delta == null || delta.length == 0) && (mode != ChangeMode.DELETE && mode != ChangeMode.RESET)) { + if (changed.acceptChange(ChangeMode.DELETE) != null) + changed.change(e, null, ChangeMode.DELETE); return; - changed.change(e, delta, mode); // Trigger beforeChanged hook - // REMIND use a random element out of delta if changed only supports changing a single instance -// changed.change(e, new Changer2() { -// @Override -// public Object change(Object o) { -// return delta; -// } -// }, mode); + } + changed.change(e, delta, mode); } @Override