Skip to content

Commit

Permalink
fix: use current location rather than previous location when respawning
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 committed Jun 6, 2023
1 parent ec0efcb commit 94be286
Showing 1 changed file with 1 addition and 5 deletions.
Expand Up @@ -123,18 +123,14 @@ public void onRespawn(PlayerRespawnEvent e) {
// How many times do we need to go over this?
if (e.getPlayer().hasMetadata("NPC")) return;

// Get the player in question being managed
final var atPlayer = ATPlayer.getPlayer(e.getPlayer());

// If the spawn feature is disabled, stop there
if (!MainConfig.get().USE_SPAWN.get()) return;

// Get the configuration section for death management
ConfigSection deathManagement = MainConfig.get().DEATH_MANAGEMENT.get();

// Get the previous location of the world, or the default option
String spawnCommand = deathManagement.getString(atPlayer.getPreviousLocation() == null ?
"default" : atPlayer.getPreviousLocation().getWorld().getName());
String spawnCommand = deathManagement.getString(e.getPlayer().getWorld().getName());

// If one of those don't work, try the default option again
if (spawnCommand == null || spawnCommand.equals("default")) {
Expand Down

0 comments on commit 94be286

Please sign in to comment.