4
4
# Source.Python
5
5
from commands import CommandReturn
6
6
from commands .typed import TypedClientCommand , TypedSayCommand
7
+ from core import AutoUnload
7
8
from filters .players import PlayerIter
8
9
9
10
# Source.Python Admin
@@ -61,7 +62,7 @@ def iter_filter_targets(filter_str, filter_args, issuer):
61
62
# =============================================================================
62
63
# >> CLASSES
63
64
# =============================================================================
64
- class BaseFeatureCommand :
65
+ class BaseFeatureCommand ( AutoUnload ) :
65
66
def __init__ (self , commands , feature ):
66
67
if isinstance (commands , str ):
67
68
commands = [commands , ]
@@ -70,17 +71,21 @@ def __init__(self, commands, feature):
70
71
71
72
self .feature = feature
72
73
73
- TypedSayCommand (
74
+ self . _public_chat_command = TypedSayCommand (
74
75
['!spa' , ] + commands , feature .flag
75
- )( self . _get_public_chat_callback ())
76
+ )
76
77
77
- TypedSayCommand (
78
+ self . _private_chat_command = TypedSayCommand (
78
79
['/spa' , ] + commands , feature .flag
79
- )( self . _get_private_chat_callback ())
80
+ )
80
81
81
- TypedClientCommand (
82
+ self . _client_command = TypedClientCommand (
82
83
['spa' , ] + commands , feature .flag
83
- )(self ._get_client_callback ())
84
+ )
85
+
86
+ self ._public_chat_command (self ._get_public_chat_callback ())
87
+ self ._private_chat_command (self ._get_private_chat_callback ())
88
+ self ._client_command (self ._get_client_callback ())
84
89
85
90
def _get_public_chat_callback (self ):
86
91
raise NotImplementedError
@@ -91,6 +96,11 @@ def _get_private_chat_callback(self):
91
96
def _get_client_callback (self ):
92
97
raise NotImplementedError
93
98
99
+ def _unload_instance (self ):
100
+ self ._public_chat_command ._unload_instance ()
101
+ self ._private_chat_command ._unload_instance ()
102
+ self ._client_command ._unload_instance ()
103
+
94
104
95
105
class FeatureCommand (BaseFeatureCommand ):
96
106
def _execute (self , command_info ):
0 commit comments