Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
1. 删除遗留无用的imoort
2. 对一些if判断进行调整
  • Loading branch information
stevei5mc committed May 17, 2024
1 parent ff5fd4a commit c6d9055
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 33 deletions.
15 changes: 8 additions & 7 deletions src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public void onEnable() {
if (this.getServer().getPluginManager().getPlugin("Tips") != null) {
//存在则加载该插件
this.getServer().getCommandMap().register("", new NewTipsVariablesCommand());//注册命令
this.deBugMode();//用于加载debug信息
if (config.getBoolean("debug", false)) {//从config.yml中获取debug为true则执行相关内容,如果无法获取则为false
this.deBugMode();
}
this.tipsvariables();//加载变量部分
this.loadover();//加载完成显示的内容
} else {
Expand All @@ -62,7 +64,9 @@ public void loadConfigRes() {
this.configInPlayer = new Config(this.getDataFolder() + "/player.yml", Config.YAML);
this.worldName = new Config(this.getDataFolder() + "/world_name.yml", Config.YAML);
this.language = new Config(this.getDataFolder() + "/language.yml", Config.YAML);
ConfigUtils.checkConfig();
if (config.getBoolean("updata.in-config.check")) {//从config.yml中获取debug为true则执行相关内容
ConfigUtils.checkVersion();
}
}

public void loadVarRes() {
Expand All @@ -76,11 +80,8 @@ public void loadVarRes() {
}

public void deBugMode() {
boolean deBug = this.config.getBoolean("debug", false); //这个功能默认关闭,不在config.yml中,需手动加上
if (deBug) {
debug = true;
this.getLogger().warning("§7[§cDEBUG§7] §cdebug模式已开启");
}
debug = true;
this.getLogger().warning("§7[§cDEBUG§7] §cdebug模式已开启");
}

public void tipsvariables() {
Expand Down
45 changes: 21 additions & 24 deletions src/main/java/cn/stevei5mc/NewTipsVariables/utils/ConfigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,27 @@ public class ConfigUtils {
public static int ccvt = Main.getInstance().getConfig().getInt("version"); //config.yml
public static int cpvt = Main.getInstance().getConfigInPlayer().getInt("version"); //player.yml
public static int csvt = Main.getInstance().getConfigInServer().getInt("version"); //server.yml
public static void checkConfig() {
boolean checkConfig = Main.getInstance().getConfig().getBoolean("updata.in-config.check");
if (checkConfig) {
if (ccvl > csvl) {
Main.getInstance().getLogger().warning("§econfig.yml 版本不是最新版");
} else if (ccvl < csvl) {
Main.getInstance().getLogger().error("§cconfig.yml 版本出现了错误");
} else {
Main.getInstance().getLogger().info("§aconfig.yml 版本是最新版");
}
if (cpvl > cpvt) {
Main.getInstance().getLogger().warning("§eplayer.yml 版本不是最新版");
} else if (cpvl < cpvt) {
Main.getInstance().getLogger().error("§cplayer.yml 版本出现了错误");
} else {
Main.getInstance().getLogger().info("§aplayer.yml 版本是最新版");
}
if (csvt > csvt) {
Main.getInstance().getLogger().warning("§eserver.yml 版本不是最新版");
} else if (csvt < csvt) {
Main.getInstance().getLogger().error("§cserver.yml 版本出现了错误");
} else {
Main.getInstance().getLogger().info("§aserver.yml 版本是最新版");
}
public static void checkVersion() {
if (ccvl > csvl) {
Main.getInstance().getLogger().warning("§econfig.yml 版本不是最新版");
} else if (ccvl < csvl) {
Main.getInstance().getLogger().error("§cconfig.yml 版本出现了错误");
} else {
Main.getInstance().getLogger().info("§aconfig.yml 版本是最新版");
}
if (cpvl > cpvt) {
Main.getInstance().getLogger().warning("§eplayer.yml 版本不是最新版");
} else if (cpvl < cpvt) {
Main.getInstance().getLogger().error("§cplayer.yml 版本出现了错误");
} else {
Main.getInstance().getLogger().info("§aplayer.yml 版本是最新版");
}
if (csvt > csvt) {
Main.getInstance().getLogger().warning("§eserver.yml 版本不是最新版");
} else if (csvt < csvt) {
Main.getInstance().getLogger().error("§cserver.yml 版本出现了错误");
} else {
Main.getInstance().getLogger().info("§aserver.yml 版本是最新版");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import cn.stevei5mc.NewTipsVariables.Main;
import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.SmallasWaterPlugins;
import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.LuckPermsVar;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;

public class LoadSupportPlugins{
public static boolean pl1 = false;
Expand Down

0 comments on commit c6d9055

Please sign in to comment.