Skip to content

Commit

Permalink
Make use of the new Outpost event's chosen spawn point.
Browse files Browse the repository at this point in the history
  • Loading branch information
LlmDl committed May 1, 2024
1 parent 8f87a81 commit 4e394df
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import com.palmergames.bukkit.towny.object.comparators.ComparatorType;
import com.palmergames.bukkit.towny.object.economy.Account;
import com.palmergames.bukkit.towny.object.Nation;
import com.palmergames.bukkit.towny.object.Position;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.SpawnType;
import com.palmergames.bukkit.towny.object.Town;
Expand Down Expand Up @@ -2279,10 +2278,10 @@ public static void townSetOutpost(CommandSender sender, Town town) throws TownyE
if (!townBlock.getTownOrNull().equals(town))
throw new TownyException(Translatable.of("msg_not_own_area"));

Location newSpawn = Position.ofLocation(player.getLocation()).asLocation();
BukkitTools.ifCancelledThenThrow(new TownSetOutpostSpawnEvent(town, player, newSpawn));
TownSetOutpostSpawnEvent event = new TownSetOutpostSpawnEvent(town, player, player.getLocation());
BukkitTools.ifCancelledThenThrow(event);

town.addOutpostSpawn(player.getLocation());
town.addOutpostSpawn(event.getNewSpawn());
town.save();
TownyMessaging.sendMsg(sender, Translatable.of("msg_set_outpost_spawn"));
}
Expand Down

0 comments on commit 4e394df

Please sign in to comment.