some codestyle application

This commit is contained in:
dordsor21 2021-09-08 16:39:43 +01:00
parent dc11b74020
commit 195a13a23c
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
92 changed files with 465 additions and 291 deletions

View File

@ -10,9 +10,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
* Class to prevent the above/below being removed from shaded/relocated dependencies via minimization
*/
final class DoNotMiniseThese {
private final Long2ObjectLinkedOpenHashMap a = null;
private final LongArraySet b = null;
private final LongIterator c = null;
private final LongSet d = null;
private final Int2ObjectMap e = null;
}

View File

@ -313,7 +313,8 @@ public class BukkitWorld extends AbstractWorld {
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 pt) {
//FAWE start - allow tree commands to be undone and obey region restrictions
return TaskManager.IMP.sync(() -> WorldEditPlugin.getInstance().getBukkitImplAdapter().generateTree(type, editSession, pt,
getWorld()));
getWorld()
));
//FAWE end
}

View File

@ -306,7 +306,7 @@ public class WorldEditPlugin extends JavaPlugin {
"The version of Spigot/Paper you are using doesn't support Tags. The usage of tags with WorldEdit will not work until you update.");
}
}
// FAWE start
private void setupBiomes() {
if (this.adapter.value().isPresent()) {

View File

@ -262,7 +262,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
* Clears the contents of a Clearable block.
*
* @param world The world
* @param pt The location
* @param pt The location
* @return If a block was cleared
*/
default boolean clearContainerBlockContents(World world, BlockVector3 pt) {

View File

@ -68,27 +68,32 @@ import java.util.logging.Logger;
public class StubServer implements Server {
@Override
public @NotNull String getName() {
public @NotNull
String getName() {
return null;
}
@Override
public @NotNull String getVersion() {
public @NotNull
String getVersion() {
return "STUB";
}
@Override
public @NotNull String getBukkitVersion() {
public @NotNull
String getBukkitVersion() {
return null;
}
@Override
public @NotNull String getMinecraftVersion() {
public @NotNull
String getMinecraftVersion() {
return null;
}
@Override
public @NotNull Collection<? extends Player> getOnlinePlayers() {
public @NotNull
Collection<? extends Player> getOnlinePlayers() {
return null;
}
@ -113,12 +118,14 @@ public class StubServer implements Server {
}
@Override
public @NotNull String getIp() {
public @NotNull
String getIp() {
return null;
}
@Override
public @NotNull String getWorldType() {
public @NotNull
String getWorldType() {
return null;
}
@ -163,7 +170,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull Set<OfflinePlayer> getWhitelistedPlayers() {
public @NotNull
Set<OfflinePlayer> getWhitelistedPlayers() {
return null;
}
@ -182,12 +190,14 @@ public class StubServer implements Server {
}
@Override
public @NotNull String getUpdateFolder() {
public @NotNull
String getUpdateFolder() {
return null;
}
@Override
public @NotNull File getUpdateFolderFile() {
public @NotNull
File getUpdateFolderFile() {
return null;
}
@ -222,52 +232,62 @@ public class StubServer implements Server {
}
@Override
public @Nullable Player getPlayer(@NotNull String s) {
public @Nullable
Player getPlayer(@NotNull String s) {
return null;
}
@Override
public @Nullable Player getPlayerExact(@NotNull String s) {
public @Nullable
Player getPlayerExact(@NotNull String s) {
return null;
}
@Override
public @NotNull List<Player> matchPlayer(@NotNull String s) {
public @NotNull
List<Player> matchPlayer(@NotNull String s) {
return null;
}
@Override
public @Nullable Player getPlayer(@NotNull UUID uuid) {
public @Nullable
Player getPlayer(@NotNull UUID uuid) {
return null;
}
@Override
public @Nullable UUID getPlayerUniqueId(@NotNull String s) {
public @Nullable
UUID getPlayerUniqueId(@NotNull String s) {
return null;
}
@Override
public @NotNull PluginManager getPluginManager() {
public @NotNull
PluginManager getPluginManager() {
return null;
}
@Override
public @NotNull BukkitScheduler getScheduler() {
public @NotNull
BukkitScheduler getScheduler() {
return null;
}
@Override
public @NotNull ServicesManager getServicesManager() {
public @NotNull
ServicesManager getServicesManager() {
return null;
}
@Override
public @NotNull List<World> getWorlds() {
public @NotNull
List<World> getWorlds() {
return null;
}
@Override
public @Nullable World createWorld(@NotNull WorldCreator worldCreator) {
public @Nullable
World createWorld(@NotNull WorldCreator worldCreator) {
return null;
}
@ -282,17 +302,20 @@ public class StubServer implements Server {
}
@Override
public @Nullable World getWorld(@NotNull String s) {
public @Nullable
World getWorld(@NotNull String s) {
return null;
}
@Override
public @Nullable World getWorld(@NotNull UUID uuid) {
public @Nullable
World getWorld(@NotNull UUID uuid) {
return null;
}
@Override
public @Nullable World getWorld(@NotNull NamespacedKey namespacedKey) {
public @Nullable
World getWorld(@NotNull NamespacedKey namespacedKey) {
return null;
}
@ -301,17 +324,20 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @Nullable MapView getMap(int i) {
public @Nullable
MapView getMap(int i) {
return null;
}
@Override
public @NotNull MapView createMap(@NotNull World world) {
public @NotNull
MapView createMap(@NotNull World world) {
return null;
}
@Override
public @NotNull ItemStack createExplorerMap(
public @NotNull
ItemStack createExplorerMap(
@NotNull World world,
@NotNull Location location,
@NotNull StructureType structureType
@ -320,7 +346,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull ItemStack createExplorerMap(
public @NotNull
ItemStack createExplorerMap(
@NotNull World world,
@NotNull Location location,
@NotNull StructureType structureType,
@ -341,12 +368,14 @@ public class StubServer implements Server {
}
@Override
public @NotNull Logger getLogger() {
public @NotNull
Logger getLogger() {
return Logger.getLogger("StubServer");
}
@Override
public @Nullable PluginCommand getPluginCommand(@NotNull String s) {
public @Nullable
PluginCommand getPluginCommand(@NotNull String s) {
return null;
}
@ -366,22 +395,26 @@ public class StubServer implements Server {
}
@Override
public @NotNull List<Recipe> getRecipesFor(@NotNull ItemStack itemStack) {
public @NotNull
List<Recipe> getRecipesFor(@NotNull ItemStack itemStack) {
return null;
}
@Override
public @Nullable Recipe getRecipe(@NotNull NamespacedKey namespacedKey) {
public @Nullable
Recipe getRecipe(@NotNull NamespacedKey namespacedKey) {
return null;
}
@Override
public @Nullable Recipe getCraftingRecipe(final @NotNull ItemStack[] itemStacks, @NotNull final World world) {
public @Nullable
Recipe getCraftingRecipe(final @NotNull ItemStack[] itemStacks, @NotNull final World world) {
return null;
}
@Override
public @NotNull ItemStack craftItem(
public @NotNull
ItemStack craftItem(
final @NotNull ItemStack[] itemStacks,
@NotNull final World world,
@NotNull final Player player
@ -390,7 +423,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull Iterator<Recipe> recipeIterator() {
public @NotNull
Iterator<Recipe> recipeIterator() {
return null;
}
@ -410,7 +444,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull Map<String, String[]> getCommandAliases() {
public @NotNull
Map<String, String[]> getCommandAliases() {
return null;
}
@ -469,22 +504,26 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @NotNull OfflinePlayer getOfflinePlayer(@NotNull String s) {
public @NotNull
OfflinePlayer getOfflinePlayer(@NotNull String s) {
return null;
}
@Override
public @Nullable OfflinePlayer getOfflinePlayerIfCached(@NotNull String s) {
public @Nullable
OfflinePlayer getOfflinePlayerIfCached(@NotNull String s) {
return null;
}
@Override
public @NotNull OfflinePlayer getOfflinePlayer(@NotNull UUID uuid) {
public @NotNull
OfflinePlayer getOfflinePlayer(@NotNull UUID uuid) {
return null;
}
@Override
public @NotNull Set<String> getIPBans() {
public @NotNull
Set<String> getIPBans() {
return null;
}
@ -499,22 +538,26 @@ public class StubServer implements Server {
}
@Override
public @NotNull Set<OfflinePlayer> getBannedPlayers() {
public @NotNull
Set<OfflinePlayer> getBannedPlayers() {
return null;
}
@Override
public @NotNull BanList getBanList(BanList.@NotNull Type type) {
public @NotNull
BanList getBanList(BanList.@NotNull Type type) {
return null;
}
@Override
public @NotNull Set<OfflinePlayer> getOperators() {
public @NotNull
Set<OfflinePlayer> getOperators() {
return null;
}
@Override
public @NotNull GameMode getDefaultGameMode() {
public @NotNull
GameMode getDefaultGameMode() {
return null;
}
@ -524,37 +567,44 @@ public class StubServer implements Server {
}
@Override
public @NotNull ConsoleCommandSender getConsoleSender() {
public @NotNull
ConsoleCommandSender getConsoleSender() {
return null;
}
@Override
public @NotNull File getWorldContainer() {
public @NotNull
File getWorldContainer() {
return null;
}
@Override
public @NotNull OfflinePlayer[] getOfflinePlayers() {
public @NotNull
OfflinePlayer[] getOfflinePlayers() {
return new OfflinePlayer[0];
}
@Override
public @NotNull Messenger getMessenger() {
public @NotNull
Messenger getMessenger() {
return null;
}
@Override
public @NotNull HelpMap getHelpMap() {
public @NotNull
HelpMap getHelpMap() {
return null;
}
@Override
public @NotNull Inventory createInventory(@Nullable InventoryHolder inventoryHolder, @NotNull InventoryType inventoryType) {
public @NotNull
Inventory createInventory(@Nullable InventoryHolder inventoryHolder, @NotNull InventoryType inventoryType) {
return null;
}
@Override
public @NotNull Inventory createInventory(
public @NotNull
Inventory createInventory(
@Nullable InventoryHolder inventoryHolder,
@NotNull InventoryType inventoryType,
@NotNull Component component
@ -569,7 +619,8 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @NotNull Inventory createInventory(
public @NotNull
Inventory createInventory(
@Nullable InventoryHolder inventoryHolder,
@NotNull InventoryType inventoryType,
@NotNull String s
@ -578,12 +629,14 @@ public class StubServer implements Server {
}
@Override
public @NotNull Inventory createInventory(@Nullable InventoryHolder inventoryHolder, int i) throws IllegalArgumentException {
public @NotNull
Inventory createInventory(@Nullable InventoryHolder inventoryHolder, int i) throws IllegalArgumentException {
return null;
}
@Override
public @NotNull Inventory createInventory(
public @NotNull
Inventory createInventory(
@Nullable InventoryHolder inventoryHolder,
int i,
@NotNull Component component
@ -598,13 +651,15 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @NotNull Inventory createInventory(@Nullable InventoryHolder inventoryHolder, int i, @NotNull String s) throws
public @NotNull
Inventory createInventory(@Nullable InventoryHolder inventoryHolder, int i, @NotNull String s) throws
IllegalArgumentException {
return null;
}
@Override
public @NotNull Merchant createMerchant(@Nullable Component component) {
public @NotNull
Merchant createMerchant(@Nullable Component component) {
return null;
}
@ -613,7 +668,8 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @NotNull Merchant createMerchant(@Nullable String s) {
public @NotNull
Merchant createMerchant(@Nullable String s) {
return null;
}
@ -648,7 +704,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull Component motd() {
public @NotNull
Component motd() {
return null;
}
@ -656,12 +713,14 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @NotNull String getMotd() {
public @NotNull
String getMotd() {
return null;
}
@Override
public @Nullable Component shutdownMessage() {
public @Nullable
Component shutdownMessage() {
return null;
}
@ -669,7 +728,8 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @Nullable String getShutdownMessage() {
public @Nullable
String getShutdownMessage() {
return null;
}
@ -679,27 +739,32 @@ public class StubServer implements Server {
}
@Override
public @NotNull ItemFactory getItemFactory() {
public @NotNull
ItemFactory getItemFactory() {
return null;
}
@Override
public @NotNull ScoreboardManager getScoreboardManager() {
public @NotNull
ScoreboardManager getScoreboardManager() {
return null;
}
@Override
public @Nullable CachedServerIcon getServerIcon() {
public @Nullable
CachedServerIcon getServerIcon() {
return null;
}
@Override
public @NotNull CachedServerIcon loadServerIcon(@NotNull File file) throws IllegalArgumentException, Exception {
public @NotNull
CachedServerIcon loadServerIcon(@NotNull File file) throws IllegalArgumentException, Exception {
return null;
}
@Override
public @NotNull CachedServerIcon loadServerIcon(@NotNull BufferedImage bufferedImage) throws IllegalArgumentException,
public @NotNull
CachedServerIcon loadServerIcon(@NotNull BufferedImage bufferedImage) throws IllegalArgumentException,
Exception {
return null;
}
@ -725,7 +790,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull BossBar createBossBar(
public @NotNull
BossBar createBossBar(
@Nullable String s,
@NotNull BarColor barColor,
@NotNull BarStyle barStyle,
@ -735,7 +801,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull KeyedBossBar createBossBar(
public @NotNull
KeyedBossBar createBossBar(
@NotNull NamespacedKey namespacedKey,
@Nullable String s,
@NotNull BarColor barColor,
@ -746,12 +813,14 @@ public class StubServer implements Server {
}
@Override
public @NotNull Iterator<KeyedBossBar> getBossBars() {
public @NotNull
Iterator<KeyedBossBar> getBossBars() {
return null;
}
@Override
public @Nullable KeyedBossBar getBossBar(@NotNull NamespacedKey namespacedKey) {
public @Nullable
KeyedBossBar getBossBar(@NotNull NamespacedKey namespacedKey) {
return null;
}
@ -761,17 +830,20 @@ public class StubServer implements Server {
}
@Override
public @Nullable Entity getEntity(@NotNull UUID uuid) {
public @Nullable
Entity getEntity(@NotNull UUID uuid) {
return null;
}
@Override
public @NotNull double[] getTPS() {
public @NotNull
double[] getTPS() {
return new double[0];
}
@Override
public @NotNull long[] getTickTimes() {
public @NotNull
long[] getTickTimes() {
return new long[0];
}
@ -781,37 +853,44 @@ public class StubServer implements Server {
}
@Override
public @NotNull CommandMap getCommandMap() {
public @NotNull
CommandMap getCommandMap() {
return null;
}
@Override
public @Nullable Advancement getAdvancement(@NotNull NamespacedKey namespacedKey) {
public @Nullable
Advancement getAdvancement(@NotNull NamespacedKey namespacedKey) {
return null;
}
@Override
public @NotNull Iterator<Advancement> advancementIterator() {
public @NotNull
Iterator<Advancement> advancementIterator() {
return null;
}
@Override
public @NotNull BlockData createBlockData(@NotNull Material material) {
public @NotNull
BlockData createBlockData(@NotNull Material material) {
return null;
}
@Override
public @NotNull BlockData createBlockData(@NotNull Material material, @Nullable Consumer<BlockData> consumer) {
public @NotNull
BlockData createBlockData(@NotNull Material material, @Nullable Consumer<BlockData> consumer) {
return null;
}
@Override
public @NotNull BlockData createBlockData(@NotNull String s) throws IllegalArgumentException {
public @NotNull
BlockData createBlockData(@NotNull String s) throws IllegalArgumentException {
return null;
}
@Override
public @NotNull BlockData createBlockData(@Nullable Material material, @Nullable String s) throws IllegalArgumentException {
public @NotNull
BlockData createBlockData(@Nullable Material material, @Nullable String s) throws IllegalArgumentException {
return null;
}
@ -821,17 +900,20 @@ public class StubServer implements Server {
}
@Override
public @NotNull <T extends Keyed> Iterable<Tag<T>> getTags(@NotNull String s, @NotNull Class<T> aClass) {
public @NotNull
<T extends Keyed> Iterable<Tag<T>> getTags(@NotNull String s, @NotNull Class<T> aClass) {
return null;
}
@Override
public @Nullable LootTable getLootTable(@NotNull NamespacedKey namespacedKey) {
public @Nullable
LootTable getLootTable(@NotNull NamespacedKey namespacedKey) {
return null;
}
@Override
public @NotNull List<Entity> selectEntities(@NotNull CommandSender commandSender, @NotNull String s) throws
public @NotNull
List<Entity> selectEntities(@NotNull CommandSender commandSender, @NotNull String s) throws
IllegalArgumentException {
return null;
}
@ -840,12 +922,14 @@ public class StubServer implements Server {
* @deprecated
*/
@Override
public @NotNull UnsafeValues getUnsafe() {
public @NotNull
UnsafeValues getUnsafe() {
return null;
}
@Override
public @NotNull Spigot spigot() {
public @NotNull
Spigot spigot() {
return null;
}
@ -865,22 +949,26 @@ public class StubServer implements Server {
}
@Override
public @NotNull String getPermissionMessage() {
public @NotNull
String getPermissionMessage() {
return null;
}
@Override
public @NotNull PlayerProfile createProfile(@NotNull UUID uuid) {
public @NotNull
PlayerProfile createProfile(@NotNull UUID uuid) {
return null;
}
@Override
public @NotNull PlayerProfile createProfile(@NotNull String s) {
public @NotNull
PlayerProfile createProfile(@NotNull String s) {
return null;
}
@Override
public @NotNull PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String s) {
public @NotNull
PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String s) {
return null;
}
@ -895,17 +983,20 @@ public class StubServer implements Server {
}
@Override
public @NotNull MobGoals getMobGoals() {
public @NotNull
MobGoals getMobGoals() {
return null;
}
@Override
public @NotNull DatapackManager getDatapackManager() {
public @NotNull
DatapackManager getDatapackManager() {
return null;
}
@Override
public @NotNull Iterable<? extends Audience> audiences() {
public @NotNull
Iterable<? extends Audience> audiences() {
return null;
}
@ -915,7 +1006,8 @@ public class StubServer implements Server {
}
@Override
public @NotNull Set<String> getListeningPluginChannels() {
public @NotNull
Set<String> getListeningPluginChannels() {
return null;
}

View File

@ -32,8 +32,8 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.registry.Registries;
import org.enginehub.piston.CommandManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.EnumMap;
@ -164,7 +164,8 @@ class CLIPlatform extends AbstractPlatform {
}
@Override
public @Nonnull RelighterFactory getRelighterFactory() {
public @Nonnull
RelighterFactory getRelighterFactory() {
return (_a, _b, _c) -> NullRelighter.INSTANCE;
}

View File

@ -11,7 +11,7 @@ applyPlatformAndCoreConfiguration()
dependencies {
constraints {
implementation( "org.yaml:snakeyaml") {
implementation("org.yaml:snakeyaml") {
version { strictly("1.28") }
because("Bukkit provides SnakeYaml")
}

View File

@ -291,10 +291,10 @@ Other Permissions
}
private fun String.makeRstSafe(lineJoiner: String) = trim()
.replace("\"", "\\\"").replace("\n", "\n" + " ".repeat(2))
.lineSequence()
.map { line -> line.ifBlank { "" } }
.joinToString(separator = lineJoiner)
.replace("\"", "\\\"").replace("\n", "\n" + " ".repeat(2))
.lineSequence()
.map { line -> line.ifBlank { "" } }
.joinToString(separator = lineJoiner)
private fun linkSafe(text: String) = text.replace(" ", "-")

View File

@ -53,8 +53,8 @@ private fun formatAsRst(component: Component, currentDeco: String? = null): Char
deco?.let {
require(currentDeco == null) {
"Nested decorations are hell in RST. \n" +
"Existing: $currentDeco; New: $deco\n" +
"Offender: ${TextHelper.reduceToText(component)}"
"Existing: $currentDeco; New: $deco\n" +
"Offender: ${TextHelper.reduceToText(component)}"
}
content.rstDeco(deco)
}

View File

@ -37,8 +37,9 @@ import java.util.Map;
/**
* A mob spawner block.
*
* @deprecated WorldEdit does not handle interpreting NBT,
* deprecated for removal without replacement
* deprecated for removal without replacement
*/
@Deprecated(forRemoval = true)
public class MobSpawnerBlock extends BaseBlock {
@ -69,7 +70,7 @@ public class MobSpawnerBlock extends BaseBlock {
* Construct the mob spawner block.
*
* @param blockState The block state
* @param mobType mob type
* @param mobType mob type
*/
public MobSpawnerBlock(BlockState blockState, String mobType) {
super(blockState);
@ -140,7 +141,8 @@ public class MobSpawnerBlock extends BaseBlock {
if (spawnPotentials == null) {
values.put("SpawnPotentials", new ListTag(CompoundTag.class, ImmutableList.of(
new CompoundTag(ImmutableMap.of("Weight", new IntTag(1), "Entity",
new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))))))));
new CompoundTag(ImmutableMap.of("id", new StringTag(mobType)))
)))));
} else {
values.put("SpawnPotentials", new ListTag(CompoundTag.class, spawnPotentials.getValue()));
}

View File

@ -33,25 +33,25 @@ import java.util.Map;
* Represents a sign block.
*
* @deprecated WorldEdit does not handle interpreting NBT,
* deprecated for removal without replacement
* deprecated for removal without replacement
*/
@Deprecated(forRemoval = true)
public class SignBlock extends BaseBlock {
private String[] text;
private static String EMPTY = "{\"text\":\"\"}";
private static String EMPTY = "{\"text\":\"\"}";
/**
* Construct the sign with text.
*
* @param blockState The block state
* @param text lines of text
* @param text lines of text
*/
public SignBlock(BlockState blockState, String[] text) {
super(blockState);
if (text == null) {
this.text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY };
this.text = new String[]{EMPTY, EMPTY, EMPTY, EMPTY};
return;
}
for (int i = 0; i < text.length; i++) {
@ -115,7 +115,7 @@ public class SignBlock extends BaseBlock {
Tag t;
text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY };
text = new String[]{EMPTY, EMPTY, EMPTY, EMPTY};
t = values.get("id");
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals(getNbtId())) {

View File

@ -33,7 +33,7 @@ import java.util.Map;
* A skull block.
*
* @deprecated WorldEdit does not handle interpreting NBT,
* deprecated for removal without replacement
* deprecated for removal without replacement
*/
@Deprecated(forRemoval = true)
public class SkullBlock extends BaseBlock {
@ -42,6 +42,7 @@ public class SkullBlock extends BaseBlock {
/**
* Construct the skull block with a default type of skelton.
*
* @param state BlockState to set
*/
public SkullBlock(BlockState state) {
@ -52,8 +53,9 @@ public class SkullBlock extends BaseBlock {
/**
* Construct the skull block with a given rotation and owner.
* The type is assumed to be player unless owner is null or empty.
*
* @param blockState BlockState to set
* @param owner name of player
* @param owner name of player
*/
public SkullBlock(BlockState blockState, String owner) {
super(blockState);
@ -62,6 +64,7 @@ public class SkullBlock extends BaseBlock {
/**
* Set the skull's owner. Automatically sets type to player if not empty or null.
*
* @param owner player name to set the skull to
*/
public void setOwner(String owner) {
@ -78,6 +81,7 @@ public class SkullBlock extends BaseBlock {
/**
* Get the skull's owner. Returns null if unset.
*
* @return player name or null
*/
public String getOwner() {
@ -123,4 +127,5 @@ public class SkullBlock extends BaseBlock {
setOwner(((CompoundTag) t).getValue().get("Name").getValue().toString());
}
}
}

View File

@ -351,7 +351,8 @@ public class Fawe {
* Non-api. Handles an input FAWE exception if not already handled, given the input boolean array.
* Looks at the {@link FaweException.Type} and decides what to do (rethrows if we want to attempt to show the error to the
* player, outputs to console where necessary).
* @param faweExceptionReasonsUsed boolean array that should be cached where this method is called from of length {@code
*
* @param faweExceptionReasonsUsed boolean array that should be cached where this method is called from of length {@code
* FaweException.Type.values().length}
* @param e {@link FaweException} to handle
* @param logger {@link Logger} of the calling class

View File

@ -277,7 +277,8 @@ public class FaweAPI {
);
RegionWrapper boundsPlus = new RegionWrapper(bounds.minX - 64, bounds.maxX + 512, bounds.minY, bounds.maxY,
bounds.minZ - 64,
bounds.maxZ + 512);
bounds.maxZ + 512
);
HashSet<RegionWrapper> regionSet = Sets.<RegionWrapper>newHashSet(bounds);
ArrayList<DiskStorageHistory> result = new ArrayList<>();
for (File file : files) {
@ -285,7 +286,8 @@ public class FaweAPI {
DiskStorageHistory dsh = new DiskStorageHistory(world, uuid, Integer.parseInt(file.getName().split("\\.")[0]));
SimpleChangeSetSummary summary = dsh.summarize(boundsPlus, shallow);
RegionWrapper region = new RegionWrapper(summary.minX, summary.maxX, extent.getMinY(), extent.getMaxY(), summary.minZ,
summary.maxZ);
summary.maxZ
);
boolean encompassed = false;
boolean isIn = false;
for (RegionWrapper allowed : regionSet) {

View File

@ -141,9 +141,11 @@ public enum FaweCache implements Trimable {
Caption.of("fawe.cancel.worldedit.cancel.reason.no.region"),
Type.NO_REGION
);
public static final FaweException OUTSIDE_REGION = new FaweException(Caption.of(
"fawe.cancel.worldedit.cancel.reason.outside.region"),
Type.OUTSIDE_REGION);
public static final FaweException OUTSIDE_REGION = new FaweException(
Caption.of(
"fawe.cancel.worldedit.cancel.reason.outside.region"),
Type.OUTSIDE_REGION
);
public static final FaweException MAX_CHECKS = new FaweException(
Caption.of("fawe.cancel.worldedit.cancel.reason.max" + ".checks"),
Type.MAX_CHECKS
@ -156,16 +158,20 @@ public enum FaweCache implements Trimable {
Caption.of("fawe.cancel.worldedit.cancel.reason.low" + ".memory"),
Type.LOW_MEMORY
);
public static final FaweException MAX_ENTITIES = new FaweException(Caption.of(
"fawe.cancel.worldedit.cancel.reason.max.entities"),
Type.MAX_ENTITIES);
public static final FaweException MAX_ENTITIES = new FaweException(
Caption.of(
"fawe.cancel.worldedit.cancel.reason.max.entities"),
Type.MAX_ENTITIES
);
public static final FaweException MAX_TILES = new FaweException(Caption.of(
"fawe.cancel.worldedit.cancel.reason.max.tiles",
Type.MAX_TILES
));
public static final FaweException MAX_ITERATIONS = new FaweException(Caption.of(
"fawe.cancel.worldedit.cancel.reason.max.iterations"),
Type.MAX_ITERATIONS);
public static final FaweException MAX_ITERATIONS = new FaweException(
Caption.of(
"fawe.cancel.worldedit.cancel.reason.max.iterations"),
Type.MAX_ITERATIONS
);
/*
thread cache

View File

@ -4,7 +4,6 @@ import com.fastasyncworldedit.core.command.tool.ResettableTool;
import com.fastasyncworldedit.core.configuration.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.function.pattern.Pattern;

View File

@ -79,7 +79,8 @@ public class CopyPastaBrush implements Brush, ResettableTool {
// Add origin
mask.test(position);
RecursiveVisitor visitor = new RecursiveVisitor(mask, new NullRegionFunction(), (int) size, editSession.getMinY(),
editSession.getMaxY());
editSession.getMaxY()
);
visitor.visit(position);
Operations.completeBlindly(visitor);
// Build the clipboard

View File

@ -27,8 +27,10 @@ public class HeightBrush implements Brush {
public final boolean layers;
public final boolean smooth;
public HeightBrush(InputStream stream, int rotation, double yscale, boolean layers, boolean smooth, Clipboard clipboard,
int minY, int maxY) {
public HeightBrush(
InputStream stream, int rotation, double yscale, boolean layers, boolean smooth, Clipboard clipboard,
int minY, int maxY
) {
this(stream, rotation, yscale, layers, smooth, clipboard, ScalableHeightMap.Shape.CONE, minY, maxY);
}

View File

@ -41,7 +41,8 @@ public class LayerBrush implements Brush {
final RadiusMask radius = new RadiusMask(0, (int) size);
visitor = new RecursiveVisitor(new MaskIntersection(adjacent, solid, radius), funcion -> true, Integer.MAX_VALUE,
editSession.getMinY(),
editSession.getMaxY());
editSession.getMaxY()
);
visitor.visit(position);
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
Operations.completeBlindly(visitor);

View File

@ -53,7 +53,8 @@ public class ScatterBrush implements Brush {
final int distance = Math.min((int) size, this.distance);
RecursiveVisitor visitor = new RecursiveVisitor(new MaskIntersection(radius, surface), function -> true,
Integer.MAX_VALUE, editSession.getMinY(), editSession.getMaxY());
Integer.MAX_VALUE, editSession.getMinY(), editSession.getMaxY()
);
visitor.visit(position);
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
Operations.completeBlindly(visitor);

View File

@ -21,8 +21,10 @@ public class StencilBrush extends HeightBrush {
private final boolean onlyWhite;
public StencilBrush(InputStream stream, int rotation, double yscale, boolean onlyWhite, Clipboard clipboard, int minY,
int maxY) {
public StencilBrush(
InputStream stream, int rotation, double yscale, boolean onlyWhite, Clipboard clipboard, int minY,
int maxY
) {
super(stream, rotation, yscale, false, true, clipboard, minY, maxY);
this.onlyWhite = onlyWhite;
}

View File

@ -6,7 +6,6 @@ import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.fastasyncworldedit.core.util.MathMan;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;

View File

@ -1,12 +1,12 @@
package com.fastasyncworldedit.core.extension.factory;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.extension.factory.parser.transform.RichTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.Linear3DTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.LinearTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.OffsetTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.PatternTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.RandomTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.RichTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.RotateTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.ScaleTransformParser;
import com.fastasyncworldedit.core.extension.factory.parser.transform.SpreadTransformParser;
@ -93,7 +93,7 @@ public class TransformFactory extends AbstractFactory<ResettableExtent> {
* Parses a transform without considering parsing through the {@link RichTransformParser}, therefore not accepting
* "richer" parsing where & and , are used. Exists to prevent stack overflows.
*
* @param input input string
* @param input input string
* @param context input context
* @return parsed result
* @throws InputParseException if no result found

View File

@ -5,13 +5,9 @@ import com.fastasyncworldedit.core.function.mask.AdjacentAnyMask;
import com.fastasyncworldedit.core.function.mask.AdjacentMask;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Locatable;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.world.World;
import javax.annotation.Nonnull;
import java.util.stream.Stream;

View File

@ -2,7 +2,6 @@ package com.fastasyncworldedit.core.extension.factory.parser.mask;
import com.fastasyncworldedit.core.extension.factory.parser.RichParser;
import com.fastasyncworldedit.core.function.mask.WallMask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -10,7 +9,6 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.stream.Stream;
public class WallMaskParser extends RichParser<Mask> {

View File

@ -7,7 +7,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.formatting.text.TextComponent;

View File

@ -7,7 +7,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.formatting.text.TextComponent;

View File

@ -6,7 +6,6 @@ import com.fastasyncworldedit.core.function.pattern.RelativePattern;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.formatting.text.TextComponent;

View File

@ -7,7 +7,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.formatting.text.TextComponent;

View File

@ -7,7 +7,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.formatting.text.TextComponent;

View File

@ -1,8 +1,8 @@
package com.fastasyncworldedit.core.extension.factory.parser.transform;
import com.fastasyncworldedit.core.extension.factory.parser.RichParser;
import com.fastasyncworldedit.core.extent.transform.OffsetTransform;
import com.fastasyncworldedit.core.extent.ResettableExtent;
import com.fastasyncworldedit.core.extent.transform.OffsetTransform;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;

View File

@ -1,6 +1,5 @@
package com.fastasyncworldedit.core.extent;
import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.extent.filter.block.ExtentFilterBlock;
import com.fastasyncworldedit.core.function.generator.GenBase;
import com.fastasyncworldedit.core.function.generator.Resource;

View File

@ -27,16 +27,13 @@ import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;

View File

@ -2,7 +2,6 @@ package com.fastasyncworldedit.core.extent;
import com.fastasyncworldedit.core.util.ExtentTraverser;
import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;

View File

@ -1,7 +1,6 @@
package com.fastasyncworldedit.core.extent.clipboard.io.schematic;
import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.math.MutableBlockVector3;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag;

View File

@ -15,8 +15,8 @@ public class ArrayHeightMap extends ScalableHeightMap {
* New height map represented by byte array[][] of values x*z to be scaled given a set size
*
* @param height array of height values
* @param minY min y value allowed to be set. Inclusive.
* @param maxY max y value allowed to be set. Inclusive.
* @param minY min y value allowed to be set. Inclusive.
* @param maxY max y value allowed to be set. Inclusive.
*/
public ArrayHeightMap(byte[][] height, int minY, int maxY) {
super(minY, maxY);

View File

@ -138,8 +138,10 @@ public interface HeightMap {
double raiseScaled = diff * (raisePow * sizePowInv);
double raiseScaledAbs = Math.abs(raiseScaled);
int random =
ThreadLocalRandom.current().nextInt(maxY + 1 - minY) - minY < (int) ((Math.ceil(raiseScaledAbs) - Math.floor(
raiseScaledAbs)) * (maxY + 1 - minY)) ? (diff > 0 ? 1 : -1) : 0;
ThreadLocalRandom
.current()
.nextInt(maxY + 1 - minY) - minY < (int) ((Math.ceil(raiseScaledAbs) - Math.floor(
raiseScaledAbs)) * (maxY + 1 - minY)) ? (diff > 0 ? 1 : -1) : 0;
int raiseScaledInt = (int) raiseScaled + random;
newData[index] = height + raiseScaledInt;
}
@ -181,8 +183,10 @@ public interface HeightMap {
}
raise = (yscale * raise);
int random =
ThreadLocalRandom.current().nextInt(maxY + 1 - minY) - minY < (int) ((raise - (int) raise) * (maxY - minY + 1))
? 1 : 0;
ThreadLocalRandom
.current()
.nextInt(maxY + 1 - minY) - minY < (int) ((raise - (int) raise) * (maxY - minY + 1))
? 1 : 0;
int newHeight = height + (int) raise + random;
newData[index] = newHeight;
}

View File

@ -92,7 +92,7 @@ public class ScalableHeightMap implements HeightMap {
highestY = y + 1;
}
}
int pointHeight = Math.min(clipMaxY, ((maxY - minY + 1 ) * (highestY - clipMinY)) / clipHeight);
int pointHeight = Math.min(clipMaxY, ((maxY - minY + 1) * (highestY - clipMinY)) / clipHeight);
int x = xx - clipMinX;
int z = zz - clipMinZ;
heightArray[x][z] = (byte) pointHeight;

View File

@ -17,9 +17,9 @@ public class OffsetTransform extends ResettableExtent {
* New instance
*
* @param parent extent to set to
* @param dx offset x
* @param dy offset y
* @param dz offset z
* @param dx offset x
* @param dy offset y
* @param dz offset z
*/
public OffsetTransform(Extent parent, int dx, int dy, int dz) {
super(parent);

View File

@ -20,9 +20,9 @@ public class RandomOffsetTransform extends ResettableExtent {
* New instance
*
* @param parent extent to set to
* @param dx range of x values to choose from (0 -> x)
* @param dy range of y values to choose from (0 -> y)
* @param dz range of z values to choose from (0 -> z)
* @param dx range of x values to choose from (0 -> x)
* @param dy range of y values to choose from (0 -> y)
* @param dz range of z values to choose from (0 -> z)
*/
public RandomOffsetTransform(Extent parent, int dx, int dy, int dz) {
super(parent);

View File

@ -48,6 +48,7 @@ public class FaweException extends RuntimeException {
/**
* Get the {@link FaweException.Type}
*
* @return the {@link FaweException.Type}
*/
public Type getType() {

View File

@ -356,7 +356,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
minSectionIndex = layer;
if (biomes != null) {
BiomeType[] tmpBiomes = new BiomeType[sectionCount * 64];
System.arraycopy(biomes, 0, tmpBiomes, 64*diff, biomes.length);
System.arraycopy(biomes, 0, tmpBiomes, 64 * diff, biomes.length);
biomes = tmpBiomes;
}
if (light != null) {

View File

@ -333,19 +333,29 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
@Override
public void flushLightToGet(ChunkHolder chunk) {
chunk.chunkExisting.setLightingToGet(chunk.chunkSet.getLight(), chunk.chunkSet.getMinSectionIndex(),
chunk.chunkSet.getMaxSectionIndex());
chunk.chunkSet.getMaxSectionIndex()
);
chunk.chunkExisting.setSkyLightingToGet(chunk.chunkSet.getSkyLight(), chunk.chunkSet.getMinSectionIndex(),
chunk.chunkSet.getMaxSectionIndex());
chunk.chunkSet.getMaxSectionIndex()
);
}
@Override
public void setLightingToGet(ChunkHolder chunk, char[][] lighting) {
chunk.chunkExisting.setLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex());
chunk.chunkExisting.setLightingToGet(
lighting,
chunk.chunkSet.getMinSectionIndex(),
chunk.chunkSet.getMaxSectionIndex()
);
}
@Override
public void setSkyLightingToGet(ChunkHolder chunk, char[][] lighting) {
chunk.chunkExisting.setSkyLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex());
chunk.chunkExisting.setSkyLightingToGet(
lighting,
chunk.chunkSet.getMinSectionIndex(),
chunk.chunkSet.getMaxSectionIndex()
);
}
@Override
@ -486,12 +496,20 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
@Override
public void setLightingToGet(ChunkHolder chunk, char[][] lighting) {
chunk.chunkExisting.setLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex());
chunk.chunkExisting.setLightingToGet(
lighting,
chunk.chunkSet.getMinSectionIndex(),
chunk.chunkSet.getMaxSectionIndex()
);
}
@Override
public void setSkyLightingToGet(ChunkHolder chunk, char[][] lighting) {
chunk.chunkExisting.setSkyLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex());
chunk.chunkExisting.setSkyLightingToGet(
lighting,
chunk.chunkSet.getMinSectionIndex(),
chunk.chunkSet.getMaxSectionIndex()
);
}
@Override

View File

@ -75,7 +75,10 @@ public class AsyncPreloader implements Preloader, Runnable {
}
synchronized (existing) { // Ensure key & value are mutated together
existing.setKey(world);
existing.setValue(ImmutableSet.copyOf(Iterables.limit(region.getChunks(), Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT)));
existing.setValue(ImmutableSet.copyOf(Iterables.limit(
region.getChunks(),
Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT
)));
}
synchronized (update) {
update.notify();

View File

@ -4,7 +4,6 @@ package com.fastasyncworldedit.core.util;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

View File

@ -6,13 +6,13 @@ import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.extent.FaweRegionExtent;
import com.fastasyncworldedit.core.extent.HistoryExtent;
import com.fastasyncworldedit.core.extent.LimitExtent;
import com.fastasyncworldedit.core.extent.MultiRegionExtent;
import com.fastasyncworldedit.core.extent.NullExtent;
import com.fastasyncworldedit.core.extent.SingleRegionExtent;
import com.fastasyncworldedit.core.extent.SlowExtent;
import com.fastasyncworldedit.core.extent.StripNBTExtent;
import com.fastasyncworldedit.core.extent.processor.HeightmapProcessor;
import com.fastasyncworldedit.core.extent.LimitExtent;
import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter;
import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode;
import com.fastasyncworldedit.core.extent.processor.lighting.RelightProcessor;

View File

@ -472,7 +472,8 @@ public class MainUtil {
* @param z New Z coordinate
* @return New tag
*/
@Nonnull public static CompoundTag setPosition(@Nonnull CompoundTag tag, int x, int y, int z) {
@Nonnull
public static CompoundTag setPosition(@Nonnull CompoundTag tag, int x, int y, int z) {
Map<String, Tag> value = new HashMap<>(tag.getValue());
value.put("x", new IntTag(x));
value.put("y", new IntTag(y));
@ -487,7 +488,8 @@ public class MainUtil {
* @param entity Entity
* @return New tag
*/
@Nonnull public static CompoundTag setEntityInfo(@Nonnull CompoundTag tag, @Nonnull Entity entity) {
@Nonnull
public static CompoundTag setEntityInfo(@Nonnull CompoundTag tag, @Nonnull Entity entity) {
Map<String, Tag> map = new HashMap<>(tag.getValue());
map.put("Id", new StringTag(entity.getState().getType().getId()));
ListTag pos = (ListTag) map.get("Pos");

View File

@ -1999,7 +1999,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
// There are boundaries that the routine needs to stay in
Mask mask = new MaskIntersection(
new BoundedHeightMask(minY, Math.min(origin.getBlockY(), maxY)),
new BoundedHeightMask(minY, Math.min(origin.getBlockY(), maxY)),
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
blockMask
);

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.extension.factory.TransformFactory;
import com.fastasyncworldedit.core.extent.ResettableExtent;
import com.google.common.base.Throwables;
import com.google.common.collect.HashMultimap;
@ -38,7 +39,6 @@ import com.sk89q.worldedit.extension.factory.BlockFactory;
import com.sk89q.worldedit.extension.factory.ItemFactory;
import com.sk89q.worldedit.extension.factory.MaskFactory;
import com.sk89q.worldedit.extension.factory.PatternFactory;
import com.fastasyncworldedit.core.extension.factory.TransformFactory;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.Platform;

View File

@ -1500,4 +1500,5 @@ public class BrushCommands {
player.print(Caption.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
}
}

View File

@ -28,7 +28,6 @@ import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard;
import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard;
import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder;
import com.fastasyncworldedit.core.internal.exception.FaweException;
import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream;
import com.fastasyncworldedit.core.object.FaweLimit;
import com.fastasyncworldedit.core.util.ImgurUtility;

View File

@ -75,9 +75,9 @@ public class ExpandCommands {
command.condition(new PermissionCondition(ImmutableSet.of("worldedit.selection.expand")));
command.addPart(SubCommandPart.builder(
Caption.of("vert"),
TextComponent.of("Vertical expansion sub-command")
)
Caption.of("vert"),
TextComponent.of("Vertical expansion sub-command")
)
.withCommands(ImmutableSet.of(createVertCommand(commandManager)))
.optional()
.build());

View File

@ -51,7 +51,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
import org.enginehub.piston.annotation.Command;
@ -637,11 +636,14 @@ public class GenerationCommands {
((AbstractExtentMask) mask).setExtent(editSession);
}
checkCommandArgument(minY >= editSession.getMinY(), Caption.of("fawe.error.outside-range-lower", "miny",
editSession.getMinY()));
editSession.getMinY()
));
checkCommandArgument(maxY <= editSession.getMaxY(), Caption.of("fawe.error.outside-range-upper", "maxy",
editSession.getMaxY()));
editSession.getMaxY()
));
checkCommandArgument(minY < maxY, Caption.of("fawe.error.argument-size-mismatch", "miny",
"maxy"));
"maxy"
));
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
}

View File

@ -147,8 +147,8 @@ class LegacySnapshotCommands {
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {
@ -167,8 +167,8 @@ class LegacySnapshotCommands {
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {

View File

@ -320,10 +320,10 @@ public class RegionCommands {
) throws WorldEditException {
if (from == null) {
from = new ExistingBlockMask(editSession);
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow
} else if (from instanceof AbstractExtentMask) {
((AbstractExtentMask) from).setExtent(editSession);
//FAWE end
//FAWE end
}
if (from instanceof AbstractExtentMask) {
((AbstractExtentMask) from).setExtent(editSession);

View File

@ -272,8 +272,8 @@ public class SnapshotCommands {
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {
@ -314,8 +314,8 @@ public class SnapshotCommands {
}
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {

View File

@ -122,9 +122,9 @@ public class ToolCommands {
.collect(Collectors.toSet());
commandManager.register("tool", command -> {
command.addPart(SubCommandPart.builder(
Caption.of("tool"),
TextComponent.of("The tool to bind")
)
Caption.of("tool"),
TextComponent.of("The tool to bind")
)
.withCommands(nonGlobalCommands)
.required()
.build());

View File

@ -367,11 +367,13 @@ public class ToolUtilCommands {
desc = "Set the brush transform"
)
@CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
public void transform(Player player, LocalSession session, EditSession editSession,
@Arg(desc = "The transform", def = "") ResettableExtent transform,
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
boolean offHand,
Arguments arguments) throws WorldEditException {
public void transform(
Player player, LocalSession session, EditSession editSession,
@Arg(desc = "The transform", def = "") ResettableExtent transform,
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
boolean offHand,
Arguments arguments
) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(Caption.of("fawe.worldedit.brush.brush.none"));

View File

@ -414,7 +414,9 @@ public class UtilityCommands {
size = Math.max(1, size);
we.checkMaxRadius(size);
height = height != null ? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1) : (world.getMaxY() - world.getMinY() + 1);
height = height != null
? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1)
: (world.getMaxY() - world.getMinY() + 1);
int affected = editSession.removeAbove(session.getPlacementPosition(actor), size, height);
actor.print(Caption.of("worldedit.removeabove.removed", TextComponent.of(affected)));
return affected;
@ -437,7 +439,9 @@ public class UtilityCommands {
size = Math.max(1, size);
we.checkMaxRadius(size);
height = height != null ? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1) : (world.getMaxY() - world.getMinY() + 1);
height = height != null
? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1)
: (world.getMaxY() - world.getMinY() + 1);
int affected = editSession.removeBelow(session.getPlacementPosition(actor), size, height);
actor.print(Caption.of("worldedit.removebelow.removed", TextComponent.of(affected)));
return affected;

View File

@ -30,11 +30,11 @@ public class BooleanConverter {
commandManager.registerConverter(
Key.of(Boolean.class),
MultiKeyConverter.builder(
ImmutableSetMultimap.<Boolean, String>builder()
.putAll(false, "off", "f", "false", "n", "no")
.putAll(true, "on", "t", "true", "y", "yes")
.build()
)
ImmutableSetMultimap.<Boolean, String>builder()
.putAll(false, "off", "f", "false", "n", "no")
.putAll(true, "on", "t", "true", "y", "yes")
.build()
)
.errorMessage(arg -> "Not a boolean value: " + arg)
.build()
);

View File

@ -60,6 +60,7 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
private final String description;
@Nullable
private final Consumer<ParserContext> contextTweaker;
private FactoryConverter(
WorldEdit worldEdit,
Function<WorldEdit, AbstractFactory<T>> factoryExtractor,

View File

@ -34,12 +34,12 @@ public class RegionFactoryConverter {
commandManager.registerConverter(
Key.of(RegionFactory.class),
MultiKeyConverter.builder(
ImmutableSetMultimap.<RegionFactory, String>builder()
.put(new CuboidRegionFactory(), "cuboid")
.put(new SphereRegionFactory(), "sphere")
.putAll(new CylinderRegionFactory(1), "cyl", "cylinder")
.build()
)
ImmutableSetMultimap.<RegionFactory, String>builder()
.put(new CuboidRegionFactory(), "cuboid")
.put(new SphereRegionFactory(), "sphere")
.putAll(new CylinderRegionFactory(1), "cyl", "cylinder")
.build()
)
.errorMessage(arg -> "Not a known region type: " + arg)
.build()
);

View File

@ -53,17 +53,17 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
@SuppressWarnings("unchecked")
public static void register(CommandManager commandManager) {
ImmutableList.of(
BlockType.class,
BlockCategory.class,
ItemType.class,
ItemCategory.class,
BiomeType.class,
EntityType.class,
FluidType.class,
FluidCategory.class,
GameMode.class,
WeatherType.class
)
BlockType.class,
BlockCategory.class,
ItemType.class,
ItemCategory.class,
BiomeType.class,
EntityType.class,
FluidType.class,
FluidCategory.class,
GameMode.class,
WeatherType.class
)
.stream()
.map(c -> (Class<Keyed>) c)
.forEach(registryType ->

View File

@ -88,7 +88,8 @@ public class FloodFillTool implements BlockTool {
Mask mask = initialType.toMask(editSession);
BlockReplace function = new BlockReplace(editSession, pattern);
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range, editSession.getMinY(),
editSession.getMaxY(), editSession);
editSession.getMaxY(), editSession
);
visitor.visit(origin);
Operations.completeLegacy(visitor);
//FAWE end

View File

@ -77,7 +77,7 @@ public class QueryTool implements BlockTool {
}
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.tool.info.light.hover"))));
player.print(builder.build());

View File

@ -235,6 +235,7 @@ public final class SuggestionHelper {
}
//FAWE start
/**
* Returns a stream of suggestions for booleans.
*

View File

@ -21,7 +21,6 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.extension.factory.parser.AliasedParser;
import com.fastasyncworldedit.core.util.StringMan;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
@ -36,7 +35,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

View File

@ -384,9 +384,9 @@ public final class PlatformCommandManager {
final List<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
cmd.addPart(SubCommandPart.builder(
Caption.of("worldedit.argument.action"),
TextComponent.of("Sub-command to run.")
)
Caption.of("worldedit.argument.action"),
TextComponent.of("Sub-command to run.")
)
.withCommands(subCommands)
.required()
.build());
@ -419,9 +419,9 @@ public final class PlatformCommandManager {
final List<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
cmd.addPart(SubCommandPart.builder(
Caption.of("worldedit.argument.action"),
TextComponent.of("Sub-command to run.")
)
Caption.of("worldedit.argument.action"),
TextComponent.of("Sub-command to run.")
)
.withCommands(subCommands)
.required()
.build());

View File

@ -29,7 +29,6 @@ import com.fastasyncworldedit.core.queue.Filter;
import com.fastasyncworldedit.core.util.EditSessionBuilder;
import com.fastasyncworldedit.core.util.MaskTraverser;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;

View File

@ -56,7 +56,11 @@ public class Apply implements Contextual<Operation> {
@Override
public Operation createFromContext(EditContext context) {
//FAWE start > add extent to RegionVisitor to allow chunk preloading
return new RegionVisitor(firstNonNull(context.getRegion(), region), function.createFromContext(context), context.getDestination());
return new RegionVisitor(
firstNonNull(context.getRegion(), region),
function.createFromContext(context),
context.getDestination()
);
//FAWE end
}

View File

@ -49,7 +49,11 @@ public class ApplyRegion implements Contextual<Operation> {
@Override
public Operation createFromContext(EditContext context) {
//FAWE start > add extent to RegionVisitor to allow chunk preloading
return new RegionVisitor(firstNonNull(context.getRegion(), region), function.createFromContext(context), context.getDestination());
return new RegionVisitor(
firstNonNull(context.getRegion(), region),
function.createFromContext(context),
context.getDestination()
);
//FAWE end
}

View File

@ -71,7 +71,13 @@ public class Paint implements Contextual<Operation> {
Region region = firstNonNull(context.getRegion(), this.region);
GroundFunction ground = new GroundFunction(new ExistingBlockMask(destination), function.createFromContext(context));
//FAWE start - provide extent for preloading
LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground, destination);
LayerVisitor visitor = new LayerVisitor(
asFlatRegion(region),
minimumBlockY(region),
maximumBlockY(region),
ground,
destination
);
//FAWE end
visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
return visitor;

View File

@ -62,6 +62,7 @@ public final class Masks {
}
//FAWE start
/**
* Negate the given mask.
*
@ -212,7 +213,8 @@ public final class Masks {
//FAWE start - protected > private
protected static class NegatedMask implements Mask {
//FAWE end
//FAWE end
protected final Mask mask;
private NegatedMask(Mask mask) {
@ -244,6 +246,7 @@ public final class Masks {
}
private static class NegatedMask2D implements Mask2D {
private final Mask2D mask;
private NegatedMask2D(Mask2D mask) {

View File

@ -28,7 +28,6 @@ import com.fastasyncworldedit.core.function.block.CombinedBlockCopy;
import com.fastasyncworldedit.core.function.block.SimpleBlockCopy;
import com.fastasyncworldedit.core.function.visitor.IntersectRegionFunction;
import com.fastasyncworldedit.core.queue.implementation.ParallelQueueExtent;
import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent;
import com.fastasyncworldedit.core.util.ExtentTraverser;
import com.fastasyncworldedit.core.util.MaskTraverser;
import com.google.common.collect.ImmutableList;

View File

@ -114,6 +114,7 @@ public abstract class BreadthFirstSearch implements Operation {
}
//FAWE start - int depth, min/max y, preloading
/**
* Create a new instance.
*
@ -290,7 +291,8 @@ public abstract class BreadthFirstSearch implements Operation {
if (singleQueue != null && Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT > 1) {
int cx = Integer.MIN_VALUE;
int cz = Integer.MIN_VALUE;
outer: for (BlockVector3 from : queue) {
outer:
for (BlockVector3 from : queue) {
for (BlockVector3 direction : dirs) {
if (loadCount > Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT) {
break outer;

View File

@ -53,6 +53,7 @@ public class DownwardVisitor extends RecursiveVisitor {
}
//FAWE start - int depth, min/max y, preloading
/**
* Create a new visitor.
*

View File

@ -49,6 +49,7 @@ public class FlatRegionVisitor implements Operation {
private int affected = 0;
//FAWE start - chunk preloading
/**
* Create a new visitor.
*

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.visitor;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.math.BlockVectorSet;
import com.fastasyncworldedit.core.queue.implementation.ParallelQueueExtent;
import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent;
import com.fastasyncworldedit.core.util.ExtentTraverser;
@ -35,8 +33,6 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.FlatRegion;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@ -61,6 +57,7 @@ public class LayerVisitor implements Operation {
//FAWE start - chunk preloading
/**
* Create a new visitor.
*

View File

@ -44,6 +44,7 @@ public class NonRisingVisitor extends RecursiveVisitor {
}
//FAWE start - int depth, preloading, min/max y
/**
* Create a new recursive visitor.
*

View File

@ -46,6 +46,7 @@ public class RecursiveVisitor extends BreadthFirstSearch {
}
//FAWE start - int depth, min/max y
/**
* Create a new recursive visitor.
*
@ -60,6 +61,7 @@ public class RecursiveVisitor extends BreadthFirstSearch {
}
//FAWE start - int depth, min/max y
/**
* Create a new recursive visitor.
*

View File

@ -35,6 +35,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import java.util.Iterator;
/**
@ -42,7 +43,8 @@ import java.util.Iterator;
*
* @deprecated - FAWE deprecation: Let the queue iterate, not the region function which lacks any kind of optimizations / parallelism
*/
@Deprecated public class RegionVisitor implements Operation {
@Deprecated
public class RegionVisitor implements Operation {
public final Iterable<? extends BlockVector3> iterable;
//FAWE start - allow chunk preloading
@ -55,7 +57,8 @@ import java.util.Iterator;
/**
* @deprecated Use other constructors which will preload chunks during iteration
*/
@Deprecated public RegionVisitor(Region region, RegionFunction function) {
@Deprecated
public RegionVisitor(Region region, RegionFunction function) {
this(region, function, null);
}
@ -87,7 +90,8 @@ import java.util.Iterator;
return affected;
}
@Override public Operation resume(RunContext run) throws WorldEditException {
@Override
public Operation resume(RunContext run) throws WorldEditException {
//FAWE start > allow chunk preloading
if (singleQueue != null && Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT > 1) {
/*
@ -196,10 +200,12 @@ import java.util.Iterator;
}
//FAWE end
@Override public void cancel() {
@Override
public void cancel() {
}
@Override public Iterable<Component> getStatusMessages() {
@Override
public Iterable<Component> getStatusMessages() {
return ImmutableList.of(Caption.of("worldedit.operation.affected.block", TextComponent.of(getAffected())));
}

View File

@ -113,12 +113,12 @@ public final class Functions {
// Special cases: we accept varargs for these
map.put("min", lookup.findStatic(Doubles.class, "min",
methodType(double.class, double[].class)
)
methodType(double.class, double[].class)
)
.asVarargsCollector(double[].class));
map.put("max", lookup.findStatic(Doubles.class, "max",
methodType(double.class, double[].class)
)
methodType(double.class, double[].class)
)
.asVarargsCollector(double[].class));
}
@ -171,38 +171,38 @@ public final class Functions {
MethodHandles.Lookup lookup
) throws NoSuchMethodException, IllegalAccessException {
map.put("megabuf", lookup.findSpecial(Functions.class, "megabuf",
methodType(double.class, double.class), Functions.class
)
methodType(double.class, double.class), Functions.class
)
.bindTo(this));
map.put("megabuf", lookup.findSpecial(Functions.class, "megabuf",
methodType(double.class, double.class, double.class), Functions.class
)
methodType(double.class, double.class, double.class), Functions.class
)
.bindTo(this));
map.put("closest", lookup.findSpecial(Functions.class, "closest",
methodType(double.class, double.class, double.class, double.class, double.class,
double.class, double.class
), Functions.class
)
methodType(double.class, double.class, double.class, double.class, double.class,
double.class, double.class
), Functions.class
)
.bindTo(this));
// rely on expression field
map.put("query", lookup.findSpecial(Functions.class, "query",
methodType(double.class, double.class, double.class, double.class, LocalSlot.class,
LocalSlot.class
), Functions.class
)
methodType(double.class, double.class, double.class, double.class, LocalSlot.class,
LocalSlot.class
), Functions.class
)
.bindTo(this));
map.put("queryAbs", lookup.findSpecial(Functions.class, "queryAbs",
methodType(double.class, double.class, double.class, double.class, LocalSlot.class,
LocalSlot.class
), Functions.class
)
methodType(double.class, double.class, double.class, double.class, LocalSlot.class,
LocalSlot.class
), Functions.class
)
.bindTo(this));
map.put("queryRel", lookup.findSpecial(Functions.class, "queryRel",
methodType(double.class, double.class, double.class, double.class, LocalSlot.class,
LocalSlot.class
), Functions.class
)
methodType(double.class, double.class, double.class, double.class, LocalSlot.class,
LocalSlot.class
), Functions.class
)
.bindTo(this));
}

View File

@ -116,8 +116,8 @@ class ExpressionHandles {
methodType(boolean.class, double.class)
));
CALL_BINARY_OP = lookup.findVirtual(DoubleBinaryOperator.class, "applyAsDouble",
methodType(double.class, double.class, double.class)
)
methodType(double.class, double.class, double.class)
)
.asType(methodType(Double.class, DoubleBinaryOperator.class, double.class, double.class));
NEW_LS_CONSTANT = lookup.findConstructor(
LocalSlot.Constant.class,

View File

@ -68,9 +68,11 @@ class Int2BaseBlockMap extends AbstractInt2ObjectMap<BaseBlock> {
}
private final Int2IntMap commonMap = new Int2IntOpenHashMap(64, 0.9f);
{
commonMap.defaultReturnValue(BlockStateIdAccess.invalidId());
}
private final Int2ObjectMap<BaseBlock> uncommonMap = new Int2ObjectOpenHashMap<>(1, 0.75f);
@Override

View File

@ -68,7 +68,12 @@ class AnnotatedSubscriberFinder implements SubscriberFindingStrategy {
throw new IllegalArgumentException("Method " + method + " failed to unreflect.", e);
}
EventHandler handler = new MethodHandleEventHandler(annotation.priority(), listener, handle, method.getName());
EventHandler handler = new MethodHandleEventHandler(
annotation.priority(),
listener,
handle,
method.getName()
);
methodsInListener.put(eventType, handler);
}
}

View File

@ -36,7 +36,7 @@ public class MethodEventHandler extends EventHandler {
* Create a new event handler.
*
* @param priority the priority
* @param method the method
* @param method the method
*/
public MethodEventHandler(Priority priority, Object object, Method method) {
super(priority);
@ -83,4 +83,5 @@ public class MethodEventHandler extends EventHandler {
result = 31 * result + method.hashCode();
return result;
}
}

View File

@ -32,10 +32,10 @@ public class MethodHandleEventHandler extends EventHandler {
/**
* Create a new event handler that uses MethodHandles to dispatch.
*
* @param priority the priority
* @param object The object to invoke it on
* @param priority the priority
* @param object The object to invoke it on
* @param methodHandle The handle to invoke
* @param methodName The name of the method (for equality checks)
* @param methodName The name of the method (for equality checks)
*/
protected MethodHandleEventHandler(Priority priority, Object object, MethodHandle methodHandle, String methodName) {
super(priority);
@ -79,4 +79,5 @@ public class MethodHandleEventHandler extends EventHandler {
return Objects.equals(object, that.object);
}
}

View File

@ -221,6 +221,7 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
void simulateBlockMine(BlockVector3 position);
//FAWE start
/**
* Return items that may drop by destroying this block.
*

View File

@ -318,4 +318,5 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
return blockState.getAsString() + nbtString;
}
}

View File

@ -151,7 +151,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
if (type == null) {
String input = key.toString();
throw new SuggestInputParseException("Does not match a valid block type: " + input, input, () -> Stream.of(
BlockTypesCache.values)
BlockTypesCache.values)
.filter(b -> StringMan.blockStateMatches(input, b.getId()))
.map(BlockType::getId)
.sorted(StringMan.blockStateComparator(input))
@ -464,4 +464,5 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
return equalsFuzzy((BlockState) obj);
}
}

View File

@ -101,6 +101,7 @@ public interface BlockStateHolder<B extends BlockStateHolder<B>> extends TileEnt
<V> V getState(Property<V> property);
//FAWE start
/**
* Returns a BlockStateHolder with the given state and value applied.
*

View File

@ -1893,7 +1893,7 @@ public final class BlockTypes {
}
throw new SuggestInputParseException("Does not match a valid block type: " + inputLower, inputLower, () -> Stream.of(
BlockTypesCache.values)
BlockTypesCache.values)
.filter(b -> StringMan.blockStateMatches(inputLower, b.getId()))
.map(BlockType::getId)
.sorted(StringMan.blockStateComparator(inputLower))