magmaus3
e66ed05ef7
+ Allow assigning multiple hook types to a class. + Add hook types, that are executed (almost) on every occasion.
19 lines
416 B
Python
19 lines
416 B
Python
#
|
|
# Example module.
|
|
#
|
|
|
|
from .. import hook_system
|
|
|
|
hook = hook_system.hook
|
|
|
|
|
|
@hook.add_hook
|
|
class Login:
|
|
# Different hook types are executed at different places.
|
|
# In this case, the hook is executed when a user logs in.
|
|
#
|
|
# Check the documentation for more hook types.
|
|
hook_type = ["player_login"]
|
|
|
|
def __call__(self, hook_type, *args, **kwargs):
|
|
print("LOGIN HOOK:", args, kwargs)
|