Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Added a few utility methods.
Dieser Commit ist enthalten in:
Ursprung
b2bc043eeb
Commit
b2769befdb
@ -41,6 +41,7 @@ import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -106,6 +107,26 @@ public class BukkitAdapter {
|
||||
return new BukkitWorld(world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WorldEdit Player from a Bukkit Player.
|
||||
*
|
||||
* @param player The Bukkit player
|
||||
* @return The WorldEdit player
|
||||
*/
|
||||
public static BukkitPlayer adapt(Player player) {
|
||||
return WorldEditPlugin.getInstance().wrapPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Bukkit Player from a WorldEdit Player.
|
||||
*
|
||||
* @param player The WorldEdit player
|
||||
* @return The Bukkit player
|
||||
*/
|
||||
public static Player adapt(com.sk89q.worldedit.entity.Player player) {
|
||||
return ((BukkitPlayer) player).getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Bukkit world from a WorldEdit world.
|
||||
*
|
||||
|
@ -268,7 +268,10 @@ class DefaultBlockParser extends InputParser<BlockStateHolder> {
|
||||
// No wildcards allowed => eliminate them. (Start with default state)
|
||||
state = blockType.getDefaultState();
|
||||
} else {
|
||||
state = new BlockState(blockType, blockStates);
|
||||
state = blockType.getDefaultState().toFuzzy();
|
||||
for (Map.Entry<Property<?>, Object> blockState : blockStates.entrySet()) {
|
||||
state = state.with((Property) blockState.getKey(), blockState.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
state = applyProperties(state, stateProperties);
|
||||
|
@ -50,7 +50,7 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
// Neighbouring state table.
|
||||
private Table<Property<?>, Object, BlockState> states;
|
||||
|
||||
BlockState(BlockType blockType) {
|
||||
private BlockState(BlockType blockType) {
|
||||
this.blockType = blockType;
|
||||
this.values = new LinkedHashMap<>();
|
||||
this.fuzzy = false;
|
||||
@ -62,13 +62,13 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
* @param blockType The block type
|
||||
* @param values The block state values
|
||||
*/
|
||||
public BlockState(BlockType blockType, Map<Property<?>, Object> values) {
|
||||
private BlockState(BlockType blockType, Map<Property<?>, Object> values) {
|
||||
this.blockType = blockType;
|
||||
this.values = values;
|
||||
this.fuzzy = true;
|
||||
}
|
||||
|
||||
public static Map<Map<Property<?>, Object>, BlockState> generateStateMap(BlockType blockType) {
|
||||
static Map<Map<Property<?>, Object>, BlockState> generateStateMap(BlockType blockType) {
|
||||
Map<Map<Property<?>, Object>, BlockState> stateMap = new LinkedHashMap<>();
|
||||
List<? extends Property> properties = blockType.getProperties();
|
||||
|
||||
@ -105,7 +105,7 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
return stateMap;
|
||||
}
|
||||
|
||||
public void populate(Map<Map<Property<?>, Object>, BlockState> stateMap) {
|
||||
private void populate(Map<Map<Property<?>, Object>, BlockState> stateMap) {
|
||||
final Table<Property<?>, Object, BlockState> states = HashBasedTable.create();
|
||||
|
||||
for(final Map.Entry<Property<?>, Object> entry : this.values.entrySet()) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren