perf(bukkit): 优化代码
This commit is contained in:
@@ -154,6 +154,7 @@ public abstract class ParentCommand extends ChildCommand {
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||
if (args.length == 0) {
|
||||
return childCommands.stream()
|
||||
.filter(o -> o.hasPermission(sender))
|
||||
.map(ChildCommand::getName)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@@ -164,6 +165,7 @@ public abstract class ParentCommand extends ChildCommand {
|
||||
}
|
||||
args[0] = args[0].toLowerCase();
|
||||
return childCommands.stream()
|
||||
.filter(o -> o.hasPermission(sender))
|
||||
.map(ChildCommand::getName)
|
||||
.filter(o -> o.toLowerCase().startsWith(args[0]))
|
||||
.collect(Collectors.toList());
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package cn.hamster3.mc.plugin.core.bukkit.util;
|
||||
|
||||
import cn.hamster3.mc.plugin.core.bukkit.HamsterCorePlugin;
|
||||
import cn.hamster3.mc.plugin.core.common.data.DisplayMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -213,11 +212,11 @@ public final class BukkitUtils {
|
||||
public static YamlConfiguration getPluginConfig(@NotNull Plugin plugin, @NotNull String filename) {
|
||||
File dataFolder = plugin.getDataFolder();
|
||||
if (dataFolder.mkdirs()) {
|
||||
HamsterCorePlugin.getInstance().getLogger().info("已为插件 %s 生成存档文件夹...");
|
||||
plugin.getLogger().info("已生成插件存档文件夹...");
|
||||
}
|
||||
File file = new File(dataFolder, filename);
|
||||
if (!file.exists()) {
|
||||
try (InputStream stream = plugin.getClass().getResourceAsStream(filename)) {
|
||||
try (InputStream stream = plugin.getResource(filename)) {
|
||||
if (stream == null) {
|
||||
throw new IllegalArgumentException("在插件 " + plugin.getName() + " 的文件内部未找到 " + filename + " !");
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
datasource:
|
||||
# 数据库链接驱动地址
|
||||
# 除非你知道自己在做什么,否则不建议更改该项
|
||||
# 旧版服务端(低于1.13)请使用:com.mysql.jdbc.Driver
|
||||
driver: "com.mysql.cj.jdbc.Driver"
|
||||
# 数据库链接填写格式:
|
||||
# jdbc:mysql://{数据库地址}:{数据库端口}/{使用的库名}?参数
|
||||
|
Reference in New Issue
Block a user