Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 12:00:07 +01:00
Remove FaweLocation
it was a leftover from when WE didn't have Location
Dieser Commit ist enthalten in:
Ursprung
7b9a03a9ec
Commit
c773a1e278
@ -2,20 +2,15 @@ package com.boydti.fawe.bukkit;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLocation;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitPlayer extends FawePlayer<Player> {
|
||||
|
||||
private static ConsoleCommandSender console;
|
||||
@ -94,12 +89,6 @@ public class BukkitPlayer extends FawePlayer<Player> {
|
||||
Bukkit.getServer().dispatchCommand(this.parent, cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaweLocation getLocation() {
|
||||
final Location loc = this.parent.getLocation();
|
||||
return new FaweLocation(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.sk89q.worldedit.entity.Player toWorldEditPlayer() {
|
||||
return WorldEditPlugin.getInstance().wrapPlayer(this.parent);
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.example.NMSMappedFaweQueue;
|
||||
import com.boydti.fawe.example.NMSRelighter;
|
||||
import com.boydti.fawe.object.FaweLocation;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
@ -36,6 +35,7 @@ import com.sk89q.worldedit.internal.registry.AbstractFactory;
|
||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -319,8 +319,13 @@ public class FaweAPI {
|
||||
* Reading only part of the file will result in unreliable bounds info for large edits
|
||||
* @return
|
||||
*/
|
||||
public static List<DiskStorageHistory> getBDFiles(FaweLocation origin, UUID user, int radius, long timediff, boolean shallow) {
|
||||
File history = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + origin.world);
|
||||
public static List<DiskStorageHistory> getBDFiles(Location origin, UUID user, int radius, long timediff, boolean shallow) {
|
||||
Extent extent = origin.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
throw new IllegalArgumentException("Origin is not a valid world");
|
||||
}
|
||||
World world = (World) extent;
|
||||
File history = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(world));
|
||||
if (!history.exists()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -351,7 +356,6 @@ public class FaweAPI {
|
||||
}
|
||||
}
|
||||
}
|
||||
World world = origin.getWorld();
|
||||
files.sort((a, b) -> {
|
||||
String aName = a.getName();
|
||||
String bName = b.getName();
|
||||
@ -360,7 +364,7 @@ public class FaweAPI {
|
||||
long value = aI - bI;
|
||||
return value == 0 ? 0 : value < 0 ? -1 : 1;
|
||||
});
|
||||
RegionWrapper bounds = new RegionWrapper(origin.getX() - radius, origin.getX() + radius, origin.getZ() - radius, origin.getZ() + radius);
|
||||
RegionWrapper bounds = new RegionWrapper(origin.getBlockX() - radius, origin.getBlockX() + radius, origin.getBlockZ() - radius, origin.getBlockZ() + radius);
|
||||
RegionWrapper boundsPlus = new RegionWrapper(bounds.minX - 64, bounds.maxX + 512, bounds.minZ - 64, bounds.maxZ + 512);
|
||||
HashSet<RegionWrapper> regionSet = Sets.<RegionWrapper>newHashSet(bounds);
|
||||
ArrayList<DiskStorageHistory> result = new ArrayList<>();
|
||||
|
@ -9,6 +9,7 @@ import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -60,16 +61,16 @@ public class Rollback extends FaweCommand {
|
||||
return false;
|
||||
}
|
||||
player.deleteMeta(FawePlayer.METADATA_KEYS.ROLLBACK);
|
||||
final FaweLocation origin = player.getLocation();
|
||||
Location origin = player.getPlayer().getLocation();
|
||||
rollback(player, !player.hasPermission("fawe.rollback.deep"), Arrays.copyOfRange(args, 1, args.length), new RunnableVal<List<DiskStorageHistory>>() {
|
||||
@Override
|
||||
public void run(List<DiskStorageHistory> edits) {
|
||||
long total = 0;
|
||||
player.sendMessage("&d=| Username | Bounds | Distance | Changes | Age |=");
|
||||
for (DiskStorageHistory edit : edits) {
|
||||
DiskStorageHistory.DiskStorageSummary summary = edit.summarize(new RegionWrapper(origin.getX(), origin.getX(), origin.getZ(), origin.getZ()), !player.hasPermission("fawe.rollback.deep"));
|
||||
DiskStorageHistory.DiskStorageSummary summary = edit.summarize(new RegionWrapper(origin.getBlockX(), origin.getBlockX(), origin.getBlockZ(), origin.getBlockZ()), !player.hasPermission("fawe.rollback.deep"));
|
||||
RegionWrapper region = new RegionWrapper(summary.minX, summary.maxX, summary.minZ, summary.maxZ);
|
||||
int distance = region.distance(origin.getX(), origin.getZ());
|
||||
int distance = region.distance(origin.getBlockX(), origin.getBlockZ());
|
||||
String name = Fawe.imp().getName(edit.getUUID());
|
||||
long seconds = (System.currentTimeMillis() - edit.getBDFile().lastModified()) / 1000;
|
||||
total += edit.getBDFile().length();
|
||||
@ -176,7 +177,7 @@ public class Rollback extends FaweCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
FaweLocation origin = player.getLocation();
|
||||
Location origin = player.getLocation();
|
||||
List<DiskStorageHistory> edits = FaweAPI.getBDFiles(origin, user, radius, time, shallow);
|
||||
if (edits == null) {
|
||||
player.sendMessage("&cToo broad, try refining your search!");
|
||||
|
@ -21,6 +21,7 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -249,8 +250,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
public void setPacketViewer(FawePlayer player) {
|
||||
this.player = player;
|
||||
if (player != null) {
|
||||
FaweLocation pos = player.getLocation();
|
||||
this.chunkOffset = BlockVector2.at(1 + (pos.getX() >> 4), 1 + (pos.getZ() >> 4));
|
||||
Location pos = player.getLocation();
|
||||
this.chunkOffset = BlockVector2.at(1 + (pos.getBlockX() >> 4), 1 + (pos.getBlockZ() >> 4));
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,9 +292,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int OX = chunkOffset.getBlockX();
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
FaweLocation position = player.getLocation();
|
||||
int pcx = (position.getX() >> 4) - OX;
|
||||
int pcz = (position.getZ() >> 4) - OZ;
|
||||
Location position = player.getLocation();
|
||||
int pcx = (position.getBlockX() >> 4) - OX;
|
||||
int pcz = (position.getBlockZ() >> 4) - OZ;
|
||||
|
||||
int scx = Math.max(0, pcx - 15);
|
||||
int scz = Math.max(0, pcz - 15);
|
||||
@ -901,9 +902,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int OX = chunkOffset.getBlockX();
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
FaweLocation position = player.getLocation();
|
||||
int pcx = (position.getX() >> 4) - OX;
|
||||
int pcz = (position.getZ() >> 4) - OZ;
|
||||
Location position = player.getLocation();
|
||||
int pcx = (position.getBlockX() >> 4) - OX;
|
||||
int pcz = (position.getBlockZ() >> 4) - OZ;
|
||||
|
||||
int scx = Math.max(0, pcx - 10);
|
||||
int scz = Math.max(0, pcz - 10);
|
||||
|
@ -1,86 +0,0 @@
|
||||
package com.boydti.fawe.object;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.sk89q.worldedit.math.*;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import jdk.nashorn.internal.ir.Block;
|
||||
|
||||
/**
|
||||
* @deprecated This is likely to be removed in favor of {@link com.sk89q.worldedit.util.Location}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class FaweLocation {
|
||||
|
||||
public final BlockVector3 vector;
|
||||
@Deprecated
|
||||
public final int x;
|
||||
@Deprecated
|
||||
public final int z;
|
||||
@Deprecated
|
||||
public final int y;
|
||||
public final String world;
|
||||
|
||||
public FaweLocation(final String world, final int x, final int y, final int z) {
|
||||
this.world = world;
|
||||
this.vector = BlockVector3.at(x,y,z);
|
||||
this.x = vector.getX();
|
||||
this.y = vector.getY();
|
||||
this.z = vector.getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X coordinate.
|
||||
*
|
||||
* @return the x coordinate
|
||||
*/
|
||||
public int getX() {
|
||||
return vector.getX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y coordinate.
|
||||
*
|
||||
* @return the y coordinate
|
||||
*/
|
||||
public int getY() {
|
||||
return vector.getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Z coordinate.
|
||||
*
|
||||
* @return the z coordinate
|
||||
*/
|
||||
public int getZ() {
|
||||
return vector.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final FaweLocation other = (FaweLocation) obj;
|
||||
return ((this.x == other.x) && (this.y == other.y) && (this.z == other.z) && (this.world.equals(other.world)));
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return FaweAPI.getWorld(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return world + "," + x + "," + y + "," + z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.x << (8 + this.z) << (4 + this.y);
|
||||
}
|
||||
}
|
@ -44,6 +44,7 @@ import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CylinderRegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -489,7 +490,9 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract FaweLocation getLocation();
|
||||
public Location getLocation() {
|
||||
return getPlayer().getLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the WorldEdit player object
|
||||
|
@ -2,7 +2,6 @@ package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLocation;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
@ -14,6 +13,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
@ -89,7 +89,7 @@ public class WEManager {
|
||||
if (!Settings.IMP.REGION_RESTRICTIONS || player.hasPermission("fawe.bypass") || player.hasPermission("fawe.bypass.regions")) {
|
||||
return new Region[]{RegionWrapper.GLOBAL()};
|
||||
}
|
||||
FaweLocation loc = player.getLocation();
|
||||
Location loc = player.getLocation();
|
||||
String world = player.getWorld().getName();
|
||||
if (!world.equals(player.getMeta("lastMaskWorld"))) {
|
||||
player.deleteMeta("lastMaskWorld");
|
||||
@ -112,7 +112,7 @@ public class WEManager {
|
||||
FaweMask mask = iter.next();
|
||||
if (mask.isValid(player, type)) {
|
||||
Region region = mask.getRegion();
|
||||
if (region.contains(loc.vector)) {
|
||||
if (region.contains(loc.toBlockPoint())) {
|
||||
regions.add(region);
|
||||
} else {
|
||||
removed = true;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren