Bukkit/CraftBukkit — comment on commit 76c5230f6329dee94641c396f607041d39d35ee0
File: src/main/java/net/minecraft/server/ContainerEnchantTable.java line 114
By Resistance:

Only talk about costs when you have hard evidence that it performs bad. Since this event won't probably be called that often, array allocation wouldn't be a problem. I'd rather have clean code than smelly code. Also, instead of zeroing loops you could use a static final field

On the topic of seeing wrong state, it is perfectly fine. Event handlers should not touch an object that is undergoing state modification, they have everything they should use in the event object.