hi i have a plugin(a training plugin) but its not reading and problem is in the end of main.php when i put ?> at end it say : (( syntax error, unexpected '?>', expecting function (T_FUNCTION) or const (T_CONST)" (EXCEPTION) in "plugins/Cure_v 1.0 (by doxestic)/src/doxestic/main" at line 83 )) and when i put nothink it say syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST)" (EXCEPTION) in "plugins/Cure_v 1.0 (by amirTBM)/src/amirTBM/main" at line 83 and when i put } for class main extends pluginbase{ it can't find class main =|
Check if all semicolons are there and all brackets match up. You should not use ?> anywhere, unless you inline php inside of html when making a website
Code: <?php namespace doxestic\main; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\event\Cancellable; use pocketmine\event\player\PlayerCommandPreprocessEvent; use pocketmine\level\particle\DestroyBlockParticle as BloodParticle; use pocketmine\level\particle\FlameParticle as WeaponShootParticle; use pocketmine\level\sound\AnvilFallSound as DropBombSound; use pocketmine\level\sound\BlazeShootSound as WeaponShootSound; use pocketmine\level\sound\DoorCrashSound as ExplodeSound; use pocketmine\level\Explosion; use pocketmine\level\Position; use pocketmine\event\Listener; use pocketmine\Player; use pocketmine\block\Air; use pocketmine\block\Block; use pocketmine\item\Item; use pocketmine\item\Snowball as Bullet; use pocketmine\entity\Entity; use pocketmine\entity\Snowball; use pocketmine\entity\Egg; use pocketmine\entity\PrimedTNT; use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\DoubleTag; use pocketmine\nbt\tag\StringTag; use pocketmine\event\CommandExecutor; use pocketmine\nbt\tag\ListTag; use pocketmine\nbt\tag\FloatTag; use pocketmine\event\player\PlayerMoveEvent as PlayerWalkEvent; use pocketmine\event\player\PlayerInteractEvent as PlayerUseWeaponEvent; use pocketmine\event\player\cheat\PlayerCheatEvent; use pocketmine\event\player\PlayerItemHeldEvent; use pocketmine\event\player\PlayerDeathEvent; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityDamageByEntityEvent; use pocketmine\event\entity\EntityDamageByChildEntityEvent; use pocketmine\event\entity\ExplosionPrimeEvent; use pocketmine\plugin\PluginBase; use pocketmine\Server; use pocketmine\math\Vector3; use pocketmine\inventory\Inventory; use pocketmine\utils\TextFormat; use pocketmine\utils\Config; use pocketmine\utils\TextFormat as TF; use pocketmine\utils\TextFormat as C; use pocketmine\event\player\PlayerJoinEvent; use pocketmine\event\player\PlayerLoginEvent; use pocketmine\event\block\BlockBreakEvent; use pocketmine\event\player\PlayerMoveEvent; use pocketmine\network\mcpe\protocol\LoginPacket; use pocketmine\event\server\DataPacketReceiveEvent; use onebone\economyapi\EconomyAPI; use pocketmine\entity\Effect; use pocketmine\entity\EffectInstance; use pocketmine\inventory\playerinventory; use pocketmine\event\player\PlayerItemConsumeEvent; class main extends pluginbase{ public function onenable() { $this->getlogger()->info("§a plugin enabled"); } public function on_hit() { $this->player = $player; $this->$player->getname(); if ($player->PlayerItemConsumeEvent($player, apple)) { $this->$player->setAutoJump(500); return true; } } } its code and eror is not reading main how can i fix it?
That code is very wrong and I suggest you learn at least the basics of php before writing a PocketMine plugin. As for the syntax error, that doesn't appear in your code, however I found a lot of other mistakes. Your namespace makes no sense, unless your plugin is called main That's a lot of unused use statements PluginBase should be written in CamelCase onEnable, too Your on_hit function will never get executed Why are you setting $player as a class property getName should also be written in camelCase $player->PlayerItemConsumeEvent($player, apple) is complete nonsense why return true? https://www.php.net/manual/en/language.basic-syntax.phptags.php