Fix refresh chunk for 1.7.X

This commit is contained in:
boy0001 2015-06-10 06:00:53 +10:00
parent 5f3fab5e42
commit 3aa7a74626
6 changed files with 12 additions and 22 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.11.17</version> <version>2.11.18</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -438,6 +438,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
e.printStackTrace(); e.printStackTrace();
BukkitSetBlockManager.setBlockManager = new SetBlockSlow(); BukkitSetBlockManager.setBlockManager = new SetBlockSlow();
} }
try {
new SendChunk();
MainUtil.canSendChunk = true;
} catch (final Throwable e) {
MainUtil.canSendChunk = false;
}
} else { } else {
try { try {
BukkitSetBlockManager.setBlockManager = new SetBlockFast(); BukkitSetBlockManager.setBlockManager = new SetBlockFast();
@ -447,12 +453,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
} }
BlockUpdateUtil.setBlockManager = BukkitSetBlockManager.setBlockManager; BlockUpdateUtil.setBlockManager = BukkitSetBlockManager.setBlockManager;
try {
new SendChunk();
MainUtil.canSendChunk = true;
} catch (final Throwable e) {
MainUtil.canSendChunk = false;
}
return BlockManager.manager = new BukkitUtil(); return BlockManager.manager = new BukkitUtil();
} }

View File

@ -373,11 +373,6 @@ public class PlotSquared {
if (!config.contains(path)) { if (!config.contains(path)) {
config.createSection(path); config.createSection(path);
} }
System.out.print("GENERATOR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.print(generator != null);
System.out.print(generator instanceof PlotGenerator);
plotWorld.TYPE = generator instanceof PlotGenerator ? 0 : 2; plotWorld.TYPE = generator instanceof PlotGenerator ? 0 : 2;
plotWorld.TERRAIN = 0; plotWorld.TERRAIN = 0;
plotWorld.saveConfiguration(config.getConfigurationSection(path)); plotWorld.saveConfiguration(config.getConfigurationSection(path));

View File

@ -26,17 +26,11 @@ public class BukkitSetupUtils extends SetupUtils {
} }
final String testWorld = "CheckingPlotSquaredGenerator"; final String testWorld = "CheckingPlotSquaredGenerator";
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
System.out.print(plugin.getName());
if (plugin.isEnabled()) { if (plugin.isEnabled()) {
System.out.print(" - enabled");
final ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, ""); final ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
if (generator != null) { if (generator != null) {
System.out.print(" - non null");
PlotSquared.removePlotWorld(testWorld); PlotSquared.removePlotWorld(testWorld);
final String name = plugin.getDescription().getName(); final String name = plugin.getDescription().getName();
if (generator instanceof PlotGenerator) {
System.out.print(" - ps gen");
}
// final PlotGenerator pgen = (PlotGenerator) generator; // final PlotGenerator pgen = (PlotGenerator) generator;
// if (pgen.getPlotManager() instanceof SquarePlotManager) { // if (pgen.getPlotManager() instanceof SquarePlotManager) {
SetupUtils.generators.put(name, generator); SetupUtils.generators.put(name, generator);

View File

@ -121,8 +121,9 @@ public class SetBlockFast extends BukkitSetBlockManager {
} }
if (!MainUtil.canSendChunk) { if (!MainUtil.canSendChunk) {
for (Chunk chunk : chunks) { for (Chunk chunk : chunks) {
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ()); chunk.unload(true, false);
chunk.load(true); // chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
chunk.load();
} }
return; return;
} }

View File

@ -333,8 +333,8 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
} }
if (!MainUtil.canSendChunk) { if (!MainUtil.canSendChunk) {
for (Chunk chunk : chunks) { for (Chunk chunk : chunks) {
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ()); chunk.unload(true, false);
chunk.load(true); chunk.load();
} }
return; return;
} }