directly use chunkpos tolong
This commit is contained in:
parent
1e167300ef
commit
4c263f3743
@ -94,7 +94,7 @@ public class ClaimStorage {
|
|||||||
int[] chunks = getChunkPos(claim);
|
int[] chunks = getChunkPos(claim);
|
||||||
for (int x = chunks[0]; x <= chunks[1]; x++)
|
for (int x = chunks[0]; x <= chunks[1]; x++)
|
||||||
for (int z = chunks[2]; z <= chunks[3]; z++) {
|
for (int z = chunks[2]; z <= chunks[3]; z++) {
|
||||||
List<Claim> claims = this.claims.get(new ChunkPos(x, z).toLong());
|
List<Claim> claims = this.claims.get(ChunkPos.toLong(x, z));
|
||||||
if (claims != null)
|
if (claims != null)
|
||||||
for (Claim other : claims) {
|
for (Claim other : claims) {
|
||||||
if (claim.intersects(other) && !other.equals(except)) {
|
if (claim.intersects(other) && !other.equals(except)) {
|
||||||
@ -116,8 +116,7 @@ public class ClaimStorage {
|
|||||||
int[] pos = getChunkPos(claim);
|
int[] pos = getChunkPos(claim);
|
||||||
for (int x = pos[0]; x <= pos[1]; x++)
|
for (int x = pos[0]; x <= pos[1]; x++)
|
||||||
for (int z = pos[2]; z <= pos[3]; z++) {
|
for (int z = pos[2]; z <= pos[3]; z++) {
|
||||||
ChunkPos chunkPos = new ChunkPos(x, z);
|
this.claims.compute(ChunkPos.toLong(x, z), (key, val) -> {
|
||||||
this.claims.compute(chunkPos.toLong(), (key, val) -> {
|
|
||||||
if (val == null)
|
if (val == null)
|
||||||
return null;
|
return null;
|
||||||
val.remove(claim);
|
val.remove(claim);
|
||||||
@ -160,7 +159,7 @@ public class ClaimStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Claim getClaimAt(BlockPos pos) {
|
public Claim getClaimAt(BlockPos pos) {
|
||||||
long chunk = new ChunkPos(pos).toLong();
|
long chunk = ChunkPos.toLong(pos.getX()>>4, pos.getZ()>>4);
|
||||||
if (this.claims.containsKey(chunk))
|
if (this.claims.containsKey(chunk))
|
||||||
for (Claim claim : this.claims.get(chunk)) {
|
for (Claim claim : this.claims.get(chunk)) {
|
||||||
if (claim.insideClaim(pos))
|
if (claim.insideClaim(pos))
|
||||||
@ -177,8 +176,7 @@ public class ClaimStorage {
|
|||||||
int[] pos = getChunkPos(claim);
|
int[] pos = getChunkPos(claim);
|
||||||
for (int x = pos[0]; x <= pos[1]; x++)
|
for (int x = pos[0]; x <= pos[1]; x++)
|
||||||
for (int z = pos[2]; z <= pos[3]; z++) {
|
for (int z = pos[2]; z <= pos[3]; z++) {
|
||||||
ChunkPos chunkPos = new ChunkPos(x, z);
|
this.claims.merge(ChunkPos.toLong(x, z), Lists.newArrayList(claim), (old, val) -> {
|
||||||
this.claims.merge(chunkPos.toLong(), Lists.newArrayList(claim), (old, val) -> {
|
|
||||||
old.add(claim);
|
old.add(claim);
|
||||||
return old;
|
return old;
|
||||||
});
|
});
|
||||||
@ -266,9 +264,8 @@ public class ClaimStorage {
|
|||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
dirty = true;
|
dirty = true;
|
||||||
} else {
|
} else {
|
||||||
if (this.dirty.contains(owner.equals(adminClaimString) ? null : e.getKey())) {
|
if (this.dirty.remove(owner.equals(adminClaimString) ? null : e.getKey())) {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
this.dirty.clear();
|
|
||||||
} else {
|
} else {
|
||||||
for (Claim claim : e.getValue())
|
for (Claim claim : e.getValue())
|
||||||
if (claim.isDirty()) {
|
if (claim.isDirty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user