0

我一直在研究一个插件,但我一直在控制台上遇到这个问题。

[21:05:42] [Server thread/CRITICAL]: ErrorException: "Undefined property: 

Erik1206\GuardianTunnel\Main::$GTunnelAPI" (EXCEPTION) in "plugins/GuardianTunnel2/src/Erik1206/GuardianTunnel/Main" at line 20
[21:05:42] [Server thread/DEBUG]: #0 plugins/GuardianTunnel2/src/Erik1206/GuardianTunnel/Main(20): pocketmine\utils\Utils::errorExceptionHandler(integer 8, string[61] Undefined property: Erik1206\GuardianTunnel\Main::$GTunnelAPI, string[91] /home/demouser/Desktop/py/mcpe/plugins/GuardianTunnel2/src/Erik1206/GuardianTunn, integer 20, array[0])
[21:05:42] [Server thread/DEBUG]: #1 src/pocketmine/plugin/PluginBase(115): Erik1206\GuardianTunnel\Main->onEnable()
[21:05:42] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(541): pocketmine\plugin\PluginBase->setEnabled(boolean 1)
[21:05:42] [Server thread/DEBUG]: #3 src/pocketmine/Server(1783): pocketmine\plugin\PluginManager->enablePlugin(object Erik1206\GuardianTunnel\Main)
[21:05:42] [Server thread/DEBUG]: #4 src/pocketmine/Server(1769): pocketmine\Server->enablePlugin(object Erik1206\GuardianTunnel\Main)
[21:05:42] [Server thread/DEBUG]: #5 src/pocketmine/Server(1582): pocketmine\Server->enablePlugins(integer 1)
[21:05:42] [Server thread/DEBUG]: #6 src/pocketmine/PocketMine(273): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[31] /home/demouser/Desktop/py/mcpe/, string[39] /home/demouser/Desktop/py/mcpe/plugins/)
[21:05:42] [Server thread/DEBUG]: #7 src/pocketmine/PocketMine(296): pocketmine\server()
[21:05:42] [Server thread/DEBUG]: #8 (11): require(string[86] phar:///home/demouser/Desktop/py/mcpe/PocketMine-MP.phar/src/pocketmine/PocketMi)

我已经尝试了几件事来修复它,但它不起作用。

主.php:

<?php

namespace Erik1206\GuardianTunnel;
use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\plugin\PluginBase;
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\utils\TextFormat;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use Erik1206\GuardianTunnel\GTunnelAPI;
$this->GTunnelAPI = new GTunnelAPI();

class Main extends PluginBase implements Listener{
     public function onEnable(){
          $this->getServer()->getPluginManager()->registerEvents($this,$this);
          $this->getLogger()->info("Plugin Enabled");
          $this->GTunnelAPI::sendCommandViaTunnel("EEE");
     }
     public function onJoin(PlayerJoinEvent $event){
          $player = $event->getPlayer();
          $name = $player->getName();
          $this->getServer()->broadcastMessage(TextFormat::GREEN."$name Joined The test Server! Awesome!");


     }
}

我试过声明 GTUNNEL 但同样的问题。我想请你帮忙。

问候, 埃里克

4

0 回答 0