couple more compilation issues

This commit is contained in:
Jesse Boyd
2019-07-23 06:58:18 +10:00
parent e53fc8a7f6
commit c05d425f64
22 changed files with 274 additions and 151 deletions

View File

@ -124,11 +124,13 @@ import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.Key;
import static com.sk89q.worldedit.command.MethodCommands.*;
/**
* Commands to set brush shape.
*/
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class BrushCommands extends MethodCommands {
public class BrushCommands {
private final WorldEdit worldEdit;
@ -298,8 +300,8 @@ public class BrushCommands extends MethodCommands {
}
@Command(
name = "sspl",
aliases = {"sspline", "surfacespline"},
name = "surfacespline",
aliases = {"sspline", "sspl"},
desc = "Draws a spline (curved line) on the surface",
descFooter = "Create a spline on the surface\n" +
"Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
@ -549,8 +551,8 @@ public class BrushCommands extends MethodCommands {
}
@Command(
name = "scmd",
aliases = {"scattercmd", "scattercommand", "scommand"},
name = "scattercommand",
aliases = {"scattercmd", "scmd", "scommand"},
desc = "Run commands at random points on a surface",
descFooter =
"Run commands at random points on a surface\n" +

View File

@ -48,18 +48,20 @@ import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
@Command(aliases = {"masks"},
desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
descFooter = "Masks determine if a block can be placed\n" +
" - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" +
" - Use & to AND multiple\n" +
"e.g. >[stone,dirt],#light[0][5],$jungle\n" +
"More Info: https://git.io/v9r4K"
)
//@Command(aliases = {"masks"},
// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
// descFooter = "Masks determine if a block can be placed\n" +
// " - Use [brackets] for arguments\n" +
// " - Use , to OR multiple\n" +
// " - Use & to AND multiple\n" +
// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
// "More Info: https://git.io/v9r4K"
//)
public class MaskCommands extends MethodCommands {
private final WorldEdit worldEdit;
public MaskCommands(WorldEdit worldEdit) {
super(worldEdit);
this.worldEdit = worldEdit;
}
@Command(

View File

@ -15,7 +15,7 @@ import java.util.Optional;
import static com.google.common.base.Preconditions.checkNotNull;
public class MethodCommands {
public Command getCommand() {
public static Command getCommand() {
try {
StackTraceElement[] stack = new Exception().getStackTrace();
for (StackTraceElement elem : stack) {
@ -33,7 +33,7 @@ public class MethodCommands {
return null;
}
public String getArguments(InjectedValueAccess context) {
public static String getArguments(InjectedValueAccess context) {
if (context == null) return null;
Optional<Arguments> arguments = context.injectedValue(Key.of(Arguments.class));
if (arguments.isPresent()) {
@ -42,7 +42,7 @@ public class MethodCommands {
return null;
}
public String[] getPermissions(InjectedValueAccess context) {
public static String[] getPermissions(InjectedValueAccess context) {
CommandPermissions cmdPerms = context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
if (cmdPerms != null) {
return cmdPerms.value();

View File

@ -23,6 +23,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.command.AnvilCommands;
import com.boydti.fawe.command.AnvilCommandsRegistration;
import com.boydti.fawe.command.CFICommand;
import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FawePlayer;
@ -33,7 +36,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.TypeToken;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -105,7 +107,6 @@ import com.sk89q.worldedit.extension.platform.binding.CommandBindings;
import com.sk89q.worldedit.extension.platform.binding.ConsumeBindings;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.internal.command.CommandArgParser;
import com.sk89q.worldedit.internal.command.CommandLoggingHandler;
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
@ -161,7 +162,6 @@ import org.enginehub.piston.part.SubCommandPart;
import org.enginehub.piston.suggestion.Suggestion;
import org.enginehub.piston.util.HelpGenerator;
import org.enginehub.piston.util.ValueProvider;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -250,9 +250,8 @@ public final class PlatformCommandManager {
RegionFactoryConverter.register(commandManager);
}
public void register(Object classWithMethods) {
public void registerAlwaysInjectedValues() {
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of);
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
register(new AnnotatedBindings(worldEdit));
register(new CommandBindings(worldEdit));
register(new ConsumeBindings(worldEdit));
@ -260,6 +259,10 @@ public final class PlatformCommandManager {
register(new ProvideBindings(worldEdit));
}
public void register(Object classWithMethods) {
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
}
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
CommandRegistration<CI> registration, CI instance) {
registerSubCommands(name, aliases, desc, registration, instance, m -> {});
@ -380,9 +383,14 @@ public final class PlatformCommandManager {
new GeneralCommands(worldEdit)
);
this.registration.register(
commandManager,
GenerationCommandsRegistration.builder(),
new GenerationCommands(worldEdit)
commandManager,
GenerationCommandsRegistration.builder(),
new GenerationCommands(worldEdit)
);
this.registration.register(
new CFICommand(commandManager),
CFICommands.builder(),
new CFICommands(worldEdit)
);
this.registration.register(
commandManager,

View File

@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.visitor;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.example.MappedIQueueExtent;
import com.boydti.fawe.object.collection.BlockVectorSet;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction;
@ -37,8 +36,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Performs a breadth-first search starting from points added with
* {@link #visit(BlockVector3)}. The search continues

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.visitor;
import com.boydti.fawe.object.HasIQueueExtent;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
@ -39,11 +37,11 @@ public class NonRisingVisitor extends RecursiveVisitor {
* @param function the function
*/
public NonRisingVisitor(Mask mask, RegionFunction function) {
this(mask, function, Integer.MAX_VALUE, null);
this(mask, function, Integer.MAX_VALUE);
}
public NonRisingVisitor(Mask mask, RegionFunction function, int depth, HasIQueueExtent hasIQueueExtent) {
super(mask, function, depth, hasIQueueExtent);
public NonRisingVisitor(Mask mask, RegionFunction function, int depth) {
super(mask, function, depth);
setDirections(
BlockVector3.UNIT_X,
BlockVector3.UNIT_MINUS_X,

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.internal.annotation;
import com.sk89q.worldedit.util.command.binding.PrimitiveBindings;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -41,6 +41,7 @@ import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import javax.annotation.Nullable;
import java.nio.file.Path;
import java.util.function.Supplier;
/**
* An abstract implementation of {@link World}.
@ -105,7 +106,7 @@ public interface SimpleWorld extends World {
@Override
default boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) {
Fawe.get().getQueueHandler().sync(() -> playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4));
Fawe.get().getQueueHandler().sync((Supplier<Boolean>) () -> playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4));
return true;
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.world;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
@ -127,7 +128,13 @@ public interface World extends Extent {
* @param position the position
* @return the light level (0-15)
*/
int getBlockLightLevel(BlockVector3 position);
default int getBlockLightLevel(BlockVector3 position) {
if (this instanceof LightingExtent) {
LightingExtent extent = (LightingExtent) this;
return extent.getBlockLight(position.getX(), position.getY(), position.getZ());
}
return getBlock(position).getMaterial().getLightValue();
}
/**
* Clear a chest's contents.