Skip to content

Commit

Permalink
Release V1.5.1 (little bug fix update)
Browse files Browse the repository at this point in the history
- Fixed a bug on player respawn
  • Loading branch information
supercrafter333 committed Dec 2, 2021
1 parent c683200 commit 490d831
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changlogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,9 @@ End of theSpawn PM3 support
- *[FIX]* - Fixed a bug in `AliasMap.php`
- *[FIX]* - Config comments will no longer removed when theSpawn gets informations from the config
- *[UPDATE]* - Updated some codes to new php8.0 features (the updated codes are looking better now)
- *[VERSION]* - Version bump

### Changelog V1.5.0 » V1.5.1
> This version doesn't contain any major code changes from the previous version. It's only a bug fix update.
- *[FIX]* - Fixed a bug on player respawn
- *[VERSION]* - Version bump
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/ca6cWPpERp)
# theSpawn - V1.5.0 [![](https://poggit.pmmp.io/shield.state/theSpawn)](https://poggit.pmmp.io/p/theSpawn) [![](https://poggit.pmmp.io/shield.dl.total/theSpawn)](https://poggit.pmmp.io/p/theSpawn)
# theSpawn - V1.5.1 [![](https://poggit.pmmp.io/shield.state/theSpawn)](https://poggit.pmmp.io/p/theSpawn) [![](https://poggit.pmmp.io/shield.dl.total/theSpawn)](https://poggit.pmmp.io/p/theSpawn)

**This plugin will replace MSpawns! Help me to make this plugin better!**

Expand Down
2 changes: 1 addition & 1 deletion resources/Languages/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ no-spawn-set-for-world: "§cThere's no spawn set for world {world}!"


#don't change this
version: "1.5.0"
version: "1.5.1"


############################
Expand Down
2 changes: 1 addition & 1 deletion resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ language: "en_BE"


#DON'T CHANGE THIS!!
version: "1.5.0"
version: "1.5.1"

############################
##########theSpawn##########
Expand Down
18 changes: 13 additions & 5 deletions src/supercrafter333/theSpawn/theSpawn.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ class theSpawn extends PluginBase implements Listener
/**
* @var string
*/
public string $version = "1.5.0";
public string $version = "1.5.1";


/**
* On plugin loading. (That's before enabling)
* On plugin loading. (That's before enabling)
*/
public function onLoad(): void
Expand Down Expand Up @@ -391,8 +392,7 @@ public function onPlayerRespawn(PlayerRespawnEvent $event)
{
$s = $event->getPlayer();
$spawn = new Config($this->getDataFolder() . "theSpawns.yml", Config::YAML);
$worldname = $s->getWorld()->getDisplayName();
$world = $this->getServer()->getWorldManager()->getWorldByName($worldname);
$world = $s->getWorld();
if ($world === null) {
if ($this->getHub() instanceof Position) {
$event->setRespawnPosition($this->getHub());
Expand Down Expand Up @@ -555,12 +555,20 @@ public function getHub(int $count = null): ?Position
}

/**
* @param World $world
* @param World|null $world
* @return false|Position
* @return false|Position
*/
public function getSpawn(World $world)
public function getSpawn(?World $world): Position|false
{
if (!$world instanceof World) {
$hub = $this->getHub();
if (!$hub instanceof Position) {
return $this->getServer()->getWorldManager()->getDefaultWorld()->getSafeSpawn();
}
return $hub;
}

$spawn = new Config($this->getDataFolder() . "theSpawns.yml", Config::YAML);
$spawn->get($world->getDisplayName());
if ($spawn->exists($world->getDisplayName())) {
Expand Down

0 comments on commit 490d831

Please sign in to comment.