@@ -164,7 +164,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
164164 private $ inAction = false ;
165165
166166
167-
168167 private $ needACK = [];
169168
170169 /**
@@ -287,8 +286,8 @@ public function showPlayer(Player $player){
287286 }
288287 unset($ this ->hiddenPlayers [$ player ->getName ()]);
289288 if ($ player ->isOnline ()){
290- $ player ->spawnTo ($ this );
291- }
289+ $ player ->spawnTo ($ this );
290+ }
292291 }
293292
294293 /**
@@ -520,6 +519,7 @@ public function getSpawn(){
520519 return $ this ->spawnPosition ;
521520 }else {
522521 $ level = $ this ->server ->getDefaultLevel ();
522+
523523 return $ level ->getSafeSpawn ();
524524 }
525525 }
@@ -1368,7 +1368,7 @@ public function handleDataPacket(DataPacket $packet){
13681368 $ item = $ this ->inventory ->getItem ($ packet ->slot );
13691369 $ slot = $ packet ->slot ;
13701370 }
1371-
1371+
13721372 if ($ packet ->slot === -1 ){ //Air
13731373 if (($ this ->gamemode & 0x01 ) === Player::CREATIVE ){
13741374 $ found = false ;
@@ -1379,7 +1379,7 @@ public function handleDataPacket(DataPacket $packet){
13791379 break ;
13801380 }
13811381 }
1382-
1382+
13831383 if (!$ found ){ //couldn't find a empty slot (error)
13841384 $ this ->inventory ->sendContents ($ this );
13851385 break ;
@@ -1498,27 +1498,27 @@ public function handleDataPacket(DataPacket $packet){
14981498 switch ($ packet ->action ){
14991499 case 5 : //Shot arrow
15001500 //if($this->entity->inAction === true){
1501- if ($ this ->inventory ->getItemInHand ()->getID () === Item::BOW ){
1502- $ f = 1 * 2 * 1.5 ;
1503- $ nbt = new Compound ("" , [
1504- "Pos " => new Enum ("Pos " , [
1505- new Double ("" , $ this ->x ),
1506- new Double ("" , $ this ->y + 1.62 ),
1507- new Double ("" , $ this ->z )
1508- ]),
1509- "Motion " => new Enum ("Motion " , [
1510- new Double ("" , -sin ($ this ->yaw / 180 * M_PI ) * cos ($ this ->pitch / 180 * M_PI ) * $ f ),
1511- new Double ("" , -sin ($ this ->pitch / 180 * M_PI ) * $ f ),
1512- new Double ("" , cos ($ this ->yaw / 180 * M_PI ) * cos ($ this ->pitch / 180 * M_PI ) * $ f )
1513- ]),
1514- "Rotation " => new Enum ("Rotation " , [
1515- new Float ("" , $ this ->yaw ),
1516- new Float ("" , $ this ->pitch )
1517- ]),
1518- ]);
1519- $ arrow = new Arrow ($ this ->chunk , $ nbt );
1520- $ arrow ->spawnToAll ();
1521- }
1501+ if ($ this ->inventory ->getItemInHand ()->getID () === Item::BOW ){
1502+ $ f = 1 * 2 * 1.5 ;
1503+ $ nbt = new Compound ("" , [
1504+ "Pos " => new Enum ("Pos " , [
1505+ new Double ("" , $ this ->x ),
1506+ new Double ("" , $ this ->y + 1.62 ),
1507+ new Double ("" , $ this ->z )
1508+ ]),
1509+ "Motion " => new Enum ("Motion " , [
1510+ new Double ("" , -sin ($ this ->yaw / 180 * M_PI ) * cos ($ this ->pitch / 180 * M_PI ) * $ f ),
1511+ new Double ("" , -sin ($ this ->pitch / 180 * M_PI ) * $ f ),
1512+ new Double ("" , cos ($ this ->yaw / 180 * M_PI ) * cos ($ this ->pitch / 180 * M_PI ) * $ f )
1513+ ]),
1514+ "Rotation " => new Enum ("Rotation " , [
1515+ new Float ("" , $ this ->yaw ),
1516+ new Float ("" , $ this ->pitch )
1517+ ]),
1518+ ]);
1519+ $ arrow = new Arrow ($ this ->chunk , $ nbt );
1520+ $ arrow ->spawnToAll ();
1521+ }
15221522 //}
15231523 $ this ->startAction = false ;
15241524 //$this->entity->inAction = false;
@@ -1711,7 +1711,7 @@ public function handleDataPacket(DataPacket $packet){
17111711
17121712 if ($ item ->isTool () and ($ this ->gamemode & 0x01 ) === 0 ){
17131713 if ($ item ->useOn ($ target ) and $ item ->getDamage () >= $ item ->getMaxDurability ()){
1714- $ this ->inventory ->setItemInHand (Item::get (Item::AIR , 0 , 1 ));
1714+ $ this ->inventory ->setItemInHand (Item::get (Item::AIR , 0 , 1 ));
17151715 }
17161716 }
17171717 }
@@ -1893,12 +1893,11 @@ public function handleDataPacket(DataPacket $packet){
18931893 }
18941894 if (($ this ->gamemode & 0x01 ) === Player::CREATIVE ){
18951895 if ($ this ->getCreativeBlock ($ packet ->item ) !== -1 ){
1896- $ this ->inventory ->setItem ($ packet ->slot ,$ packet ->item );
1897- $ this ->inventory ->setHotbarSlotIndex ($ packet ->slot ,$ packet ->slot ); //links $hotbar[$packet->slot] to $slots[$packet->slot]
1896+ $ this ->inventory ->setItem ($ packet ->slot , $ packet ->item );
1897+ $ this ->inventory ->setHotbarSlotIndex ($ packet ->slot , $ packet ->slot ); //links $hotbar[$packet->slot] to $slots[$packet->slot]
18981898 }
1899- }
1900- else {
1901- $ this ->inventory ->setHeldItemSlot ($ packet ->slot );
1899+ }else {
1900+ $ this ->inventory ->setHeldItemSlot ($ packet ->slot );
19021901 }
19031902 $ transaction = new BaseTransaction ($ this ->inventory , $ packet ->slot , $ this ->inventory ->getItem ($ packet ->slot ), $ packet ->item );
19041903 }elseif (isset ($ this ->windowIndex [$ packet ->windowid ])){
@@ -2054,7 +2053,7 @@ public function handleDataPacket(DataPacket $packet){
20542053 public function kick ($ reason = "" ){
20552054 $ this ->server ->getPluginManager ()->callEvent ($ ev = new PlayerKickEvent ($ this , $ reason , TextFormat::YELLOW . $ this ->username . " has left the game " ));
20562055 if (!$ ev ->isCancelled ()){
2057- $ message = "Kicked by admin. " . ($ reason !== "" ? " Reason: " . $ reason : "" );
2056+ $ message = "Kicked by admin. " . ($ reason !== "" ? " Reason: " . $ reason : "" );
20582057 $ this ->sendMessage ($ message );
20592058 $ this ->close ($ ev ->getQuitMessage (), $ message );
20602059
@@ -2183,7 +2182,7 @@ public function kill(){
21832182 $ this ->inventory ->clearAll ();
21842183 }
21852184
2186- $ message = $ this ->getName () ." died " ;
2185+ $ message = $ this ->getName () . " died " ;
21872186 $ cause = $ this ->getLastDamageCause ();
21882187 $ ev = null ;
21892188 if ($ cause instanceof EntityDamageEvent){
@@ -2196,29 +2195,29 @@ public function kill(){
21962195 if ($ ev instanceof EntityDamageByEntityEvent){
21972196 $ e = $ ev ->getDamager ();
21982197 if ($ e instanceof Player){
2199- $ message = $ this ->getName () ." was killed by " . $ e ->getName ();
2198+ $ message = $ this ->getName () . " was killed by " . $ e ->getName ();
22002199 break ;
22012200 }elseif ($ e instanceof Living){
2202- $ message = $ this ->getName () ." was slain by " . $ e ->getName ();
2201+ $ message = $ this ->getName () . " was slain by " . $ e ->getName ();
22032202 break ;
22042203 }
22052204 }
2206- $ message = $ this ->getName () ." was killed " ;
2205+ $ message = $ this ->getName () . " was killed " ;
22072206 break ;
22082207 case EntityDamageEvent::CAUSE_SUICIDE :
22092208
22102209 break ;
22112210 case EntityDamageEvent::CAUSE_VOID :
2212- $ message = $ this ->getName () ." fell out of the world " ;
2211+ $ message = $ this ->getName () . " fell out of the world " ;
22132212 break ;
22142213 case EntityDamageEvent::CAUSE_FALL :
22152214 if ($ ev instanceof EntityDamageEvent){
22162215 if ($ ev ->getFinalDamage () > 2 ){
2217- $ message = $ this ->getName () ." fell from a high place " ;
2216+ $ message = $ this ->getName () . " fell from a high place " ;
22182217 break ;
22192218 }
22202219 }
2221- $ message = $ this ->getName () ." hit the ground too hard " ;
2220+ $ message = $ this ->getName () . " hit the ground too hard " ;
22222221 break ;
22232222
22242223 case EntityDamageEvent::CAUSE_CONTACT :
0 commit comments