wyvern.lib
Interface HookCallback

All Known Implementing Classes:
AutobagRules, BearTrap, BerserkSkill, BoltSpell, wyvern.lib.classes.games.ChessChair, ConeSpell, Confuser, Converter, EchoCommand, Generator, HealersCurse, Instrument, Jump, LinkedMovement, ManaShield, MovableSoundSource, NagaShift, Paralyzer, PitTrap, Poison, PortableHole, Searcher, Shop, SideScroller, SokobanLevel, SpeechFilter, SummonSpell, TimeStop, Vault, Vehicle, VerboseCommand.Verboser, VorpalBlade, WizardEye

public interface HookCallback

Allows you to hook a Hookable event.

This interface is used by objects that wish to be able to hook into game events, to override them, modify them or simply react to them.

As an example, the Shop class implements much of its functionality using hooks. It prevents you from wielding, wearing, eating or otherwising using unpaid items by registering for the hooks for the "wield", "wear", "eat" (etc.) commands. If the target of the event is an unpaid item, the shop vetoes the event by calling the event's veto() method.

Version:
1.0, 10/03/97
Author:
Steve Yegge

Method Summary
 void hookEvent(java.lang.String hookName, CommandEvent event)
          Gives the HookCallback a chance to do something with the passed event.
 

Method Detail

hookEvent

public void hookEvent(java.lang.String hookName,
                      CommandEvent event)
Gives the HookCallback a chance to do something with the passed event. Sometimes more than one command is registered with the same verb (e.g. "turn wheel", "turn ring"), so the HookCallback should check the class of the passed CommandEvent and make sure it's the right event.

Parameters:
hookName - the name of the hook, such as "movePreHook".
event - the CommandEvent encapsulating the event parameters