mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 10:28:35 +00:00
commanding-pipeline diff
This commit is contained in:
@ -24,6 +24,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.NbtValued;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
@ -85,14 +87,7 @@ public class BaseEntity implements NbtValued {
|
||||
}
|
||||
|
||||
public Location getLocation(Extent extent) {
|
||||
ListTag posTag = nbtData.getListTag("Pos");
|
||||
ListTag rotTag = nbtData.getListTag("Rotation");
|
||||
double x = posTag.getDouble(0);
|
||||
double y = posTag.getDouble(1);
|
||||
double z = posTag.getDouble(2);
|
||||
float yaw = rotTag.getFloat(0);
|
||||
float pitch = rotTag.getFloat(1);
|
||||
return new Location(extent, x, y, z, yaw, pitch);
|
||||
return nbtData.getEntityLocation(extent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.sk89q.worldedit.entity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface MapMetadatable extends Metadatable {
|
||||
|
||||
Map<String, Object> getRawMeta();
|
||||
/**
|
||||
* Set some session only metadata for the player
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
default void setMeta(String key, Object value) {
|
||||
getRawMeta().put(key, value);
|
||||
}
|
||||
|
||||
default <T> T getAndSetMeta(String key, T value) {
|
||||
return (T) getRawMeta().put(key, value);
|
||||
}
|
||||
|
||||
default boolean hasMeta() {
|
||||
return !getRawMeta().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the metadata for a key.
|
||||
*
|
||||
* @param <V>
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
default <V> V getMeta(String key) {
|
||||
return (V) getRawMeta().get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the metadata for a specific key (or return the default provided)
|
||||
*
|
||||
* @param key
|
||||
* @param def
|
||||
* @param <V>
|
||||
* @return
|
||||
*/
|
||||
default <V> V getMeta(String key, V def) {
|
||||
V value = (V) getRawMeta().get(key);
|
||||
return value == null ? def : value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the metadata for a key.
|
||||
* - metadata is session only
|
||||
* - deleting other plugin's metadata may cause issues
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
default <V> V deleteMeta(String key) {
|
||||
return (V) getRawMeta().remove(key);
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.entity;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||
@ -38,6 +39,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
@ -48,7 +50,10 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import java.io.File;
|
||||
import java.text.NumberFormat;
|
||||
import javax.annotation.Nullable;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a player
|
||||
@ -367,14 +372,6 @@ public interface Player extends Entity, Actor {
|
||||
return WorldEdit.getInstance().getPlatformManager().getWorldForEditing(getWorld());
|
||||
}
|
||||
|
||||
default boolean runAsyncIfFree(Runnable r) {
|
||||
return runAction(r, true, true);
|
||||
}
|
||||
|
||||
default boolean runIfFree(Runnable r) {
|
||||
return runAction(r, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister this player (deletes all metadata etc) - Usually called on logout
|
||||
*/
|
||||
@ -385,7 +382,6 @@ public interface Player extends Entity, Actor {
|
||||
getSession().clearHistory();
|
||||
getSession().unregisterTools(this);
|
||||
}
|
||||
Fawe.get().unregister(getName());
|
||||
}
|
||||
|
||||
default int cancel(boolean close) {
|
||||
|
Reference in New Issue
Block a user