geforkt von Mirrors/FastAsyncWorldEdit
merge
Dieser Commit ist enthalten in:
Ursprung
47e2226be5
Commit
ae89c16390
@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.bukkit.beta.BukkitGetBlocks;
|
import com.boydti.fawe.bukkit.adapter.mc1_14.BukkitGetBlocks_1_14;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
@ -509,8 +509,13 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendChunk(int X, int Z, int mask) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChunkGet get(int chunkX, int chunkZ) {
|
public IChunkGet get(int chunkX, int chunkZ) {
|
||||||
return new BukkitGetBlocks(getWorldChecked(), chunkX, chunkZ, Settings.IMP.QUEUE.POOL);
|
return new BukkitGetBlocks_1_14(getWorldChecked(), chunkX, chunkZ, Settings.IMP.QUEUE.POOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||||
import com.boydti.fawe.bukkit.v1_14.adapter.Spigot_v1_14_R1;
|
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
|
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_14.Spigot_v1_14_R1;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import com.sk89q.util.yaml.YAMLProcessor;
|
import com.sk89q.util.yaml.YAMLProcessor;
|
||||||
|
@ -72,28 +72,6 @@ public class ApplyBrushCommands {
|
|||||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
|
||||||
commandManager.register("apply", builder -> {
|
|
||||||
builder.description(TextComponent.of("Apply brush, apply a function to every block"));
|
|
||||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
|
||||||
|
|
||||||
CommandManager manager = service.newCommandManager();
|
|
||||||
registration.register(
|
|
||||||
manager,
|
|
||||||
ApplyBrushCommandsRegistration.builder(),
|
|
||||||
new ApplyBrushCommands()
|
|
||||||
);
|
|
||||||
|
|
||||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.apply")));
|
|
||||||
|
|
||||||
builder.addParts(REGION_FACTORY, RADIUS);
|
|
||||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
|
|
||||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
|
||||||
.required()
|
|
||||||
.build());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setApplyBrush(CommandParameters parameters, Player player, LocalSession localSession,
|
private void setApplyBrush(CommandParameters parameters, Player player, LocalSession localSession,
|
||||||
Contextual<? extends RegionFunction> generatorFactory) throws WorldEditException {
|
Contextual<? extends RegionFunction> generatorFactory) throws WorldEditException {
|
||||||
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
||||||
|
@ -597,13 +597,13 @@ public class BrushCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "clipboard",
|
name = "clipboard",
|
||||||
aliases = { "copy" },
|
desc = "@Deprecated use instead: `/br copypaste`)",
|
||||||
desc = "Choose the clipboard brush (Recommended: `/br copypaste`)",
|
|
||||||
descFooter = "Chooses the clipboard brush.\n" +
|
descFooter = "Chooses the clipboard brush.\n" +
|
||||||
"Without the -p flag, the paste will appear centered at the target location. " +
|
"Without the -p flag, the paste will appear centered at the target location. " +
|
||||||
"With the flag, then the paste will appear relative to where you had " +
|
"With the flag, then the paste will appear relative to where you had " +
|
||||||
"stood relative to the copied area when you copied it."
|
"stood relative to the copied area when you copied it."
|
||||||
)
|
)
|
||||||
|
@Deprecated
|
||||||
@CommandPermissions("worldedit.brush.clipboard")
|
@CommandPermissions("worldedit.brush.clipboard")
|
||||||
public BrushSettings clipboardBrush(Player player,LocalSession session,
|
public BrushSettings clipboardBrush(Player player,LocalSession session,
|
||||||
@Switch(name = 'a', desc = "Don't paste air from the clipboard")
|
@Switch(name = 'a', desc = "Don't paste air from the clipboard")
|
||||||
|
@ -77,28 +77,6 @@ public class PaintBrushCommands {
|
|||||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
|
||||||
commandManager.register("paint", builder -> {
|
|
||||||
builder.description(TextComponent.of("Paint brush, apply a function to a surface"));
|
|
||||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
|
||||||
|
|
||||||
CommandManager manager = service.newCommandManager();
|
|
||||||
registration.register(
|
|
||||||
manager,
|
|
||||||
PaintBrushCommandsRegistration.builder(),
|
|
||||||
new PaintBrushCommands()
|
|
||||||
);
|
|
||||||
|
|
||||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.paint")));
|
|
||||||
|
|
||||||
builder.addParts(REGION_FACTORY, RADIUS, DENSITY);
|
|
||||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
|
|
||||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
|
||||||
.required()
|
|
||||||
.build());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setPaintBrush(CommandParameters parameters, Player player, LocalSession localSession,
|
private void setPaintBrush(CommandParameters parameters, Player player, LocalSession localSession,
|
||||||
Contextual<? extends RegionFunction> generatorFactory) throws WorldEditException {
|
Contextual<? extends RegionFunction> generatorFactory) throws WorldEditException {
|
||||||
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
||||||
|
@ -33,14 +33,18 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.boydti.fawe.object.task.ThrowableSupplier;
|
import com.boydti.fawe.object.task.ThrowableSupplier;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||||
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import com.google.common.collect.SetMultimap;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.ApplyBrushCommands;
|
import com.sk89q.worldedit.command.ApplyBrushCommands;
|
||||||
|
import com.sk89q.worldedit.command.ApplyBrushCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.BiomeCommands;
|
import com.sk89q.worldedit.command.BiomeCommands;
|
||||||
import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.BrushCommands;
|
import com.sk89q.worldedit.command.BrushCommands;
|
||||||
@ -61,6 +65,7 @@ import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
|||||||
import com.sk89q.worldedit.command.NavigationCommands;
|
import com.sk89q.worldedit.command.NavigationCommands;
|
||||||
import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.PaintBrushCommands;
|
import com.sk89q.worldedit.command.PaintBrushCommands;
|
||||||
|
import com.sk89q.worldedit.command.PaintBrushCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.PatternCommands;
|
import com.sk89q.worldedit.command.PatternCommands;
|
||||||
import com.sk89q.worldedit.command.PatternCommandsRegistration;
|
import com.sk89q.worldedit.command.PatternCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.RegionCommands;
|
import com.sk89q.worldedit.command.RegionCommands;
|
||||||
@ -131,13 +136,19 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.logging.FileHandler;
|
import java.util.logging.FileHandler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -194,6 +205,7 @@ public final class PlatformCommandManager {
|
|||||||
private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler();
|
private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler();
|
||||||
private final WorldEditExceptionConverter exceptionConverter;
|
private final WorldEditExceptionConverter exceptionConverter;
|
||||||
public final CommandRegistrationHandler registration;
|
public final CommandRegistrationHandler registration;
|
||||||
|
|
||||||
private static PlatformCommandManager INSTANCE;
|
private static PlatformCommandManager INSTANCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,45 +279,74 @@ public final class PlatformCommandManager {
|
|||||||
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
|
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
|
||||||
}
|
}
|
||||||
|
|
||||||
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
public org.enginehub.piston.annotation.Command createAnnotation(String name, List<String> aliases, String desc) {
|
||||||
CommandRegistration<CI> registration, CI instance) {
|
return new org.enginehub.piston.annotation.Command() {
|
||||||
registerSubCommands(name, aliases, desc, registration, instance, m -> {});
|
@Override
|
||||||
|
public Class<? extends Annotation> annotationType() {
|
||||||
|
return getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
@Override
|
||||||
CommandRegistration<CI> registration, CI instance,
|
public String name() {
|
||||||
Consumer<CommandManager> additionalConfig) {
|
return name;
|
||||||
commandManager.register(name, cmd -> {
|
}
|
||||||
cmd.aliases(aliases);
|
|
||||||
cmd.description(TextComponent.of(desc));
|
@Override
|
||||||
cmd.action(Command.Action.NULL_ACTION);
|
public String[] aliases() {
|
||||||
|
return aliases.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String descFooter() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public <CI> void registerSubCommands(org.enginehub.piston.annotation.Command annotation, Consumer<BiConsumer<CommandRegistration,CI>> handlerInstance) {
|
||||||
|
registerSubCommands(annotation, commandManager, handlerInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <CI> void registerSubCommands(org.enginehub.piston.annotation.Command annotation, CommandManager commandManager, Consumer<BiConsumer<CommandRegistration,CI>> handlerInstance) {
|
||||||
|
commandManager.register(annotation.name(), builder -> {
|
||||||
|
builder.description(TextComponent.of(annotation.desc()));
|
||||||
|
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||||
|
|
||||||
CommandManager manager = commandManagerService.newCommandManager();
|
CommandManager manager = commandManagerService.newCommandManager();
|
||||||
this.registration.register(
|
|
||||||
|
handlerInstance.accept((handler, instance) -> registration.register(
|
||||||
manager,
|
manager,
|
||||||
registration,
|
handler,
|
||||||
instance
|
instance
|
||||||
);
|
));
|
||||||
additionalConfig.accept(manager);
|
|
||||||
|
|
||||||
final List<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
|
final List<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
|
||||||
cmd.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"),
|
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"),
|
||||||
TextComponent.of("Sub-command to run."))
|
TextComponent.of("Sub-command to run."))
|
||||||
.withCommands(subCommands)
|
.withCommands(subCommands)
|
||||||
.required()
|
.required()
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
cmd.condition(new SubCommandPermissionCondition.Generator(subCommands).build());
|
builder.condition(new SubCommandPermissionCondition.Generator(subCommands).build());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCommand(String arguments) {
|
public <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||||
|
CommandRegistration<CI> registration, CI instance) {
|
||||||
|
registerSubCommands(createAnnotation(name, aliases, desc), commandManager, c -> c.accept(registration, instance));
|
||||||
|
}
|
||||||
|
|
||||||
|
public <CI> void registerSubCommands(String name, List<String> aliases, String desc, Consumer<BiConsumer<CommandRegistration,CI>> handlerInstance) {
|
||||||
|
registerSubCommands(createAnnotation(name, aliases, desc), commandManager, handlerInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerAllCommands() {
|
public void registerAllCommands() {
|
||||||
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
||||||
// TODO NOT IMPLEMENTED dunno why these have issues generating
|
|
||||||
registerSubCommands(
|
registerSubCommands(
|
||||||
"patterns",
|
"patterns",
|
||||||
ImmutableList.of(),
|
ImmutableList.of(),
|
||||||
@ -342,19 +383,16 @@ public final class PlatformCommandManager {
|
|||||||
new SuperPickaxeCommands(worldEdit)
|
new SuperPickaxeCommands(worldEdit)
|
||||||
);
|
);
|
||||||
registerSubCommands(
|
registerSubCommands(
|
||||||
"brush",
|
createAnnotation("brush", Arrays.asList("br", "/brush", "/br", "/tool", "tool"), "Brushing commands"),
|
||||||
ImmutableList.of("br", "/brush", "/br"),
|
c -> {
|
||||||
"Brushing commands",
|
c.accept(BrushCommandsRegistration.builder(), new BrushCommands(worldEdit));
|
||||||
BrushCommandsRegistration.builder(),
|
c.accept(PaintBrushCommandsRegistration.builder(), new PaintBrushCommands());
|
||||||
new BrushCommands(worldEdit),
|
c.accept(ApplyBrushCommandsRegistration.builder(), new ApplyBrushCommands());
|
||||||
manager -> {
|
|
||||||
PaintBrushCommands.register(commandManagerService, manager, registration);
|
|
||||||
ApplyBrushCommands.register(commandManagerService, manager, registration);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
registerSubCommands(
|
registerSubCommands(
|
||||||
"brush",
|
"brush",
|
||||||
ImmutableList.of("br", "/b"),
|
ImmutableList.of("br", "/brush", "/br", "/tool", "tool"),
|
||||||
"Tool commands",
|
"Tool commands",
|
||||||
BrushOptionsCommandsRegistration.builder(),
|
BrushOptionsCommandsRegistration.builder(),
|
||||||
new BrushOptionsCommands(worldEdit)
|
new BrushOptionsCommands(worldEdit)
|
||||||
|
@ -19,29 +19,44 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.registry;
|
package com.sk89q.worldedit.registry;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
|
import static org.enginehub.piston.converter.SuggestionHelper.byPrefix;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public final class NamespacedRegistry<V extends RegistryItem & Keyed> extends Registry<V> {
|
public final class NamespacedRegistry<V extends Keyed> extends Registry<V> {
|
||||||
private static final String MINECRAFT_NAMESPACE = "minecraft";
|
private static final String MINECRAFT_NAMESPACE = "minecraft";
|
||||||
private final Set<String> knownNamespaces = new HashSet<>();
|
private final Set<String> knownNamespaces = new HashSet<>();
|
||||||
private final String defaultNamespace;
|
private final String defaultNamespace;
|
||||||
private final List<V> values = new ArrayList<>();
|
private final List<V> values = new ArrayList<>();
|
||||||
private int lastInternalId = 0;
|
private int lastInternalId = 0;
|
||||||
|
|
||||||
|
public NamespacedRegistry(final String name, Map<String, V> map) {
|
||||||
|
this(name, map, MINECRAFT_NAMESPACE);
|
||||||
|
}
|
||||||
|
|
||||||
public NamespacedRegistry(final String name) {
|
public NamespacedRegistry(final String name) {
|
||||||
this(name, MINECRAFT_NAMESPACE);
|
this(name, MINECRAFT_NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamespacedRegistry(final String name, final String defaultNamespace) {
|
public NamespacedRegistry(final String name, final String defaultNamespace) {
|
||||||
super(name);
|
this(name, Maps.newHashMap(), defaultNamespace);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NamespacedRegistry(final String name, Map<String, V> map, final String defaultNamespace) {
|
||||||
|
super(name, map);
|
||||||
this.defaultNamespace = defaultNamespace;
|
this.defaultNamespace = defaultNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +75,9 @@ public final class NamespacedRegistry<V extends RegistryItem & Keyed> extends Re
|
|||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
throw new UnsupportedOperationException("Replacing existing registrations is not supported");
|
throw new UnsupportedOperationException("Replacing existing registrations is not supported");
|
||||||
}
|
}
|
||||||
value.setInternalId(lastInternalId++);
|
if (value instanceof RegistryItem) {
|
||||||
|
((RegistryItem) value).setInternalId(lastInternalId++);
|
||||||
|
}
|
||||||
values.add(value);
|
values.add(value);
|
||||||
super.register(key, value);
|
super.register(key, value);
|
||||||
if (key.startsWith(defaultNamespace)) {
|
if (key.startsWith(defaultNamespace)) {
|
||||||
@ -77,10 +94,6 @@ public final class NamespacedRegistry<V extends RegistryItem & Keyed> extends Re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInternalId(V value) {
|
|
||||||
return value.getInternalId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return values.size();
|
return values.size();
|
||||||
}
|
}
|
||||||
@ -109,4 +122,32 @@ public final class NamespacedRegistry<V extends RegistryItem & Keyed> extends Re
|
|||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <V1 extends Keyed> Stream<String> getSuggestions(String input) {
|
||||||
|
if (input.isEmpty() || input.equals(":")) {
|
||||||
|
final Set<String> namespaces = getKnownNamespaces();
|
||||||
|
if (namespaces.size() == 1) {
|
||||||
|
return keySet().stream();
|
||||||
|
} else {
|
||||||
|
return namespaces.stream().map(s -> s + ":");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (input.startsWith(":")) { // special case - search across namespaces
|
||||||
|
final String term = input.substring(1).toLowerCase(Locale.ROOT);
|
||||||
|
Predicate<String> search = byPrefix(term);
|
||||||
|
return keySet().stream().filter(s -> search.test(s.substring(s.indexOf(':') + 1)));
|
||||||
|
}
|
||||||
|
// otherwise, we actually have some text to search
|
||||||
|
if (input.indexOf(':') < 0) {
|
||||||
|
// don't yet have namespace - search namespaces + default
|
||||||
|
final String lowerSearch = input.toLowerCase(Locale.ROOT);
|
||||||
|
String defKey = getDefaultNamespace() + ":" + lowerSearch;
|
||||||
|
return Stream.concat(keySet().stream().filter(s -> s.startsWith(defKey)),
|
||||||
|
getKnownNamespaces().stream().filter(n -> n.startsWith(lowerSearch)).map(n -> n + ":"));
|
||||||
|
}
|
||||||
|
// have a namespace - search that
|
||||||
|
Predicate<String> search = byPrefix(input.toLowerCase(Locale.ROOT));
|
||||||
|
return keySet().stream().filter(search);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,6 +293,16 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
|
|||||||
return getName().replace(" ", "_").toLowerCase(Locale.ROOT);
|
return getName().replace(" ", "_").toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh a specific chunk with a bitMask (0 = default, 65535 = all block sections)
|
||||||
|
* Note: only 0 is guaranteed to send all tiles / entities
|
||||||
|
* Note: Only 65535 is guaranteed to send all blocks
|
||||||
|
* @param chunkX
|
||||||
|
* @param chunkZ
|
||||||
|
* @param bitMask
|
||||||
|
*/
|
||||||
|
void sendChunk(final int X, final int Z, final int mask);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IChunkGet get(int x, int z);
|
IChunkGet get(int x, int z);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren