mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
PWE
This commit is contained in:
parent
70ff6d87c8
commit
aefd148bcd
@ -308,9 +308,8 @@ public class BukkitMain extends JavaPlugin implements Listener,IPlotMain {
|
||||
@Override
|
||||
public void registerWorldEditEvents() {
|
||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
||||
WorldEditPlugin worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
|
||||
final String version = worldEdit.getDescription().getVersion();
|
||||
PlotSquared.worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
final String version = PlotSquared.worldEdit.getDescription().getVersion();
|
||||
if ((version != null) && version.startsWith("5.")) {
|
||||
log("&cThis version of WorldEdit does not support PlotSquared.");
|
||||
log("&cPlease use WorldEdit 6+ for masking support");
|
||||
|
@ -53,6 +53,7 @@ import com.intellectualcrafters.plot.util.Logger.LogLevel;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
|
||||
public class PlotSquared {
|
||||
|
||||
@ -74,6 +75,7 @@ public class PlotSquared {
|
||||
public static TaskManager TASK = null;
|
||||
private static boolean LOADING_WORLD = false;
|
||||
public static Economy economy = null;
|
||||
public static WorldEditPlugin worldEdit = null;
|
||||
|
||||
private final static HashMap<String, PlotWorld> plotworlds = new HashMap<>();
|
||||
private final static HashMap<String, PlotManager> plotmanagers = new HashMap<>();
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -29,6 +28,7 @@ import com.intellectualcrafters.plot.BukkitMain;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -44,7 +44,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
@SuppressWarnings("ALL") public class PWE {
|
||||
public class PWE {
|
||||
|
||||
public static void setMask(final Player p, final Location l, boolean force) {
|
||||
try {
|
||||
@ -54,7 +54,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
} else {
|
||||
s = PlotSquared.worldEdit.getSession(p);
|
||||
}
|
||||
if (!PlotSquared.isPlotWorld(p.getWorld())) {
|
||||
if (!PlotSquared.isPlotWorld(p.getWorld().getName())) {
|
||||
removeMask(p);
|
||||
}
|
||||
final PlotId id = PlayerFunctions.getPlot(l);
|
||||
@ -66,13 +66,13 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
}
|
||||
boolean r = ((plot.getOwner() != null) && plot.getOwner().equals(UUIDHandler.getUUID(p))) || plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(UUIDHandler.getUUID(p));
|
||||
if (r) {
|
||||
final World w = l.getWorld();
|
||||
final String w = l.getWorld();
|
||||
|
||||
final Location bloc = PlotHelper.getPlotBottomLoc(w, plot.id);
|
||||
final Location tloc = PlotHelper.getPlotTopLoc(w, plot.id);
|
||||
|
||||
final Vector bvec = new Vector(bloc.getBlockX() + 1, bloc.getBlockY(), bloc.getBlockZ() + 1);
|
||||
final Vector tvec = new Vector(tloc.getBlockX(), tloc.getBlockY(), tloc.getBlockZ());
|
||||
final Vector bvec = new Vector(bloc.getX() + 1, bloc.getY(), bloc.getZ() + 1);
|
||||
final Vector tvec = new Vector(tloc.getX(), tloc.getY(), tloc.getZ());
|
||||
|
||||
final LocalWorld lw = PlotSquared.worldEdit.wrapPlayer(p).getWorld();
|
||||
|
||||
|
@ -24,13 +24,13 @@ package com.intellectualcrafters.plot.util;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.ChatPaginator;
|
||||
@ -133,7 +133,7 @@ import java.util.UUID;
|
||||
return null;
|
||||
}
|
||||
final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
|
||||
return manager.getPlotIdAbs(plotworld, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
return manager.getPlotIdAbs(plotworld, loc.getX(), loc.getY(), loc.getZ());
|
||||
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ import java.util.UUID;
|
||||
return null;
|
||||
}
|
||||
final PlotWorld plotworld = PlotSquared.getWorldSettings(world);
|
||||
PlotId id = manager.getPlotId(plotworld, loc.getBlockX(),loc.getBlockY(), loc.getBlockZ());
|
||||
PlotId id = manager.getPlotId(plotworld, loc.getX(),loc.getY(), loc.getZ());
|
||||
|
||||
if (id!=null && plotworld.TYPE == 2) {
|
||||
if (ClusterManager.getCluster(world, id) == null) {
|
||||
|
@ -49,6 +49,7 @@ import com.intellectualcrafters.jnbt.Tag;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
|
||||
@ -231,7 +232,7 @@ public class SchematicHandler {
|
||||
*
|
||||
* @return tag
|
||||
*/
|
||||
public static CompoundTag getCompoundTag(final World world, PlotId id) {
|
||||
public static CompoundTag getCompoundTag(final String world, PlotId id) {
|
||||
if (!PlotSquared.getPlots(world).containsKey(id)) {
|
||||
return null;
|
||||
}
|
||||
@ -297,19 +298,18 @@ public class SchematicHandler {
|
||||
for (int y = 0; y < height; y++) {
|
||||
final int index = (y * width * length) + (z * width) + x;
|
||||
|
||||
block = BukkitUtil.getBlock(new Location(world, sx + x, sy + y, sz + z));
|
||||
@SuppressWarnings("deprecation") final int id2 = block.getTypeId();
|
||||
PlotBlock block = BukkitUtil.getBlock(new Location(world, sx + x, sy + y, sz + z));
|
||||
|
||||
if (id2 > 255) {
|
||||
if (block.id > 255) {
|
||||
if (addBlocks == null) {
|
||||
addBlocks = new byte[(blocks.length >> 1) + 1];
|
||||
}
|
||||
|
||||
addBlocks[index >> 1] = (byte) (((index & 1) == 0) ? (addBlocks[index >> 1] & 0xF0) | ((id2 >> 8) & 0xF) : (addBlocks[index >> 1] & 0xF) | (((id2 >> 8) & 0xF) << 4));
|
||||
addBlocks[index >> 1] = (byte) (((index & 1) == 0) ? (addBlocks[index >> 1] & 0xF0) | ((block.id >> 8) & 0xF) : (addBlocks[index >> 1] & 0xF) | (((block.id >> 8) & 0xF) << 4));
|
||||
}
|
||||
|
||||
blocks[index] = (byte) id2;
|
||||
blockData[index] = block.getData();
|
||||
blocks[index] = (byte) block.id;
|
||||
blockData[index] = block.data;
|
||||
|
||||
// We need worldedit to save tileentity data or entities
|
||||
// - it uses NMS and CB internal code, which changes every
|
||||
|
Loading…
Reference in New Issue
Block a user