Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build 12 [1.0b12] #540

Merged
merged 3 commits into from
Mar 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Wrapper.py
Binary file not shown.
23 changes: 23 additions & 0 deletions build/CHANGELOG.DEV.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
Build 12 [1.0b12]
Started as a refactor, but I discovered that Entity controls were not functioning properly.
(and discovered that the mineraft entity controls actually are not as robust as ours).
- Refactored all packet constants to a standard format:
CONSTANT = [PACKET, [PARSING]], where PACKET = 0xNN packet number and parsing
is a list of constants like [VARINT, BOOL, STRING]. Some packets already
followed this convention, but most simply defined packets like `PACKET_NAME = 0xNN`
- Correct errors with new mcserver.py `_console_event` function not sending commands anywhere
except for the wrapper interface.
- Corrected Entities config items listing old names (i.e. - 'Sheep' was changed to 'sheep' in 11.1)
- Added internal wrapper event 'server.autoCompletes' to process (future) autocompletions.
- Added optimization to make non-abortable events spur off in their own thread to prevent
delays to wrapper (and in proxy mode, proxy packet) processing.
- Removed "player.runCommand" event from public API. It is now private event. Also
changed the behaviour to not be "abortable".. I.e. any command _will_ abort and get
processed directly by _either_ wrapper or the server.
- All registered commands run on their own thread, so wrapper plugin commands
do not pause proxy!
- All non-abortable events run as a deamon thread, allowing wrapper to continue
running while any event runs on a separate thread.
- Made improvements to whitelist commands `online` and `offline`.


Build 11 [1.0b11]
- scrub out old packet.send methods that will be deprecated.
- clean up keep-alives a little.
Expand Down
2 changes: 1 addition & 1 deletion build/Wrapper.py.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b4c48d6b9f98c70f49e062d8d9273f3e
354911aaf7e35029c9af199b268b5174
6 changes: 6 additions & 0 deletions build/build_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ def format_to_rst(data):
when the event occurs. The call back function must reference the correct
return payload.

When a plugin calls an event which can be aborted, it is important that
your code not delay in completing. The proxy packet processing is on
hold while your code decides what to do with the event. If you take too
long, the client could be disconnected! This is an aggregate time of
all the plugins that call this event.

:sample Plugin snippet:

.. code:: python
Expand Down
2 changes: 1 addition & 1 deletion build/buildinfo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Do not edit this file to bump versions; it is built automatically

__version__ = [1, 0, 0, 'beta', 11]
__version__ = [1, 0, 0, 'beta', 12]
__branch__ = 'dev'
4 changes: 2 additions & 2 deletions build/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
0,
0,
"beta",
11
12
],
"build": 229,
"release_time": 1519755280.663678,
"release_time": 1520195736.894644,
"repotype": "dev"
}
2 changes: 1 addition & 1 deletion docs/Wrapper.py.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b4c48d6b9f98c70f49e062d8d9273f3e
354911aaf7e35029c9af199b268b5174
2 changes: 1 addition & 1 deletion documentation/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@



- callEvent(self, event, payload)
- callEvent(self, event, payload, abortable=False)

Invokes the specific event. Payload is extra information
relating to the event. Errors may occur if you don't specify
Expand Down
117 changes: 69 additions & 48 deletions documentation/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
when the event occurs. The call back function must reference the correct
return payload.

When a plugin calls an event which can be aborted, it is important that
your code not delay in completing. The proxy packet processing is on
hold while your code decides what to do with the event. If you take too
long, the client could be disconnected! This is an aggregate time of
all the plugins that call this event.

:sample Plugin snippet:

.. code:: python
Expand Down Expand Up @@ -36,7 +42,8 @@
When player logs into the java MC server.

:Payload:
:"playername": player name
:"player": player object (if object available -could be False if not)
:"playername": user name of player (string)

:Can be aborted/modified: No

Expand All @@ -49,13 +56,19 @@

:Module: mcserver.py *(core/mcserver.py)*

:Description: player.logout
:Description:
When player logs out of the java MC server.

:Payload:
:"player": self.getplayer(players_name)
:"player": player object (if object available -could be False if not)
:"playername": user name of player (string)

:Can be aborted/modified:
:Can be aborted/modified: No - but This will pause long enough for you to deal with the playerobject.

:Comments:
All events in the core/mcserver.py group are collected
from the console output, do not require proxy mode, and
therefore, also, cannot be aborted.

:Event: "server.stopped"

Expand All @@ -64,7 +77,8 @@
:Description: server.stopped

:Payload:
:"reason": reason
:"reason": reason}
abortable=False

:Can be aborted/modified:

Expand All @@ -76,7 +90,8 @@
:Description: server.starting

:Payload:
:"reason": reason
:"reason": reason}
abortable=False

:Can be aborted/modified:

Expand All @@ -88,7 +103,8 @@
:Description: server.started

:Payload:
:"reason": reason
:"reason": reason}
abortable=False

:Can be aborted/modified:

Expand All @@ -100,7 +116,8 @@
:Description: server.stopping

:Payload:
:"reason": reason
:"reason": reason}
abortable=False

:Can be aborted/modified:

Expand All @@ -113,7 +130,8 @@

:Payload:
:"state": state
:"reason": reason
:"reason": reason}
abortable=False

:Can be aborted/modified:

Expand All @@ -130,7 +148,7 @@
:"message": <str> type - what the player said in chat. ('hello everyone')
:"original": The original line of text from the console ('<mcplayer> hello everyone`)

:Can be aborted/modified:
:Can be aborted/modified: No

:Comments:
This event is triggered by console chat which has already been sent.
Expand All @@ -146,7 +164,8 @@

:Payload:
:"player": self.getplayer(name)
:"action": message
:"action": message}
abortable=False

:Can be aborted/modified:

Expand All @@ -159,7 +178,8 @@

:Payload:
:"player": name
:"achievement": achievement
:"achievement": achievement}
abortable=False

:Can be aborted/modified:

Expand All @@ -173,7 +193,8 @@
:Payload:
:"player": name
:"message": message
:"original": original
:"original": original}
abortable=False

:Can be aborted/modified:

Expand All @@ -187,7 +208,8 @@
:Payload:
:"player": self.getplayer(name)
:"death": getargsafter(line_words
1)
1)}
abortable=False

:Can be aborted/modified:

Expand All @@ -199,7 +221,8 @@
:Description: server.lagged

:Payload:
:"ticks": get_int(skipping_ticks)
:"ticks": get_int(skipping_ticks)}
abortable=False

:Can be aborted/modified:

Expand All @@ -219,6 +242,21 @@
:Comments:
driven from console message "Teleported ___ to ....".

**< Group 'api/base.py' >**

:Event: "event"

:Module: base.py *(api/base.py)*

:Description: event

:Payload:
payload
abortable

:Can be aborted/modified:


**< Group 'wrapper' >**

:Event: "timer.second"
Expand All @@ -228,7 +266,9 @@
:Description:
a timer that is called each second.

:Payload: None
:Payload:
None
abortable=False

:Can be aborted/modified: No

Expand All @@ -241,7 +281,9 @@
a timer that is called each 1/20th
of a second, like a minecraft tick.

:Payload: None
:Payload:
None
abortable=False

:Can be aborted/modified: No

Expand All @@ -259,7 +301,8 @@

:Payload:
:"nick": nick
:"channel": channel
:"channel": channel}
abortable=False

:Can be aborted/modified:

Expand All @@ -272,7 +315,8 @@

:Payload:
:"nick": nick
:"channel": channel
:"channel": channel}
abortable=False

:Can be aborted/modified:

Expand All @@ -286,7 +330,8 @@
:Payload:
:"nick": nick
:"message": message
:"channel": None
:"channel": None}
abortable=False

:Can be aborted/modified:

Expand All @@ -301,7 +346,8 @@
:"nick": nick
:"channel": channel
:"action": getargsafter(message.split(" ")
1)[:-1]
1)[:-1]}
abortable=False

:Can be aborted/modified:

Expand All @@ -315,7 +361,8 @@
:Payload:
:"nick": nick
:"channel": channel
:"message": message
:"message": message}
abortable=False

:Can be aborted/modified:

Expand Down Expand Up @@ -364,32 +411,6 @@
passing to server. 'chatmsg' accepts both raw string
or a dictionary payload containing ["message"] item.

:Event: "player.runCommand"

:Module: parse_sb.py *(client/parse_sb.py)*

:Description:
When a player runs a command. Do not use
for registering commands.

:Payload:
:"player": playerobject()
:"command": slash command (or whatever is set in wrapper's
config as the command cursor).
:"args": the remaining words/args

:Can be aborted/modified: Yes. Registered commands ARE already aborted since they do not get passed to the server.

:Comments:
Called AFTER player.rawMessage event (if rawMessage
does not reject it). However, rawMessage could have
modified it before this point.

The best use of this event is a quick way to prevent a client from
passing certain commands or command arguments to the server.
rawMessage is better if you need something else (parsing or
filtering chat, for example).

:Event: "player.dig"

:Module: parse_sb.py *(client/parse_sb.py)*
Expand Down
6 changes: 6 additions & 0 deletions documentation/helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ using 'self.api.helpers'



- config_write_from_dict(filename, filepath, dictionary)

Use a keyed dictionary and write a disk file with '='
lines (like server.properties).


- scrub_item_value(item)

Takes a text item value and determines if it should be a boolean,
Expand Down
18 changes: 18 additions & 0 deletions documentation/minecraft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@
fully booted or not.


- changeServerProps(self, config_item, new_value, reload_server=False)

*New feature starting in version 1.0*

Edits the server.properties file

:Args:
:item: item, like "online-mode"

:new_value: applicable value

:reload_server: True to restart the server.

Items are changed in the config, but a server restart is required to
make the changes persist.



- configWrapper(self, section, config_item, new_value, reload_file=False)

*New feature starting in version 0.8.12*
Expand Down
Loading