mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Almost finished the state system. Just got to have it actually load in the values.
This commit is contained in:
@ -20,12 +20,15 @@
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
||||
import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -41,6 +44,23 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
||||
material -> new BukkitBlockMaterial(BukkitBlockRegistry.super.getMaterial(id), material));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> getPropertyValues(BlockType blockType, Property<?> property) {
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
|
||||
return WorldEditPlugin.getInstance().getBukkitImplAdapter().getPropertyValues(blockType, property);
|
||||
}
|
||||
return super.getPropertyValues(blockType, property);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Map<String, ? extends Property> getProperties(BlockType blockType) {
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
|
||||
return WorldEditPlugin.getInstance().getBukkitImplAdapter().getProperties(blockType);
|
||||
}
|
||||
return super.getProperties(blockType);
|
||||
}
|
||||
|
||||
public static class BukkitBlockMaterial extends PassthroughBlockMaterial {
|
||||
|
||||
private final Material material;
|
||||
|
@ -20,12 +20,17 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -91,4 +96,19 @@ public interface BukkitImplAdapter {
|
||||
Entity createEntity(Location location, BaseEntity state);
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of values for a property.
|
||||
*
|
||||
* @param property The property
|
||||
* @return The list of values
|
||||
*/
|
||||
List<Object> getPropertyValues(BlockType blockType, Property<?> property);
|
||||
|
||||
/**
|
||||
* Get a map of string -> properties
|
||||
*
|
||||
* @param blockType The block type
|
||||
* @return The properties map
|
||||
*/
|
||||
Map<String, ? extends Property> getProperties(BlockType blockType);
|
||||
}
|
||||
|
Reference in New Issue
Block a user