Skip to content

Commit b6025e3

Browse files
committed
Removed selectors on Player->sendMessage()
1 parent 35de331 commit b6025e3

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/pocketmine/Player.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,29 +2220,11 @@ public function kick($reason = ""){
22202220
public function sendMessage($message){
22212221
$mes = explode("\n", $message);
22222222
foreach($mes as $m){
2223-
if(preg_match_all('#@([@A-Za-z_]{1,})#', $m, $matches, PREG_OFFSET_CAPTURE) > 0){
2224-
$offsetshift = 0;
2225-
foreach($matches[1] as $selector){
2226-
if($selector[0]{0} === "@"){ //Escape!
2227-
$m = substr_replace($m, $selector[0], $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1);
2228-
--$offsetshift;
2229-
continue;
2230-
}
2231-
switch(strtolower($selector[0])){
2232-
case "player":
2233-
case "username":
2234-
$m = substr_replace($m, $this->username, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1);
2235-
$offsetshift += strlen($selector[0]) - strlen($this->username) + 1;
2236-
break;
2237-
}
2238-
}
2239-
}
2240-
22412223
if($m !== ""){
22422224
$pk = new MessagePacket;
22432225
$pk->source = ""; //Do not use this ;)
22442226
$pk->message = $this->removeFormat === false ? $m : TextFormat::clean($m);
2245-
$this->directDataPacket($pk);
2227+
$this->dataPacket($pk);
22462228
}
22472229
}
22482230
}

0 commit comments

Comments
 (0)