Skip to content

Commit b995d27

Browse files
author
minecraft server
committed
Merge branch 'master' into dev
2 parents 83bcd82 + 2620f9c commit b995d27

File tree

4 files changed

+66
-12
lines changed

4 files changed

+66
-12
lines changed

README

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MCProxy is a python application that aims to:
2+
Proxy minecraft packet connections between clients and servers
3+
Packet inspection on that link
4+
Implement features/restrictions on the minecraft game by modifying the packet stream
5+
6+
The main proxy (in the top level directory) is the guts and provides a framework for making plugins.
7+
Plugins are in the plugins directory and are loaded in order. This order is set in the plugins.py file.
8+
9+
All packets recieved are filtered through each plugin in order. Each plugin may replace it, modify it or just drop it completely.
10+
See the plugin spec for details.
11+
12+
Within the plugins directory there are several core plugins that provide a framework for player interaction and other useful tasks.

packet_decoder.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,10 @@
44
import sys
55

66
#TODO: Review which of these we actually need
7-
NODE_SERVER = 0x01
87
SERVER_TO_CLIENT = 0x01
9-
FROM_SERVER = 0x01
10-
TO_CLIENT = 0x01
11-
12-
NODE_CLIENT = 0x02
138
CLIENT_TO_SERVER = 0x02
14-
FROM_CLIENT = 0x02
15-
TO_SERVER = 0x02
16-
17-
EVENT_CLIENT_CONNECT = 0x00
18-
EVENT_CLIENT_DISCONNECT = 0x01
19-
EVENT_SERVER_DISCONNECT = 0x02
209

21-
PROTOCOL_VERSION = 23
10+
PROTOCOL_VERSION = 28
2211

2312
class Packet:
2413
def __init__(self):

plugin-spec.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Plugin files are python modules.
2+
3+
Plugins SHOULD contain the following global variables:
4+
AUTHOR: String containing name or handle of plugin author, or list of the same.
5+
CONTACT: String containing contact details (preferably an email address) for author, or list of the same.
6+
DESCRIPTION: String containing description of plugin.
7+
8+
Plugins MAY contain the following defined functions:
9+
on_start():
10+
Run on plugin initialisation. If an exception is raised here, plugin is disabled and a warning is given.
11+
on_tick(users):
12+
Run approximately every server tick (200ms). Users is a list of all currently connected User objects.
13+
Important note: This call occurs on a signal and may interrupt any other execution at any point.
14+
Any code using this function should prepare accordingly.
15+
on_packet(packet, user, to_server):
16+
This function is called for every packet passing through the proxy.
17+
packet is a Packet and contains packet data.
18+
user is a User and contains session data.
19+
to_server is a bool and is True for client->server packets, False for server->client.
20+
This function may return:
21+
a Packet
22+
a list of Packet
23+
and each packet in the list will be passed along to the next plugin in the chain.
24+
Note that returning [] has the effect of dropping the packet.
25+
Note also that it is common to simply modify the given Packet before returning it.
26+
27+
If a plugin wishes to log to the main logger, it MAY use the root logger available through the logging module.
28+
However, in general, the plugin SHOULD use its own logging path.
29+
30+
Plugins MAY import any of the items contained in the top level directory.
31+
As an exception, plugins MAY NOT import proxy.py
32+
Plugins SHOULD make use of the functions given in helpers.py

useful-plugins.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The following plugins are designed for use by other plugins.
2+
You may depend on their presence - please use them.
3+
4+
usernames
5+
Doesn't need to be imported directly.
6+
This module ensures that the user's name is available under user.username
7+
8+
timed_events
9+
Still in testing/development. Used for scheduling functions to occur at a later time.
10+
11+
player_cmd
12+
Register functions to be called when players type a given message. Runs on regex :D.
13+
14+
menus
15+
Menu interface system for any situation where you want players to read pages of text,
16+
interactively pick an option, etc.
17+
Highly flexible but somewhat overly so - see menu_test for good example usage.
18+
19+
plugin_helpers
20+
Still in development. This is the place for any helper functions that don't need a seperate plugin
21+
but require other plugins to operate (and so cannot go in helpers.py to prevent cyclic dependencies).

0 commit comments

Comments
 (0)