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

Commit b95f444

Browse files
committed
Added more re-raises, formatted files.
1 parent 53d0e0a commit b95f444

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

plugins/announcer_plugin/announcer_plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ def after_connect_response(self, data):
1717
self.protocol.player.colored_name(self.config.colors) + " joined.", 0, "", "Announcer")
1818
except AttributeError:
1919
self.logger.exception("Attribute error in after_connect_response.", exc_info=True)
20+
raise
2021
except:
2122
self.logger.exception("Unknown error in after_connect_response.", exc_info=True)
23+
raise
2224

2325
def on_client_disconnect(self, data):
2426
self.protocol.factory.broadcast(self.protocol.player.colored_name(self.config.colors) + " left.", 0,
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from base_plugin import BasePlugin
22
from core_plugins.player_manager import UserLevels
33

4+
45
class BouncerPlugin(BasePlugin):
56
"""
67
Prohibits players with a UserLevel < REGISTRED from destructive actions.
@@ -10,16 +11,17 @@ class BouncerPlugin(BasePlugin):
1011

1112
def activate(self):
1213
super(BouncerPlugin, self).activate()
13-
bad_packets = [
14-
"CONNECT_WIRE",
15-
"DISCONNECT_ALL_WIRES",
16-
"OPEN_CONTAINER",
17-
"CLOSE_CONTAINER",
18-
"SWAP_IN_CONTAINER",
19-
"DAMAGE_TILE",
20-
"DAMAGE_TILE_GROUP",
21-
"REQUEST_DROP",
22-
"ENTITY_INTERACT"
23-
]
24-
for n in ["on_"+n.lower() for n in bad_packets]:
25-
setattr(self, n, (lambda x: False if self.protocol.player.access_level < UserLevels.REGISTERED else True))
14+
bad_packets = [
15+
"CONNECT_WIRE",
16+
"DISCONNECT_ALL_WIRES",
17+
"OPEN_CONTAINER",
18+
"CLOSE_CONTAINER",
19+
"SWAP_IN_CONTAINER",
20+
"DAMAGE_TILE",
21+
"DAMAGE_TILE_GROUP",
22+
"REQUEST_DROP",
23+
"ENTITY_INTERACT"
24+
]
25+
for n in ["on_" + n.lower() for n in bad_packets]:
26+
setattr(self, n,
27+
(lambda x: False if self.protocol.player.access_level < UserLevels.REGISTERED else True))

0 commit comments

Comments
 (0)