DaPigGuy / PiggyFactions

A modern open source factions plugin for PocketMine-MP
https://rtdx.aericio.net/en/latest/plugins/piggyfactions/
Apache License 2.0
52 stars 30 forks source link

Not working f home on first home creation #123

Closed dadodasyra closed 1 year ago

dadodasyra commented 2 years ago

Please make sure your pull request complies with these guidelines:

What does the PR change?

The homeWorld variable is checked when the player does /f home to teleport to his faction home. The thing is that it's always null until the server reboots. So if the faction is new and the home is new the player cannot teleport to it. I don't really understand why homeWorld exists but maybe it's usefull so here is a fix. There's no real issue opened to it.

Testing Environment

N/A

Extra Information

N/A

dadodasyra commented 2 years ago

In fact Position::$world can be null, the easiest way is to detect if Position::$world is null and it should fix #72. Btw you should check world after checking if the home exists.

I didn't tried it in game but I dont see why this should not work, I will today if I can.