More events

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-09 18:05:12 +01:00
parent cd3aaa1b50
commit b9b0039cd7
3 changed files with 82 additions and 43 deletions

View File

@ -1,111 +1,142 @@
#!/bin/bash
echo "[INFO] PocketMine-MP PHP compiler for Linux - by @shoghicp v0.2"
if [ "$(whoami)" != 'root' ]; then
echo "[ERROR] You must be root to run this script"
exit 1;
fi
echo "[PocketMine] PHP installer and compiler for Linux - by @shoghicp v0.3"
#if [ "$(whoami)" != 'root' ]; then
#echo "[ERROR] You must be root to run this script"
#exit 1;
#fi
DIR=`pwd`
date > $DIR/install.log
uname -a >> $DIR/install.log
echo "[INFO] Checking dependecies"
type make >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; exit 1; }
type autoconf >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"autoconf\""; exit 1; }
type automake >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"automake\""; exit 1; }
type gcc >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"gcc\""; exit 1; }
type m4 >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"m4\""; exit 1; }
mkdir -m 0777 install_data >> $DIR/install.log 2>&1
mkdir -m 0777 php5 >> $DIR/install.log 2>&1
cd install_data
apt-get -f -y install >> $DIR/install.log 2>&1
apt-get -y install \
build-essential \
autoconf >> $DIR/install.log 2>&1
#apt-get -f -y install >> $DIR/install.log 2>&1
#apt-get -y install \
build-essentials \
automake \
autoconf \
make \
gcc >> $DIR/install.log 2>&1
#PHP 5
echo -n "[PHP5] downloading..."
wget http://php.net/get/php-5.4.10.tar.gz/from/this/mirror -O php-5.4.10.tar.gz >> $DIR/install.log 2>&1
echo -n " extracting..."
tar -zxvf php-5.4.10.tar.gz >> $DIR/install.log 2>&1
rm -f php-5.4.10.tar.gz >> $DIR/install.log 2>&1
mv php-5.4.10 php
echo " done!"
#zlib
echo -n "[zlib] Downloading..."
wget http://zlib.net/zlib-1.2.7.tar.gz -q -O zlib-1.2.7.tar.gz
echo -n "[zlib] downloading..."
wget http://zlib.net/zlib-1.2.7.tar.gz -O zlib-1.2.7.tar.gz >> $DIR/install.log 2>&1
echo -n " extracting..."
tar -zxvf zlib-1.2.7.tar.gz >> $DIR/install.log 2>&1
rm -f zlib-1.2.7.tar.gz >> $DIR/install.log 2>&1
mv zlib-1.2.7 zlib
echo -n " compiling..."
cd zlib
./configure >> $DIR/install.log 2>&1
./configure --prefix=$DIR/install_data/php/ext/zlib >> $DIR/install.log 2>&1
make >> $DIR/install.log 2>&1
echo -n " installing..."
make install >> $DIR/install.log 2>&1
echo " done!"
echo -n " cleaning..."
cd ..
rm -r -f ./zlib
echo " done!"
#OpenSSL
echo -n "[OpenSSL] downloading..."
wget ftp://ftp.openssl.org/source/openssl-1.0.1c.tar.gz -q -O openssl-1.0.1c.tar.gz
wget ftp://ftp.openssl.org/source/openssl-1.0.1c.tar.gz -O openssl-1.0.1c.tar.gz >> $DIR/install.log 2>&1
echo -n " extracting..."
tar -zxvf openssl-1.0.1c.tar.gz >> $DIR/install.log 2>&1
rm -f openssl-1.0.1c.tar.gz >> $DIR/install.log 2>&1
mv openssl-1.0.1c openssl
echo -n " compiling..."
cd openssl
./config >> $DIR/install.log 2>&1
./config --prefix=$DIR/install_data/php/ext/openssl >> $DIR/install.log 2>&1
make >> $DIR/install.log 2>&1
echo -n " installing..."
make install >> $DIR/install.log 2>&1
echo " done!"
echo -n " cleaning..."
cd ..
rm -r -f ./openssl
echo " done!"
#GMP
echo -n "[GMP] downloading..."
wget ftp://ftp.gmplib.org/pub/gmp-5.1.0/gmp-5.1.0.tar.bz2 -q -O gmp-5.1.0.tar.bz2
wget ftp://ftp.gmplib.org/pub/gmp-5.1.0/gmp-5.1.0.tar.bz2 -O gmp-5.1.0.tar.bz2 >> $DIR/install.log 2>&1
echo -n " extracting..."
tar -jxvf gmp-5.1.0.tar.bz2 >> $DIR/install.log 2>&1
rm -f gmp-5.1.0.tar.bz2 >> $DIR/install.log 2>&1
mv gmp-5.1.0 gmp
echo -n " compiling..."
cd gmp
./configure >> $DIR/install.log 2>&1
./configure --prefix=$DIR/install_data/php/ext/gmp >> $DIR/install.log 2>&1
make >> $DIR/install.log 2>&1
echo -n " installing..."
make install >> $DIR/install.log 2>&1
echo " done!"
echo -n " cleaning..."
cd ..
rm -r -f ./gmp
echo " done!"
echo -n "[cURL] downloading..."
wget https://github.com/bagder/curl/archive/master.tar.gz -q -O curl-master.tar.gz
wget https://github.com/bagder/curl/archive/master.tar.gz -O curl-master.tar.gz >> $DIR/install.log 2>&1
echo -n " extracting..."
tar -zxvf curl-master.tar.gz >> $DIR/install.log 2>&1
rm -f curl-master.tar.gz >> $DIR/install.log 2>&1
mv curl-master curl
echo -n " compiling..."
cd curl
./buildconf >> $DIR/install.log 2>&1
./configure >> $DIR/install.log 2>&1
./configure --prefix=$DIR/install_data/php/ext/curl >> $DIR/install.log 2>&1
make >> $DIR/install.log 2>&1
echo -n " installing..."
make install >> $DIR/install.log 2>&1
echo " done!"
echo -n " cleaning..."
cd ..
#PHP 5
echo -n "[PHP5] downloading..."
wget http://php.net/get/php-5.4.10.tar.gz/from/this/mirror -q -O php-5.4.10.tar.gz
echo -n " extracting..."
tar -zxvf php-5.4.10.tar.gz >> $DIR/install.log 2>&1
mv php-5.4.10 php
rm -r -f ./curl
echo " done!"
cd php/ext
#pthreads
echo "[PHP pthreads] downloading..."
wget https://github.com/krakjoe/pthreads/archive/master.tar.gz -q -O pthreads-master.tar.gz
wget https://github.com/krakjoe/pthreads/archive/master.tar.gz -O pthreads-master.tar.gz >> $DIR/install.log 2>&1
echo -n " extracting..."
tar -zxvf pthreads-master.tar.gz >> $DIR/install.log 2>&1
mv pthreads-master pthreads
rm -f pthreads-master.tar.gz >> $DIR/install.log 2>&1
mv pthreads-master $DIR/install_data/php/ext/pthreads
echo " done!"
cd ../
echo -n "[PHP5] compiling..."
./buildconf --force
cd php
./buildconf --force >> $DIR/install.log 2>&1
./configure --prefix=$DIR/php5 \
--exec-prefix=$DIR/php5 \
--enable-embedded-mysqli \
--with-openssl \
--with-openssl=$DIR/install_data/php/ext/openssl \
--enable-bcmath \
--with-gmp \
--with-curl \
--with-gmp=$DIR/install_data/php/ext/gmp \
--with-curl=$DIR/install_data/php/ext/curl \
--enable-zip \
--with-zlib \
--with-zlib=$DIR/install_data/php/ext/zlib \
--enable-sockets \
--enable-pthreads \
--enable-maintainer-zts \
--enable-cli
make
make install
--enable-cli >> $DIR/install.log 2>&1
make >> $DIR/install.log 2>&1
make install >> $DIR/install.log 2>&1
echo " done!"
cd $DIR
echo -n "[INFO] Cleaning up..."
rm -r -f install_data/
rmdir install_data/
rm -r -f install_data/ >> $DIR/install.log 2>&1
rmdir install_data/ >> $DIR/install.log 2>&1
echo " done!"
echo "[PocketMine] You should start the server now using \"./start.sh\""

View File

@ -280,6 +280,10 @@ class Player{
if($c !== false){
$c->close("logged in from another location");
}
if($this->server->dhandle("player.join", $this) === false){
$this->close();
return;
}
$this->server->api->player->add($this->CID);
$this->auth = true;
$this->data["lastIP"] = $this->ip;

View File

@ -306,6 +306,7 @@ class PocketMinecraftServer{
foreach($this->entities as $entity){
}
$this->trigger("server.save", $final);
}
}
@ -365,6 +366,9 @@ class PocketMinecraftServer{
if(isset($this->clients[$CID])){
$this->clients[$CID]->handle($packet["pid"], $data);
}else{
if($this->handle("server.noauthpacket", $packet) === false){
return;
}
switch($packet["pid"]){
case 0x02:
if($this->invisible === true){