Remove CUI and other cleaning

This commit is contained in:
MattBDev
2019-06-06 18:39:51 -04:00
parent b42553116c
commit 229182aa63
28 changed files with 574 additions and 2653 deletions

View File

@ -56,8 +56,8 @@ import org.bukkit.inventory.ItemStack;
* Adapts between Bukkit and WorldEdit equivalent objects.
*/
public enum BukkitAdapter {
INSTANCE
;
INSTANCE;
private final IBukkitAdapter adapter;
BukkitAdapter() {
@ -73,14 +73,36 @@ public enum BukkitAdapter {
return INSTANCE.adapter;
}
/**
* Checks equality between a WorldEdit BlockType and a Bukkit Material
*
* @param blockType The WorldEdit BlockType
* @param type The Bukkit Material
* @return If they are equal
*/
public static boolean equals(BlockType blockType, Material type) {
return getAdapter().equals(blockType, type);
}
/**
* Convert any WorldEdit world into an equivalent wrapped Bukkit world.
*
* <p>If a matching world cannot be found, a {@link RuntimeException}
* will be thrown.</p>
*
* @param world the world
* @return a wrapped Bukkit world
*/
public static BukkitWorld asBukkitWorld(World world) {
return getAdapter().asBukkitWorld(world);
}
/**
* Create a WorldEdit world from a Bukkit world.
*
* @param world the Bukkit world
* @return a WorldEdit world
*/
public static World adapt(org.bukkit.World world) {
return getAdapter().adapt(world);
}
@ -89,23 +111,48 @@ public enum BukkitAdapter {
return getAdapter().adapt(world);
}
/**
* Create a WorldEdit location from a Bukkit location.
*
* @param location the Bukkit location
* @return a WorldEdit location
*/
public static Location adapt(org.bukkit.Location location) {
checkNotNull(location);
return getAdapter().adapt(location);
}
/**
* Create a Bukkit location from a WorldEdit location.
*
* @param location the WorldEdit location
* @return a Bukkit location
*/
public static org.bukkit.Location adapt(Location location) {
checkNotNull(location);
return getAdapter().adapt(location);
}
public static org.bukkit.Location adapt(org.bukkit.World world, Vector3 position) {
return getAdapter().adapt(world, position);
}
public static org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) {
checkNotNull(world);
checkNotNull(position);
return getAdapter().adapt(world, position);
}
/**
* Create a Bukkit location from a WorldEdit location with a Bukkit world.
*
* @param world the Bukkit world
* @param location the WorldEdit location
* @return a Bukkit location
*/
public static org.bukkit.Location adapt(org.bukkit.World world, Location location) {
checkNotNull(world);
checkNotNull(location);
return getAdapter().adapt(world, location);
}
@ -113,23 +160,58 @@ public enum BukkitAdapter {
return getAdapter().asVector(location);
}
/**
* Create a WorldEdit Vector from a Bukkit location.
*
* @param location The Bukkit location
* @return a WorldEdit vector
*/
public static BlockVector3 asBlockVector(org.bukkit.Location location) {
checkNotNull(location);
return getAdapter().asBlockVector(location);
}
/**
* Create a WorldEdit entity from a Bukkit entity.
*
* @param entity the Bukkit entity
* @return a WorldEdit entity
*/
public static Entity adapt(org.bukkit.entity.Entity entity) {
checkNotNull(entity);
return getAdapter().adapt(entity);
}
/**
* Create a Bukkit Material form a WorldEdit ItemType
*
* @param itemType The WorldEdit ItemType
* @return The Bukkit Material
*/
public static Material adapt(ItemType itemType) {
checkNotNull(itemType);
return getAdapter().adapt(itemType);
}
/**
* Create a Bukkit Material form a WorldEdit BlockType
*
* @param blockType The WorldEdit BlockType
* @return The Bukkit Material
*/
public static Material adapt(BlockType blockType) {
checkNotNull(blockType);
return getAdapter().adapt(blockType);
}
/**
* Create a WorldEdit GameMode from a Bukkit one.
*
* @param gameMode Bukkit GameMode
* @return WorldEdit GameMode
*/
public static GameMode adapt(org.bukkit.GameMode gameMode) {
checkNotNull(gameMode);
return getAdapter().adapt(gameMode);
}
@ -161,15 +243,37 @@ public enum BukkitAdapter {
return getAdapter().adapt(entityType);
}
/**
* Converts a Material to a BlockType
*
* @param material The material
* @return The blocktype
*/
public static BlockType asBlockType(Material material) {
checkNotNull(material);
return getAdapter().asBlockType(material);
}
/**
* Converts a Material to a ItemType
*
* @param material The material
* @return The itemtype
*/
public static ItemType asItemType(Material material) {
checkNotNull(material);
return getAdapter().asItemType(material);
}
/**
* Create a WorldEdit BlockState from a Bukkit BlockData
*
* @param blockData The Bukkit BlockData
* @return The WorldEdit BlockState
*/
public static BlockState adapt(BlockData blockData) {
checkNotNull(blockData);
return getAdapter().adapt(blockData);
}
@ -183,7 +287,8 @@ public enum BukkitAdapter {
* @param block The WorldEdit BlockStateHolder
* @return The Bukkit BlockData
*/
public static <B extends BlockStateHolder<B>> BlockData adapt(B block) {
public static BlockData adapt(BlockStateHolder block) {
checkNotNull(block);
return getAdapter().adapt(block);
}
@ -191,15 +296,40 @@ public enum BukkitAdapter {
return getAdapter().getBlockData(combinedId);
}
public static BlockState asBlockState(ItemStack itemStack) {
return getAdapter().asBlockState(itemStack);
/**
* Create a WorldEdit BlockState from a Bukkit ItemStack
*
* @param itemStack The Bukkit ItemStack
* @return The WorldEdit BlockState
*/
public static BlockState asBlockState(ItemStack itemStack) throws WorldEditException {
checkNotNull(itemStack);
if (itemStack.getType().isBlock()) {
return getAdapter().asBlockState(itemStack);
} else {
throw new NotABlockException();
}
}
/**
* Create a WorldEdit BaseItemStack from a Bukkit ItemStack
*
* @param itemStack The Bukkit ItemStack
* @return The WorldEdit BaseItemStack
*/
public static BaseItemStack adapt(ItemStack itemStack) {
checkNotNull(itemStack);
return getAdapter().adapt(itemStack);
}
/**
* Create a Bukkit ItemStack from a WorldEdit BaseItemStack
*
* @param item The WorldEdit BaseItemStack
* @return The Bukkit ItemStack
*/
public static ItemStack adapt(BaseItemStack item) {
checkNotNull(item);
return getAdapter().adapt(item);
}