Skip to content

Commit

Permalink
Allow goto even on non-polar worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
emortaldev committed Dec 19, 2024
1 parent 5534423 commit c81cdbb
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/main/java/live/minehub/polarpaper/commands/GotoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,23 @@ protected static int run(CommandContext<CommandSourceStack> ctx) {
return Command.SINGLE_SUCCESS;
}

Location spawnPos;

PolarWorld polarWorld = PolarWorld.fromWorld(bukkitWorld);
if (polarWorld == null) {
sender.sendMessage(
Component.text()
.append(Component.text("World '", NamedTextColor.RED))
.append(Component.text(worldName, NamedTextColor.RED))
.append(Component.text("' is not a polar world!", NamedTextColor.RED))
);
return Command.SINGLE_SUCCESS;
if (polarWorld != null) {
Config config = Config.readFromConfig(PolarPaper.getPlugin().getConfig(), bukkitWorld.getName());
spawnPos = config.getSpawnPos();
} else {
spawnPos = bukkitWorld.getSpawnLocation();
}

Config config = Config.readFromConfig(PolarPaper.getPlugin().getConfig(), bukkitWorld.getName());

sender.sendMessage(
Component.text()
.append(Component.text("Teleporting to '", NamedTextColor.AQUA))
.append(Component.text(bukkitWorld.getName(), NamedTextColor.AQUA))
.append(Component.text("'...", NamedTextColor.AQUA))
);

Location spawnPos = config.getSpawnPos();
spawnPos.setWorld(bukkitWorld);
player.teleportAsync(spawnPos);

Expand Down

0 comments on commit c81cdbb

Please sign in to comment.