Hi, this is my first plugin. I just wanna post the code here, can someone tell me if there is any errors before I release it? PHP: <?phpnamespace AlwaysSpawn;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerRespawnEvent;class Loader extends Plugin implements Listener{ public function onLoad(){ $this->getLogger()->info("Plugin Loading"); } public function onEnable(){ $this->getLogger()->info("Enabled Plugin"); } public function onDisable(){ $this->getLogger()->info("Plugin Disabled"); } public function onPlayerRespawn(PlayerRespawnEvent $event){ $player = $event->getPlayer(); $x = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getX(); $y = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getY(); $z = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getZ(); $player->setLevel($level); } }
You don't registred events and you don't want to check safespawn x,y,z getSafeSpawn() already return position
AlwaysSpawn isn't mine (or yours), I just help maintain it for Poggit because the author is inactive, and dktapps already updated it recently to fix problems some people were having: https://poggit.pmmp.io/p/AlwaysSpawn
You can fork and edit anyone's repo as much as you like, that's one of the great things about git and github... but please don't start claiming plugins are yours because you changed a few lines; it doesn't work like that and you'll make enemies fast. Much better is to make useful changes (for example, add an option to AlwaysSpawn to teleport players somewhere in PlayerRespawnEvent, in addition to the current PlayerLoginEvent) and submit a pull request if you think it adds or fixes something in the original. Even better, start writing a plugin of your own with your very own plugin name, and get other people to contribute to yours in the same way.
Where is the Code: $this->getServer()->getPluginManager()->registerEvents($this, $this); under the function onEnable seen as you have used the class listener.
No no I think u got me wrong.. I am learning to make a plug8n I need for my server because when player die they don’t respawn properly nick helped me make it, ask him it’s authentic except they idea was from awzaws remake of a dead plugin
I'm sorry if I confused you but awzaws plugin teleports player to spawn in world. I am making one which tpass played to default world. And I am sorry for naming plugin alwaysspawn I just didn't have any better names.
Awzaw’s does teleport to the default world spawn... it’s just broken so technically you are plagiarizing.
Again, not mine! The version I've been maintaining for poggit has always worked perfectly for me as regards teleporting players to the default spawn when they join on my production servers and locally, although I did notice some issues recently on my local dev server, so I suspect there was a conflict with another plugin. This should all have been fixed in the latest poggit release which dktapps streamlined. As for where you spawn when you die, that is normally the default spawn of the world where you die, so this could be a useful PR if you work from the current master branch of the poggit - orphanage repo and add a config, listeners etc.