geforkt von Mirrors/FastAsyncWorldEdit
Finish the BlockData caching in Bukkit
Dieser Commit ist enthalten in:
Ursprung
c931095736
Commit
fdb9d77710
@ -345,6 +345,8 @@ public class BukkitAdapter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Map<String, BlockData> blockDataCache = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder
|
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder
|
||||||
*
|
*
|
||||||
@ -353,7 +355,13 @@ public class BukkitAdapter {
|
|||||||
*/
|
*/
|
||||||
public static BlockData adapt(BlockStateHolder block) {
|
public static BlockData adapt(BlockStateHolder block) {
|
||||||
checkNotNull(block);
|
checkNotNull(block);
|
||||||
return Bukkit.createBlockData(block.getAsString());
|
return blockDataCache.computeIfAbsent(block.getAsString(), new Function<String, BlockData>() {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public BlockData apply(@Nullable String input) {
|
||||||
|
return Bukkit.createBlockData(block.getAsString());
|
||||||
|
}
|
||||||
|
}).clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren