Skip to content

Commit

Permalink
Fully working version
Browse files Browse the repository at this point in the history
  • Loading branch information
Falkirks committed Aug 16, 2014
1 parent 6873d55 commit e0f48d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/icontrolu/ControlSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function sendChat(PlayerChatEvent $ev){
}
public function syncInventory(){
if($this->p->getInventory()->getContents() != $this->t->getInventory()->getContents()){
$this->p->getInventory()->setContents($this->t->getInventory()->getContents());
$this->t->getInventory()->setContents($this->p->getInventory()->getContents());
}
}
public function stopControl(){
Expand Down
6 changes: 4 additions & 2 deletions src/icontrolu/iControlU.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use pocketmine\event\player\PlayerChatEvent;
use pocketmine\event\player\PlayerDropItemEvent;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\network\protocol\AnimatePacket;
use pocketmine\Player;
use pocketmine\plugin\PluginBase;

Expand Down Expand Up @@ -55,6 +56,7 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
}
else{
$this->s[$sender->getName()] = new ControlSession($sender, $p);
$this->b[$p->getName()] = true;
$sender->sendMessage("You are now controlling " . $p->getName());
return true;
}
Expand Down Expand Up @@ -129,10 +131,10 @@ public function onQuit(PlayerQuitEvent $event){
}
}
public function onPlayerAnimation(PlayerAnimationEvent $event){
if($this->isBarred($event->getEntity())){
if($this->isBarred($event->getPlayer())){
$event->setCancelled();
}
elseif($this->isControl($event->getEntity())){
elseif($this->isControl($event->getPlayer())){
$event->setCancelled();
$pk = new AnimatePacket;
$pk->eid = $this->s[$event->getPlayer()->getName()]->getTarget()->getID();
Expand Down

0 comments on commit e0f48d8

Please sign in to comment.