Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: falkirks/Specter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5
Choose a base ref
...
head repository: falkirks/Specter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Feb 26, 2018

  1. Update .poggit.yml

    falkirks authored Feb 26, 2018
    Copy the full SHA
    7f20082 View commit details
  2. Add icon

    falkirks authored Feb 26, 2018
    Copy the full SHA
    fb3721a View commit details

Commits on Mar 18, 2018

  1. Copy the full SHA
    82c822d View commit details
  2. Merge pull request #72 from SOF3/update

    Update for latest API, fixed some wrong indents
    falkirks authored Mar 18, 2018
    Copy the full SHA
    5e1cfcd View commit details

Commits on Mar 22, 2018

  1. Copy the full SHA
    fe13544 View commit details
  2. Merge pull request #74 from SOF3/recv-event-2

    Fixed #73: Explicitly call DataPacketReceiveEvent
    falkirks authored Mar 22, 2018
    Copy the full SHA
    471cd3f View commit details

Commits on Jul 12, 2018

  1. Copy the full SHA
    f3272d5 View commit details

Commits on Dec 24, 2018

  1. Update for MC:PE 1.8 protocol [Thanks to @dktapps]

    im too lazy to clone the repo onto my laptop and use git, so... ¯\_(ツ)_/¯
    CortexPE authored Dec 24, 2018
    Copy the full SHA
    7f0a983 View commit details

Commits on Mar 23, 2019

  1. Merge pull request #78 from CortexPE/patch-2

    Update for MC:PE 1.8 protocol [Thanks to @dktapps]
    falkirks authored Mar 23, 2019
    Copy the full SHA
    72e1046 View commit details

Commits on Apr 7, 2019

  1. chat patch

    KielKing authored Apr 7, 2019
    Copy the full SHA
    32fddd7 View commit details
  2. Merge pull request #80 from KielKing/master

    chat patch
    falkirks authored Apr 7, 2019
    Copy the full SHA
    3f67949 View commit details

Commits on Dec 22, 2019

  1. Update to Minecraft 1.14

    inxomnyaa committed Dec 22, 2019
    Copy the full SHA
    842de38 View commit details

Commits on Dec 24, 2019

  1. Merge pull request #83 from thebigsmileXD/master

    Update to Minecraft 1.14
    falkirks authored Dec 24, 2019
    Copy the full SHA
    80f7f05 View commit details

Commits on Dec 27, 2019

  1. Copy the full SHA
    568e636 View commit details
  2. Fix error when spawning whitelisted/banned Specter

    Also for fun randomized skin color
    inxomnyaa committed Dec 27, 2019
    Copy the full SHA
    43ee523 View commit details
  3. Copy the full SHA
    b39d20d View commit details

Commits on Dec 28, 2019

  1. Fix respawn

    inxomnyaa committed Dec 28, 2019
    Copy the full SHA
    10c118e View commit details
  2. Copy the full SHA
    ae6ff5c View commit details
  3. Merge pull request #86 from falkirks/upgrades

    Several bugfixes
    inxomnyaa authored Dec 28, 2019
    1
    Copy the full SHA
    3c8f511 View commit details
  4. Fix auto respawn

    inxomnyaa committed Dec 28, 2019
    Copy the full SHA
    2e1f0b7 View commit details
  5. Copy the full SHA
    39eebc6 View commit details

Commits on Apr 4, 2020

  1. Add fields to clientData that are commonly used by plugins to prevent…

    … crashes
    
    See a comment in #85
    Before release the "DeviceOS" field must be validated. Can not trust sources like Steadfast.
    Putting -1 as they defined in their Player class would crash the plugin PlayerInfo. (that thing should validate client input anyways duh..)
    inxomnyaa committed Apr 4, 2020
    1
    Copy the full SHA
    3671777 View commit details

Commits on Apr 19, 2020

  1. Update SpecterInterface.php

    cuisse authored Apr 19, 2020
    Copy the full SHA
    ffef145 View commit details

Commits on Apr 26, 2020

  1. Add support for 1.14.6 - Merge pull request #88 from RomnSD/patch-1

    Update SpecterInterface.php
    inxomnyaa authored Apr 26, 2020
    Copy the full SHA
    49b30a6 View commit details
  2. Copy the full SHA
    5534518 View commit details

Commits on Jul 4, 2020

  1. 1.16.0 support

    Chitpixel committed Jul 4, 2020
    Copy the full SHA
    80ef0fb View commit details

Commits on Jul 5, 2020

  1. Copy the full SHA
    8bd6dde View commit details

Commits on Jul 8, 2020

  1. Added 1.16.0 support - Merge pull request #93 from Chitpixel/master

    Added 1.16.0 support
    Supports PM3.14
    Supports Protocol Version 407
    inxomnyaa authored Jul 8, 2020
    Copy the full SHA
    9bdbd69 View commit details

Commits on Sep 11, 2020

  1. Update plugin.yml

    IceCruelStuff authored Sep 11, 2020
    Copy the full SHA
    f51c779 View commit details
  2. Merge pull request #95 from IceCruelStuff/patch-1

    Add protocol 408
    inxomnyaa authored Sep 11, 2020
    Copy the full SHA
    42d6336 View commit details

Commits on Dec 6, 2020

  1. 1.16.100 support

    IceCruelStuff authored Dec 6, 2020
    Copy the full SHA
    ca2b2dd View commit details
  2. Merge pull request #97 from IceCruelStuff/patch-1

    1.16.100 support
    inxomnyaa authored Dec 6, 2020
    Copy the full SHA
    424bbb8 View commit details

Commits on Dec 20, 2020

  1. Fix #99 (update to .200)

    inxomnyaa authored Dec 20, 2020
    Copy the full SHA
    34585e7 View commit details

Commits on Dec 28, 2020

  1. 1
    Copy the full SHA
    742c4e3 View commit details

Commits on Dec 29, 2020

  1. Merge pull request #100 from luca28pet/master

    Fix ErrorException: "Array and string offset access syntax with curly braces is deprecated" (EXCEPTION) in "plugins/Specter.phar/src/specter/network/SpecterInterface" at line 146
    inxomnyaa authored Dec 29, 2020
    Copy the full SHA
    5d39bb2 View commit details

Commits on Mar 13, 2021

  1. support protocol 428

    brokiem committed Mar 13, 2021
    Copy the full SHA
    e874c23 View commit details
  2. fix unreachable statements

    brokiem committed Mar 13, 2021
    Copy the full SHA
    89da119 View commit details

Commits on Mar 14, 2021

  1. Copy the full SHA
    ee00ef7 View commit details

Commits on Mar 15, 2021

  1. this should be done

    brokiem committed Mar 15, 2021
    Copy the full SHA
    15a4a7b View commit details
  2. Copy the full SHA
    de8ba7a View commit details
  3. Merge pull request #101 from brokiem/master

    support protocol 428
    inxomnyaa authored Mar 15, 2021
    Copy the full SHA
    7903e92 View commit details
Showing with 229 additions and 175 deletions.
  1. +1 −0 .poggit.yml
  2. +3 −2 plugin.yml
  3. BIN resources/specter.jpg
  4. +104 −109 src/specter/Specter.php
  5. +1 −1 src/specter/api/DummyPlayer.php
  6. +117 −60 src/specter/network/SpecterInterface.php
  7. +3 −3 src/specter/network/SpecterPlayer.php
1 change: 1 addition & 0 deletions .poggit.yml
Original file line number Diff line number Diff line change
@@ -4,4 +4,5 @@ branches:
projects:
Specter:
path: ""
icon: "resources/specter.jpg"
...
5 changes: 3 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Specter
version: 0.5
version: "0.9"
author: Falkirks
main: specter\Specter
api: [3.0.0-ALPHA9, 3.0.0-ALPHA10, 3.0.0-ALPHA11, 3.0.0-ALPHA12]
api: ["3.14","3.15","3.16","3.17","3.18"]
mcpe-protocol: [407, 408, 419, 422, 428]
softdepend: ["iControlU"]
commands:
specter:
Binary file added resources/specter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
213 changes: 104 additions & 109 deletions src/specter/Specter.php
Original file line number Diff line number Diff line change
@@ -1,206 +1,198 @@
<?php

namespace specter;

use icontrolu\iControlU;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\event\Listener;
use pocketmine\event\player\cheat\PlayerIllegalMoveEvent;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\InteractPacket;
use pocketmine\network\mcpe\protocol\AnimatePacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
use pocketmine\network\mcpe\protocol\TextPacket;
use pocketmine\Player;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\TextFormat;
use specter\network\SpecterInterface;
use specter\network\SpecterPlayer;

class Specter extends PluginBase implements Listener {
class Specter extends PluginBase implements Listener
{
/** @var SpecterInterface */
private $interface;
public function onEnable(){

public function onEnable()
{
$this->saveDefaultConfig();
$this->interface = new SpecterInterface($this);
$this->interface = new SpecterInterface($this);
$this->getServer()->getNetwork()->registerInterface($this->interface);
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
/**
* @param CommandSender $sender
* @param Command $command
* @param string $label
* @param string[] $args
*
* @return bool
*/
public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool {
if(isset($args[0])){
switch($args[0]){

/**
* @param CommandSender $sender
* @param Command $command
* @param string $label
* @param string[] $args
*
* @return bool
*/
public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool
{
if (isset($args[0])) {
switch ($args[0]) {
case 'spawn':
case 'new':
case 'add':
case 's':
if(isset($args[1])) {
if ($this->getInterface()->openSession($args[1], isset($args[2]) ? $args[2] : "SPECTER", isset($args[3]) ? $args[3] : 19133)){
if (isset($args[1])) {
if ($this->getInterface()->openSession($args[1], $args[2] ?? "SPECTER", $args[3] ?? 19133)) {
$sender->sendMessage("Session started.");
}
else{
} else {
$sender->sendMessage("Failed to open session");
}
return true;
}
else{
return false;
}
break;
return false;
case 'kick':
case 'quit':
case 'close':
case 'q':
if(isset($args[1])) {
if (isset($args[1])) {
$player = $this->getServer()->getPlayer($args[1]);
if($player instanceof SpecterPlayer){
if ($player instanceof SpecterPlayer) {
$player->close("", "client disconnect.");
}
else{
} else {
$sender->sendMessage("That player isn't managed by specter.");
}
}
else{
} else {
$sender->sendMessage("Usage: /specter quit <p>");
}
return true;
break;
case 'move':
case 'm':
case 'teleport':
case 'tp':
if(isset($args[4])) {
if (isset($args[4])) {
$player = $this->getServer()->getPlayer($args[1]);
if($player instanceof SpecterPlayer){
if ($player instanceof SpecterPlayer) {
$pk = new MovePlayerPacket();
$pk->position = new Vector3($args[2],$args[3] + $player->getEyeHeight(),$args[4]);
$pk->yaw = $player->getYaw()+10; //This forces movement even if the movement is not large enough
$pk->position = new Vector3($args[2], $args[3] + $player->getEyeHeight(), $args[4]);
$pk->yaw = $player->getYaw() + 10; //This forces movement even if the movement is not large enough
$pk->pitch = 0;
$this->interface->queueReply($pk, $player->getName());
}
else{
} else {
$sender->sendMessage("That player isn't managed by specter.");
}
}
else{
} else {
$sender->sendMessage("Usage: /specter move <p> <x> <y> <z>");
}
return true;
break;
case 'attack':
case 'a':
if(isset($args[2])){
if (isset($args[2])) {
$player = $this->getServer()->getPlayer($args[1]);
if($player instanceof SpecterPlayer){
if(substr($args[2], 0, 4) === "eid:"){
if ($player instanceof SpecterPlayer) {
if (substr($args[2], 0, 4) === "eid:") {
$victimId = substr($args[2], 4);
if(!is_numeric($victimId)){
if (!is_numeric($victimId)) {
$sender->sendMessage("Usage: /specter attack <attacker> <victim>|<eid:<victim eid>>");
return true;
}
if(!($player->getLevel()->getEntity($victimId) instanceof Entity)){
if (!($victim = $player->getLevel()->getEntity($victimId) instanceof Entity)) {
$sender->sendMessage("There is no entity with entity ID $victimId in {$player->getName()}'s level");
return true;
}
}else{
} else {
$victim = $this->getServer()->getPlayer($args[2]);
if($victim instanceof Player){
if ($victim instanceof Player) {
$victimId = $victim->getId();
}
else{
} else {
$sender->sendMessage("Player $args[2] not found");
return true;
}
}
$pk = new InteractPacket();
$pk->action = InteractPacket::ACTION_RIGHT_CLICK; // unused
$pk->target = $victimId;
$damage = (float)(max(0.0, $args[3] ?? 0.0));
$ev = new EntityDamageByEntityEvent($player, $victim, EntityDamageByEntityEvent::CAUSE_ENTITY_ATTACK, $damage, [], 0.0);
$victim->attack($ev);
$pk = new AnimatePacket();
$pk->entityRuntimeId = $player->getId();
$pk->action = AnimatePacket::ACTION_SWING_ARM;
$this->getInterface()->queueReply($pk, $player->getName());
}
else{
$this->getLogger()->info(TextFormat::LIGHT_PURPLE . "{$player->getName()} attacking {$victim->getName()}(eid:{$victimId}) with {$damage} damage");
} else {
$sender->sendMessage("That player isn't managed by specter.");
}
}
else{
$sender->sendMessage("Usage: /specter attack <attacker> [eid:]<victim>");
} else {
$sender->sendMessage("Usage: /specter attack <attacker> [eid:]<victim> [damage]");
}
return true;
break;
case 'c':
case 'chat':
case 'command':
if(isset($args[2])) {
if (isset($args[2])) {
$player = $this->getServer()->getPlayer($args[1]);
if($player instanceof SpecterPlayer){
if ($player instanceof SpecterPlayer) {
$pk = new TextPacket();
$pk->type = TextPacket::TYPE_CHAT;
$pk->source = "";
$pk->type = TextPacket::TYPE_CHAT;
$pk->sourceName = "";
$pk->message = implode(" ", array_slice($args, 2));
$this->getInterface()->queueReply($pk, $player->getName());
}
else{
} else {
$sender->sendMessage("That player isn't managed by specter.");
}
}
else{
} else {
$sender->sendMessage("Usage: /specter chat <p> <data>");
}
return true;
break;
case 'control': //TODO update iControlU with better support
case 'icu':
if($sender instanceof Player) {
if ($sender instanceof Player) {
$icu = $this->getICU();
if($icu instanceof iControlU) {
if ($icu instanceof iControlU) {
$player = $this->getServer()->getPlayer($args[1]);
if ($player instanceof SpecterPlayer) {
if($icu->isControl($sender)) {
if ($icu->isControl($sender)) {
$this->getServer()->dispatchCommand($sender, "icu control " . $args[1]);
}
else{
} else {
$this->getServer()->dispatchCommand($sender, "icu stop ");
}
}
else{
} else {
$sender->sendMessage("That player isn't a specter player");
}
}
else{
} else {
$sender->sendMessage("You need to have iControlU to use this feature.");
}
}
else{
} else {
$sender->sendMessage("This command must be run in game.");
}
return true;
break;
case "respawn":
case "r":
if(!isset($args[1])){
if (!isset($args[1])) {
$sender->sendMessage("Usage: /specter respawn <player>");
return true;
}
$player = $this->getServer()->getPlayer($args[1]);
if($player instanceof SpecterPlayer){
if(!$player->spec_needRespawn){
if ($player instanceof SpecterPlayer) {
if (!$player->spec_needRespawn) {
$this->interface->queueReply(new RespawnPacket(), $player->getName());
}
else{
$respawnPK = new PlayerActionPacket();
$respawnPK->action = PlayerActionPacket::ACTION_RESPAWN;
$respawnPK->entityRuntimeId = $player->getId();
$this->interface->queueReply($respawnPK, $player->getName());
} else {
$sender->sendMessage("{$player->getName()} doesn't need respawning.");
}
}
else{
} else {
$sender->sendMessage("That player isn't a specter player");
}
return true;
break;
}
}
return false;
@@ -210,44 +202,47 @@ public function onCommand(CommandSender $sender, Command $command, string $label
* @priority HIGHEST
* @param PlayerIllegalMoveEvent $event
*/
public function onIllegalMove(PlayerIllegalMoveEvent $event){
if($event->getPlayer() instanceof SpecterPlayer && $this->getConfig()->get('allowIllegalMoves')){
public function onIllegalMove(PlayerIllegalMoveEvent $event)
{
if ($event->getPlayer() instanceof SpecterPlayer && $this->getConfig()->get('allowIllegalMoves')) {
$event->setCancelled();
}
}
/*
/**
* @priority MONITOR
* @param DataPacketReceiveEvent $pk
*
public function onDataPacketRecieve(DataPacketReceiveEvent $pk){
if($pk->getPacket() instanceof RequestChunkRadiusPacket){
$this->getLogger()->info("RADIUS:" . $pk->getPacket()->radius);
/*
/**
* @priority MONITOR
* @param DataPacketReceiveEvent $pk
*
public function onDataPacketRecieve(DataPacketReceiveEvent $pk){
if($pk->getPacket() instanceof RequestChunkRadiusPacket){
$this->getLogger()->info("RADIUS:" . $pk->getPacket()->radius);
}
$this->getLogger()->info("GOT:" . get_class($pk->getPacket()));
}
$this->getLogger()->info("GOT:" . get_class($pk->getPacket()));
}
/**
* @priority MONITOR
* @param DataPacketSendEvent $pk
*
public function onDataPacketSend(DataPacketSendEvent $pk){
if(!($pk->getPacket() instanceof SetTimePacket)) {
$this->getLogger()->info("SEND:" . get_class($pk->getPacket()));
/**
* @priority MONITOR
* @param DataPacketSendEvent $pk
*
public function onDataPacketSend(DataPacketSendEvent $pk){
if(!($pk->getPacket() instanceof SetTimePacket)) {
$this->getLogger()->info("SEND:" . get_class($pk->getPacket()));
}
}
}
*/
*/
/**
* @return SpecterInterface
*/
public function getInterface(){
public function getInterface()
{
return $this->interface;
}

/**
* @return null|\icontrolu\iControlU
*/
public function getICU(){
public function getICU()
{
return $this->getServer()->getPluginManager()->getPlugin("iControlU");
}
}
2 changes: 1 addition & 1 deletion src/specter/api/DummyPlayer.php
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ public function close(){
*/
protected function getSpecter(){
$plugin = $this->server->getPluginManager()->getPlugin("Specter");
if($plugin !== null && $plugin->isEnabled()){
if ($plugin instanceof Specter && $plugin->isEnabled()) {
return $plugin;
}
else{
Loading