More than 2 lines

This commit is contained in:
Jesse Boyd
2016-04-02 17:15:28 +11:00
parent 3edfd39af9
commit dffa00858d
12 changed files with 121 additions and 88 deletions

View File

@ -5,13 +5,16 @@ import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public abstract class ChunkManager {
@ -226,7 +229,19 @@ public abstract class ChunkManager {
return chunks;
}
public abstract void regenerateChunk(String world, ChunkLoc loc);
public void regenerateChunk(String world, ChunkLoc loc) {
SetQueue.IMP.regenerateChunk(world, loc);
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
for (Map.Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
PlotPlayer pp = entry.getValue();
Location pLoc = pp.getLocation();
if (!StringMan.isEqual(world, pLoc.getWorld()) || !pLoc.getChunkLoc().equals(loc)) {
continue;
}
pLoc.setY(WorldUtil.IMP.getHighestBlock(world, pLoc.getX(), pLoc.getZ()));
pp.teleport(pLoc);
}
}
public void deleteRegionFiles(String world, Collection<ChunkLoc> chunks) {
deleteRegionFiles(world, chunks, null);

View File

@ -26,5 +26,7 @@ public interface PlotQueue<T> {
PlotChunk<T> next(ChunkWrapper wrap, boolean fixLighting);
void clear();
void regenerateChunk(String world, ChunkLoc loc);
}

View File

@ -1,7 +1,7 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock;
import java.util.ArrayDeque;
import java.util.concurrent.atomic.AtomicInteger;
@ -149,6 +149,10 @@ public class SetQueue {
return this.queue.setBlock(world, x, y, z, (short) id, (byte) 0);
}
public void regenerateChunk(String world, ChunkLoc loc) {
queue.regenerateChunk(world, loc);
}
public class ChunkWrapper {
public final int x;