Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 01:50:06 +01:00
Removal of many prefixes and deprecation of FaweLocation
- Removed some prefixes to help make upstream merging a bit easier. - Replaced reflection code for titles with the regular bukkit api. - Removed FAWELocation and FAWEPlayer where it wasn't needed. - Deprecated FaweLocation since having it in the first place is very stupid. - FAWEPlayer should also be deprecated soon because the majority of that code is redundant.
Dieser Commit ist enthalten in:
Ursprung
bf5d2c2788
Commit
b42553116c
@ -23,7 +23,7 @@ public class PatternUtil {
|
||||
snipeData.sendMessage(ChatColor.GOLD + "Voxel: " + ChatColor.RED + arg);
|
||||
return pattern;
|
||||
} catch (InputParseException e) {
|
||||
fp.sendMessage(BBC.getPrefix() + e.getMessage());
|
||||
fp.sendMessage(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -66,21 +66,11 @@ public class BukkitPlayer extends FawePlayer<Player> {
|
||||
|
||||
@Override
|
||||
public void resetTitle() {
|
||||
sendTitle("","");
|
||||
parent.resetTitle();
|
||||
}
|
||||
|
||||
public void sendTitle(String title, String sub) {
|
||||
try {
|
||||
Method methodSendTitle = Player.class.getDeclaredMethod("sendTitle", String.class, String.class, int.class, int.class, int.class);
|
||||
methodSendTitle.invoke(parent, ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20);
|
||||
return;
|
||||
} catch (Throwable ignore) {
|
||||
try {
|
||||
Method methodSendTitle = Player.class.getDeclaredMethod("sendTitle", String.class, String.class);
|
||||
methodSendTitle.invoke(parent, ChatColor.GOLD + title, ChatColor.GOLD + sub);
|
||||
return;
|
||||
} catch (Throwable ignore2) {}
|
||||
}
|
||||
parent.sendTitle(ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20);
|
||||
if (console == null) {
|
||||
console = Bukkit.getConsoleSender();
|
||||
Bukkit.getServer().dispatchCommand(console, "gamerule sendCommandFeedback false");
|
||||
|
@ -373,7 +373,7 @@ public class FaweAPI {
|
||||
long value = aI - bI;
|
||||
return value == 0 ? 0 : value < 0 ? -1 : 1;
|
||||
});
|
||||
RegionWrapper bounds = new RegionWrapper(origin.x - radius, origin.x + radius, origin.z - radius, origin.z + radius);
|
||||
RegionWrapper bounds = new RegionWrapper(origin.getX() - radius, origin.getX() + radius, origin.getZ() - radius, origin.getZ() + 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<>();
|
||||
|
@ -67,9 +67,9 @@ public class Rollback extends FaweCommand {
|
||||
long total = 0;
|
||||
player.sendMessage("&d=| Username | Bounds | Distance | Changes | Age |=");
|
||||
for (DiskStorageHistory edit : edits) {
|
||||
DiskStorageHistory.DiskStorageSummary summary = edit.summarize(new RegionWrapper(origin.x, origin.x, origin.z, origin.z), !player.hasPermission("fawe.rollback.deep"));
|
||||
DiskStorageHistory.DiskStorageSummary summary = edit.summarize(new RegionWrapper(origin.getX(), origin.getX(), origin.getZ(), origin.getZ()), !player.hasPermission("fawe.rollback.deep"));
|
||||
RegionWrapper region = new RegionWrapper(summary.minX, summary.maxX, summary.minZ, summary.maxZ);
|
||||
int distance = region.distance(origin.x, origin.z);
|
||||
int distance = region.distance(origin.getX(), origin.getZ());
|
||||
String name = Fawe.imp().getName(edit.getUUID());
|
||||
long seconds = (System.currentTimeMillis() - edit.getBDFile().lastModified()) / 1000;
|
||||
total += edit.getBDFile().length();
|
||||
@ -101,7 +101,7 @@ public class Rollback extends FaweCommand {
|
||||
BBC.NO_PERM.send(player, "fawe.rollback.perform");
|
||||
return false;
|
||||
}
|
||||
final List<DiskStorageHistory> edits = (List<DiskStorageHistory>) player.getMeta(FawePlayer.METADATA_KEYS.ROLLBACK);
|
||||
final List<DiskStorageHistory> edits = player.getMeta(FawePlayer.METADATA_KEYS.ROLLBACK);
|
||||
player.deleteMeta(FawePlayer.METADATA_KEYS.ROLLBACK);
|
||||
if (edits == null) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
||||
@ -148,7 +148,7 @@ public class Rollback extends FaweCommand {
|
||||
} else {
|
||||
user = Fawe.imp().getUUID(split[1]);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
if (user == null) {
|
||||
player.sendMessage("&dInvalid user: " + split[1]);
|
||||
|
@ -250,7 +250,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
this.player = player;
|
||||
if (player != null) {
|
||||
FaweLocation pos = player.getLocation();
|
||||
this.chunkOffset = BlockVector2.at(1 + (pos.x >> 4), 1 + (pos.z >> 4));
|
||||
this.chunkOffset = BlockVector2.at(1 + (pos.getX() >> 4), 1 + (pos.getZ() >> 4));
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,8 +292,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
FaweLocation position = player.getLocation();
|
||||
int pcx = (position.x >> 4) - OX;
|
||||
int pcz = (position.z >> 4) - OZ;
|
||||
int pcx = (position.getX() >> 4) - OX;
|
||||
int pcz = (position.getZ() >> 4) - OZ;
|
||||
|
||||
int scx = Math.max(0, pcx - 15);
|
||||
int scz = Math.max(0, pcz - 15);
|
||||
@ -902,8 +902,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
FaweLocation position = player.getLocation();
|
||||
int pcx = (position.x >> 4) - OX;
|
||||
int pcz = (position.z >> 4) - OZ;
|
||||
int pcx = (position.getX() >> 4) - OX;
|
||||
int pcz = (position.getZ() >> 4) - OZ;
|
||||
|
||||
int scx = Math.max(0, pcx - 10);
|
||||
int scz = Math.max(0, pcz - 10);
|
||||
|
@ -1,23 +1,58 @@
|
||||
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;
|
||||
public final int y;
|
||||
@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.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
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
|
||||
|
@ -11,12 +11,10 @@ import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.task.SimpleAsyncNotifyQueue;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.boydti.fawe.util.*;
|
||||
import com.boydti.fawe.wrappers.FakePlayer;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.worldedit.*;
|
||||
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.*;
|
||||
@ -63,15 +61,9 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
* @return
|
||||
*/
|
||||
public static <V> FawePlayer<V> wrap(Object obj) {
|
||||
if (obj == null || (obj instanceof String && obj.equals("*"))) {
|
||||
return FakePlayer.getConsole().toFawePlayer();
|
||||
}
|
||||
if (obj instanceof FawePlayer) {
|
||||
return (FawePlayer<V>) obj;
|
||||
}
|
||||
if (obj instanceof FakePlayer) {
|
||||
return ((FakePlayer) obj).toFawePlayer();
|
||||
}
|
||||
if (obj instanceof Player) {
|
||||
Player actor = LocationMaskedPlayerWrapper.unwrap((Player) obj);
|
||||
if (obj instanceof PlayerProxy) {
|
||||
@ -95,9 +87,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
if (existing != null) {
|
||||
return existing;
|
||||
}
|
||||
FakePlayer fake = new FakePlayer(actor.getName(), actor.getUniqueId(), actor);
|
||||
return fake.toFawePlayer();
|
||||
}
|
||||
}
|
||||
if (obj.getClass().getName().contains("CraftPlayer") && !Fawe.imp().getPlatform().equals("bukkit")) {
|
||||
try {
|
||||
Method methodGetHandle = obj.getClass().getDeclaredMethod("getHandle");
|
||||
|
@ -75,8 +75,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
default BlockState getLazyBlock(int x, int y, int z) {
|
||||
int combinedId4Data = getCachedCombinedId4Data(x, y, z, BlockTypes.AIR.getInternalId());
|
||||
try {
|
||||
BlockState state = BlockState.getFromInternalId(combinedId4Data);
|
||||
return state;
|
||||
return BlockState.getFromInternalId(combinedId4Data);
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
@ -85,7 +84,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
|
||||
@Override
|
||||
default <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||
return setBlock(x, y, z, block.getInternalId(), block instanceof BaseBlock ? ((BaseBlock)block).getNbtData() : null);
|
||||
return setBlock(x, y, z, block.getInternalId(), block instanceof BaseBlock ? block.getNbtData() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,8 +214,8 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
if (chunks.size() > 225) {
|
||||
synchronized (SchemVis.this) {
|
||||
FaweLocation pos = player.getLocation();
|
||||
int centerX = pos.x >> 4;
|
||||
int centerZ = pos.z >> 4;
|
||||
int centerX = pos.getX() >> 4;
|
||||
int centerZ = pos.getZ() >> 4;
|
||||
ObjectIterator<Long2ObjectMap.Entry<MCAChunk>> iter = chunks.long2ObjectEntrySet().fastIterator();
|
||||
while (iter.hasNext()) {
|
||||
Long2ObjectMap.Entry<MCAChunk> entry = iter.next();
|
||||
@ -274,7 +274,7 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
}
|
||||
|
||||
private Map.Entry<File, Long> getEntry(File file, long position) {
|
||||
return new AbstractMap.SimpleEntry(file, position);
|
||||
return new AbstractMap.SimpleEntry<>(file, position);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -554,8 +554,8 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
FaweLocation position = player.getLocation();
|
||||
int pcx = (position.x >> 4) - OX;
|
||||
int pcz = (position.z >> 4) - OZ;
|
||||
int pcx = (position.getX() >> 4) - OX;
|
||||
int pcz = (position.getZ() >> 4) - OZ;
|
||||
|
||||
int scx = pcx - 15;
|
||||
int scz = pcz - 15;
|
||||
@ -564,9 +564,7 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
|
||||
for (int cz = scz; cz <= ecz; cz++) {
|
||||
for (int cx = scx; cx <= ecx; cx++) {
|
||||
final int finalCX = cx;
|
||||
final int finalCZ = cz;
|
||||
send(packetQueue, finalCX, finalCZ);
|
||||
send(packetQueue, cx, cz);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -607,8 +605,8 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
FaweLocation position = player.getLocation();
|
||||
int pcx = (position.x >> 4) - OX;
|
||||
int pcz = (position.z >> 4) - OZ;
|
||||
int pcx = (position.getX() >> 4) - OX;
|
||||
int pcz = (position.getZ() >> 4) - OZ;
|
||||
|
||||
int scx = pcx - 15;
|
||||
int scz = pcz - 15;
|
||||
|
@ -90,7 +90,7 @@ public class WEManager {
|
||||
return new Region[]{RegionWrapper.GLOBAL()};
|
||||
}
|
||||
FaweLocation loc = player.getLocation();
|
||||
String world = loc.world;
|
||||
String world = player.getWorld().getName();
|
||||
if (!world.equals(player.getMeta("lastMaskWorld"))) {
|
||||
player.deleteMeta("lastMaskWorld");
|
||||
player.deleteMeta("lastMask");
|
||||
@ -112,7 +112,7 @@ public class WEManager {
|
||||
FaweMask mask = iter.next();
|
||||
if (mask.isValid(player, type)) {
|
||||
Region region = mask.getRegion();
|
||||
if (region.contains(loc.x, loc.y, loc.z)) {
|
||||
if (region.contains(loc.vector)) {
|
||||
regions.add(region);
|
||||
} else {
|
||||
removed = true;
|
||||
@ -144,12 +144,7 @@ public class WEManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!tmpMasks.isEmpty()) {
|
||||
masks = tmpMasks;
|
||||
regions = masks.stream().map(FaweMask::getRegion).collect(Collectors.toSet());
|
||||
} else {
|
||||
regions.addAll(backupRegions);
|
||||
}
|
||||
regions.addAll(backupRegions);
|
||||
if (!masks.isEmpty()) {
|
||||
player.setMeta("lastMask", masks);
|
||||
} else {
|
||||
|
@ -1,313 +0,0 @@
|
||||
package com.boydti.fawe.wrappers;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.object.FaweLocation;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.*;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.NullWorld;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Only really useful for executing commands from console<br>
|
||||
* - The API itself doesn't any fake player anywhere
|
||||
*/
|
||||
public class FakePlayer extends AbstractPlayerActor {
|
||||
private static FakePlayer CONSOLE;
|
||||
|
||||
public static FakePlayer getConsole() {
|
||||
if (CONSOLE == null) {
|
||||
CONSOLE = new FakePlayer("#CONSOLE", null, null) {
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
return CONSOLE;
|
||||
}
|
||||
|
||||
private final Actor parent;
|
||||
private final String name;
|
||||
private final UUID uuid;
|
||||
private World world;
|
||||
private Location pos;
|
||||
|
||||
public static FakePlayer wrap(String name, UUID uuid, Actor parent) {
|
||||
if (parent != null && parent.getUniqueId().toString().equals("a233eb4b-4cab-42cd-9fd9-7e7b9a3f74be")) {
|
||||
return getConsole();
|
||||
}
|
||||
return new FakePlayer(name, uuid, parent);
|
||||
}
|
||||
|
||||
public FakePlayer(String name, UUID uuid, Actor parent) {
|
||||
this.name = name;
|
||||
this.uuid = uuid == null ? UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)) : uuid;
|
||||
try {
|
||||
this.world = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getWorlds().get(0);
|
||||
} catch (NoCapablePlatformException e) {
|
||||
this.world = NullWorld.getInstance();
|
||||
}
|
||||
this.pos = new Location(world, 0, 0, 0);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private FawePlayer fp = null;
|
||||
|
||||
public FawePlayer toFawePlayer() {
|
||||
if (fp != null) {
|
||||
Fawe.get().register(fp);
|
||||
return fp;
|
||||
}
|
||||
FawePlayer existing = Fawe.get().getCachedPlayer(getName());
|
||||
if (existing != null) {
|
||||
return fp = existing;
|
||||
}
|
||||
final Actor actor = this;
|
||||
return fp = new FawePlayer(this) {
|
||||
@Override
|
||||
public void sendTitle(String head, String sub) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTitle() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return actor.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return actor.getUniqueId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String perm) {
|
||||
return actor.hasPermission(perm) || (Boolean) getMeta("perm." + perm, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermission(String perm, boolean flag) {
|
||||
setMeta("perm." + perm, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
actor.print(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeCommand(String substring) {
|
||||
CommandManager.getInstance().handleCommand(new CommandEvent(actor, substring));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaweLocation getLocation() {
|
||||
Location loc = FakePlayer.this.getLocation();
|
||||
String world;
|
||||
if (loc.getExtent() instanceof World) {
|
||||
world = ((World) loc.getExtent()).getName();
|
||||
} else {
|
||||
world = loc.getExtent().toString();
|
||||
}
|
||||
return new FaweLocation(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player toWorldEditPlayer() {
|
||||
return FakePlayer.this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseItemStack getItemInHand(HandSide handSide) {
|
||||
return new BaseItemStack(ItemTypes.AIR, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getBlockInHand(HandSide ignore) {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveItem(BaseItemStack itemStack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockBag getInventoryBlockBag() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||
//TODO: find replacement for following code
|
||||
// if (pos instanceof Location) {
|
||||
// Extent extent = ((Location) pos).getExtent();
|
||||
// if (extent instanceof World) this.world = (World) extent;
|
||||
// }
|
||||
this.pos = new Location(world, pos, yaw, pitch);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseEntity getState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (parent != null) {
|
||||
return parent.getName();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
if (parent != null) {
|
||||
parent.printRaw(msg);
|
||||
return;
|
||||
}
|
||||
Fawe.get().debugPlain(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDebug(String msg) {
|
||||
if (parent != null) {
|
||||
parent.printDebug(msg);
|
||||
return;
|
||||
}
|
||||
Fawe.get().debugPlain(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
if (parent != null) {
|
||||
parent.print(msg);
|
||||
return;
|
||||
}
|
||||
Fawe.get().debugPlain(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printError(String msg) {
|
||||
if (parent != null) {
|
||||
parent.printError(msg);
|
||||
return;
|
||||
}
|
||||
Fawe.get().debugPlain(msg);
|
||||
}
|
||||
|
||||
private FakeSessionKey key;
|
||||
|
||||
@Override
|
||||
public SessionKey getSessionKey() {
|
||||
if (parent != null) {
|
||||
return parent.getSessionKey();
|
||||
}
|
||||
if (key == null) {
|
||||
key = new FakeSessionKey(uuid, name);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getFacet(Class<? extends T> cls) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId() {
|
||||
if (parent != null) {
|
||||
return parent.getUniqueId();
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
if (parent != null) {
|
||||
return parent.getGroups();
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
if (parent != null) {
|
||||
return parent.hasPermission(permission);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class FakeSessionKey implements SessionKey {
|
||||
private final UUID uuid;
|
||||
private final String name;
|
||||
|
||||
private FakeSessionKey(UUID uuid, String name) {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPersistent() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLocation(Location location) {
|
||||
this.pos = location;
|
||||
return true;
|
||||
}
|
||||
}
|
@ -612,7 +612,7 @@ public final class WorldEdit {
|
||||
String ext = filename.substring(index + 1);
|
||||
|
||||
if (!ext.equalsIgnoreCase("js")) {
|
||||
player.printError(BBC.getPrefix() + "Only .js scripts are currently supported");
|
||||
player.printError("Only .js scripts are currently supported");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ public final class WorldEdit {
|
||||
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
|
||||
|
||||
if (file == null) {
|
||||
player.printError(BBC.getPrefix() + "Script does not exist: " + filename);
|
||||
player.printError("Script does not exist: " + filename);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -638,7 +638,7 @@ public final class WorldEdit {
|
||||
in.close();
|
||||
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
player.printError(BBC.getPrefix() + "Script read error: " + e.getMessage());
|
||||
player.printError("Script read error: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -651,8 +651,8 @@ public final class WorldEdit {
|
||||
try {
|
||||
engine = new RhinoCraftScriptEngine();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
player.printError(BBC.getPrefix() + "Failed to find an installed script engine.");
|
||||
player.printError(BBC.getPrefix() + "Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation");
|
||||
player.printError("Failed to find an installed script engine.");
|
||||
player.printError("Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -666,15 +666,15 @@ public final class WorldEdit {
|
||||
try {
|
||||
engine.evaluate(script, filename, vars);
|
||||
} catch (ScriptException e) {
|
||||
player.printError(BBC.getPrefix() + "Failed to execute:");
|
||||
player.printError("Failed to execute:");
|
||||
player.printRaw(e.getMessage());
|
||||
logger.warn(BBC.getPrefix() + "Failed to execute script", e);
|
||||
logger.warn("Failed to execute script", e);
|
||||
} catch (NumberFormatException | WorldEditException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
player.printError(BBC.getPrefix() + "Failed to execute (see console):");
|
||||
player.printError("Failed to execute (see console):");
|
||||
player.printRaw(e.getClass().getCanonicalName());
|
||||
logger.warn(BBC.getPrefix() + "Failed to execute script", e);
|
||||
logger.warn("Failed to execute script", e);
|
||||
} finally {
|
||||
for (EditSession editSession : scriptContext.getEditSessions()) {
|
||||
editSession.flushSession();
|
||||
|
@ -201,7 +201,7 @@ public class BiomeCommands extends MethodCommands {
|
||||
c.getAmount() / (double) size * 100,
|
||||
data == null ? "Unknown" : data.getName(),
|
||||
c.getID().getInternalId());
|
||||
player.print(BBC.getPrefix() + str);
|
||||
player.print(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,9 +76,9 @@ public class ChunkCommands {
|
||||
String filename = "c." + Integer.toString(chunkX, 36)
|
||||
+ "." + Integer.toString(chunkZ, 36) + ".dat";
|
||||
|
||||
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename(
|
||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print("Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
player.print("McRegion: region/" + McRegionChunkStore.getFilename(
|
||||
BlockVector2.at(chunkX, chunkZ)));
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class ChunkCommands {
|
||||
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
|
||||
for (BlockVector2 chunk : chunks) {
|
||||
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
|
||||
player.print(LegacyChunkStore.getFilename(chunk));
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,14 +108,14 @@ public class ChunkCommands {
|
||||
@CommandPermissions("worldedit.delchunks")
|
||||
@Logging(REGION)
|
||||
public void deleteChunks(Player player, LocalSession session) throws WorldEditException {
|
||||
player.print(BBC.getPrefix() + "Note that this command does not yet support the mcregion format.");
|
||||
player.print("Note that this command does not yet support the mcregion format.");
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
|
||||
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
FileOutputStream out = null;
|
||||
|
||||
if (config.shellSaveType == null) {
|
||||
player.printError(BBC.getPrefix() + "Shell script type must be configured: 'bat' or 'bash' expected.");
|
||||
player.printError("Shell script type must be configured: 'bat' or 'bash' expected.");
|
||||
} else if (config.shellSaveType.equalsIgnoreCase("bat")) {
|
||||
try {
|
||||
out = new FileOutputStream("worldedit-delchunks.bat");
|
||||
@ -137,7 +137,7 @@ public class ChunkCommands {
|
||||
writer.write("ECHO Complete.\r\n");
|
||||
writer.write("PAUSE\r\n");
|
||||
writer.close();
|
||||
player.print(BBC.getPrefix() + "worldedit-delchunks.bat written. Run it when no one is near the region.");
|
||||
player.print("worldedit-delchunks.bat written. Run it when no one is near the region.");
|
||||
} catch (IOException e) {
|
||||
player.printError("Error occurred: " + e.getMessage());
|
||||
} finally {
|
||||
@ -169,8 +169,8 @@ public class ChunkCommands {
|
||||
writer.write("echo Complete.\n");
|
||||
writer.write("read -p \"Press any key to continue...\"\n");
|
||||
writer.close();
|
||||
player.print(BBC.getPrefix() + "worldedit-delchunks.sh written. Run it when no one is near the region.");
|
||||
player.print(BBC.getPrefix() + "You will have to chmod it to be executable.");
|
||||
player.print("worldedit-delchunks.sh written. Run it when no one is near the region.");
|
||||
player.print("You will have to chmod it to be executable.");
|
||||
} catch (IOException e) {
|
||||
player.printError("Error occurred: " + e.getMessage());
|
||||
} finally {
|
||||
@ -182,7 +182,7 @@ public class ChunkCommands {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.printError(BBC.getPrefix() + "Shell script type must be configured: 'bat' or 'bash' expected.");
|
||||
player.printError("Shell script type must be configured: 'bat' or 'bash' expected.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public abstract class HelpBuilder implements Runnable {
|
||||
displayFailure(BBC.HELP_SUGGEST.f(arg, StringMan.join(found, ", ")));
|
||||
return;
|
||||
} else {
|
||||
String msg = String.format(BBC.getPrefix() + "The sub-command '%s' under '%s' could not be found.",
|
||||
String msg = String.format("The sub-command '%s' under '%s' could not be found.",
|
||||
command, Joiner.on(" ").join(visited));
|
||||
displayFailure(msg);
|
||||
return;
|
||||
@ -152,7 +152,7 @@ public abstract class HelpBuilder implements Runnable {
|
||||
visited.add(args.getString(i));
|
||||
isRootLevel = false;
|
||||
} else {
|
||||
String msg = String.format(BBC.getPrefix() + "'%s' has no sub-commands. (Maybe '%s' is for a parameter?)",
|
||||
String msg = String.format("'%s' has no sub-commands. (Maybe '%s' is for a parameter?)",
|
||||
Joiner.on(" ").join(visited), command);
|
||||
displayFailure(msg);
|
||||
return;
|
||||
@ -189,7 +189,7 @@ public abstract class HelpBuilder implements Runnable {
|
||||
|
||||
// Box
|
||||
if (offset >= aliases.size()) {
|
||||
displayFailure(String.format(BBC.getPrefix() + "There is no page %d (total number of pages is %d).", page + 1, pageTotal));
|
||||
displayFailure(String.format("There is no page %d (total number of pages is %d).", page + 1, pageTotal));
|
||||
} else {
|
||||
int end = Math.min(offset + perPage, aliases.size());
|
||||
List<CommandMapping> subAliases = aliases.subList(offset, end);
|
||||
|
@ -256,7 +256,7 @@ public class OptionsCommands {
|
||||
int limit = args.argsLength() == 0 ? config.calculationTimeout : Math.max(-1, args.getInteger(0));
|
||||
if (!mayDisable && config.maxCalculationTimeout > -1) {
|
||||
if (limit > config.maxCalculationTimeout) {
|
||||
player.printError(BBC.getPrefix() + "Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms.");
|
||||
player.printError("Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -264,9 +264,9 @@ public class OptionsCommands {
|
||||
session.setTimeout(limit);
|
||||
|
||||
if (limit != config.calculationTimeout) {
|
||||
player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)");
|
||||
player.print("Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)");
|
||||
} else {
|
||||
player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms.");
|
||||
player.print("Timeout time set to " + limit + " ms.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,27 +281,27 @@ public class OptionsCommands {
|
||||
public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
|
||||
if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) {
|
||||
throw new DisallowedUsageException(BBC.getPrefix() + "This functionality is disabled in the configuration!");
|
||||
throw new DisallowedUsageException("This functionality is disabled in the configuration!");
|
||||
}
|
||||
String newState = args.getString(0, null);
|
||||
if (session.shouldUseServerCUI()) {
|
||||
if ("on".equals(newState)) {
|
||||
player.printError(BBC.getPrefix() + "Server CUI already enabled.");
|
||||
player.printError("Server CUI already enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.setUseServerCUI(false);
|
||||
session.updateServerCUI(player);
|
||||
player.print(BBC.getPrefix() + "Server CUI disabled.");
|
||||
player.print("Server CUI disabled.");
|
||||
} else {
|
||||
if ("off".equals(newState)) {
|
||||
player.printError(BBC.getPrefix() + "Server CUI already disabled.");
|
||||
player.printError("Server CUI already disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.setUseServerCUI(true);
|
||||
session.updateServerCUI(player);
|
||||
player.print(BBC.getPrefix() + "Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.");
|
||||
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,29 +327,29 @@ public class OptionsCommands {
|
||||
ItemType type = ItemTypes.get(query);
|
||||
|
||||
if (type != null) {
|
||||
actor.print(BBC.getPrefix() + type.getId() + " (" + type.getName() + ")");
|
||||
actor.print(type.getId() + " (" + type.getName() + ")");
|
||||
} else {
|
||||
if (query.length() <= 2) {
|
||||
actor.printError(BBC.getPrefix() + "Enter a longer search string (len > 2).");
|
||||
actor.printError("Enter a longer search string (len > 2).");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!blocksOnly && !itemsOnly) {
|
||||
actor.print(BBC.getPrefix() + "Searching for: " + query);
|
||||
actor.print("Searching for: " + query);
|
||||
} else if (blocksOnly && itemsOnly) {
|
||||
actor.printError(BBC.getPrefix() + "You cannot use both the 'b' and 'i' flags simultaneously.");
|
||||
actor.printError("You cannot use both the 'b' and 'i' flags simultaneously.");
|
||||
return;
|
||||
} else if (blocksOnly) {
|
||||
actor.print(BBC.getPrefix() + "Searching for blocks: " + query);
|
||||
actor.print("Searching for blocks: " + query);
|
||||
} else {
|
||||
actor.print(BBC.getPrefix() + "Searching for items: " + query);
|
||||
actor.print("Searching for items: " + query);
|
||||
}
|
||||
|
||||
int found = 0;
|
||||
|
||||
for (ItemType searchType : ItemType.REGISTRY) {
|
||||
if (found >= 15) {
|
||||
actor.print(BBC.getPrefix() + "Too many results!");
|
||||
actor.print("Too many results!");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ public class OptionsCommands {
|
||||
|
||||
for (String alias : Sets.newHashSet(searchType.getId(), searchType.getName())) {
|
||||
if (alias.contains(query)) {
|
||||
actor.print(BBC.getPrefix() + searchType.getId() + " (" + searchType.getName() + ")");
|
||||
actor.print(searchType.getId() + " (" + searchType.getName() + ")");
|
||||
++found;
|
||||
break;
|
||||
}
|
||||
@ -371,7 +371,7 @@ public class OptionsCommands {
|
||||
}
|
||||
|
||||
if (found == 0) {
|
||||
actor.printError(BBC.getPrefix() + "No items found.");
|
||||
actor.printError("No items found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.example.NMSMappedFaweQueue;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FaweLocation;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
@ -115,14 +114,14 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void fixlighting(Player player) throws WorldEditException {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final FaweLocation loc = fp.getLocation();
|
||||
final Location loc = player.getLocation();
|
||||
Region selection = fp.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
final int cx = loc.getBlockX() >> 4;
|
||||
final int cz = loc.getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.ALL);
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection,null, FaweQueue.RelightMode.ALL);
|
||||
BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count);
|
||||
}
|
||||
|
||||
@ -135,9 +134,9 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void getlighting(Player player) throws WorldEditException {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final FaweLocation loc = fp.getLocation();
|
||||
final Location loc = player.getLocation();
|
||||
FaweQueue queue = fp.getFaweQueue(false);
|
||||
fp.sendMessage(BBC.getPrefix() + "Light: " + queue.getEmmittedLight(loc.x, loc.y, loc.z) + " | " + queue.getSkyLight(loc.x, loc.y, loc.z));
|
||||
fp.sendMessage(BBC.getPrefix() + "Light: " + queue.getEmmittedLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()) + " | " + queue.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -149,14 +148,13 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.light.remove")
|
||||
public void removelighting(Player player) {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final FaweLocation loc = fp.getLocation();
|
||||
Region selection = fp.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
final int cx = player.getLocation().getBlockX() >> 4;
|
||||
final int cz = player.getLocation().getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.NONE);
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null, FaweQueue.RelightMode.NONE);
|
||||
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
|
||||
}
|
||||
|
||||
@ -188,12 +186,9 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setlighting(Player player, @Selection Region region, @Range(min = 0, max = 15) int value) {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final FaweLocation loc = fp.getLocation();
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
|
||||
for (BlockVector3 pt : region) {
|
||||
queue.setBlockLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
|
||||
queue.setBlockLight(pt.getX(), pt.getY(), pt.getZ(), value);
|
||||
}
|
||||
int count = 0;
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
@ -212,12 +207,9 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setskylighting(Player player, @Selection Region region, @Range(min = 0, max = 15) int value) {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final FaweLocation loc = fp.getLocation();
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
|
||||
for (BlockVector3 pt : region) {
|
||||
queue.setSkyLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
|
||||
queue.setSkyLight(pt.getX(), pt.getY(), pt.getZ(), value);
|
||||
}
|
||||
int count = 0;
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
@ -676,7 +668,7 @@ public class RegionCommands extends MethodCommands {
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
}
|
||||
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
@ -722,10 +714,10 @@ public class RegionCommands extends MethodCommands {
|
||||
BBC.COMMAND_REGEN_2.send(player);
|
||||
} else if (biome == null) {
|
||||
BBC.COMMAND_REGEN_0.send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_REGEN_0.send(player);
|
||||
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_0.send(player);
|
||||
} else if (seed == null) {
|
||||
BBC.COMMAND_REGEN_1.send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player);
|
||||
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player);
|
||||
} else {
|
||||
BBC.COMMAND_REGEN_2.send(player);
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.wand.toggle")
|
||||
public void toggleWand(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
|
||||
|
||||
session.setToolControl(!session.isToolControlEnabled());
|
||||
|
||||
if (session.isToolControlEnabled()) {
|
||||
@ -621,17 +621,17 @@ public class SelectionCommands {
|
||||
long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ());
|
||||
|
||||
String msg = String.format("%1$s: %2$s @ %3$s (%4$d blocks)", name, sizeStr, originStr, numBlocks);
|
||||
player.print(BBC.getPrefix() + msg);
|
||||
player.print(msg);
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// player.print(BBC.getPrefix() + "Cuboid dimensions (max - min): " + size);
|
||||
// player.print(BBC.getPrefix() + "Offset: " + origin);
|
||||
// player.print(BBC.getPrefix() + "Cuboid distance: " + size.distance(Vector.ONE));
|
||||
// player.print(BBC.getPrefix() + "# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
// player.print("Cuboid dimensions (max - min): " + size);
|
||||
// player.print("Offset: " + origin);
|
||||
// player.print("Cuboid distance: " + size.distance(Vector.ONE));
|
||||
// player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
//=======
|
||||
// public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
// if (args.hasFlag('c')) {
|
||||
@ -653,17 +653,17 @@ public class SelectionCommands {
|
||||
.subtract(region.getMinimumPoint())
|
||||
.add(1, 1, 1);
|
||||
|
||||
player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld())
|
||||
player.print("Type: " + session.getRegionSelector(player.getWorld())
|
||||
.getTypeName());
|
||||
|
||||
for (String line : session.getRegionSelector(player.getWorld())
|
||||
.getInformationLines()) {
|
||||
player.print(BBC.getPrefix() + line);
|
||||
player.print(line);
|
||||
}
|
||||
|
||||
player.print(BBC.getPrefix() + "Size: " + size);
|
||||
player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print(BBC.getPrefix() + "# of blocks: " + region.getArea());
|
||||
player.print("Size: " + size);
|
||||
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print("# of blocks: " + region.getArea());
|
||||
}
|
||||
|
||||
|
||||
@ -713,7 +713,7 @@ public class SelectionCommands {
|
||||
size = session.getSelection(player.getWorld()).getArea();
|
||||
|
||||
if (distributionData.size() <= 0) {
|
||||
player.printError(BBC.getPrefix() + "No blocks counted.");
|
||||
player.printError("No blocks counted.");
|
||||
return;
|
||||
}
|
||||
BBC.SELECTION_DISTR.send(player, size);
|
||||
@ -724,7 +724,7 @@ public class SelectionCommands {
|
||||
String.valueOf(c.getAmount()),
|
||||
c.getAmount() / (double) size * 100,
|
||||
name);
|
||||
player.print(BBC.getPrefix() + str);
|
||||
player.print(str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,37 +751,37 @@ public class SelectionCommands {
|
||||
final RegionSelector selector;
|
||||
if (typeName.equalsIgnoreCase("cuboid")) {
|
||||
selector = new CuboidRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_CUBOID.s());
|
||||
player.print(BBC.SEL_CUBOID.s());
|
||||
} else if (typeName.equalsIgnoreCase("extend")) {
|
||||
selector = new ExtendingCuboidRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_CUBOID_EXTEND.s());
|
||||
player.print(BBC.SEL_CUBOID_EXTEND.s());
|
||||
} else if (typeName.equalsIgnoreCase("poly")) {
|
||||
selector = new Polygonal2DRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_2D_POLYGON.s());
|
||||
player.print(BBC.SEL_2D_POLYGON.s());
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(player).getPolygonVertexLimit();
|
||||
limit.ifPresent(integer -> player.print(BBC.getPrefix() + BBC.SEL_MAX.f(integer)));
|
||||
player.print(BBC.getPrefix() + BBC.SEL_LIST.s());
|
||||
limit.ifPresent(integer -> player.print(BBC.SEL_MAX.f(integer)));
|
||||
player.print(BBC.SEL_LIST.s());
|
||||
} else if (typeName.equalsIgnoreCase("ellipsoid")) {
|
||||
selector = new EllipsoidRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_ELLIPSIOD.s());
|
||||
player.print(BBC.SEL_ELLIPSIOD.s());
|
||||
} else if (typeName.equalsIgnoreCase("sphere")) {
|
||||
selector = new SphereRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_SPHERE.s());
|
||||
player.print(BBC.SEL_SPHERE.s());
|
||||
} else if (typeName.equalsIgnoreCase("cyl")) {
|
||||
selector = new CylinderRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_CYLINDRICAL.s());
|
||||
player.print(BBC.SEL_CYLINDRICAL.s());
|
||||
} else if (typeName.equalsIgnoreCase("convex") || typeName.equalsIgnoreCase("hull")) {
|
||||
selector = new ConvexPolyhedralRegionSelector(oldSelector);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
player.print(BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(player).getPolyhedronVertexLimit();
|
||||
limit.ifPresent(integer -> player.print(BBC.getPrefix() + BBC.SEL_MAX.f(integer)));
|
||||
player.print(BBC.getPrefix() + BBC.SEL_LIST.s());
|
||||
limit.ifPresent(integer -> player.print(BBC.SEL_MAX.f(integer)));
|
||||
player.print(BBC.SEL_LIST.s());
|
||||
} else if (typeName.equalsIgnoreCase("polyhedral") || typeName.equalsIgnoreCase("polyhedron")) {
|
||||
selector = new PolyhedralRegionSelector(player.getWorld());
|
||||
player.print(BBC.getPrefix() + BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
player.print(BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(player).getPolyhedronVertexLimit();
|
||||
limit.ifPresent(integer -> player.print(BBC.getPrefix() + BBC.SEL_MAX.f(integer)));
|
||||
player.print(BBC.getPrefix() + BBC.SEL_LIST.s());
|
||||
limit.ifPresent(integer -> player.print(BBC.SEL_MAX.f(integer)));
|
||||
player.print(BBC.SEL_LIST.s());
|
||||
} else if (typeName.startsWith("fuzzy") || typeName.startsWith("magic")) {
|
||||
Mask mask;
|
||||
if (typeName.length() > 6) {
|
||||
@ -795,13 +795,13 @@ public class SelectionCommands {
|
||||
mask = new IdMask(editSession);
|
||||
}
|
||||
selector = new FuzzyRegionSelector(player, editSession, mask);
|
||||
player.print(BBC.getPrefix() + BBC.SEL_FUZZY.f());
|
||||
player.print(BBC.getPrefix() + BBC.SEL_LIST.f());
|
||||
player.print(BBC.SEL_FUZZY.f());
|
||||
player.print(BBC.SEL_LIST.f());
|
||||
} else {
|
||||
CommandListBox box = new CommandListBox("Selection modes");
|
||||
StyledFragment contents = box.getContents();
|
||||
StyledFragment tip = contents.createFragment(Style.RED);
|
||||
tip.append(BBC.getPrefix() + BBC.SEL_MODES.s()).newLine();
|
||||
tip.append(BBC.SEL_MODES.s()).newLine();
|
||||
|
||||
box.appendCommand("//sel cuboid", "Select two corners of a cuboid");
|
||||
box.appendCommand("//sel extend", "Fast cuboid selection mode");
|
||||
@ -839,4 +839,4 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -29,7 +30,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
int ox = clicked.getBlockX();
|
||||
int oy = clicked.getBlockY();
|
||||
int oz = clicked.getBlockZ();
|
||||
@ -63,4 +64,4 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,37 +32,14 @@ import com.boydti.fawe.object.task.ThrowableSupplier;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.chat.UsageMessage;
|
||||
import com.boydti.fawe.wrappers.FakePlayer;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissionsException;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.BiomeCommands;
|
||||
import com.sk89q.worldedit.command.BrushCommands;
|
||||
import com.sk89q.worldedit.command.BrushOptionsCommands;
|
||||
import com.sk89q.worldedit.command.ChunkCommands;
|
||||
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||
import com.sk89q.worldedit.command.GenerationCommands;
|
||||
import com.sk89q.worldedit.command.HistoryCommands;
|
||||
import com.sk89q.worldedit.command.NavigationCommands;
|
||||
import com.sk89q.worldedit.command.OptionsCommands;
|
||||
import com.sk89q.worldedit.command.RegionCommands;
|
||||
import com.sk89q.worldedit.command.SchematicCommands;
|
||||
import com.sk89q.worldedit.command.ScriptingCommands;
|
||||
import com.sk89q.worldedit.command.SelectionCommands;
|
||||
import com.sk89q.worldedit.command.SnapshotCommands;
|
||||
import com.sk89q.worldedit.command.SnapshotUtilCommands;
|
||||
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
||||
import com.sk89q.worldedit.command.ToolCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||
import com.sk89q.worldedit.command.*;
|
||||
import com.sk89q.worldedit.command.argument.ReplaceParser;
|
||||
import com.sk89q.worldedit.command.argument.TreeGeneratorParser;
|
||||
import com.sk89q.worldedit.command.composition.ApplyCommand;
|
||||
@ -76,19 +53,11 @@ import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.factory.Deform;
|
||||
import com.sk89q.worldedit.function.factory.Deform.Mode;
|
||||
import com.sk89q.worldedit.internal.command.ActorAuthorizer;
|
||||
import com.sk89q.worldedit.internal.command.CommandLoggingHandler;
|
||||
import com.sk89q.worldedit.internal.command.UserCommandCompleter;
|
||||
import com.sk89q.worldedit.internal.command.WorldEditBinding;
|
||||
import com.sk89q.worldedit.internal.command.WorldEditExceptionConverter;
|
||||
import com.sk89q.worldedit.internal.command.*;
|
||||
import com.sk89q.worldedit.scripting.CommandScriptLoader;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
import com.sk89q.worldedit.util.command.CallableProcessor;
|
||||
import com.sk89q.worldedit.util.command.CommandCallable;
|
||||
import com.sk89q.worldedit.util.command.CommandMapping;
|
||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
||||
import com.sk89q.worldedit.util.command.InvalidUsageException;
|
||||
import com.sk89q.worldedit.util.command.*;
|
||||
import com.sk89q.worldedit.util.command.composition.ProvidedValue;
|
||||
import com.sk89q.worldedit.util.command.fluent.CommandGraph;
|
||||
import com.sk89q.worldedit.util.command.fluent.DispatcherNode;
|
||||
@ -404,9 +373,6 @@ public final class CommandManager {
|
||||
if (!dispatcher.contains(split[0])) {
|
||||
return;
|
||||
}
|
||||
if (!actor.isPlayer()) {
|
||||
actor = FakePlayer.wrap(actor.getName(), actor.getUniqueId(), actor);
|
||||
}
|
||||
LocalSession session = worldEdit.getSessionManager().get(actor);
|
||||
Request.request().setSession(session);
|
||||
if (actor instanceof Entity) {
|
||||
|
@ -51,6 +51,7 @@ public class BlockVector3 {
|
||||
// thread-safe initialization idiom
|
||||
private static final class YzxOrderComparator {
|
||||
private static final Comparator<BlockVector3> YZX_ORDER = (a, b) -> {
|
||||
//noinspection SuspiciousNameCombination
|
||||
return ComparisonChain.start()
|
||||
.compare(a.y, b.y)
|
||||
.compare(a.z, b.z)
|
||||
@ -61,7 +62,7 @@ public class BlockVector3 {
|
||||
|
||||
/**
|
||||
* Returns a comparator that sorts vectors first by Y, then Z, then X.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Useful for sorting by chunk block storage order.
|
||||
*/
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren