Merging upstream changes

This commit is contained in:
matt
2019-03-26 13:27:09 -04:00
parent 85bfd16d7c
commit 0d88a6bce2
23 changed files with 1708 additions and 1768 deletions

View File

@ -19,10 +19,7 @@
package com.sk89q.worldedit.entity;
import javax.annotation.Nullable;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.inventory.BlockBag;
@ -32,9 +29,12 @@ import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.gamemode.GameMode;
import javax.annotation.Nullable;
/**
* Represents a player
*/

View File

@ -1,67 +0,0 @@
package com.sk89q.worldedit.entity.metadata;
import java.util.Map;
public interface Metadatable {
Map<String, Object> getMetaMap();
/**
* Set some session only metadata for the player
*
* @param key
* @param value
* @return previous value
*/
default void setMeta(String key, Object value) {
getMetaMap().put(key, value);
}
default <T> T getAndSetMeta(String key, T value) {
return (T) getMetaMap().put(key, value);
}
default boolean hasMeta() {
return !getMetaMap().isEmpty();
}
/**
* Get the metadata for a key.
*
* @param <V>
* @param key
* @return
*/
default <V> V getMeta(String key) {
if (getMetaMap() != null) {
return (V) getMetaMap().get(key);
}
return null;
}
/**
* 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) {
if (getMetaMap() != null) {
V value = (V) getMetaMap().get(key);
return value == null ? def : value;
}
return def;
}
/**
* 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 getMetaMap() == null ? null : (V) getMetaMap().remove(key);
}
}