Skip to content

Commit

Permalink
Fixed going through portals when worlds are disabled still trying to …
Browse files Browse the repository at this point in the history
…paste schematics in these worlds (#1030)
  • Loading branch information
OmerBenGera committed Apr 8, 2022
1 parent 5a64bd7 commit 61005ff
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -46,6 +46,9 @@ public static void handlePlayerPortal(Player player, Location portalLocation,

World.Environment destinationEnvironment = getTargetWorld(portalLocation, teleportCause);

if (plugin.getGrid().getIslandsWorld(island, destinationEnvironment) == null)
return;

if (!isIslandWorldEnabled(destinationEnvironment, island)) {
if (!Message.WORLD_NOT_UNLOCKED.isEmpty(superiorPlayer.getUserLocale()))
PlayerLocales.sendSchematicMessage(superiorPlayer, Message.WORLD_NOT_UNLOCKED.getMessage(
Expand Down Expand Up @@ -75,14 +78,14 @@ public static void handlePlayerPortal(Player player, Location portalLocation,
return;
}

island.setSchematicGenerate(destinationEnvironment);

Location schematicPlacementLocation = island.getCenter(destinationEnvironment).subtract(0, 1, 0);

BigDecimal originalWorth = island.getRawWorth();
BigDecimal originalLevel = island.getRawLevel();

schematic.pasteSchematic(island, schematicPlacementLocation, () -> {
island.setSchematicGenerate(destinationEnvironment);

if (shouldOffsetSchematic(destinationEnvironment)) {
BigDecimal schematicWorth = island.getRawWorth().subtract(originalWorth),
schematicLevel = island.getRawLevel().subtract(originalLevel);
Expand Down

0 comments on commit 61005ff

Please sign in to comment.