Skip to content

Commit d2b4365

Browse files
author
minecraft server
committed
Stuff
1 parent 5c33d37 commit d2b4365

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

nbt.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def gzip(s):
3535
sio = StringIO()
3636
gz = GzipFile(fileobj=sio, mode='w')
3737
gz.write(s)
38+
gz.close()
3839
sio.seek(0)
3940
return sio.read()
4041

plugins.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
sys.path.append(PLUGIN_PATH)
44

55
# Import plugins here
6-
import log_all, log_sorted, usernames
6+
import log_all, log_sorted, usernames, no_changes
77

88
# Set ordering here
9-
plugins = [log_all, log_sorted, usernames]
9+
plugins = [log_all, log_sorted, usernames, no_changes]

plugins/no_changes.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def on_start():
88

99
def on_packet(packet, user, to_server):
1010
if hasattr(packet, 'original'):
11-
reencoded = packet_decoder.stateless_pack(packet)
11+
reencoded = packet_decoder.stateless_pack(packet, to_server)
1212
if packet.original != reencoded:
13-
raise Exception("Packet (%s) changed: Reencodes to %s, not %s" % (packet, repr(reencoded), repr(packet.original))
13+
raise Exception("Packet (%s) changed: Reencodes to %s, not %s" % (packet, repr(reencoded), repr(packet.original)))
14+
return packet

proxy.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
send_buffers = {} # Map from fd to a send buffer, if any.
2424
listener = None # the main bound listen socket
2525

26+
plugins = []
2627

2728
def main():
2829

@@ -37,7 +38,9 @@ def main():
3738
logging.init(lambda level, msg: (level != 'debug') and (log_fd.write("[%f]\t%s\t%s\n" % (time.time(), level, msg))))
3839
logging.info("Starting up")
3940

40-
from plugins import plugins # Lazy import prevents circular references
41+
from plugins import plugins as _plugins # Lazy import prevents circular references
42+
global plugins
43+
plugins = _plugins
4144
for plugin in plugins[:]: # Note that x[:] is a copy of x
4245
try:
4346
logging.debug("Loading plugin: %s", plugin)

0 commit comments

Comments
 (0)