mirror of
https://github.com/darksaid98/nightcore-spigot.git
synced 2026-12-03 22:16:57 +00:00
small fixes
This commit is contained in:
1 parent
722e9acf36
commit
2c1394f7f1
5 files changed
+20
-7
No files matched your search
@@ -9,6 +9,10 @@ import su.nightexpress.nightcore.command.api.NightCommand;
|
|||||||
import su.nightexpress.nightcore.core.CoreLang;
|
import su.nightexpress.nightcore.core.CoreLang;
|
||||||
import su.nightexpress.nightcore.util.Placeholders;
|
import su.nightexpress.nightcore.util.Placeholders;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class HelpSubCommand extends AbstractCommand<NightCorePlugin> {
|
public class HelpSubCommand extends AbstractCommand<NightCorePlugin> {
|
||||||
|
|
||||||
public HelpSubCommand(@NotNull NightCorePlugin plugin) {
|
public HelpSubCommand(@NotNull NightCorePlugin plugin) {
|
||||||
@@ -29,7 +33,9 @@ public class HelpSubCommand extends AbstractCommand<NightCorePlugin> {
|
|||||||
CoreLang.COMMAND_HELP_LIST.getMessage()
|
CoreLang.COMMAND_HELP_LIST.getMessage()
|
||||||
.replace(Placeholders.GENERIC_NAME, this.plugin.getNameLocalized())
|
.replace(Placeholders.GENERIC_NAME, this.plugin.getNameLocalized())
|
||||||
.replace(Placeholders.GENERIC_ENTRY, list -> {
|
.replace(Placeholders.GENERIC_ENTRY, list -> {
|
||||||
parent.getChildrens().forEach(children -> {
|
Set<NightCommand> commands = new HashSet<>(parent.getChildrens());
|
||||||
|
|
||||||
|
commands.stream().sorted(Comparator.comparing(command -> command.getAliases()[0])).forEach(children -> {
|
||||||
if (!children.hasPermission(sender)) return;
|
if (!children.hasPermission(sender)) return;
|
||||||
|
|
||||||
list.add(children.replacePlaceholders().apply(CoreLang.COMMAND_HELP_ENTRY.getString()));
|
list.add(children.replacePlaceholders().apply(CoreLang.COMMAND_HELP_ENTRY.getString()));
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public abstract class AbstractCommand<P extends NightCorePlugin> implements Nigh
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Collection<NightCommand> getChildrens() {
|
public Collection<NightCommand> getChildrens() {
|
||||||
return new ArrayList<>(this.childrens.values());
|
return this.childrens.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -87,14 +87,12 @@ public class FileConfig extends YamlConfiguration {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<FileConfig> loadAll(@NotNull String path) {
|
public static List<FileConfig> loadAll(@NotNull String path) {
|
||||||
return FileUtil.getConfigFiles(path).stream().map(FileConfig::new).toList();
|
return loadAll(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Deprecated
|
|
||||||
public static List<FileConfig> loadAll(@NotNull String path, boolean deep) {
|
public static List<FileConfig> loadAll(@NotNull String path, boolean deep) {
|
||||||
return loadAll(path);
|
return FileUtil.getConfigFiles(path, deep).stream().map(FileConfig::new).toList();
|
||||||
//return FileUtil.getConfigFiles(path).stream().map(FileConfig::new).toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeOptions(@NotNull Class<?> clazz) {
|
public void initializeOptions(@NotNull Class<?> clazz) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
public class BukkitThing {
|
public class BukkitThing {
|
||||||
|
|
||||||
@@ -25,6 +26,9 @@ public class BukkitThing {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static <T extends Keyed> Set<T> allFromRegistry(@NotNull Registry<T> registry) {
|
public static <T extends Keyed> Set<T> allFromRegistry(@NotNull Registry<T> registry) {
|
||||||
|
if (Version.isBehind(Version.V1_20_R2)) {
|
||||||
|
return StreamSupport.stream(registry.spliterator(), false).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
return registry.stream().collect(Collectors.toSet());
|
return registry.stream().collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,12 @@ public class FileUtil {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<File> getConfigFiles(@NotNull String path) {
|
public static List<File> getConfigFiles(@NotNull String path) {
|
||||||
return getFiles(path, FileConfig.EXTENSION, false);
|
return getConfigFiles(path, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static List<File> getConfigFiles(@NotNull String path, boolean deep) {
|
||||||
|
return getFiles(path, FileConfig.EXTENSION, deep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in new issue
Block a user