Fix spawn location event (#192)

This commit is contained in:
Max Lee 2021-12-06 16:55:08 +01:00 committed by GitHub
parent 32e2711732
commit b0581f1a78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,9 +190,9 @@ public class PlayerListener implements Listener
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(player.getLocation()); ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(event.getSpawnLocation());
Object location = WorldGuardUtils.queryValueUnchecked(player, player.getWorld(), regions.getRegions(), Flags.JOIN_LOCATION); Object location = WorldGuardUtils.queryValueUnchecked(player, event.getSpawnLocation().getWorld(), regions.getRegions(), Flags.JOIN_LOCATION);
if (location != null) if (location != null)
{ {
event.setSpawnLocation(WorldEditUtils.toLocation(location)); event.setSpawnLocation(WorldEditUtils.toLocation(location));