Compare commits

..

4 Commits

Author SHA1 Message Date
Auxilor
d7fce6834c Updated to 6.35.3 2022-05-03 13:05:41 +01:00
Auxilor
ac807a991b Players can no longer tab-complete commands they don't have permission for 2022-05-03 13:05:32 +01:00
Auxilor
ba315ced3c Updated to 6.35.2 2022-04-29 22:45:42 +01:00
Auxilor
f2e65174f9 Reverted to old block vein code 2022-04-29 22:45:02 +01:00
3 changed files with 19 additions and 13 deletions

View File

@@ -167,7 +167,10 @@ abstract class HandledCommand implements CommandBase {
StringUtil.copyPartialMatches( StringUtil.copyPartialMatches(
args[0], 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 completions
); );
@@ -182,6 +185,10 @@ abstract class HandledCommand implements CommandBase {
HandledCommand command = null; HandledCommand command = null;
for (CommandBase subcommand : this.getSubcommands()) { for (CommandBase subcommand : this.getSubcommands()) {
if (!sender.hasPermission(subcommand.getPermission())) {
continue;
}
if (args[0].equalsIgnoreCase(subcommand.getName())) { if (args[0].equalsIgnoreCase(subcommand.getName())) {
command = (HandledCommand) subcommand; command = (HandledCommand) subcommand;
} }

View File

@@ -23,26 +23,25 @@ public final class BlockUtils {
*/ */
private static final int MAX_BLOCKS = 2500; 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 List<Material> allowedMaterials,
@NotNull final Set<Block> blocks, @NotNull final Set<Block> blocks,
final int limit) { final int limit) {
for (BlockFace face : BlockFace.values()) { for (BlockFace face : BlockFace.values()) {
Block block = origin.getRelative(face); Block block = start.getRelative(face);
if (!allowedMaterials.contains(block.getType())) {
continue;
}
if (blocks.contains(block)) { if (blocks.contains(block)) {
continue; continue;
} }
if (blocks.size() >= limit || blocks.size() > MAX_BLOCKS) { if (allowedMaterials.contains(block.getType())) {
return blocks; 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; return blocks;

View File

@@ -1,3 +1,3 @@
version = 6.35.1 version = 6.35.3
plugin-name = eco plugin-name = eco
kotlin.code.style = official kotlin.code.style = official