Skip to content

Commit

Permalink
Possible fix for #58 Inconsistent chunk after /city delete
Browse files Browse the repository at this point in the history
  • Loading branch information
joserobjr committed Nov 14, 2016
1 parent 692c1b3 commit a2d3174
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,14 @@ public ClaimedChunk getClaim(@NotNull ChunkPos pos)
return chunk.getMineCityClaim();
}

private void setClaim(@NotNull IChunk chunk, @NotNull ClaimedChunk claim)
{
ClaimedChunk old = chunk.getMineCityClaim();
chunk.setMineCityClaim(claim);
if(old != null && old != claim)
old.invalidate();
}

public boolean setClaim(@NotNull ClaimedChunk claim)
{
ChunkPos pos = claim.chunk;
Expand All @@ -602,10 +610,7 @@ public boolean setClaim(@NotNull ClaimedChunk claim)
IChunk chunk = (IChunk) pos.instance;
if(chunk.isMineCityChunkValid())
{
ClaimedChunk old = chunk.getMineCityClaim();
chunk.setMineCityClaim(claim);
if(old != null && old != claim)
old.invalidate();
setClaim(chunk, claim);
return true;
}
}
Expand All @@ -619,7 +624,7 @@ public boolean setClaim(@NotNull ClaimedChunk claim)
return false;

pos.instance = forgeChunk;
forgeChunk.setMineCityClaim(claim);
setClaim(forgeChunk, claim);
return true;
}

Expand Down

0 comments on commit a2d3174

Please sign in to comment.