Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7fce6834c | ||
|
|
ac807a991b | ||
|
|
ba315ced3c | ||
|
|
f2e65174f9 | ||
|
|
d5584e863b | ||
|
|
d9c0e8e763 |
@@ -167,7 +167,10 @@ abstract class HandledCommand implements CommandBase {
|
||||
|
||||
StringUtil.copyPartialMatches(
|
||||
args[0],
|
||||
this.getSubcommands().stream().map(CommandBase::getName).collect(Collectors.toList()),
|
||||
this.getSubcommands().stream()
|
||||
.filter(subCommand -> sender.hasPermission(subCommand.getPermission()))
|
||||
.map(CommandBase::getName)
|
||||
.collect(Collectors.toList()),
|
||||
completions
|
||||
);
|
||||
|
||||
@@ -182,6 +185,10 @@ abstract class HandledCommand implements CommandBase {
|
||||
HandledCommand command = null;
|
||||
|
||||
for (CommandBase subcommand : this.getSubcommands()) {
|
||||
if (!sender.hasPermission(subcommand.getPermission())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase(subcommand.getName())) {
|
||||
command = (HandledCommand) subcommand;
|
||||
}
|
||||
|
||||
@@ -23,26 +23,25 @@ public final class BlockUtils {
|
||||
*/
|
||||
private static final int MAX_BLOCKS = 2500;
|
||||
|
||||
private static Set<Block> getNearbyBlocks(@NotNull final Block origin,
|
||||
private static Set<Block> getNearbyBlocks(@NotNull final Block start,
|
||||
@NotNull final List<Material> allowedMaterials,
|
||||
@NotNull final Set<Block> blocks,
|
||||
final int limit) {
|
||||
for (BlockFace face : BlockFace.values()) {
|
||||
Block block = origin.getRelative(face);
|
||||
|
||||
if (!allowedMaterials.contains(block.getType())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = start.getRelative(face);
|
||||
if (blocks.contains(block)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (blocks.size() >= limit || blocks.size() > MAX_BLOCKS) {
|
||||
return blocks;
|
||||
}
|
||||
if (allowedMaterials.contains(block.getType())) {
|
||||
blocks.add(block);
|
||||
|
||||
blocks.addAll(getNearbyBlocks(block, allowedMaterials, blocks, limit));
|
||||
if (blocks.size() > limit || blocks.size() > MAX_BLOCKS) {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
blocks.addAll(getNearbyBlocks(block, allowedMaterials, blocks, limit));
|
||||
}
|
||||
}
|
||||
|
||||
return blocks;
|
||||
|
||||
@@ -32,12 +32,6 @@ fun CommandSender.asAudience(): Audience =
|
||||
fun Player.runExempted(action: () -> Unit) =
|
||||
PlayerUtils.runExempted(this, action)
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.runExempted
|
||||
*/
|
||||
fun Player.runExempted(action: (Player) -> Unit) =
|
||||
PlayerUtils.runExempted(this, action)
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.tryAsPlayer
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.35.0
|
||||
version = 6.35.3
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
Reference in New Issue
Block a user