Removed possible crash on RakLibInterface

This commit is contained in:
Shoghi Cervantes 2015-04-22 15:45:04 +02:00
parent 0aebcb9f81
commit 2ea8835b12
2 changed files with 4 additions and 6 deletions

View File

@ -175,9 +175,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
} }
public function notifyACK($identifier, $identifierACK){ public function notifyACK($identifier, $identifierACK){
if(isset($this->players[$identifier])){
$this->players[$identifier]->handleACK($identifierACK);
}
} }
public function setName($name){ public function setName($name){

View File

@ -25,7 +25,7 @@ namespace pocketmine\utils;
* Class used to handle Minecraft chat format, and convert it to other formats like ANSI or HTML * Class used to handle Minecraft chat format, and convert it to other formats like ANSI or HTML
*/ */
abstract class TextFormat{ abstract class TextFormat{
const ESCAPE = "§"; const ESCAPE = "\xc2\xa7"; //§
const BLACK = TextFormat::ESCAPE . "0"; const BLACK = TextFormat::ESCAPE . "0";
const DARK_BLUE = TextFormat::ESCAPE . "1"; const DARK_BLUE = TextFormat::ESCAPE . "1";
@ -59,7 +59,7 @@ abstract class TextFormat{
* @return array * @return array
*/ */
public static function tokenize($string){ public static function tokenize($string){
return preg_split("/(§[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); return preg_split("/(". TextFormat::ESCAPE ."[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
} }
/** /**
@ -72,7 +72,7 @@ abstract class TextFormat{
*/ */
public static function clean($string, $removeFormat = true){ public static function clean($string, $removeFormat = true){
if($removeFormat){ if($removeFormat){
return str_replace("§", "", preg_replace(["[0123456789abcdefklmnor]/", "/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/"], "", $string)); return str_replace(TextFormat::ESCAPE, "", preg_replace(["/". TextFormat::ESCAPE ."[0123456789abcdefklmnor]/", "/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/"], "", $string));
} }
return str_replace("\x1b", "", preg_replace("/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/", "", $string)); return str_replace("\x1b", "", preg_replace("/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/", "", $string));
} }