The Meaning of Life, the Universe, and Everything.
Look up Forge Handlers Tutorials. They will let you do kind of intermediate->advanced things. They do things like check if a player is doing/holding/looking at X, then do Y. For things like enchantments or special events (like summoning a boss when an item drains enough souls).