mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-28 17:38:01 +01:00
New features + fixes
Fixed a very specific case of IC world not loading with multiverse every second startup Fixed chunks not being sent for plot clearing (although it was being sent for other thing) Fixes #554 Added fast experimental sudo-async worldedit processor
This commit is contained in:
parent
0e8ae9e6e4
commit
6ca6880917
@ -268,7 +268,10 @@ public class PS {
|
||||
if (world.equals("CheckingPlotSquaredGenerator")) {
|
||||
continue;
|
||||
}
|
||||
if (!BlockManager.manager.isWorld(world)) {
|
||||
if (!BlockManager.manager.isWorld(world) || (BlockManager.manager.isWorld(world) && !isPlotWorld(world))) {
|
||||
PS.debug("&c`" + world + "` was not properly loaded - PlotSquared will now try to load it properly: ");
|
||||
PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml as well");
|
||||
PS.debug("&8 - &7Your world management plugin may be faulty. Consider using an up to date plugin.");
|
||||
IMP.setGenerator(world);
|
||||
}
|
||||
}
|
||||
@ -1250,6 +1253,7 @@ public class PS {
|
||||
LOADING_WORLD = false;
|
||||
}
|
||||
} else {
|
||||
LOADING_WORLD = false;
|
||||
plotWorld = generator.getNewPlotWorld(world);
|
||||
plotManager = generator.getPlotManager();
|
||||
if (!config.contains(path)) {
|
||||
@ -1842,6 +1846,7 @@ public class PS {
|
||||
// Chunk processor
|
||||
options.put("chunk-processor.enabled", Settings.CHUNK_PROCESSOR);
|
||||
options.put("chunk-processor.auto-unload", Settings.CHUNK_PROCESSOR_GC);
|
||||
options.put("chunk-processor.experimental-fast-async-worldedit", Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT);
|
||||
options.put("chunk-processor.auto-trim", Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE);
|
||||
options.put("chunk-processor.max-blockstates", Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES);
|
||||
options.put("chunk-processor.max-entities", Settings.CHUNK_PROCESSOR_MAX_ENTITIES);
|
||||
@ -1956,10 +1961,9 @@ public class PS {
|
||||
|
||||
// Chunk processor
|
||||
Settings.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled");
|
||||
|
||||
Settings.CHUNK_PROCESSOR_GC = config.getBoolean("chunk-processor.auto-unload");
|
||||
Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE = config.getBoolean("chunk-processor.auto-trim");
|
||||
|
||||
Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT = config.getBoolean("chunk-processor.experimental-fast-async-worldedit");
|
||||
Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES = config.getInt("chunk-processor.max-blockstates");
|
||||
Settings.CHUNK_PROCESSOR_MAX_ENTITIES = config.getInt("chunk-processor.max-entities");
|
||||
Settings.CHUNK_PROCESSOR_DISABLE_PHYSICS = config.getBoolean("chunk-processor.disable-physics");
|
||||
|
@ -81,10 +81,10 @@ public class DebugClaimTest extends SubCommand {
|
||||
try {
|
||||
final String[] split1 = args[1].split(";");
|
||||
final String[] split2 = args[2].split(";");
|
||||
min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1]));
|
||||
max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1]));
|
||||
min = PlotId.fromString(args[1]);
|
||||
max = PlotId.fromString(args[2]);
|
||||
} catch (final Exception e) {
|
||||
return !MainUtil.sendMessage(null, "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X,Y are the plot coords\nThe conversion will only check the plots in the selected area.");
|
||||
return !MainUtil.sendMessage(null, "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X;Y are the plot coords\nThe conversion will only check the plots in the selected area.");
|
||||
}
|
||||
MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while...");
|
||||
MainUtil.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
|
||||
|
@ -68,6 +68,7 @@ public class Settings {
|
||||
* Chunk processor
|
||||
*/
|
||||
public static boolean CHUNK_PROCESSOR = false;
|
||||
public static boolean EXPERIMENTAL_FAST_ASYNC_WORLDEDIT = false;
|
||||
public static boolean CHUNK_PROCESSOR_TRIM_ON_SAVE = false;
|
||||
public static boolean CHUNK_PROCESSOR_GC = false;
|
||||
public static int CHUNK_PROCESSOR_MAX_BLOCKSTATES = 4096;
|
||||
|
@ -53,6 +53,7 @@ import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
|
||||
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
||||
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
||||
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
|
||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||
import com.plotsquared.bukkit.generator.HybridGen;
|
||||
import com.plotsquared.bukkit.listeners.ChunkListener;
|
||||
import com.plotsquared.bukkit.listeners.ForceFieldListener;
|
||||
@ -578,15 +579,28 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
setup.step = new ConfigurationNode[0];
|
||||
setup.world = worldname;
|
||||
SetupUtils.manager.setupWorld(setup);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
if (!PS.get().isPlotWorld(worldname)) {
|
||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldname));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log("Failed to reload world: " + world);
|
||||
Bukkit.getServer().unloadWorld(world, false);
|
||||
}
|
||||
}
|
||||
world = Bukkit.getWorld(worldname);
|
||||
final ChunkGenerator gen = world.getGenerator();
|
||||
if (gen instanceof BukkitPlotGenerator) {
|
||||
PS.get().loadWorld(worldname, new BukkitGeneratorWrapper(worldname, (BukkitPlotGenerator) gen));
|
||||
}
|
||||
else {
|
||||
if (PS.get().config.contains("worlds." + worldname)) {
|
||||
PS.get().loadWorld(worldname, new BukkitGeneratorWrapper(worldname, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchematicHandler initSchematicHandler() {
|
||||
|
@ -4,7 +4,11 @@ import java.util.HashSet;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -22,15 +26,18 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
int Ecount = 0;
|
||||
boolean BSblocked = false;
|
||||
boolean Eblocked = false;
|
||||
private String world;
|
||||
|
||||
public ProcessedWEExtent(HashSet<RegionWrapper> mask, Extent extent) {
|
||||
public ProcessedWEExtent(String world, HashSet<RegionWrapper> mask, Extent extent) {
|
||||
super(extent);
|
||||
this.mask = mask;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
|
||||
switch (block.getType()) {
|
||||
int id = block.getType();
|
||||
switch (id) {
|
||||
case 54:
|
||||
case 130:
|
||||
case 142:
|
||||
@ -74,11 +81,127 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
BSblocked = true;
|
||||
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (WEManager.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
|
||||
return super.setBlock(location, block);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
if (WEManager.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
|
||||
switch(id) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 24:
|
||||
case 25:
|
||||
case 30:
|
||||
case 32:
|
||||
case 37:
|
||||
case 39:
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
case 45:
|
||||
case 46:
|
||||
case 47:
|
||||
case 48:
|
||||
case 49:
|
||||
case 50:
|
||||
case 51:
|
||||
case 52:
|
||||
case 54:
|
||||
case 55:
|
||||
case 56:
|
||||
case 57:
|
||||
case 58:
|
||||
case 60:
|
||||
case 61:
|
||||
case 62:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 73:
|
||||
case 74:
|
||||
case 75:
|
||||
case 76:
|
||||
case 78:
|
||||
case 79:
|
||||
case 80:
|
||||
case 81:
|
||||
case 82:
|
||||
case 83:
|
||||
case 84:
|
||||
case 85:
|
||||
case 87:
|
||||
case 88:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 110:
|
||||
case 112:
|
||||
case 113:
|
||||
case 117:
|
||||
case 121:
|
||||
case 122:
|
||||
case 123:
|
||||
case 124:
|
||||
case 129:
|
||||
case 133:
|
||||
case 138:
|
||||
case 137:
|
||||
case 140:
|
||||
case 165:
|
||||
case 166:
|
||||
case 169:
|
||||
case 170:
|
||||
case 172:
|
||||
case 173:
|
||||
case 174:
|
||||
case 176:
|
||||
case 177:
|
||||
case 181:
|
||||
case 182:
|
||||
case 188:
|
||||
case 189:
|
||||
case 190:
|
||||
case 191:
|
||||
case 192: {
|
||||
if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
SetBlockQueue.setBlock(world, x, y, z, id);
|
||||
}
|
||||
else {
|
||||
super.setBlock(location, block);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
SetBlockQueue.setBlock(world, x, y, z, new PlotBlock((short) id, (byte) block.getData()));
|
||||
}
|
||||
else {
|
||||
super.setBlock(location, block);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
// BlockManager.manager.functionSetBlock(world, x, y, z, id, data);
|
||||
// return super.setBlock(location, block);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class WESubscriber {
|
||||
return;
|
||||
}
|
||||
if (Settings.CHUNK_PROCESSOR) {
|
||||
event.setExtent(new ProcessedWEExtent(mask, event.getExtent()));
|
||||
event.setExtent(new ProcessedWEExtent(world, mask, event.getExtent()));
|
||||
}
|
||||
else {
|
||||
event.setExtent(new WEExtent(mask, event.getExtent()));
|
||||
|
@ -56,6 +56,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.BlockUpdateUtil;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -101,6 +102,9 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
World worldObj = Bukkit.getWorld(world);
|
||||
// Chunk chunk = worldObj.getChunkAt(loc.x, loc.z);
|
||||
worldObj.regenerateChunk(loc.x, loc.z);
|
||||
if (MainUtil.canSendChunk && BlockUpdateUtil.setBlockManager != null) {
|
||||
BlockUpdateUtil.setBlockManager.update(world, Arrays.asList(loc));
|
||||
}
|
||||
for (final Player player : worldObj.getPlayers()) {
|
||||
org.bukkit.Location locObj = player.getLocation();
|
||||
if (locObj.getBlockX() >> 4 == loc.x && locObj.getBlockZ() >> 4 == loc.z && !locObj.getBlock().isEmpty()) {
|
||||
|
@ -72,29 +72,37 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal -g " + object.setupGenerator);
|
||||
setGenerator(world, object.setupGenerator);
|
||||
} else {
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world + " plugin:" + object.setupGenerator);
|
||||
setGenerator(world, object.setupGenerator);
|
||||
} else {
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
final WorldCreator wc = new WorldCreator(object.world);
|
||||
wc.generator(object.setupGenerator);
|
||||
wc.environment(Environment.NORMAL);
|
||||
Bukkit.createWorld(wc);
|
||||
setGenerator(world, object.setupGenerator);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal");
|
||||
} else {
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world);
|
||||
} else {
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
Bukkit.createWorld(new WorldCreator(object.world).environment(World.Environment.NORMAL));
|
||||
}
|
||||
}
|
||||
}
|
||||
return object.world;
|
||||
}
|
||||
|
||||
|
@ -104,14 +104,15 @@ public class SendChunk {
|
||||
if (dx > view || dz > view) {
|
||||
continue;
|
||||
}
|
||||
Object c = methodGetHandleChunk.of(chunk).call();
|
||||
net.minecraft.server.v1_8_R2.Chunk c = (net.minecraft.server.v1_8_R2.Chunk) methodGetHandleChunk.of(chunk).call();
|
||||
c.initLighting();
|
||||
chunks.remove(chunk);
|
||||
Object con = connection.of(entity).get();
|
||||
if (dx != 0 || dz != 0) {
|
||||
Object packet = MapChunk.create(c, true, 1);
|
||||
send.of(con).call(packet);
|
||||
}
|
||||
Object packet = MapChunk.create(c, true, 65565);
|
||||
// if (dx != 0 || dz != 0) {
|
||||
// Object packet = MapChunk.create(c, true, 0);
|
||||
// send.of(con).call(packet);
|
||||
// }
|
||||
Object packet = MapChunk.create(c, true, 65535);
|
||||
send.of(con).call(packet);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user