Skip to content

Commit

Permalink
Fix the build a bit
Browse files Browse the repository at this point in the history
Improved checkstyling
  • Loading branch information
octylFractal committed Nov 14, 2021
1 parent 410688e commit 5355919
Show file tree
Hide file tree
Showing 29 changed files with 100 additions and 62 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/CommonJavaConfig.kt
Expand Up @@ -33,7 +33,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, javaRelease: Int =

configure<CheckstyleExtension> {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
toolVersion = "8.34"
toolVersion = "9.1"
}

tasks.withType<Test>().configureEach {
Expand Down
2 changes: 1 addition & 1 deletion worldedit-core/doctools/build.gradle.kts
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.4.21"
kotlin("jvm") version "1.5.30"
application
}

Expand Down
Expand Up @@ -299,8 +299,8 @@ public ListTag getListTag(String key) {
*
* @param key the key
* @param listType the class of the contained type
* @return a list of tags
* @param <T> the type of list
* @return a list of tags
*/
@SuppressWarnings("unchecked")
public <T extends Tag> List<T> getList(String key, Class<T> listType) {
Expand Down
2 changes: 1 addition & 1 deletion worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java
Expand Up @@ -308,8 +308,8 @@ public ListTag getListTag(int index) {
*
* @param index the index
* @param listType the class of the contained type
* @return a list of tags
* @param <T> the NBT type
* @return a list of tags
*/
@SuppressWarnings("unchecked")
public <T extends Tag> List<T> getList(int index, Class<T> listType) {
Expand Down
Expand Up @@ -36,9 +36,8 @@ public interface BlockTool extends Tool {
* Perform the primary action of this tool.
*
* @return true to cancel the original event which triggered this action (if possible)
* @deprecated New subclasses should override
* {@link #actPrimary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
* instead
* @deprecated New subclasses should override {@link #actPrimary(Platform, LocalConfiguration, Player, LocalSession,
* Location, Direction)} instead
*/
@Deprecated
default boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
Expand Down
Expand Up @@ -39,9 +39,8 @@ public interface DoubleActionBlockTool extends BlockTool {
* Perform the secondary action of this block tool.
*
* @return true to cancel the original event which triggered this action (if possible)
* @deprecated New subclasses must override
* {@link #actSecondary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
* instead
* @deprecated New subclasses must override {@link #actSecondary(Platform, LocalConfiguration, Player, LocalSession,
* Location, Direction)} instead
*/
@Deprecated
default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
Expand Down
Expand Up @@ -284,8 +284,7 @@ default Location getBlockIn() {
* @param pos where to move them
* @param pitch the pitch (up/down) of the player's view in degrees
* @param yaw the yaw (left/right) of the player's view in degrees
* @deprecated This method may fail without indication. Use
* {@link #trySetPosition(Vector3, float, float)} instead
* @deprecated This method may fail without indication. Use {@link #trySetPosition(Vector3, float, float)} instead
*/
@Deprecated
default void setPosition(Vector3 pos, float pitch, float yaw) {
Expand Down
Expand Up @@ -132,9 +132,8 @@ public <T> Optional<AssetLoader<T>> getAssetLoader(Class<T> assetClass, String f
* Get the Asset Loaders for the given type.
*
* @param assetClass The class to get the loaders of
* @return The list of asset loaders
*
* @param <T> The asset type
* @return The list of asset loaders
*/
@SuppressWarnings("unchecked")
public <T> List<AssetLoader<T>> getAssetLoaders(Class<T> assetClass) {
Expand Down
Expand Up @@ -34,6 +34,9 @@
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.util.Substring;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
import org.enginehub.piston.inject.MapBackedValueStore;
Expand All @@ -42,9 +45,6 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;

import static com.sk89q.worldedit.fabric.FabricAdapter.adaptPlayer;
import static net.minecraft.commands.Commands.argument;
Expand Down
Expand Up @@ -37,11 +37,6 @@
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -54,6 +49,12 @@
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.Vec3;

import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import javax.annotation.Nullable;

import static com.google.common.base.Preconditions.checkNotNull;

public final class FabricAdapter {
Expand Down Expand Up @@ -109,11 +110,16 @@ public static Vec3 toVec3(BlockVector3 vector) {

public static net.minecraft.core.Direction adapt(Direction face) {
switch (face) {
case NORTH: return net.minecraft.core.Direction.NORTH;
case SOUTH: return net.minecraft.core.Direction.SOUTH;
case WEST: return net.minecraft.core.Direction.WEST;
case EAST: return net.minecraft.core.Direction.EAST;
case DOWN: return net.minecraft.core.Direction.DOWN;
case NORTH:
return net.minecraft.core.Direction.NORTH;
case SOUTH:
return net.minecraft.core.Direction.SOUTH;
case WEST:
return net.minecraft.core.Direction.WEST;
case EAST:
return net.minecraft.core.Direction.EAST;
case DOWN:
return net.minecraft.core.Direction.DOWN;
case UP:
default:
return net.minecraft.core.Direction.UP;
Expand All @@ -125,11 +131,16 @@ public static Direction adaptEnumFacing(@Nullable net.minecraft.core.Direction f
return null;
}
switch (face) {
case NORTH: return Direction.NORTH;
case SOUTH: return Direction.SOUTH;
case WEST: return Direction.WEST;
case EAST: return Direction.EAST;
case DOWN: return Direction.DOWN;
case NORTH:
return Direction.NORTH;
case SOUTH:
return Direction.SOUTH;
case WEST:
return Direction.WEST;
case EAST:
return Direction.EAST;
case DOWN:
return Direction.DOWN;
case UP:
default:
return Direction.UP;
Expand All @@ -142,6 +153,7 @@ public static BlockPos toBlockPos(BlockVector3 vector) {

/**
* Adapts property.
*
* @deprecated without replacement, use the block adapter methods
*/
@Deprecated
Expand All @@ -151,6 +163,7 @@ public static Property<?> adaptProperty(net.minecraft.world.level.block.state.pr

/**
* Adapts properties.
*
* @deprecated without replacement, use the block adapter methods
*/
@Deprecated
Expand Down
Expand Up @@ -21,13 +21,14 @@

import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;

import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;

public class FabricBlockCategoryRegistry implements BlockCategoryRegistry {
@Override
Expand Down
Expand Up @@ -21,11 +21,12 @@

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;
import javax.annotation.Nullable;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.PushReaction;

import javax.annotation.Nullable;

/**
* Fabric block material that pulls as much info as possible from the Minecraft
* Material, and passes the rest to another implementation, typically the
Expand Down
Expand Up @@ -27,12 +27,13 @@
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
import net.minecraft.world.level.block.Block;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.OptionalInt;
import java.util.TreeMap;
import net.minecraft.world.level.block.Block;

public class FabricBlockRegistry extends BundledBlockRegistry {

Expand Down
Expand Up @@ -28,12 +28,13 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.NullWorld;
import com.sk89q.worldedit.world.entity.EntityTypes;
import java.lang.ref.WeakReference;
import javax.annotation.Nullable;
import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;

import java.lang.ref.WeakReference;
import javax.annotation.Nullable;

import static com.google.common.base.Preconditions.checkNotNull;

class FabricEntity implements Entity {
Expand Down
Expand Up @@ -21,13 +21,14 @@

import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.registry.ItemCategoryRegistry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;

import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;

public class FabricItemCategoryRegistry implements ItemCategoryRegistry {
@Override
Expand Down
Expand Up @@ -45,7 +45,6 @@
import net.minecraft.world.level.storage.ServerLevelData;
import org.enginehub.piston.CommandManager;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -55,6 +54,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nullable;

class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {

Expand Down
Expand Up @@ -59,10 +59,10 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;

import javax.annotation.Nullable;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.UUID;
import javax.annotation.Nullable;

public class FabricPlayer extends AbstractPlayerActor {

Expand Down
Expand Up @@ -98,6 +98,7 @@
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;

import java.lang.ref.WeakReference;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down
Expand Up @@ -22,6 +22,7 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
Expand Down
Expand Up @@ -20,13 +20,14 @@
package com.sk89q.worldedit.fabric;

import com.mojang.authlib.GameProfile;
import java.util.UUID;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stat;
import net.minecraft.world.damagesource.DamageSource;

import java.util.UUID;

public class WorldEditFakePlayer extends ServerPlayer {
private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]");

Expand Down
Expand Up @@ -24,6 +24,7 @@
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkStatus;

import javax.annotation.Nullable;

// For now, this does nothing, but might be useful later for regen progress communication.
Expand Down
Expand Up @@ -20,11 +20,12 @@
package com.sk89q.worldedit.fabric.internal;

import com.sk89q.worldedit.util.SideEffect;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;

import javax.annotation.Nullable;

public interface ExtendedChunk {
/**
* {@link ChunkAccess#setBlockState(BlockPos, BlockState, boolean)} with the extra
Expand Down
Expand Up @@ -19,10 +19,11 @@

package com.sk89q.worldedit.fabric.internal;

import java.nio.file.Path;
import net.minecraft.server.ServerResources;
import net.minecraft.world.level.Level;

import java.nio.file.Path;

public interface ExtendedMinecraftServer {

Path getStoragePath(Level world);
Expand Down
Expand Up @@ -28,16 +28,17 @@
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.block.BlockType;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty;

import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

/**
* Raw, un-cached transformations.
*/
Expand Down

0 comments on commit 5355919

Please sign in to comment.