mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
misc fixes
This commit is contained in:
parent
6075de6460
commit
e0970dcdd2
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>2.8.9</version>
|
||||
<version>2.8.10</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
|
@ -275,7 +275,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
BlockUpdateUtil.setBlockManager = BukkitSetBlockManager.setBlockManager;
|
||||
try {
|
||||
new SendChunk();
|
||||
MainUtil.canSendChunk = true;
|
||||
if (checkVersion(1, 7, 10) && !checkVersion(1, 7, 11)) {
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
else {
|
||||
MainUtil.canSendChunk = true;
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
|
@ -666,6 +666,6 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
*/
|
||||
public int getAllowedPlots(final Player player) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
return MainUtil.getAllowedPlots(pp, MainUtil.getPlayerPlotCount(player.getWorld().getName(), pp));
|
||||
return MainUtil.getAllowedPlots(pp);
|
||||
}
|
||||
}
|
@ -62,7 +62,7 @@ public class Clear extends SubCommand {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.clear(world, plot, true, null);
|
||||
MainUtil.clear(world, plot, plot.owner == null, null);
|
||||
PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
|
||||
}
|
||||
};
|
||||
@ -122,7 +122,7 @@ public class Clear extends SubCommand {
|
||||
@Override
|
||||
public void run() {
|
||||
final long start = System.currentTimeMillis();
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() {
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, plot.owner == null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||
|
@ -147,6 +147,9 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
final int I = i;
|
||||
final int J = j;
|
||||
BukkitUtil.regenerateChunk(world, I / 16, J / 16);
|
||||
if (!MainUtil.canSendChunk) {
|
||||
BukkitUtil.refreshChunk(world, I / 16, J / 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
setWall(dpw, plot.id, new PlotBlock[] { wall });
|
||||
|
@ -665,44 +665,6 @@ public class MainUtil {
|
||||
return getPlotHome(w, plot.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the plot chunks
|
||||
*
|
||||
* @param world World in which the plot is located
|
||||
* @param plot Plot Object
|
||||
*/
|
||||
public static void refreshPlotChunks(final String world, final Plot plot) {
|
||||
final int bottomX = getPlotBottomLoc(world, plot.id).getX();
|
||||
final int topX = getPlotTopLoc(world, plot.id).getX();
|
||||
final int bottomZ = getPlotBottomLoc(world, plot.id).getZ();
|
||||
final int topZ = getPlotTopLoc(world, plot.id).getZ();
|
||||
final int minChunkX = (int) Math.floor((double) bottomX / 16);
|
||||
final int maxChunkX = (int) Math.floor((double) topX / 16);
|
||||
final int minChunkZ = (int) Math.floor((double) bottomZ / 16);
|
||||
final int maxChunkZ = (int) Math.floor((double) topZ / 16);
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
||||
if (canSendChunk) {
|
||||
final ChunkLoc chunk = new ChunkLoc(x, z);
|
||||
chunks.add(chunk);
|
||||
} else {
|
||||
BukkitUtil.refreshChunk(world, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
SendChunk.sendChunk(world, chunks);
|
||||
} catch (final Throwable e) {
|
||||
canSendChunk = false;
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
||||
BukkitUtil.refreshChunk(world, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the top plot location of a plot (all plots are treated as small plots) - To get the top loc of a mega plot
|
||||
* use getPlotTopLoc(...)
|
||||
|
@ -145,8 +145,10 @@ public class BukkitUtil extends BlockManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void refreshChunk(final String world, final int x, final int z) {
|
||||
getWorld(world).refreshChunk(x, z);
|
||||
public static void refreshChunk(final String name, final int x, final int z) {
|
||||
World world = getWorld(name);
|
||||
world.unloadChunk(x, z);
|
||||
world.loadChunk(x, z);
|
||||
}
|
||||
|
||||
public static void regenerateChunk(final String world, final int x, final int z) {
|
||||
|
@ -90,7 +90,8 @@ public class SetBlockFast extends BukkitSetBlockManager {
|
||||
if (!MainUtil.canSendChunk) {
|
||||
final World world = chunks.get(0).getWorld();
|
||||
for (final Chunk chunk : chunks) {
|
||||
world.refreshChunk(chunk.getX(), chunk.getZ());
|
||||
world.unloadChunk(chunk);
|
||||
world.loadChunk(chunk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -294,7 +294,8 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
||||
if (!MainUtil.canSendChunk) {
|
||||
final World world = chunks.get(0).getWorld();
|
||||
for (final Chunk chunk : chunks) {
|
||||
world.refreshChunk(chunk.getX(), chunk.getZ());
|
||||
world.unloadChunk(chunk);
|
||||
world.loadChunk(chunk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user