Skip to content

Commit

Permalink
重写插件是否存在的判断(初步)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevei5mc committed Aug 26, 2024
1 parent a24e64b commit 43c84c7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,4 @@ Food:

[i2]: ./docs/text-variables.md "点击查看变量文档"
[i3]: ./docs/player-variables.md "点击查看变量文档"
[i4]: ./docs/server-variables.md "点击查看变量文档"
[i5]: ./docs/config-info.md "点击查看配置文件相关介绍"
[i4]: ./docs/server-variables.md "点击查看变量文档"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package cn.stevei5mc.NewTipsVariables.utils;

public class PluginsState {

private static PluginsState instance;


public static PluginsState getInstance() {
if (instance == null) {
instance = new PluginsState();
}
return instance;
}

// 插件的状态
public boolean playerPoints = false;
public boolean EconomyAPI = false;
public boolean OreArea = false;
public boolean RSTask = false;
public boolean HealthAPI = false;
public boolean LevelAwakenSystem = false;
public boolean RSWeapon = false;
public boolean LuckPerms = false;

public void setPluginState(String pluginName) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ public static LuckPerms getLP() {
return luckperms;
}

public static boolean pl1 = false;
public static boolean pl3 = false;
public static boolean pl4 = false;
public static boolean pl5 = false;
public static boolean pl6 = false;
public static boolean pl7 = false;
//加载相关插件的变量时的提示
public static String successMsg = Main.debugPrefix+"§a找到插件§e【§b{0}§e】§a相关变量已加载";
public static String failureMsg = Main.debugPrefix+"§c无法找到插件§e【§b{0}§e】§c相关变量加载失败,请安装相关插件再试";

//需要加载的变量的插件
public static void loadSupportVariables(Player player) {
boolean debug = Main.debug;
/* boolean debug = Main.debug;
String plugin;
plugin = "playerPoints";
if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) {
Expand Down Expand Up @@ -87,5 +82,5 @@ public static void loadSupportVariables(Player player) {
} else if (debug) {
Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin));
}
}
} */
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,31 @@
import AwakenSystem.data.baseAPI;
import AwakenSystem.utils.nbtItems;
import cn.stevei5mc.NewTipsVariables.variables.LoadSupportPlugins;
import cn.stevei5mc.NewTipsVariables.utils.PluginsState;

public class SmallasWaterPlugins extends BaseVariable {
public SmallasWaterPlugins(Player player) {
super(player);
}

public void strReplace() {
if (LoadSupportPlugins.pl1) {
PluginsState ps = PluginsState.getInstance();
if (ps.playerPoints) {
playerPoint();
}
if (LoadSupportPlugins.pl3) {
if (ps.RsTask) {
RsTask();
}
if (LoadSupportPlugins.pl4) {
if (ps.OreArea) {
OreArea();
}
if (LoadSupportPlugins.pl5) {
if (ps.HealthAPI) {
HealthAPI();
}
if (LoadSupportPlugins.pl6) {
if (ps.RSWeapon) {
RSWeapon();
}
if (LoadSupportPlugins.pl7) {
if (ps.LevelAwakenSystem) {
LevelAwakenSystem();
}
}
Expand Down

0 comments on commit 43c84c7

Please sign in to comment.