I'm getting this error and cant seem to figure it out Spoiler: Error Notice: Indirect modification of overloaded property pocketmine\utils\Config::$YaBoiJunk1 has no effect in C:\Users\Conner\Documents\PocketMine-MP\plugins\Factions-pp-master\src\HittmanA\factionspp\MainClass.php on line 111 Code: PHP: <?phpnamespace HittmanA\factionspp;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\utils\TextFormat;use pocketmine\utils\Config;class MainClass extends PluginBase implements Listener { /** @var Config */ protected $fac; //Faction name tag coming soon >:D //$player->setDisplayName("My Rank" . $player->getName()); public function onEnable() { @mkdir($this->getDataFolder()); $this->facs = new Config($this->getDataFolder() . "factions.json", Config::JSON, []); $this->playerInfo = new Config($this->getDataFolder() . "players.json", Config::JSON, []); $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getPluginManager()->registerEvents(new Events($this), $this); $this->getLogger()->info(TextFormat::YELLOW . "Loaded!"); } public function onDisable() { $this->getLogger()->info(TextFormat::YELLOW . "Unloading!"); } public function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $dispName = $player->getName(); $fac = $this->playerInfo->$dispName->faction; if(isset($fac)) { $prefix = "[$fac]"; $player->setDisplayName($prefix . " " . $player->getName()); $player->setNameTag($prefix . " " . $player->getName()); } } ##$this->facs->$facWhosPowerYouWantToChange["power"] == 10;##$this->facs->save(true); ##$power = $this->facs->$facName[“power”];##$power += 10 //amount to add. Can also be a var##$power -= 10 public function onCommand(CommandSender $sender, Command $command, $label, array $args) { $displayName = $sender->getName(); $subcmd = strtolower(array_shift($args)); switch ($command->getName()){ case "factionspp": case "fpp": case "f": if($sender instanceof Player) { if($subcmd === "create") { if(isset($args[0])) { $facName = array_shift($args); if(isset($this->playerInfo->$displayName["faction"])) { $sender->sendMessage(TextFormat::RED . "You are already in a faction!"); }else if(isset($this->facs->$facName)){ $sender->sendMessage(TextFormat::RED . "A faction with this name already exists!"); }elseif(!isset($this->playerInfo->$displayName["faction"])) { if(!isset($this->facs->$facName)){ $this->facs->set($facName, [ "name" => strtolower($facName), "display" => $facName, "leader" => $displayName, "officers" => [], "members" => [], "power" => 5 ]); $this->playerInfo->set($displayName,[ "name" => $displayName, "faction" => $facName, "role" => "Leader" ]); $this->facs->save(true); $this->playerInfo->save(true); $prefix = "[".$facName."]"; $sender->setDisplayName($prefix . " " . $displayName); $sender->setNameTag($prefix . " " . $displayName); $sender->sendMessage(TextFormat::GREEN . "Faction created!"); } } else { $sender->sendMessage(TextFormat::GOLD . "Usage: /factionspp create <name>"); } } } elseif ($subcmd === "info") { if(isset($this->playerInfo->$displayName)) { $playerFPPProfile = $this->playerInfo->$displayName; $playerFac = $playerFPPProfile["faction"]; $playerFacInfo = $this->facs->$playerFac; $sender->sendMessage(TextFormat::GOLD . "Faction: " . $playerFac); $sender->sendMessage(TextFormat::GREEN . "Your Role: " . $playerFPPProfile["role"]); }else{ $sender->sendMessage(TextFormat::RED . "You must be part of a faction to run this command!"); } }elseif ($subcmd === "leave" || $subcmd === "quit") { if(isset($this->playerInfo->$displayName)) { $displayName = $sender->getName(); $playerFPPProfile = $this->playerInfo->$displayName; $playerFac = $playerFPPProfile["faction"]; $playerFacInfo = $this->facs->$playerFac; if(empty($playerFacInfo["officers"]) || empty($playerFacInfo["members"])) { $this->playerInfo->$displayName["faction"] = " "; $this->playerInfo->$displayName["role"] = " "; $this->facs->remove($playerFac); $sender->sendMessage(TextFormat::GREEN . "You have left the faction!"); }else{ if($playerFPPProfile["role"]) { $this->facs->$playerFac[$playerFPPProfile["rank"] . "s"]->remove($displayName); $this->facs->$playerFac["faction"] = " "; $this->facs->$playerFac["role"] = " "; $sender->sendMessage(TextFormat::GREEN . "You have left the faction!"); }else{ $sender->sendMessage(TextFormat::RED . "You must make another player leader first!"); } } }else{ $sender->sendMessage(TextFormat::RED . "You must be part of a faction to run this command!"); } } } else { $sender->sendMessage(TextFormat::RED . "Please run this command in-game"); } } $this->facs->save(true); $this->playerInfo->save(true);}}
The third & fourth line of onJoin must be... PHP: $fac = $this->playerInfo;If (isset($fac->dispName) && isset($fac->dispName->fac)) {
PHP: $this->playerInfo->$displayName["faction"] = " ";$this->playerInfo->$displayName["role"] = " "; wtf is that? why on earth do you try to access static variables with -> while there are no static variables? And why do you even think the config object should have any var named $displayName
displayname is the senders name, i defined that on the 2nd line of the command function. I know its in there because when u do /f create (whatever) it adds it. Yes i am doing that first
That is not possible. You cannot access static properties like that. Learn to code, don't code to learn.