Skip to content

Commit

Permalink
Fixed default world not registered as a generated schematic world, ma…
Browse files Browse the repository at this point in the history
…king block calculates to not work (#1396)
  • Loading branch information
OmerBenGera committed Oct 6, 2022
1 parent f601ed7 commit f10901a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Expand Up @@ -221,18 +221,21 @@ private void createIslandInternalAsync(IslandBuilderImpl builder, Biome biome, b
this.islandsContainer.addIsland(island);
setLastIsland(new SBlockPosition(islandLocation));

island.setBiome(biome);
try {
island.getDatabaseBridge().setDatabaseBridgeMode(DatabaseBridgeMode.IDLE);

if (offset) {
try {
island.getDatabaseBridge().setDatabaseBridgeMode(DatabaseBridgeMode.IDLE);
island.setBiome(biome);
island.setSchematicGenerate(plugin.getSettings().getWorlds().getDefaultWorld());

if (offset) {
island.setBonusWorth(island.getRawWorth().negate());
island.setBonusLevel(island.getRawLevel().negate());
} finally {
island.getDatabaseBridge().setDatabaseBridgeMode(DatabaseBridgeMode.SAVE_DATA);
}
} finally {
island.getDatabaseBridge().setDatabaseBridgeMode(DatabaseBridgeMode.SAVE_DATA);
}


IslandsDatabaseBridge.insertIsland(island);

island.setIslandHome(schematic.adjustRotation(islandLocation));
Expand Down
Expand Up @@ -244,7 +244,6 @@ public SIsland(IslandBuilderImpl builder) {
this.isLocked = builder.isLocked;
this.isTopIslandsIgnored = builder.isIgnored;
this.description = builder.description;
this.generatedSchematics.set(builder.generatedSchematicsMask);
this.unlockedWorlds.set(builder.unlockedWorldsMask);
this.lastTimeUpdate = builder.lastTimeUpdated;
this.islandHomes.write(islandHomes -> islandHomes.putAll(builder.islandHomes));
Expand Down Expand Up @@ -288,15 +287,23 @@ public SIsland(IslandBuilderImpl builder) {
this.blocksTracker = plugin.getFactory().createIslandBlocksTrackerAlgorithm(this);
this.entitiesTracker = plugin.getFactory().createIslandEntitiesTrackerAlgorithm(this);

if (builder.generatedSchematicsMask == 0) {
setSchematicGenerate(plugin.getSettings().getWorlds().getDefaultWorld());
} else {
this.generatedSchematics.set(builder.generatedSchematicsMask);
}

builder.dirtyChunks.forEach(chunkPosition -> ChunksTracker.markDirty(this, chunkPosition, false));
if (!builder.blockCounts.isEmpty()) {
BukkitExecutor.sync(() -> builder.blockCounts.forEach((block, count) ->
handleBlockPlace(block, count, false, false)
), 20L);
}

builder.warpCategories.forEach(warpCategoryRecord -> {
loadWarpCategory(warpCategoryRecord.name, warpCategoryRecord.slot, warpCategoryRecord.icon);
});

builder.warps.forEach(warpRecord -> {
WarpCategory warpCategory = null;

Expand Down
Expand Up @@ -91,7 +91,7 @@ public class IslandBuilderImpl implements Island.Builder {
public Value<Double> mobDrops = Value.syncedFixed(-1D);
public Value<BigDecimal> bankLimit = Value.syncedFixed(SYNCED_BANK_LIMIT_VALUE);
public BigDecimal balance = BigDecimal.ZERO;
public long lastInterestTime = 0L;
public long lastInterestTime = System.currentTimeMillis() / 1000;
public List<WarpRecord> warps = new LinkedList<>();
public List<WarpCategoryRecord> warpCategories = new LinkedList<>();
public List<BankTransaction> bankTransactions = new LinkedList<>();
Expand Down

0 comments on commit f10901a

Please sign in to comment.