Skip to content
This repository was archived by the owner on Apr 27, 2019. It is now read-only.

Commit 8e8d42a

Browse files
committed
Merge pull request #135 from natemontgomery/merge-branch
Merge Refactor Plugin Loading patch from ElsIf. Plugins that should be loaded on startup should be added to the initial_plugins structure instead of a auto_activate. Various other quirks resolved.
2 parents 5f68517 + 1679afa commit 8e8d42a

43 files changed

Lines changed: 271 additions & 289 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

base_plugin.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ class BasePlugin(object):
1818
name = "Base Plugin"
1919
description = "The common class for all plugins to inherit from."
2020
version = ".1"
21-
depends = []
22-
auto_activate = True
23-
24-
def __init__(self):
25-
plugin_config = self.config.plugin_config
26-
if 'auto_activate' not in plugin_config:
27-
plugin_config['auto_activate'] = self.auto_activate
28-
self.config.plugin_config = plugin_config
21+
depends = []
2922

3023
def activate(self):
3124
"""
@@ -389,23 +382,22 @@ class SimpleCommandPlugin(BasePlugin):
389382
name = "simple_command_plugin"
390383
description = "Provides a simple parent class to define chat commands."
391384
version = "0.1"
392-
depends = ["command_dispatcher"]
385+
depends = ["command_plugin"]
393386
commands = []
394387
command_aliases = {}
395-
auto_activate = True
396388

397389
def activate(self):
398390
super(SimpleCommandPlugin, self).activate()
399391
for command in self.commands:
400392
f = getattr(self, command)
401393
if not callable(f):
402394
raise CommandNameError("Could not find a method called %s" % command)
403-
self.plugins['command_dispatcher'].register(f, command)
395+
self.plugins['command_plugin'].register(f, command)
404396
for command, alias_list in self.command_aliases.iteritems():
405397
for alias in alias_list:
406-
self.plugins['command_dispatcher'].register(alias, command)
398+
self.plugins['command_plugin'].register(alias, command)
407399

408400
def deactivate(self):
409401
super(SimpleCommandPlugin, self).deactivate()
410402
for command in self.commands:
411-
self.plugins['command_dispatcher'].unregister(command)
403+
self.plugins['command_plugin'].unregister(command)

config/config.json.default

Lines changed: 24 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,55 +12,43 @@
1212
"owner": "^#F7434C;",
1313
"registered": "^#A0F743;"
1414
},
15+
"initial_plugins": [
16+
"admin_messenger",
17+
"afk_plugin",
18+
"announcer_plugin",
19+
"bookmarks_plugin",
20+
"brutus_whisper",
21+
"chat_logger",
22+
"claims",
23+
"emotes",
24+
"loginwho_plugin",
25+
"mod_chatter",
26+
"motd_plugin",
27+
"new_player_greeter_plugin",
28+
"planet_protect",
29+
"planet_visitor_announcer_plugin",
30+
"players_plugin",
31+
"plugin_manager_plugin",
32+
"poi_plugin",
33+
"udp_forwarder",
34+
"uptime_plugin"
35+
],
1536
"command_prefix": "/",
16-
"core_plugin_path": "core_plugins",
1737
"log_level": "DEBUG",
38+
"debug_file": "debug.log",
1839
"owner_uuid": "!!--REPLACE THIS--!!",
1940
"passthrough": false,
2041
"player_db": "config/player.db",
2142
"plugin_config": {
22-
"Base Plugin": {
23-
"auto_activate": true
24-
},
25-
"admin_messenger": {
26-
"auto_activate": true
27-
},
2843
"afk_plugin": {
2944
"afk_msg": "^gray;is now AFK.",
30-
"afkreturn_msg": "^gray;has returned.",
31-
"auto_activate": true
32-
},
33-
"announcer_plugin": {
34-
"auto_activate": true
35-
},
36-
"bookmarks_plugin": {
37-
"auto_activate": true
38-
},
39-
"brutus_whisper": {
40-
"auto_activate": true
41-
},
42-
"chat_logger": {
43-
"auto_activate": true
45+
"afkreturn_msg": "^gray;has returned."
4446
},
4547
"claims": {
46-
"auto_activate": true,
4748
"max_claims": 5,
4849
"unclaimable_planets": []
4950
},
50-
"colored_names_plugin": {
51-
"auto_activate": true
52-
},
53-
"command_dispatcher": {
54-
"auto_activate": true
55-
},
56-
"emotes_plugin": {
57-
"auto_activate": true
58-
},
59-
"fuelgiver_plugin": {
60-
"auto_activate": false
61-
},
6251
"irc": {
63-
"auto_activate": false,
6452
"bot_nickname": "StarryPyBot",
6553
"channel": "##test",
6654
"color": "^#e39313;",
@@ -69,21 +57,10 @@
6957
"port": 6667,
7058
"server": "irc.freenode.net"
7159
},
72-
"loginwho_plugin": {
73-
"auto_activate": true
74-
},
75-
"mod_chatter": {
76-
"auto_activate": true
77-
},
7860
"motd_plugin": {
79-
"auto_activate": true,
8061
"motd": "Welcome to the server! Play nice."
8162
},
82-
"mute_manager": {
83-
"auto_activate": true
84-
},
8563
"new_player_greeter_plugin": {
86-
"auto_activate": false,
8764
"items": [
8865
[
8966
"coalore",
@@ -93,7 +70,6 @@
9370
"message": "Welcome to the server!"
9471
},
9572
"planet_protect": {
96-
"auto_activate": true,
9773
"bad_packets": [
9874
"COLLECT_LIQUID",
9975
"CONNECT_WIRE",
@@ -184,31 +160,14 @@
184160
"protected_planets": [
185161
]
186162
},
187-
"planet_visitor_announcer_plugin": {
188-
"auto_activate": true
189-
},
190-
"player_manager": {
163+
"player_manager_plugin": {
191164
"admin_ss": "tester",
192-
"auto_activate": true,
193165
"name_removal_regexes": [
194166
"\\^\\w+;|\\^#\\w+;|\\W",
195167
"\\s\\s+"
196168
]
197169
},
198-
"players_plugin": {
199-
"auto_activate": true
200-
},
201-
"plugin_manager": {
202-
"auto_activate": true
203-
},
204-
"poi_plugin": {
205-
"auto_activate": true
206-
},
207-
"starbound_config_manager": {
208-
"auto_activate": true
209-
},
210170
"starteritems_plugin": {
211-
"auto_activate": false,
212171
"message": "Enjoy these gifts from us!",
213172
"items": [
214173
[
@@ -217,17 +176,7 @@
217176
]
218177
]
219178
},
220-
"uptime_plugin": {
221-
"auto_activate": true
222-
},
223-
"user_management_commands": {
224-
"auto_activate": true
225-
},
226-
"warpy_plugin": {
227-
"auto_activate": true
228-
},
229179
"web_gui": {
230-
"auto_activate": true,
231180
"cookie_token": "",
232181
"log_path": "webgui.log",
233182
"log_path_access": "webgui_access.log",

0 commit comments

Comments
 (0)