mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
Cleanup some javac warnings
This commit is contained in:
parent
4961c343ba
commit
81f6e3e7cf
@ -37,7 +37,10 @@
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-processing", "-Xlint:-path"))
|
||||
val disabledLint = listOf(
|
||||
"processing", "path", "fallthrough", "serial"
|
||||
)
|
||||
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
||||
options.isDeprecation = true
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
"api"("org.bukkit:bukkit:1.15.2-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
"compileOnly"("org.jetbrains:annotations:19.0.0")
|
||||
"compileOnly"("com.destroystokyo.paper:paper-api:1.15.2-R0.1-SNAPSHOT")
|
||||
"implementation"("io.papermc:paperlib:1.0.2")
|
||||
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
||||
|
@ -48,21 +48,25 @@ public void load() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean hasPermission(String name, String permission) {
|
||||
return hasPermission(server.getOfflinePlayer(name), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean hasPermission(String worldName, String name, String permission) {
|
||||
return hasPermission(worldName, server.getOfflinePlayer(name), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean inGroup(String name, String group) {
|
||||
return inGroup(server.getOfflinePlayer(name), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public String[] getGroups(String name) {
|
||||
return getGroups(server.getOfflinePlayer(name));
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ public NijiPermissionsResolver(Server server, Permissions plugin) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("static-access")
|
||||
public boolean hasPermission(String name, String permission) {
|
||||
try {
|
||||
Player player = server.getPlayerExact(name);
|
||||
@ -82,7 +81,7 @@ public boolean hasPermission(String name, String permission) {
|
||||
try {
|
||||
return api.getHandler().has(player, permission);
|
||||
} catch (Throwable t) {
|
||||
return api.Security.permission(player, permission);
|
||||
return Permissions.Security.permission(player, permission);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
log.warn("Failed to check permissions", t);
|
||||
@ -105,7 +104,6 @@ public boolean hasPermission(String worldName, String name, String permission) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("static-access")
|
||||
public boolean inGroup(String name, String group) {
|
||||
try {
|
||||
Player player = server.getPlayerExact(name);
|
||||
@ -115,7 +113,7 @@ public boolean inGroup(String name, String group) {
|
||||
try {
|
||||
return api.getHandler().inGroup(player.getWorld().getName(), name, group);
|
||||
} catch (Throwable t) {
|
||||
return api.Security.inGroup(name, group);
|
||||
return Permissions.Security.inGroup(name, group);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
log.warn("Failed to check groups", t);
|
||||
@ -124,7 +122,6 @@ public boolean inGroup(String name, String group) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("static-access")
|
||||
public String[] getGroups(String name) {
|
||||
try {
|
||||
Player player = server.getPlayerExact(name);
|
||||
@ -135,7 +132,7 @@ public String[] getGroups(String name) {
|
||||
try {
|
||||
groups = api.getHandler().getGroups(player.getWorld().getName(), player.getName());
|
||||
} catch (Throwable t) {
|
||||
String group = api.Security.getGroup(player.getWorld().getName(), player.getName());
|
||||
String group = Permissions.Security.getGroup(player.getWorld().getName(), player.getName());
|
||||
if (group != null) {
|
||||
groups = new String[] { group };
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public static PermissionsResolverManager getInstance() {
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[] {
|
||||
PluginPermissionsResolver.class,
|
||||
PermissionsExResolver.class,
|
||||
|
@ -62,21 +62,25 @@ public String getDetectionMessage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean hasPermission(String name, String permission) {
|
||||
return hasPermission(server.getOfflinePlayer(name), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean hasPermission(String worldName, String name, String permission) {
|
||||
return hasPermission(worldName, server.getOfflinePlayer(name), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean inGroup(String player, String group) {
|
||||
return inGroup(server.getOfflinePlayer(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public String[] getGroups(String player) {
|
||||
return getGroups(server.getOfflinePlayer(player));
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ public String getDetectionMessage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean hasPermission(String name, String permission) {
|
||||
return hasPermission(server.getOfflinePlayer(name), permission);
|
||||
}
|
||||
@ -64,11 +65,13 @@ public boolean hasPermission(String worldName, String name, String permission) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean inGroup(String player, String group) {
|
||||
return inGroup(server.getOfflinePlayer(player), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public String[] getGroups(String player) {
|
||||
return getGroups(server.getOfflinePlayer(player));
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ public String getName() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printRaw(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
sender.sendMessage(part);
|
||||
@ -74,6 +75,7 @@ public void printRaw(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void print(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
print(TextComponent.of(part, TextColor.LIGHT_PURPLE));
|
||||
@ -81,6 +83,7 @@ public void print(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printDebug(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
print(TextComponent.of(part, TextColor.GRAY));
|
||||
@ -88,6 +91,7 @@ public void printDebug(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printError(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
print(TextComponent.of(part, TextColor.RED));
|
||||
|
@ -65,6 +65,7 @@ public String getName() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printRaw(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
sender.sendMessage(part);
|
||||
@ -72,6 +73,7 @@ public void printRaw(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void print(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
sender.sendMessage("§d" + part);
|
||||
@ -79,6 +81,7 @@ public void print(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printDebug(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
sender.sendMessage("§7" + part);
|
||||
@ -86,6 +89,7 @@ public void printDebug(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printError(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
sender.sendMessage("§c" + part);
|
||||
|
@ -105,6 +105,7 @@ public void giveItem(BaseItemStack itemStack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printRaw(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage(part);
|
||||
@ -112,6 +113,7 @@ public void printRaw(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void print(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage("§d" + part);
|
||||
@ -119,6 +121,7 @@ public void print(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printDebug(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage("§7" + part);
|
||||
@ -126,6 +129,7 @@ public void printDebug(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printError(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage("§c" + part);
|
||||
|
@ -171,7 +171,7 @@ private void setupWorldData() {
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
private void initializeRegistries() {
|
||||
// Biome
|
||||
for (Biome biome : Biome.values()) {
|
||||
|
@ -33,7 +33,7 @@ public class SimpleInjector implements Injector {
|
||||
|
||||
public SimpleInjector(Object... args) {
|
||||
this.args = args;
|
||||
argClasses = new Class[args.length];
|
||||
argClasses = new Class<?>[args.length];
|
||||
for (int i = 0; i < args.length; ++i) {
|
||||
argClasses[i] = args[i].getClass();
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ public void timeout(Actor actor, LocalSession session,
|
||||
desc = "Toggle fast mode"
|
||||
)
|
||||
@CommandPermissions("worldedit.fast")
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
void fast(Actor actor, LocalSession session,
|
||||
@Arg(desc = "The new fast mode state", def = "")
|
||||
Boolean fastMode) {
|
||||
|
@ -329,7 +329,7 @@ public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||
} else {
|
||||
setFlying(true);
|
||||
}
|
||||
setPosition(Vector3.at(x + 0.5, y, z + 0.5));
|
||||
trySetPosition(Vector3.at(x + 0.5, y, z + 0.5));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,21 +115,25 @@ public World getWorld() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printRaw(String msg) {
|
||||
basePlayer.print(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printDebug(String msg) {
|
||||
basePlayer.printDebug(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void print(String msg) {
|
||||
basePlayer.printInfo(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printError(String msg) {
|
||||
basePlayer.printError(TextComponent.of(msg));
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public Clipboard read() throws IOException {
|
||||
if (newBlock != null) {
|
||||
for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
||||
if (handler.isAffectedBlock(newBlock)) {
|
||||
newBlock = handler.updateNBT(block, values);
|
||||
newBlock = handler.updateNBT(block, values).toImmutableState();
|
||||
if (newBlock == null || values.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
@ -24,9 +24,8 @@
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
import com.sk89q.worldedit.registry.state.IntegerProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -38,15 +37,15 @@
|
||||
|
||||
public class BannerBlockCompatibilityHandler implements NBTCompatibilityHandler {
|
||||
|
||||
private static final DirectionalProperty FacingProperty;
|
||||
private static final IntegerProperty RotationProperty;
|
||||
private static final Property<Direction> FacingProperty;
|
||||
private static final Property<Integer> RotationProperty;
|
||||
|
||||
static {
|
||||
DirectionalProperty tempFacing;
|
||||
IntegerProperty tempRotation;
|
||||
Property<Direction> tempFacing;
|
||||
Property<Integer> tempRotation;
|
||||
try {
|
||||
tempFacing = (DirectionalProperty) (Property<?>) BlockTypes.WHITE_WALL_BANNER.getProperty("facing");
|
||||
tempRotation = (IntegerProperty) (Property<?>) BlockTypes.WHITE_BANNER.getProperty("rotation");
|
||||
tempFacing = BlockTypes.WHITE_WALL_BANNER.getProperty("facing");
|
||||
tempRotation = BlockTypes.WHITE_BANNER.getProperty("rotation");
|
||||
} catch (NullPointerException | IllegalArgumentException | ClassCastException e) {
|
||||
tempFacing = null;
|
||||
tempRotation = null;
|
||||
@ -62,7 +61,7 @@ public <B extends BlockStateHolder<B>> boolean isAffectedBlock(B block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values) {
|
||||
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
|
||||
Tag typeTag = values.get("Base");
|
||||
if (typeTag instanceof IntTag) {
|
||||
boolean isWall = block.getBlockType() == BlockTypes.WHITE_WALL_BANNER;
|
||||
@ -73,10 +72,10 @@ public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> val
|
||||
BlockState state = type.getDefaultState();
|
||||
|
||||
if (isWall) {
|
||||
Property facingProp = type.getProperty("facing");
|
||||
Property<Direction> facingProp = type.getProperty("facing");
|
||||
state = state.with(facingProp, block.getState(FacingProperty));
|
||||
} else {
|
||||
Property rotationProp = type.getProperty("rotation");
|
||||
Property<Integer> rotationProp = type.getProperty("rotation");
|
||||
state = state.with(rotationProp, block.getState(RotationProperty));
|
||||
}
|
||||
|
||||
@ -102,7 +101,7 @@ public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> val
|
||||
}
|
||||
values.put("Patterns", new ListTag(((ListTag) patternsTag).getType(), tempList));
|
||||
}
|
||||
return (B) state;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,8 @@
|
||||
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
import com.sk89q.worldedit.registry.state.EnumProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -31,23 +30,24 @@
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("")
|
||||
public class BedBlockCompatibilityHandler implements NBTCompatibilityHandler {
|
||||
|
||||
private static final DirectionalProperty FacingProperty;
|
||||
private static final EnumProperty PartProperty;
|
||||
private static final Property<Direction> FACING_PROPERTY;
|
||||
private static final Property<String> PART_PROPERTY;
|
||||
|
||||
static {
|
||||
DirectionalProperty tempFacing;
|
||||
EnumProperty tempPart;
|
||||
Property<Direction> tempFacing;
|
||||
Property<String> tempPart;
|
||||
try {
|
||||
tempFacing = (DirectionalProperty) (Property<?>) BlockTypes.RED_BED.getProperty("facing");
|
||||
tempPart = (EnumProperty) (Property<?>) BlockTypes.RED_BED.getProperty("part");
|
||||
tempFacing = BlockTypes.RED_BED.getProperty("facing");
|
||||
tempPart = BlockTypes.RED_BED.getProperty("part");
|
||||
} catch (NullPointerException | IllegalArgumentException | ClassCastException e) {
|
||||
tempFacing = null;
|
||||
tempPart = null;
|
||||
}
|
||||
FacingProperty = tempFacing;
|
||||
PartProperty = tempPart;
|
||||
FACING_PROPERTY = tempFacing;
|
||||
PART_PROPERTY = tempPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,7 +56,7 @@ public <B extends BlockStateHolder<B>> boolean isAffectedBlock(B block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values) {
|
||||
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
|
||||
Tag typeTag = values.get("color");
|
||||
if (typeTag instanceof IntTag) {
|
||||
String bedType = convertBedType(((IntTag) typeTag).getValue());
|
||||
@ -65,17 +65,17 @@ public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> val
|
||||
if (type != null) {
|
||||
BlockState state = type.getDefaultState();
|
||||
|
||||
Property facingProp = type.getProperty("facing");
|
||||
state = state.with(facingProp, block.getState(FacingProperty));
|
||||
Property<Direction> facingProp = type.getProperty("facing");
|
||||
state = state.with(facingProp, block.getState(FACING_PROPERTY));
|
||||
|
||||
Property occupiedProp = type.getProperty("occupied");
|
||||
Property<Boolean> occupiedProp = type.getProperty("occupied");
|
||||
state = state.with(occupiedProp, false);
|
||||
|
||||
Property partProp = type.getProperty("part");
|
||||
state = state.with(partProp, block.getState(PartProperty));
|
||||
Property<String> partProp = type.getProperty("part");
|
||||
state = state.with(partProp, block.getState(PART_PROPERTY));
|
||||
|
||||
values.remove("color");
|
||||
return (B) state;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ public <B extends BlockStateHolder<B>> boolean isAffectedBlock(B block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values) {
|
||||
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
|
||||
Tag item = values.get("Item");
|
||||
if (item instanceof StringTag) {
|
||||
String id = ((StringTag) item).getValue();
|
||||
if (id.isEmpty()) {
|
||||
return (B) BlockTypes.FLOWER_POT.getDefaultState();
|
||||
return BlockTypes.FLOWER_POT.getDefaultState();
|
||||
}
|
||||
int data = 0;
|
||||
Tag dataTag = values.get("Data");
|
||||
@ -52,7 +52,7 @@ public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> val
|
||||
BlockState newState = convertLegacyBlockType(id, data);
|
||||
if (newState != null) {
|
||||
values.clear();
|
||||
return (B) newState; // generics pls :\
|
||||
return newState;
|
||||
}
|
||||
}
|
||||
return block;
|
||||
|
@ -27,5 +27,5 @@
|
||||
public interface NBTCompatibilityHandler {
|
||||
<B extends BlockStateHolder<B>> boolean isAffectedBlock(B block);
|
||||
|
||||
<B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values);
|
||||
<B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public <B extends BlockStateHolder<B>> boolean isAffectedBlock(B block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values) {
|
||||
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
|
||||
// note that instrument was not stored (in state or nbt) previously.
|
||||
// it will be updated to the block below when it gets set into the world for the first time
|
||||
Tag noteTag = values.get("note");
|
||||
@ -55,7 +55,7 @@ public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> val
|
||||
Byte note = ((ByteTag) noteTag).getValue();
|
||||
if (note != null) {
|
||||
values.clear();
|
||||
return (B) block.with(NoteProperty, (int) note).toImmutableState();
|
||||
return block.with(NoteProperty, (int) note).toImmutableState();
|
||||
}
|
||||
}
|
||||
return block;
|
||||
|
@ -39,7 +39,7 @@ public <B extends BlockStateHolder<B>> boolean isAffectedBlock(B block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values) {
|
||||
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
String key = "Text" + (i + 1);
|
||||
Tag value = values.get(key);
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -32,12 +32,12 @@
|
||||
|
||||
public class SkullBlockCompatibilityHandler implements NBTCompatibilityHandler {
|
||||
|
||||
private static final DirectionalProperty FacingProperty;
|
||||
private static final Property<Direction> FacingProperty;
|
||||
|
||||
static {
|
||||
DirectionalProperty tempFacing;
|
||||
Property<Direction> tempFacing;
|
||||
try {
|
||||
tempFacing = (DirectionalProperty) (Property<?>) BlockTypes.SKELETON_WALL_SKULL.getProperty("facing");
|
||||
tempFacing = BlockTypes.SKELETON_WALL_SKULL.getProperty("facing");
|
||||
} catch (NullPointerException | IllegalArgumentException | ClassCastException e) {
|
||||
tempFacing = null;
|
||||
}
|
||||
@ -51,7 +51,7 @@ public <B extends BlockStateHolder<B>> boolean isAffectedBlock(B block) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> values) {
|
||||
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
|
||||
boolean isWall = block.getBlockType() == BlockTypes.SKELETON_WALL_SKULL;
|
||||
Tag typeTag = values.get("SkullType");
|
||||
if (typeTag instanceof ByteTag) {
|
||||
@ -61,18 +61,18 @@ public <B extends BlockStateHolder<B>> B updateNBT(B block, Map<String, Tag> val
|
||||
if (type != null) {
|
||||
BlockState state = type.getDefaultState();
|
||||
if (isWall) {
|
||||
Property newProp = type.getProperty("facing");
|
||||
Property<Direction> newProp = type.getProperty("facing");
|
||||
state = state.with(newProp, block.getState(FacingProperty));
|
||||
} else {
|
||||
Tag rotTag = values.get("Rot");
|
||||
if (rotTag instanceof ByteTag) {
|
||||
Property newProp = type.getProperty("rotation");
|
||||
Property<Integer> newProp = type.getProperty("rotation");
|
||||
state = state.with(newProp, (int) ((ByteTag) rotTag).getValue());
|
||||
}
|
||||
}
|
||||
values.remove("SkullType");
|
||||
values.remove("Rot");
|
||||
return (B) state;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,8 +260,9 @@ public static <B extends BlockStateHolder<B>> B transform(B block, Transform tra
|
||||
directionalProperties.put(closestProp, Boolean.TRUE);
|
||||
} else {
|
||||
if (prop.getValues().contains("none")) {
|
||||
//noinspection unchecked
|
||||
result = result.with((Property<Object>) prop, "none");
|
||||
@SuppressWarnings("unchecked")
|
||||
Property<Object> propAsObj = (Property<Object>) prop;
|
||||
result = result.with(propAsObj, "none");
|
||||
}
|
||||
directionalProperties.put(closestProp, block.getState(prop));
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ private BlockVector3(int x, int y, int z) {
|
||||
|
||||
public long toLongPackedForm() {
|
||||
checkLongPackable(this);
|
||||
return (x & BITS_26) | ((z & BITS_26) << 26) | (((y & (long) BITS_12) << (26 + 26)));
|
||||
return (x & BITS_26) | ((z & BITS_26) << 26) | (((y & BITS_12) << (26 + 26)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,14 +132,9 @@ public boolean contains(BlockVector3 position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
Iterator<BlockVector3>[] iterators = (Iterator<BlockVector3>[]) new Iterator[regions.size()];
|
||||
for (int i = 0; i < regions.size(); i++) {
|
||||
iterators[i] = regions.get(i).iterator();
|
||||
}
|
||||
return Iterators.concat(iterators);
|
||||
return Iterators.concat(Iterators.transform(regions.iterator(), r -> r.iterator()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
@ -40,7 +41,12 @@ public class SideEffectBox extends PaginationBox {
|
||||
private static final LazyReference<List<SideEffect>> SIDE_EFFECTS = LazyReference.from(() ->
|
||||
WorldEdit.getInstance().getPlatformManager().getSupportedSideEffects()
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(Enum::name))
|
||||
.sorted(Comparator.comparing(effect ->
|
||||
WorldEditText.reduceToText(
|
||||
TranslatableComponent.of(effect.getDisplayName()),
|
||||
Locale.US
|
||||
)
|
||||
))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
|
@ -159,6 +159,7 @@ public static Map<Property<?>, Object> adaptProperties(BlockType block, Map<net.
|
||||
return props;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private static net.minecraft.block.BlockState applyProperties(StateManager<Block, net.minecraft.block.BlockState> stateContainer,
|
||||
net.minecraft.block.BlockState newState, Map<Property<?>, Object> states) {
|
||||
for (Map.Entry<Property<?>, Object> state : states.entrySet()) {
|
||||
|
@ -86,10 +86,9 @@
|
||||
* receive the source version in the compound.
|
||||
* </p>
|
||||
*/
|
||||
@SuppressWarnings("UnnecessarilyQualifiedStaticUsage")
|
||||
@SuppressWarnings({ "UnnecessarilyQualifiedStaticUsage", "unchecked", "rawtypes" })
|
||||
class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.world.DataFixer {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T fixUp(FixType<T> type, T original, int srcVer) {
|
||||
if (type == FixTypes.CHUNK) {
|
||||
|
@ -139,6 +139,7 @@ public Locale getLocale() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printRaw(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
this.player.sendMessage(new LiteralText(part), false);
|
||||
@ -146,16 +147,19 @@ public void printRaw(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printDebug(String msg) {
|
||||
sendColorized(msg, Formatting.GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void print(String msg) {
|
||||
sendColorized(msg, Formatting.LIGHT_PURPLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printError(String msg) {
|
||||
sendColorized(msg, Formatting.RED);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@
|
||||
* receive the source version in the compound.
|
||||
* </p>
|
||||
*/
|
||||
@SuppressWarnings("UnnecessarilyQualifiedStaticUsage")
|
||||
@SuppressWarnings({ "UnnecessarilyQualifiedStaticUsage", "unchecked", "rawtypes" })
|
||||
class ForgeDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.world.DataFixer {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -138,6 +138,7 @@ private void sendMessage(ITextComponent textComponent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printRaw(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
sendMessage(new StringTextComponent(part));
|
||||
@ -145,16 +146,19 @@ public void printRaw(String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printDebug(String msg) {
|
||||
sendColorized(msg, TextFormatting.GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void print(String msg) {
|
||||
sendColorized(msg, TextFormatting.LIGHT_PURPLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void printError(String msg) {
|
||||
sendColorized(msg, TextFormatting.RED);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user