INDEV -- Pushed for in-house testing and development

This commit is contained in:
IronApollo 2019-02-17 03:47:32 -05:00
parent 0763e4c05c
commit 24fbc86cdd
25 changed files with 377 additions and 326 deletions

View File

@ -8,7 +8,6 @@ import com.boydti.fawe.wrappers.PlayerWrapper;
import java.lang.reflect.Method;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import org.bukkit.Bukkit;

View File

@ -1,8 +1,8 @@
package com.boydti.fawe.bukkit.filter;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.regions.general.CuboidRegionFilter;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.TaskManager;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.math.BlockVector2;
import java.util.ArrayDeque;

View File

@ -23,6 +23,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
@ -358,4 +359,9 @@ public class AsyncBlock implements Block {
public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3) {
return this.getUnsafeBlock().rayTrace(arg0, arg1, arg2, arg3);
}
@Override
public BoundingBox getBoundingBox() {
return this.getUnsafeBlock().getBoundingBox();
}
}

View File

@ -1278,4 +1278,14 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
}
@Override
public void setChunkForceLoaded(int x, int z, boolean forced) {
parent.setChunkForceLoaded(x, z, forced);
}
@Override
public Collection<Chunk> getForceLoadedChunks() {
return parent.getForceLoadedChunks();
}
}

View File

@ -79,42 +79,42 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
private BukkitConfiguration config;
private static Map<String, Plugin> lookupNames;
static {
{ // Disable AWE as otherwise both fail to load
PluginManager manager = Bukkit.getPluginManager();
try {
Field pluginsField = manager.getClass().getDeclaredField("plugins");
Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
pluginsField.setAccessible(true);
lookupNamesField.setAccessible(true);
List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
pluginsField.set(manager, plugins = new ArrayList<Plugin>(plugins) {
@Override
public boolean add(Plugin plugin) {
if (plugin.getName().startsWith("AsyncWorldEdit")) {
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
} else if (plugin.getName().startsWith("BetterShutdown")) {
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
} else {
return super.add(plugin);
}
return false;
}
});
lookupNamesField.set(manager, lookupNames = new ConcurrentHashMap<String, Plugin>(lookupNames) {
@Override
public Plugin put(String key, Plugin plugin) {
if (plugin.getName().startsWith("AsyncWorldEdit") || plugin.getName().startsWith("BetterShutdown")) {
return null;
}
return super.put(key, plugin);
}
});
} catch (Throwable ignore) {}
}
}
// static {
// { // Disable AWE as otherwise both fail to load
// PluginManager manager = Bukkit.getPluginManager();
// try {
// Field pluginsField = manager.getClass().getDeclaredField("plugins");
// Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
// pluginsField.setAccessible(true);
// lookupNamesField.setAccessible(true);
// List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
// lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
// pluginsField.set(manager, plugins = new ArrayList<Plugin>(plugins) {
// @Override
// public boolean add(Plugin plugin) {
// if (plugin.getName().startsWith("AsyncWorldEdit")) {
// Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
// } else if (plugin.getName().startsWith("BetterShutdown")) {
// Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
// } else {
// return super.add(plugin);
// }
// return false;
// }
// });
// lookupNamesField.set(manager, lookupNames = new ConcurrentHashMap<String, Plugin>(lookupNames) {
// @Override
// public Plugin put(String key, Plugin plugin) {
// if (plugin.getName().startsWith("AsyncWorldEdit") || plugin.getName().startsWith("BetterShutdown")) {
// return null;
// }
// return super.put(key, plugin);
// }
// });
// } catch (Throwable ignore) {}
// }
// }
//
public WorldEditPlugin() {
init();
}
@ -145,6 +145,7 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
@SuppressWarnings("AccessStaticViaInstance")
@Override
public void onEnable() {
rename();
this.INSTANCE = this;
FaweBukkit imp = new FaweBukkit(this);
@ -188,6 +189,7 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
}
}
}
System.out.println("finished enable");
}
private void rename() {

View File

@ -4,10 +4,9 @@ version: "${internalVersion}"
api-version: 1.13
description: Fast Async WorldEdit plugin
authors: [Empire92]
loadbefore: [WorldEdit,AsyncWorldEdit,AsyncWorldEditInjector,WorldGuard]
load: STARTUP
loadbefore: [PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector]
database: false
#softdepend: [WorldGuard, PlotSquared, MCore, Factions, GriefPrevention, Residence, Towny, PlotMe, PreciousStones]
softdepend: [WorldGuard, MCore, Factions, GriefPrevention, Residence, Towny, PlotMe, PreciousStones]
permissions:
fawe.plotsquared:
default: true

View File

@ -184,4 +184,14 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
public Map<String, Object> serialize() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastLogin() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getLastSeen() {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -213,10 +213,10 @@ public class Fawe {
try {
transformParser = new DefaultTransformParser(getWorldEdit());
visualQueue = new VisualQueue(3);
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
WEManager.IMP.managers.add(new PlotSquaredFeature());
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
} catch (Throwable e) {}
// WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
// WEManager.IMP.managers.add(new PlotSquaredFeature());
// Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
} catch (Throwable e) {e.printStackTrace();}
}, 0);
TaskManager.IMP.repeat(timer, 1);

View File

@ -12,19 +12,19 @@ import com.boydti.fawe.object.pattern.PatternExtent;
import com.boydti.fawe.util.*;
import com.boydti.fawe.util.chat.Message;
import com.boydti.fawe.util.image.ImageUtil;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.Auto;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.worlds.PlotAreaManager;
import com.intellectualcrafters.plot.object.worlds.SinglePlotArea;
import com.intellectualcrafters.plot.object.worlds.SinglePlotAreaManager;
import com.intellectualcrafters.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.Auto;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException;
@ -88,7 +88,7 @@ public class CFICommands extends MethodCommands {
}
private File getFolder(String worldName) {
return new File(PS.imp().getWorldContainer(), worldName + File.separator + "region");
return new File(PlotSquared.imp().getWorldContainer(), worldName + File.separator + "region");
}
@Command(
@ -175,7 +175,7 @@ public class CFICommands extends MethodCommands {
}
@Deprecated
public static void autoClaimFromDatabase(PlotPlayer player, PlotArea area, PlotId start, com.intellectualcrafters.plot.object.RunnableVal<Plot> whenDone) {
public static void autoClaimFromDatabase(PlotPlayer player, PlotArea area, PlotId start, com.github.intellectualsites.plotsquared.plot.object.RunnableVal<Plot> whenDone) {
final Plot plot = area.getNextFreePlot(player, start);
if (plot == null) {
whenDone.run(null);
@ -200,7 +200,7 @@ public class CFICommands extends MethodCommands {
public void done(FawePlayer fp) throws ParameterException, IOException {
CFISettings settings = assertSettings(fp);
PlotAreaManager manager = PS.get().getPlotAreaManager();
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager;
SinglePlotArea area = sManager.getArea();

View File

@ -5,14 +5,14 @@ import com.boydti.fawe.jnbt.anvil.MCAChunk;
import com.boydti.fawe.jnbt.anvil.MCAFile;
import com.boydti.fawe.object.RunnableVal4;
import com.boydti.fawe.object.collection.LongHashSet;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.HybridGen;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
@ -37,7 +37,7 @@ public class PlotTrimFilter extends DeleteUninhabitedFilter {
IndependentPlotGenerator gen = area.getGenerator();
if (area instanceof HybridPlotWorld && gen instanceof HybridGen) {
HybridPlotWorld hpw = (HybridPlotWorld) area;
return hpw.PLOT_BEDROCK && !hpw.PLOT_SCHEMATIC && hpw.MAIN_BLOCK.length == 1 && hpw.TOP_BLOCK.length == 1;
return hpw.PLOT_BEDROCK && !hpw.PLOT_SCHEMATIC && hpw.MAIN_BLOCK.getBlocks().size() == 1 && hpw.TOP_BLOCK.getBlocks().size() == 1;
}
return false;
}
@ -47,21 +47,21 @@ public class PlotTrimFilter extends DeleteUninhabitedFilter {
Fawe.debug("Initializing Plot trim...");
String worldName = Fawe.imp().getWorldName(world);
PlotArea area = PS.get().getPlotAreaByString(worldName);
PlotArea area = PlotSquared.get().getPlotAreaByString(worldName);
IndependentPlotGenerator gen = area.getGenerator();
if (!(area instanceof HybridPlotWorld) || !(gen instanceof HybridGen)) {
throw new UnsupportedOperationException("Trim does not support non hybrid plot worlds");
}
this.hg = (HybridGen) gen;
this.hpw = (HybridPlotWorld) area;
if (hpw.PLOT_SCHEMATIC || hpw.MAIN_BLOCK.length != 1 || hpw.TOP_BLOCK.length != 1) {
if (hpw.PLOT_SCHEMATIC || hpw.MAIN_BLOCK.getBlocks().size() != 1 || hpw.TOP_BLOCK.getBlocks().size() != 1) {
throw new UnsupportedOperationException("WIP - will implement later");
}
this.occupiedRegions = new LongHashSet();
this.unoccupiedChunks = new LongHashSet();
this.reference = calculateReference();
Fawe.debug(" - calculating claims");
this.calculateClaimedArea();
}
@ -70,11 +70,11 @@ public class PlotTrimFilter extends DeleteUninhabitedFilter {
MCAChunk reference = new MCAChunk(null, 0, 0);
if (hpw.PLOT_BEDROCK) {
reference.fillCuboid(0, 15, 0, 0, 0, 15, BlockTypes.BEDROCK.getInternalId());
} else if (hpw.MAIN_BLOCK[0].id == 0 && hpw.TOP_BLOCK[0].id == 0) {
} else if (hpw.MAIN_BLOCK.hasSingleItem() && hpw.MAIN_BLOCK.getBlock().isAir() && hpw.TOP_BLOCK.hasSingleItem() && hpw.TOP_BLOCK.getBlock().isAir()) {
referenceIsVoid = true;
}
reference.fillCuboid(0, 15, 1, hpw.PLOT_HEIGHT - 1, 0, 15, LegacyMapper.getInstance().getBlockFromLegacy(hpw.MAIN_BLOCK[0].id).getInternalId());
reference.fillCuboid(0, 15, hpw.PLOT_HEIGHT, hpw.PLOT_HEIGHT, 0, 15, LegacyMapper.getInstance().getBlockFromLegacy(hpw.TOP_BLOCK[0].id).getInternalId());
reference.fillCuboid(0, 15, 1, hpw.PLOT_HEIGHT - 1, 0, 15, LegacyMapper.getInstance().getBaseBlockFromPlotBlock(hpw.MAIN_BLOCK.getBlock()).getInternalBlockTypeId());
reference.fillCuboid(0, 15, hpw.PLOT_HEIGHT, hpw.PLOT_HEIGHT, 0, 15, LegacyMapper.getInstance().getBaseBlockFromPlotBlock(hpw.TOP_BLOCK.getBlock()).getInternalBlockTypeId());
return reference;
}

View File

@ -2,7 +2,7 @@ package com.boydti.fawe.object.brush;
import com.boydti.fawe.jnbt.anvil.generator.SchemGen;
import com.boydti.fawe.util.MaskTraverser;
import com.intellectualcrafters.plot.util.MathMan;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;

View File

@ -3,7 +3,7 @@ package com.boydti.fawe.object.brush;
import com.boydti.fawe.object.PseudoRandom;
import com.boydti.fawe.object.brush.heightmap.HeightMap;
import com.boydti.fawe.object.mask.AdjacentAnyMask;
import com.intellectualcrafters.plot.util.MathMan;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;

View File

@ -1,27 +1,18 @@
package com.boydti.fawe.object.clipboard.remap;
import com.boydti.fawe.FaweCache;
import com.google.common.io.Resources;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.intellectualcrafters.plot.util.MathMan;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.registry.BundledBlockData;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@ -1,17 +1,17 @@
package com.boydti.fawe.regions.general.plot;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal2;
import com.intellectualcrafters.plot.object.RunnableVal3;
import com.intellectualcrafters.plot.object.worlds.SinglePlotArea;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
import com.sk89q.worldedit.WorldEdit;
@CommandDeclaration(

View File

@ -2,10 +2,10 @@ package com.boydti.fawe.regions.general.plot;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;

View File

@ -4,15 +4,16 @@ import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.SetQueue;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.biome.Biomes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BiomeRegistry;
import com.sk89q.worldedit.world.registry.LegacyMapper;
@ -23,10 +24,12 @@ import java.util.List;
public class FaweLocalBlockQueue extends LocalBlockQueue {
public final FaweQueue IMP;
private final LegacyMapper legacyMapper;
public FaweLocalBlockQueue(String world) {
super(world);
IMP = SetQueue.IMP.getNewQueue(FaweAPI.getWorld(world), true, false);
legacyMapper = LegacyMapper.getInstance();
}
@Override
@ -63,10 +66,15 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
public long getModified() {
return IMP.getModified();
}
@Override
public boolean setBlock(int x, int y, int z, int id, int data) {
return IMP.setBlock(x, y, z, LegacyMapper.getInstance().getBlockFromLegacy(id, data));
public boolean setBlock(final int x, final int y, final int z, final PlotBlock id) {
return setBlock(x, y, z, legacyMapper.getBaseBlockFromPlotBlock(id));
}
@Override
public boolean setBlock(final int x, final int y, final int z, final BaseBlock id) {
return IMP.setBlock(x, y, z, id);
}
@Override

View File

@ -7,15 +7,14 @@ import com.boydti.fawe.object.io.PGZIPOutputStream;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.SetQueue;
import com.boydti.fawe.util.TaskManager;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.jnbt.Tag;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
@ -74,11 +73,11 @@ public class FaweSchematicHandler extends SchematicHandler {
@Override
public boolean save(CompoundTag tag, String path) {
if (tag == null) {
PS.debug("&cCannot save empty tag");
PlotSquared.debug("&cCannot save empty tag");
return false;
}
try {
File tmp = MainUtil.getFile(PS.get().IMP.getDirectory(), path);
File tmp = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), path);
tmp.getParentFile().mkdirs();
com.sk89q.jnbt.CompoundTag weTag = (com.sk89q.jnbt.CompoundTag) FaweCache.asTag(tag);
try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new PGZIPOutputStream(stream))) {
@ -97,8 +96,8 @@ public class FaweSchematicHandler extends SchematicHandler {
@Override
public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) {
if (tag == null) {
PS.debug("&cCannot save empty tag");
com.intellectualcrafters.plot.util.TaskManager.runTask(whenDone);
PlotSquared.debug("&cCannot save empty tag");
com.github.intellectualsites.plotsquared.plot.util.TaskManager.runTask(whenDone);
return;
}
MainUtil.upload(uuid, file, "schematic", new RunnableVal<OutputStream>() {

View File

@ -1,14 +1,14 @@
package com.boydti.fawe.regions.general.plot;
import com.boydti.fawe.util.TaskManager;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.commands.SubCommand;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.commands.SubCommand;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
@CommandDeclaration(
command = "trimchunks",

View File

@ -8,27 +8,27 @@ import com.boydti.fawe.jnbt.anvil.MCAWriter;
import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.SetQueue;
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLManager;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal2;
import com.intellectualcrafters.plot.object.RunnableVal3;
import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.database.SQLManager;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -44,117 +44,117 @@ import java.util.Map;
usage = "/plots moveto512 [world]"
)
// TODO FIXME
public class MoveTo512 extends Command {
public class MoveTo512 /*extends Command*/ {
public MoveTo512() {
super(MainCommand.getInstance(), true);
}
// public MoveTo512() {
// super(MainCommand.getInstance(), true);
// }
//
// private MCAChunk emptyPlot(MCAChunk chunk, HybridPlotWorld hpw) {
// int maxLayer = (hpw.PLOT_HEIGHT) >> 4;
// for (int i = maxLayer + 1; i < chunk.ids.length; i++) {
// chunk.ids[i] = null;
// chunk.data[i] = null;
// }
// for (int layer = 0; layer <= maxLayer; layer++) {
// byte[] ids = chunk.ids[layer];
// if (ids == null) {
// ids = chunk.ids[layer] = new byte[4096];
// chunk.data[layer] = new byte[2048];
// chunk.skyLight[layer] = new byte[2048];
// chunk.blockLight[layer] = new byte[2048];
// } else {
// Arrays.fill(ids, (byte) 0);
// Arrays.fill(chunk.data[layer], (byte) 0);
// Arrays.fill(chunk.skyLight[layer], (byte) 0);
// Arrays.fill(chunk.blockLight[layer], (byte) 0);
// }
// if (layer == maxLayer) {
// int yMax = hpw.PLOT_HEIGHT & 15;
// for (int y = yMax + 1; y < 15; y++) {
// Arrays.fill(chunk.skyLight[layer], y << 7, (y << 7) + 128, (byte) 255);
// }
// if (layer == 0) {
// Arrays.fill(ids, 0, 256, (byte) 7);
// for (int y = 1; y < yMax; y++) {
// int y8 = y << 8;
// Arrays.fill(ids, y8, y8 + 256, (byte) 3);
// }
// } else {
// for (int y = 0; y < yMax; y++) {
// int y8 = y << 8;
// Arrays.fill(ids, y8, y8 + 256, (byte) 3);
// }
// }
// int yMax15 = yMax & 15;
// int yMax158 = yMax15 << 8;
// Arrays.fill(ids, yMax158, yMax158 + 256, (byte) 2);
// if (yMax != 15) {
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
// }
// } else if (layer == 0){
// Arrays.fill(ids, 256, 4096, (byte) 3);
// Arrays.fill(ids, 0, 256, (byte) 7);
// } else {
// Arrays.fill(ids, (byte) 3);
// }
// }
// return chunk;
// }
//
// private MCAChunk emptyRoad(MCAChunk chunk, HybridPlotWorld hpw) {
// int maxLayer = (hpw.ROAD_HEIGHT) >> 4;
// for (int i = maxLayer + 1; i < chunk.ids.length; i++) {
// chunk.ids[i] = null;
// chunk.data[i] = null;
// }
// for (int layer = 0; layer <= maxLayer; layer++) {
// byte[] ids = chunk.ids[layer];
// if (ids == null) {
// ids = chunk.ids[layer] = new byte[4096];
// chunk.data[layer] = new byte[2048];
// chunk.skyLight[layer] = new byte[2048];
// chunk.blockLight[layer] = new byte[2048];
// } else {
// Arrays.fill(ids, (byte) 0);
// Arrays.fill(chunk.data[layer], (byte) 0);
// Arrays.fill(chunk.skyLight[layer], (byte) 0);
// Arrays.fill(chunk.blockLight[layer], (byte) 0);
// }
// if (layer == maxLayer) {
// int yMax = hpw.ROAD_HEIGHT & 15;
// for (int y = yMax + 1; y < 15; y++) {
// Arrays.fill(chunk.skyLight[layer], y << 7, (y << 7) + 128, (byte) 255);
// }
// if (layer == 0) {
// Arrays.fill(ids, 0, 256, (byte) 7);
// for (int y = 1; y <= yMax; y++) {
// int y8 = y << 8;
// Arrays.fill(ids, y8, y8 + 256, (byte) hpw.ROAD_BLOCK.id);
// }
// } else {
// for (int y = 0; y <= yMax; y++) {
// int y8 = y << 8;
// Arrays.fill(ids, y8, y8 + 256, (byte) hpw.ROAD_BLOCK.id);
// }
// }
// if (yMax != 15) {
// int yMax15 = yMax & 15;
// int yMax158 = yMax15 << 8;
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
// }
// } else if (layer == 0){
// Arrays.fill(ids, 256, 4096, (byte) hpw.ROAD_BLOCK.id);
// Arrays.fill(ids, 0, 256, (byte) 7);
// } else {
// Arrays.fill(ids, (byte) hpw.ROAD_BLOCK.id);
// }
// }
// return chunk;
// }
private MCAChunk emptyPlot(MCAChunk chunk, HybridPlotWorld hpw) {
int maxLayer = (hpw.PLOT_HEIGHT) >> 4;
for (int i = maxLayer + 1; i < chunk.ids.length; i++) {
chunk.ids[i] = null;
chunk.data[i] = null;
}
for (int layer = 0; layer <= maxLayer; layer++) {
byte[] ids = chunk.ids[layer];
if (ids == null) {
ids = chunk.ids[layer] = new byte[4096];
chunk.data[layer] = new byte[2048];
chunk.skyLight[layer] = new byte[2048];
chunk.blockLight[layer] = new byte[2048];
} else {
Arrays.fill(ids, (byte) 0);
Arrays.fill(chunk.data[layer], (byte) 0);
Arrays.fill(chunk.skyLight[layer], (byte) 0);
Arrays.fill(chunk.blockLight[layer], (byte) 0);
}
if (layer == maxLayer) {
int yMax = hpw.PLOT_HEIGHT & 15;
for (int y = yMax + 1; y < 15; y++) {
Arrays.fill(chunk.skyLight[layer], y << 7, (y << 7) + 128, (byte) 255);
}
if (layer == 0) {
Arrays.fill(ids, 0, 256, (byte) 7);
for (int y = 1; y < yMax; y++) {
int y8 = y << 8;
Arrays.fill(ids, y8, y8 + 256, (byte) 3);
}
} else {
for (int y = 0; y < yMax; y++) {
int y8 = y << 8;
Arrays.fill(ids, y8, y8 + 256, (byte) 3);
}
}
int yMax15 = yMax & 15;
int yMax158 = yMax15 << 8;
Arrays.fill(ids, yMax158, yMax158 + 256, (byte) 2);
if (yMax != 15) {
Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
}
} else if (layer == 0){
Arrays.fill(ids, 256, 4096, (byte) 3);
Arrays.fill(ids, 0, 256, (byte) 7);
} else {
Arrays.fill(ids, (byte) 3);
}
}
return chunk;
}
private MCAChunk emptyRoad(MCAChunk chunk, HybridPlotWorld hpw) {
int maxLayer = (hpw.ROAD_HEIGHT) >> 4;
for (int i = maxLayer + 1; i < chunk.ids.length; i++) {
chunk.ids[i] = null;
chunk.data[i] = null;
}
for (int layer = 0; layer <= maxLayer; layer++) {
byte[] ids = chunk.ids[layer];
if (ids == null) {
ids = chunk.ids[layer] = new byte[4096];
chunk.data[layer] = new byte[2048];
chunk.skyLight[layer] = new byte[2048];
chunk.blockLight[layer] = new byte[2048];
} else {
Arrays.fill(ids, (byte) 0);
Arrays.fill(chunk.data[layer], (byte) 0);
Arrays.fill(chunk.skyLight[layer], (byte) 0);
Arrays.fill(chunk.blockLight[layer], (byte) 0);
}
if (layer == maxLayer) {
int yMax = hpw.ROAD_HEIGHT & 15;
for (int y = yMax + 1; y < 15; y++) {
Arrays.fill(chunk.skyLight[layer], y << 7, (y << 7) + 128, (byte) 255);
}
if (layer == 0) {
Arrays.fill(ids, 0, 256, (byte) 7);
for (int y = 1; y <= yMax; y++) {
int y8 = y << 8;
Arrays.fill(ids, y8, y8 + 256, (byte) hpw.ROAD_BLOCK.id);
}
} else {
for (int y = 0; y <= yMax; y++) {
int y8 = y << 8;
Arrays.fill(ids, y8, y8 + 256, (byte) hpw.ROAD_BLOCK.id);
}
}
if (yMax != 15) {
int yMax15 = yMax & 15;
int yMax158 = yMax15 << 8;
Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
}
} else if (layer == 0){
Arrays.fill(ids, 256, 4096, (byte) hpw.ROAD_BLOCK.id);
Arrays.fill(ids, 0, 256, (byte) 7);
} else {
Arrays.fill(ids, (byte) hpw.ROAD_BLOCK.id);
}
}
return chunk;
}
@Override
public void execute(PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
// @Override
// public void execute(PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
// checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
// PlotArea area = player.getPlotAreaAbs();
// check(area, C.COMMAND_SYNTAX, getUsage());
@ -368,5 +368,5 @@ public class MoveTo512 extends Command {
// object.plotManager = PS.imp().getPluginName();
// object.setupGenerator = PS.imp().getPluginName();
// String created = SetupUtils.manager.setupWorld(object);
}
// }
}

View File

@ -1,9 +1,9 @@
package com.boydti.fawe.regions.general.plot;
import com.boydti.fawe.regions.general.CuboidRegionFilter;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.sk89q.worldedit.math.BlockVector2;
import java.util.ArrayList;
@ -22,9 +22,9 @@ public class PlotRegionFilter extends CuboidRegionFilter {
public void calculateRegions() {
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
for (Plot plot : plots) {
Location pos1 = plot.getBottom();
Location pos2 = plot.getTop();
add(BlockVector2.at(pos1.getX(), pos1.getZ()), BlockVector2.at(pos2.getX(), pos2.getZ()));
Location bottom = plot.getCorners()[0];
Location top = plot.getCorners()[1];
add(BlockVector2.at(bottom.getX(), bottom.getZ()), BlockVector2.at(top.getX(), top.getZ()));
}
}
}

View File

@ -5,21 +5,21 @@ import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.PseudoRandom;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal2;
import com.intellectualcrafters.plot.object.RunnableVal3;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;

View File

@ -7,22 +7,22 @@ import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.regions.SimpleRegion;
import com.boydti.fawe.regions.general.RegionFilter;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.generator.HybridPlotManager;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
import com.intellectualcrafters.plot.util.block.QueueProvider;
import com.plotsquared.listener.WEManager;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
@ -33,7 +33,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
Fawe.debug("Optimizing PlotSquared");
PS.get().worldedit = null;
PlotSquared.get().worldedit = null;
setupBlockQueue();
setupSchematicHandler();
setupChunkManager();
@ -44,10 +44,10 @@ public class PlotSquaredFeature extends FaweMaskManager {
new PlotSetBiome();
}
try {
new MoveTo512();
// new MoveTo512();
if (Settings.Enabled_Components.WORLDS) {
new ReplaceAll();
new CFIRedirect();
// new CFIRedirect();
}
} catch (Throwable e) {
Fawe.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
@ -94,7 +94,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
return false;
}
UUID uid = fp.getUUID();
return !Flags.NO_WORLDEDIT.isTrue(plot) && ((plot.isOwner(uid) || (type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.everyone) || ((plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.everyone)) && fp.hasPermission("fawe.plotsquared.member"))))) || fp.hasPermission("fawe.plotsquared.admin"));
return !Flags.NO_WORLDEDIT.isTrue(plot) && ((plot.isOwner(uid) || (type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE) || ((plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && fp.hasPermission("fawe.plotsquared.member"))))) || fp.hasPermission("fawe.plotsquared.admin"));
}
@Override
@ -162,7 +162,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
@Override
public RegionFilter getFilter(String world) {
PlotArea area = PS.get().getPlotArea(world, null);
PlotArea area = PlotSquared.get().getPlotArea(world, null);
if (area != null) return new PlotRegionFilter(area);
return null;
}

View File

@ -8,13 +8,13 @@ import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.SetQueue;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -87,7 +87,7 @@ public class PlotTrim {
}
});
ArrayList<Plot> plots = new ArrayList<>();
plots.addAll(PS.get().getPlots(area));
plots.addAll(PlotSquared.get().getPlots(area));
if (ExpireManager.IMP != null) {
plots.removeAll(ExpireManager.IMP.getPendingExpired());
}

View File

@ -5,19 +5,19 @@ import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.wrappers.FakePlayer;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal2;
import com.intellectualcrafters.plot.object.RunnableVal3;
import com.intellectualcrafters.plot.object.worlds.SinglePlotArea;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.extension.platform.CommandManager;

View File

@ -19,6 +19,9 @@
package com.sk89q.worldedit.world.registry;
import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.io.Resources;
@ -30,6 +33,7 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.gson.VectorAdapter;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
@ -222,6 +226,29 @@ public class LegacyMapper {
Integer combinedId = getLegacyCombined(blockState);
return combinedId == null ? null : new int[] { combinedId >> 4, combinedId & 0xF };
}
public BaseBlock getBaseBlockFromPlotBlock(PlotBlock plotBlock) {
if(plotBlock instanceof StringPlotBlock) {
try {
return BlockTypes.get(plotBlock.toString()).getDefaultState().toBaseBlock();
}catch(Throwable failed) {
log.severe("Unable to convert StringPlotBlock " + plotBlock + " to BaseBlock!");
failed.printStackTrace();
return null;
}
}else if(plotBlock instanceof LegacyPlotBlock) {
try {
return new BaseBlock(((LegacyPlotBlock)plotBlock).getId(), ((LegacyPlotBlock)plotBlock).getData());
}catch(Throwable failed) {
log.severe("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
failed.printStackTrace();
return null;
}
}else {
log.severe("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
return null;
}
}
public static LegacyMapper getInstance() {
if (INSTANCE == null) {