@Override
public void change(final Event e, final @Nullable Object[] delta, final ChangeMode mode) throws UnsupportedOperationException {
assert mode == ChangeMode.SET;
assert delta != null;
final Color c = (Color) delta[0];
final Object[] os = getExpr().getArray(e);
if (os.length == 0)
return;
for (final Object o : os) {
if (o instanceof ItemStack || o instanceof Item) {
final ItemStack is = o instanceof ItemStack ? (ItemStack) o : ((Item) o).getItemStack();
final MaterialData d = is.getData();
if (d instanceof Colorable)
((Colorable) d).setColor(c.getWoolColor());
else
continue;
if (o instanceof ItemStack) {
if (changeItemStack)
getExpr().change(e, new ItemStack[] {is}, mode);
else
getExpr().change(e, new ItemType[] {new ItemType(is)}, mode);
} else {
((Item) o).setItemStack(is);
}
} else if (o instanceof Colorable) {
((Colorable) o).setColor(c.getWoolColor());
}
}
}