Merge branch 'minor-next' into major-next

This commit is contained in:
Dylan K. Taylor 2023-03-16 15:04:27 +00:00
commit cf0e7b4213
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 40 additions and 7 deletions

View File

@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
with:
repository: pmmp/update.pmmp.io
repository: ${{ github.repository_owner }}/update.pmmp.io
ssh-key: ${{ secrets.UPDATE_PMMP_IO_DEPLOY_KEY }}
- name: Get actual tag name
@ -41,9 +41,42 @@ jobs:
- name: Update channel info
run: |
cp new_build_info.json "channels/${{ steps.channel.outputs.CHANNEL }}.json"
cp new_build_info.json "channels/${{ steps.channel.outputs.MAJOR }}.json"
cp new_build_info.json "channels/${{ steps.channel.outputs.MINOR }}.json"
function version_id() {
major=$(echo $1 | cut -d. -f1)
minor=$(echo $1 | cut -d. -f2)
patch=$(echo $1 | cut -d. -f3)
echo $(((major * 1000000) + (minor * 1000) + patch))
}
function update_channel() {
local target_file_name="$1"
local new_file_name="$2"
local old_version_id
local new_version_id
if [ ! -f "$target_file_name" ]; then
echo "Creating channel file: $target_file_name"
cp "$new_file_name" "$target_file_name"
else
old_version_id=$(version_id "$(jq -r '.base_version' "$target_file_name")")
new_version_id=$(version_id "$(jq -r '.base_version' "$new_file_name")")
echo "Old version ID: $old_version_id"
echo "New version ID: $new_version_id"
if [ $new_version_id -ge $old_version_id ]; then #suffixed versions will have the same version ID - assume they'll always be newer
echo "Updating channel file: $target_file_name ($old_version_id -> $new_version_id)"
cp "$new_file_name" "$target_file_name"
else
echo "Version $new_version_id is less than $old_version_id, not updating channel file: $target_file_name"
fi
fi
}
update_channel "channels/${{ steps.channel.outputs.CHANNEL }}.json" "new_build_info.json"
update_channel "channels/${{ steps.channel.outputs.MAJOR }}.json" "new_build_info.json"
update_channel "channels/${{ steps.channel.outputs.MINOR }}.json" "new_build_info.json"
rm new_build_info.json
- name: Commit changes

View File

@ -31,7 +31,7 @@ use pocketmine\network\mcpe\NetworkSession;
* Called before a packet is decoded and handled by the network session.
* Cancelling this event will drop the packet without decoding it, minimizing wasted CPU time.
*/
class DataPacketPreReceiveEvent extends ServerEvent implements Cancellable{
class DataPacketDecodeEvent extends ServerEvent implements Cancellable{
use CancellableTrait;
public function __construct(

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe;
use pocketmine\entity\effect\EffectInstance;
use pocketmine\event\player\PlayerDuplicateLoginEvent;
use pocketmine\event\server\DataPacketPreReceiveEvent;
use pocketmine\event\server\DataPacketDecodeEvent;
use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\event\server\DataPacketSendEvent;
use pocketmine\form\Form;
@ -414,7 +414,7 @@ class NetworkSession{
$timings->startTiming();
try{
$ev = new DataPacketPreReceiveEvent($this, $packet->pid(), $buffer);
$ev = new DataPacketDecodeEvent($this, $packet->pid(), $buffer);
$ev->call();
if($ev->isCancelled()){
return;