diff --git a/.gitignore b/.gitignore index c8b241f..7d774a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,15 @@ -target/* \ No newline at end of file +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/* + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath \ No newline at end of file diff --git a/docs/SupportPluginsVariables.md b/docs/SupportPluginsVariables.md index f5de7c2..3d90412 100644 --- a/docs/SupportPluginsVariables.md +++ b/docs/SupportPluginsVariables.md @@ -11,43 +11,22 @@ ](./SupportPluginsVariables.md) # **变量文档(支持的插件)** --- -> **按插件的英文字母排序** -> **TipsVeriable 相关变量移值中,部分变量名有改动** - - -## **E** -### **[EconomyAPI](https://github.com/Nukkit-coders/EconomyAPI)** +## **[EconomyAPI](https://github.com/Nukkit-coders/EconomyAPI)** |变量名|变量介绍| |:-:|:-:| |{economyApi-money}|玩家金钱数量| --- - -## **H** -### **[HealthAPI](https://github.com/SmallasWater/HealthAPI)** +## **[HealthAPI](https://github.com/SmallasWater/HealthAPI)** |变量名|变量介绍| |:-:|:-:| |{h}|玩家血量| |{mh}|玩家血量上限| |{hb}|玩家血量百分比| --- - -## **L** -### **[LevelAwakenSystem](https://github.com/SmallasWater/LevelAwakenSystem)** +## **[LevelAwakenSystem](https://github.com/SmallasWater/LevelAwakenSystem)** |变量名|变量介绍| |:-:|:-:| |{属性}|玩家的RPG属性| @@ -65,13 +44,14 @@ |{c}|玩家穿透| |{饰品}|玩家当前装备的饰品| |{pvp}|玩家PVP 状态 (暂时不可用)| +## **[LuckPerms](https://luckperms.net/)** +|变量名|变量介绍| +|:-:|:-:| +|{LuckPerms-prefix}|获取玩家的prefix(前缀)| +|{LuckPerms-suffix}|获取玩家的suffix(后缀)| +|{LuckPerms-group}|获取玩家所在的权限组| --- - -## **O** -### **[OreArea](https://github.com/SmallasWater/OreArea)** +## **[OreArea](https://github.com/SmallasWater/OreArea)** **注意: 变量`{orearea-time-use}`在有限时的矿区会有BUG(到秒就不动了)** |变量名|变量介绍| |:-:|:-:| @@ -81,21 +61,18 @@ |{orearea-time-reset}|获取玩家所在的刷新时间| |{orearea-name}|获取玩家所在的矿区等级| --- -## **P** -### **[playerPoints](https://github.com/SmallasWater/PlayerPoints)** +## **[playerPoints](https://github.com/SmallasWater/PlayerPoints)** |变量名|变量介绍| |:-:|:-:| |{point}|获取玩家的点券数量| --- - -## R -### **[RsTask](https://github.com/MemoriesOfTime/RSTask)** +## **[RsTask](https://github.com/MemoriesOfTime/RSTask)** |变量名|变量介绍| |:-:|:-:| |{task-name}|正在进行中的任务 (显示第一个)| |{task-count}|玩家任务积分| -### **[RsWeapon](https://github.com/SmallasWater/RsWeapon)** +--- +## **[RsWeapon](https://github.com/SmallasWater/RsWeapon)** |变量名|变量介绍| |:-:|:-:| |{武器名称}|玩家手持武器的名称| @@ -114,20 +91,4 @@ |{we-kick}|玩家武器击退值| |{we-dkick}|玩家盔甲抗击退值| |{we-todamage}|玩家盔甲反伤百分比| ---- - \ No newline at end of file +--- \ No newline at end of file diff --git a/docs/config-info.md b/docs/config-info.md index 64cdaad..56d15d0 100644 --- a/docs/config-info.md +++ b/docs/config-info.md @@ -1,29 +1,52 @@ -[![0](https://img.shields.io/badge/%3C%3D-%E8%BF%94%E5%9B%9E-a?style=plastic&color=yellow)](.././README.md) [![1](https://img.shields.io/badge/doc-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E-a?style=plastic)](./config-info.md) [![1](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E6%96%87%E5%AD%97%E7%9B%B8%E5%85%B3-a?style=plastic&color=blue)](./text-variables.md) -[![2](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E7%8E%A9%E5%AE%B6%E7%9B%B8%E5%85%B3-a?style=plastic&color=blue)](./player-variables.md) -[![3](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9B%B8%E5%85%B3-a?style=plastic&color=blue)](./server-variables.md) -[![4](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E6%94%AF%E6%8C%81%E7%9A%84%E6%8F%92%E4%BB%B6-a?style=plastic&color=blue)](./SupportPluginsVariables.md) +[![0](https://img.shields.io/badge/%3C%3D-%E8%BF%94%E5%9B%9E-a?style=plastic&color=yellow)](.././README.md) [![1](https://img.shields.io/badge/doc-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E-a?style=plastic)](./config-info.md) [![2](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E6%96%87%E5%AD%97%E7%9B%B8%E5%85%B3-a?style=plastic&color=blue)](./text-variables.md) +[![3](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E7%8E%A9%E5%AE%B6%E7%9B%B8%E5%85%B3-a?style=plastic&color=blue)](./player-variables.md) +[![4](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9B%B8%E5%85%B3-a?style=plastic&color=blue)](./server-variables.md) +[![5](https://img.shields.io/badge/%E5%8F%98%E9%87%8F-%E6%94%AF%E6%8C%81%E7%9A%84%E6%8F%92%E4%BB%B6-a?style=plastic&color=blue)](./SupportPluginsVariables.md) --- # **配置文件使用说明** -> **若未在此说明中写配置项出则代表该配置项还没有支持** +- **若未在此说明中写配置项出则代表该配置项还没有支持,也有可能是忘记写出来了** +- **给出的预览图片可能不是最新的,但也差不到哪去** +--- ## **[config.yml](../src/main/resources/config.yml)** -> **主配置文件** -### **是否释放新的变量说明文档** +**主配置文件** ```yml +#使用说明: +#https://github.com/stevei5mc/NewTipsVariables/blob/main/README.md +#https://gitee.com/stevei5mc/NewTipsVariables/blob/main/README.md +#配置文件版本,勿动 +version: 1 +# 更新功能(这个功能展示没有用) +updata: + in-plugin: + #检查更新(暂时没有用) + check: false + #自动更新(需开启检查更新但暂时没有用) + auto: false + in-config: + #检查更新 + check: false + #自动更新(需开启检查更新) + auto: false +# 是否释放新的变量说明文档 save-variables-doc: true -``` -1. 该配置项启用后,服务器每次启动后都会生成新的变量文档 -2. 若关闭后,就算删除变量文档也不会生成新的变量文档 -3. 该配置项默认启用 -### **debug功能** -```yml debug: false ``` -1. 这个功能默认关闭并不在配置文件中,需要手动填写 -2. 把`debug: true`复制进`config.yml`即可启用 +1. `save-variables-doc` 该功能关闭后就算删除变量文档也不会生成新的变量文档 +2. `debug` 显示一些额外的信息 +![6](./image/debug.PNG) +3. `updata -> in-config -> check` 配置文件版本检查 +4. `updata -> in-config -> auto` 配置文件自动更新(需开启检查更新)**注意: 开启后配置文件将强制更新不会保留原来的配置** +![7](./image/check_config.PNG) +--- ## **[server.yml](../src/main/resources/server.yml)** -> **服务器相关变量配置文件** +**服务器相关变量配置文件** ```yml +#使用说明: +#https://github.com/stevei5mc/NewTipsVariables/blob/main/README.md +#https://gitee.com/stevei5mc/NewTipsVariables/blob/main/README.md +#配置文件版本,勿动 +version: 1 TPS: low_color: "§c" medium_value: 9 @@ -33,9 +56,15 @@ TPS: ``` 1. ```color```设置显示的颜色,```low```、```medium```、```high```为显示的范围 2. ```value```是一个范围值,```medium```、```high```为可设置的范围值,```low```值只能为```0``` +--- ## **[player.yml](../src/main/resources/player.yml)** -> **玩家相关变量配置文件** +**玩家相关变量配置文件** ```yml +#使用说明: +#https://github.com/stevei5mc/NewTipsVariables/blob/main/README.md +#https://gitee.com/stevei5mc/NewTipsVariables/blob/main/README.md +#配置文件版本,勿动 +version: 1 Device: OS: Android: "Android" @@ -60,11 +89,6 @@ Device: UIProfile: classic: "classic ui" pocket: "pocket ui" -``` -- **```OS```玩家的设备系统** -- **```Controls```获取玩家设备的操作方式** -- **```UIProfile```玩家的设备UI** -```yml ping: low_color: "§a" medium_value: 80 @@ -80,11 +104,17 @@ HP: Food: empty_color: "§7{0}/{1}" low_color: "§c{0}§7/§c{1}" - medium_value: 9 + medium_value: 9 medium_color: "§e{0}§7/§e{1}" high_value: 15 high_color: "§a{0}§7/§a{1}" ``` -1. ```color```设置显示的颜色,```low```、```medium```、```high```为显示的范围 -1. ```value```是一个范围值,```medium```、```high```为可设置的范围值,```low```值只能为```0``` -1. ```symbols```是用来设置分割符号的,例如: ```HP: 20/20``` \ No newline at end of file +1. `color`设置显示的颜色,`low`、`medium`、`high`为显示的范围 +2. `value`是一个范围值,`medium`、`high` 为可设置的范围值,`empty`值只能为`0`,`low`值只能为`0`或`1` +- **`Device -> OS`玩家的设备系统** +- **`Device -> Controls`获取玩家设备的操作方式** +- **`Device -> UIProfile`玩家的设备UI** +- **`ping` 玩家的延迟** +- **`HP` 玩家的血量** +- **`Food` 玩家的饥饿值** +--- \ No newline at end of file diff --git a/docs/image/check_config.PNG b/docs/image/check_config.PNG new file mode 100644 index 0000000..89612c4 Binary files /dev/null and b/docs/image/check_config.PNG differ diff --git a/docs/image/debug.PNG b/docs/image/debug.PNG new file mode 100644 index 0000000..cbe6969 Binary files /dev/null and b/docs/image/debug.PNG differ diff --git a/pom.xml b/pom.xml index 8cd61f0..eee24c4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 cn.stevei5mc NewTipsVariables - 1.0.0-beta8 + 1.0.0-beta9 opencollab-repo-release @@ -89,6 +89,12 @@ system ${project.basedir}/lib/RSWeapon.jar + + net.luckperms + api + 5.4 + provided + 8 diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java index c0bbb80..2314f65 100644 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java +++ b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java @@ -1,17 +1,18 @@ package cn.stevei5mc.NewTipsVariables; import cn.nukkit.plugin.PluginBase; -import cn.nukkit.plugin.PluginManager; import tip.utils.Api; import cn.stevei5mc.NewTipsVariables.variables.BaseVariables; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.loadSupportPlugins; +import cn.stevei5mc.NewTipsVariables.variables.LoadSupportPlugins; import cn.nukkit.Player; import cn.nukkit.utils.Config; import cn.stevei5mc.NewTipsVariables.command.NewTipsVariablesCommand; -import cn.stevei5mc.NewTipsVariables.utils.configUtils; +import cn.stevei5mc.NewTipsVariables.utils.ConfigUtils; import cn.nukkit.Server; public class Main extends PluginBase { + public static String debugPrefix = "§7[§cDEBUG§7] "; + public static String updataPrefix = "§7[§cUPDATA§7] "; public static Player player; private static Main instance; private Config config; @@ -20,28 +21,25 @@ public class Main extends PluginBase { private Config worldName; private Config language; public static boolean debug = false; - //定义配置文件的一些信息 - public static int config1Version = 1; //config.yml - public static int config2Version = 1; //player.yml - public static int config3Version = 1; //server.yml - + public static Main getInstance() { return instance; } - + public void onLoad() { instance = this; this.loadConfigRes();//加载配置文件 this.loadVarRes();//加载变量文档 + if (config.getBoolean("updata.in-config.check")) {//从config.yml中获取updata.in-config.check为true则执行相关内容 + ConfigUtils.checkVersion(); + } } - + public void onEnable() { //判断需要的前置插件是否存在 if (this.getServer().getPluginManager().getPlugin("Tips") != null) { //存在则加载该插件 this.getServer().getCommandMap().register("", new NewTipsVariablesCommand());//注册命令 - configUtils.configUtils(); - this.deBugMode();//用于加载debug信息 this.tipsvariables();//加载变量部分 this.loadover();//加载完成显示的内容 } else { @@ -53,12 +51,11 @@ public void onEnable() { } public void onDisable() { - this.getLogger().info("停止运行"); - this.getLogger().info("§6感谢你的使用"); + this.getLogger().info("已停止运行,感谢你的使用"); } public void loadConfigRes() { - this.getDataFolder().mkdirs(); //创建插件文件夹 + this.getDataFolder().mkdirs(); this.saveDefaultConfig(); this.saveResource("server.yml",false); this.saveResource("player.yml",false); @@ -69,35 +66,29 @@ 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); + debug = false; //这个防止出现关闭debug功能reload配置文件后还需要重启服务器的问题 + if (config.getBoolean("debug", false)) {//从config.yml中获取debug为true则执行相关内容,如果无法获取则为false + debug = true; + this.getLogger().warning(debugPrefix + "§cdebug模式已开启"); + } } public void loadVarRes() { - boolean saveVariablesDoc = this.config.getBoolean("save-variables-doc"); - if (saveVariablesDoc) { - //为true时就每次都加载最新的变量信息 + if (config.getBoolean("save-variables-doc")) {//获取配置为true时就每次都加载最新的变量文档,为false则不会更新就算把变量文档删除了也不会更新 this.saveResource("base-variables.txt",true); this.saveResource("SupportPluginsVariables.txt",true); this.getLogger().info("§a变量说明文件加载成功"); } } - public void deBugMode() { - boolean deBug = this.config.getBoolean("debug", false); //这个功能默认关闭,不在config.yml中,需手动加上 - if (deBug) { - debug = true; - this.getLogger().warning("§7[§cDEBUG§7] §cdebug模式已开启"); - } - } - public void tipsvariables() { Api.registerVariables("BaseVariables", BaseVariables.class); - loadSupportPlugins.loadSupportVariables(player); + LoadSupportPlugins.loadSupportVariables(player); } public void loadover() { this.getLogger().info("§a变量加载完成"); - this.getLogger().warning("§c警告:"); - this.getLogger().warning("§c本插件为免费且开源的一款插件,如果你是付费获取到的那么你就被骗了"); + this.getLogger().warning("§c警告! §c本插件为免费且开源的一款插件,如果你是付费获取到的那么你就被骗了"); this.getLogger().info("§a开源链接和使用方法: §bhttps://github.com/stevei5mc/NewTipsVariables"); } @@ -120,6 +111,5 @@ public Config getLanguage() { //重载配置 public void reload() { loadConfigRes(); - configUtils.configUtils(); } } \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/utils/ConfigUtils.java b/src/main/java/cn/stevei5mc/NewTipsVariables/utils/ConfigUtils.java new file mode 100644 index 0000000..1d7e3ba --- /dev/null +++ b/src/main/java/cn/stevei5mc/NewTipsVariables/utils/ConfigUtils.java @@ -0,0 +1,50 @@ +package cn.stevei5mc.NewTipsVariables.utils; + +import cn.stevei5mc.NewTipsVariables.Main; +import cn.nukkit.Server; + +public class ConfigUtils { + //定义配置文件的最新版本号 + public static int ccvl = 1; //config.yml + public static int cpvl = 1; //player.yml + public static int csvl = 1; //server.yml + + public static void checkVersion() { + //获取配置文件当前的版本号 + int ccvt = Main.getInstance().getConfig().getInt("version",0); //config.yml + int cpvt = Main.getInstance().getConfigInPlayer().getInt("version",0); //player.yml + int csvt = Main.getInstance().getConfigInServer().getInt("version",0); //server.yml + runCheck("config.yml", ccvl, ccvt); + runCheck("player.yml", cpvl, cpvt); + runCheck("server.yml", csvl, csvt); + + } + + public static void runCheck(String name, int latestVersion, int currentVersion) { + String current = String.valueOf(currentVersion); + if (currentVersion == 0) { + currentVersion = 114514;//防止有人误把配置文件中的version配置项,如果无法获取数据则输入一个最大数 + current = "null"; + } + if (Main.debug) { + String msg = Main.debugPrefix + "{0} 当前版本: {1} 最新版本:{2}"; + Main.getInstance().getLogger().info(msg.replace("{0}",name).replace("{1}",current).replace("{2}",String.valueOf(latestVersion)));//这个到时候再搞 + } + if (currentVersion == latestVersion) { + Main.getInstance().getLogger().info(name + " §a版本是最新版"); + } else if (currentVersion < latestVersion) { + Main.getInstance().getLogger().warning(name + " §e版本不是最新版, 请及时更新配置文件,如果开启自动更新可以无视该消息"); + runUpdata(name); + } else { + Main.getInstance().getLogger().error(name + " §c版本出现了错误,需要修复配置文件,如果开启自动更新可以无视该消息"); + runUpdata(name); + } + } + + private static void runUpdata(String name) { + if (Main.getInstance().getConfig().getBoolean("updata.in-config.auto")) { + Main.getInstance().saveResource(name,true); + Main.getInstance().getLogger().info(Main.updataPrefix + name + " §a更新成功"); + } + } +} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/utils/GetConfigInfo.java b/src/main/java/cn/stevei5mc/NewTipsVariables/utils/GetConfigInfo.java index e7f974b..5364d38 100644 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/utils/GetConfigInfo.java +++ b/src/main/java/cn/stevei5mc/NewTipsVariables/utils/GetConfigInfo.java @@ -3,6 +3,9 @@ import cn.stevei5mc.NewTipsVariables.Main; import cn.nukkit.Player; import cn.nukkit.Server; +import healthapi.PlayerHealth; +import cn.stevei5mc.NewTipsVariables.variables.LoadSupportPlugins; + public class GetConfigInfo { //获取服务器TPS public static String getServerTps(Player player) { @@ -24,7 +27,7 @@ public static String getServerTps(Player player) { return serverTps; } //获取玩家所在的世界名 - public static String getPlayerWorld(Player player) { + public static String getPlayerWorld(Player player) { String worldName = player.getLevel().getFolderName(); String levelName = Main.getInstance().getWorldName().getString(worldName); String unknownWorld = Main.getInstance().getLanguage().getString("Unknown_World").replace("{0}", worldName); @@ -49,7 +52,7 @@ public static String getPlayerPing(Player player) { playerMS = playerPingMediumColor + pingValue; }else { playerMS = playerPingLowColor + pingValue; - } + } return playerMS; } //获取玩家的生命值状态 @@ -60,9 +63,19 @@ public static String getPlayerHealth(Player player) { int playerHealthHgihValue = Main.getInstance().getConfigInPlayer().getInt("HP.high_value");//hgih值 String playerHealthHgihColor = Main.getInstance().getConfigInPlayer().getString("HP.high_color"); String playerHealth; - float healthValue = player.getHealth(); - String healthValue2 = String.valueOf(healthValue); - String healthMaxValue = String.valueOf(player.getMaxHealth()); + double healthValue; + String healthValue2; + String healthMaxValue; + if (LoadSupportPlugins.pl5) { + PlayerHealth health = PlayerHealth.getPlayerHealth(player); + healthValue = health.getHealth(); + healthValue2 = String.valueOf(healthValue); + healthMaxValue = String.valueOf(health.getMaxHealth()); + }else { + healthValue = player.getHealth(); + healthValue2 = String.valueOf(healthValue); + healthMaxValue = String.valueOf(player.getMaxHealth()); + } //low=1 if (healthValue >= playerHealthHgihValue) { playerHealth = playerHealthHgihColor.replace("{0}",healthValue2).replace("{1}",healthMaxValue); diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/utils/configUtils.java b/src/main/java/cn/stevei5mc/NewTipsVariables/utils/configUtils.java deleted file mode 100644 index 242c619..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/utils/configUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.utils; - -import cn.stevei5mc.NewTipsVariables.Main; - -public class configUtils { - public static void configUtils() { - int cv1 = Main.getInstance().getConfig().getInt("version"); - int cv2 = Main.getInstance().getConfigInPlayer().getInt("version"); - int cv3 = Main.getInstance().getConfigInServer().getInt("version"); - boolean checkConfig = Main.getInstance().getConfig().getBoolean("updata.in-config.check"); - if (checkConfig) { - if (Main.config1Version > cv1) { - Main.getInstance().getLogger().warning("§econfig.yml 版本不是最新版"); - } else if (Main.config1Version < cv1) { - Main.getInstance().getLogger().error("§cconfig.yml 版本出现了错误"); - } else { - Main.getInstance().getLogger().info("§aconfig.yml 版本是最新版"); - } - - if (Main.config2Version > cv2) { - Main.getInstance().getLogger().warning("§eplayer.yml 版本不是最新版"); - } else if (Main.config2Version < cv2) { - Main.getInstance().getLogger().error("§cplayer.yml 版本出现了错误"); - } else { - Main.getInstance().getLogger().info("§aplayer.yml 版本是最新版"); - } - - if (Main.config3Version > cv3) { - Main.getInstance().getLogger().warning("§eserver.yml 版本不是最新版"); - } else if (Main.config3Version < cv3) { - Main.getInstance().getLogger().error("§cserver.yml 版本出现了错误"); - } else { - Main.getInstance().getLogger().info("§aserver.yml 版本是最新版"); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/loadSupportPlugins.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/LoadSupportPlugins.java similarity index 63% rename from src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/loadSupportPlugins.java rename to src/main/java/cn/stevei5mc/NewTipsVariables/variables/LoadSupportPlugins.java index 3110969..5103af3 100644 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/loadSupportPlugins.java +++ b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/LoadSupportPlugins.java @@ -1,37 +1,36 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins; +package cn.stevei5mc.NewTipsVariables.variables; import tip.utils.Api; import cn.nukkit.Server; import cn.nukkit.Player; import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.economyApiVariable; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater.playerPointsVariable; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater.OreAreaVariable; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater.RsTaskVariable; import cn.stevei5mc.NewTipsVariables.Main; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater.HealthAPIVariable; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater.LevelAwakenSystemVariable; -import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater.RSWeaponVariable; +import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.SmallasWaterPlugins; +import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.LuckPermsVar; -public class loadSupportPlugins{ +public class LoadSupportPlugins{ + 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 debugPerfix = "§7[§cDEBUG§7] "; - public static String successMsg = debugPerfix+"§a找到插件§e【§b{0}§e】§a相关变量已加载"; - public static String failureMsg = debugPerfix+"§c无法找到插件§e【§b{0}§e】§c相关变量加载失败,请安装相关插件再试"; + 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; String plugin; - //需要加载的变量的插件 plugin = "playerPoints"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - //存在 - Api.registerVariables("playerPointsVariable", playerPointsVariable.class); + pl1 = true; if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); } plugin = "EconomyAPI"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - //存在 Api.registerVariables("economyApiVariable", economyApiVariable.class); if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { @@ -39,36 +38,43 @@ public static void loadSupportVariables(Player player) { } plugin = "OreArea"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - //存在 - Api.registerVariables("OreAreaVariable", OreAreaVariable.class); + pl3 = true; if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); } plugin = "RSTask"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - Api.registerVariables("RsTaskVariable", RsTaskVariable.class); + pl4 = true; if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); } plugin = "HealthAPI"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - Api.registerVariables("HealthAPIVariable", HealthAPIVariable.class); + pl5 = true; if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); } plugin = "LevelAwakenSystem"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - Api.registerVariables("LevelAwakenSystemVariable", LevelAwakenSystemVariable.class); + pl6 = true; if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); } plugin = "RSWeapon"; if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { - Api.registerVariables("RSWeaponVariable", RSWeaponVariable.class); + pl7 = true; + if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} + } else if (debug) { + Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); + } + Api.registerVariables("SmallasWaterPlugins", SmallasWaterPlugins.class); + plugin = "LuckPerms"; + if (Server.getInstance().getPluginManager().getPlugin(plugin) != null) { + Api.registerVariables("LuckPermsVar", LuckPermsVar.class); if (debug) {Main.getInstance().getLogger().info(successMsg.replace("{0}",plugin));} } else if (debug) { Main.getInstance().getLogger().info(failureMsg.replace("{0}",plugin)); diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/LuckPermsVar.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/LuckPermsVar.java new file mode 100644 index 0000000..3a14529 --- /dev/null +++ b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/LuckPermsVar.java @@ -0,0 +1,39 @@ +package cn.stevei5mc.NewTipsVariables.variables.supportPlugins; + +import cn.nukkit.Player; +import tip.utils.variables.BaseVariable; +import net.luckperms.api.LuckPerms; +import net.luckperms.api.model.user.User; +import net.luckperms.api.LuckPermsProvider; + +public class LuckPermsVar extends BaseVariable { + public LuckPerms luckperms; + public LuckPermsVar(Player player) { + super(player); + } + public void strReplace() { + lpvar(); + } + + public void lpvar() { + User user = LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId()); + String pf = ""; + String sf = ""; + String gp = ""; + String pfx = user.getCachedData().getMetaData().getPrefix(); + String sfx = user.getCachedData().getMetaData().getSuffix(); + String gup = user.getPrimaryGroup(); + if (pfx != null) { + pf = pfx; + } + if (sfx != null) { + sf = sfx; + } + if (gup != null) { + gp = gup; + } + addStrReplaceString("{LuckPerms-prefix}", pf); + addStrReplaceString("{LuckPerms-suffix}", sf); + addStrReplaceString("{LuckPerms-group}", gp); + } +} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/SmallasWaterPlugins.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/SmallasWaterPlugins.java new file mode 100644 index 0000000..bb92ae2 --- /dev/null +++ b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/SmallasWaterPlugins.java @@ -0,0 +1,232 @@ +package cn.stevei5mc.NewTipsVariables.variables.supportPlugins; + +import cn.nukkit.Player; +import tip.utils.variables.BaseVariable; +import net.player.api.Point; +import com.task.utils.tasks.PlayerFile; +import com.task.utils.tasks.taskitems.PlayerTask; +import java.util.LinkedList; +import ore.area.utils.player.PlayerClass; +import ore.area.utils.area.AreaClass; +import ore.area.utils.Tools; +import ore.area.AreaMainClass; +import java.util.LinkedHashMap; +import healthapi.PlayerHealth; +import weapon.items.Armor; +import weapon.items.Weapon; +import weapon.utils.PlayerAddAttributes; +import cn.nukkit.item.Item; +import cn.nukkit.Server; +import AwakenSystem.data.DamageMath; +import AwakenSystem.data.defaultAPI; +import AwakenSystem.data.baseAPI; +import AwakenSystem.utils.nbtItems; +import cn.stevei5mc.NewTipsVariables.variables.LoadSupportPlugins; + +public class SmallasWaterPlugins extends BaseVariable { + public SmallasWaterPlugins(Player player) { + super(player); + } + + public void strReplace() { + if (LoadSupportPlugins.pl1) { + playerPoint(); + } + if (LoadSupportPlugins.pl3) { + RsTask(); + } + if (LoadSupportPlugins.pl4) { + OreArea(); + } + if (LoadSupportPlugins.pl5) { + HealthAPI(); + } + if (LoadSupportPlugins.pl6) { + RSWeapon(); + } + if (LoadSupportPlugins.pl7) { + LevelAwakenSystem(); + } + } +/** + * @author SmallasWater + */ + public void playerPoint() { + addStrReplaceString("{point}", String.format("%.2f", Point.myPoint(player))); + } + + public void RsTask() { + PlayerFile file = PlayerFile.getPlayerFile(this.player.getName()); + LinkedList tasks = file.getInviteTasks(); + String taskName = "暂无"; + if (tasks.size() > 0) { + PlayerTask task = (PlayerTask)tasks.get(0); + if (task != null) { + taskName = task.getTaskName(); + } + } + this.addStrReplaceString("{task-name}", taskName); + this.addStrReplaceString("{task-count}", file.getCount() + ""); + } + + public void OreArea() { + PlayerClass playerClass = PlayerClass.getPlayerClass(player.getName()); + addStrReplaceString("{orearea-level-this}", playerClass.getMaxAreaLevel() + ""); + addStrReplaceString("{orearea-level-next}", playerClass.getMaxAreaLevel() + 1 + ""); + //参考(复制但有改动) https://github.com/SmallasWater/OreArea/blob/master/src/main/java/ore/area/utils/OreAreaVariable.java + AreaClass areaClass = Tools.getDefaultArea(player, 2); + String time = "§c不在范围,无法获取可使用时间"; + String reset = "§c不在范围,无法获取刷新时间"; + String name = "§c没有解锁矿区"; + if(areaClass != null){ + if(AreaMainClass.getInstance().useTime.containsKey(player.getName())) { + LinkedHashMap map = AreaMainClass.getInstance().useTime.get(player.getName()); + if(map.containsKey(areaClass.getName())){ + int i = Math.round(map.get(areaClass.getName()) /60); + if(i != 0) { + time = "§7" +i + "§2分钟"; + }else{ + time = "§7" +areaClass.getUseTime() + "§2秒"; + } + } + }else{ + if(!areaClass.isKey()){ + time = "§c未开启"; + }else{ + if(playerClass.canKey(areaClass.getName())) { + if(areaClass.getUseTime() == -1) { + time = "§7无时限"; + }else{ + int i = Math.round(areaClass.getUseTime() /60); + if(i != 0) { + time = "§7" +i + "§2分钟"; + }else{ + time = "§7" +areaClass.getUseTime() + "§2秒"; + } + } + }else{ + time = "§c未解锁矿区"; + } + } + } + if(AreaMainClass.timer.containsKey(areaClass.getName())) { + reset = String.valueOf(AreaMainClass.timer.get(areaClass.getName())); + }else{ + reset = "§c未刷新"; + } + name = areaClass.getName(); + } + addStrReplaceString("{orearea-time-use}", time); + addStrReplaceString("{orearea-time-reset}", reset); + addStrReplaceString("{orearea-name}", name); + } + + public void HealthAPI() { + PlayerHealth health = PlayerHealth.getPlayerHealth(this.player); + addStrReplaceString("{h}", String.format("%.1f", health.getHealth())); + addStrReplaceString("{mh}", health.getMaxHealth() + ""); + addStrReplaceString("{hb}", String.format("%.2f", health.getHealthPercentage() * 100.0D)); + } + + public void RSWeapon() { + try { + Item item = this.player.getInventory().getItemInHand(); + Weapon weapon = Weapon.getInstance(item); + String name = "§c无神器"; + int c = 0; + if (weapon != null) { + name = weapon.getName(); + if (!weapon.canUse(this.player)) { + name = name + " §c(无法使用)"; + } + c = weapon.getGemStones().size(); + } + Item het = this.player.getInventory().getHelmet(); + Item chest = this.player.getInventory().getChestplate(); + Item legging = this.player.getInventory().getLeggings(); + Item boot = this.player.getInventory().getBoots(); + int hSize = 0; + int cSize = 0; + int lSize = 0; + int bSize = 0; + String hetName = "§c无头盔"; + String chestName = "§c无胸凯"; + String leggingName = "§c无护腿"; + String bootName = "§c无靴子"; + Armor armorHet = Armor.getInstance(het); + Armor armorChest = Armor.getInstance(chest); + Armor armorLegging = Armor.getInstance(legging); + Armor armorBoot = Armor.getInstance(boot); + if (armorHet != null) { + hetName = armorHet.getName(); + if (!armorHet.canUse(this.player)) { + hetName = hetName + " §c(无法使用)"; + } + hSize = armorHet.getGemStones().size(); + } + if (armorChest != null) { + chestName = armorChest.getName(); + if (!armorChest.canUse(this.player)) { + chestName = chestName + " §c(无法使用)"; + } + cSize = armorChest.getGemStones().size(); + } + if (armorLegging != null) { + leggingName = armorLegging.getName(); + if (!armorLegging.canUse(this.player)) { + leggingName = leggingName + " §c(无法使用)"; + } + lSize = armorLegging.getGemStones().size(); + } + if (armorBoot != null) { + bootName = armorBoot.getName(); + if (!armorBoot.canUse(this.player)) { + bootName = bootName + " §c(无法使用)"; + } + bSize = armorBoot.getGemStones().size(); + } + try { + PlayerAddAttributes playerAddAttributes = new PlayerAddAttributes(); + this.string = playerAddAttributes.getStrReplace(this.player, this.string); + } catch (Exception var22) {} + this.addStrReplaceString("{头盔}", hetName); + this.addStrReplaceString("{头盔宝石}", hSize + ""); + this.addStrReplaceString("{胸甲}", chestName); + this.addStrReplaceString("{胸甲宝石}", cSize + ""); + this.addStrReplaceString("{护腿}", leggingName); + this.addStrReplaceString("{护腿宝石}", lSize + ""); + this.addStrReplaceString("{靴子}", bootName); + this.addStrReplaceString("{靴子宝石}", bSize + ""); + this.addStrReplaceString("{武器名称}", name); + this.addStrReplaceString("{宝石个数}", c + ""); + this.addStrReplaceString("{we-damage}", PlayerAddAttributes.getDamage(this.player) + ""); + this.addStrReplaceString("{we-armor}", PlayerAddAttributes.getArmor(this.player) + ""); + this.addStrReplaceString("{we-health}", PlayerAddAttributes.getHealth(this.player) + ""); + this.addStrReplaceString("{we-kick}", String.format("%.2f", PlayerAddAttributes.getKick(this.player))); + this.addStrReplaceString("{we-dkick}", String.format("%.2f", PlayerAddAttributes.getDKick(this.player))); + this.addStrReplaceString("{we-todamage}", PlayerAddAttributes.getToDamage(this.player) + ""); + } catch (Exception var23) {} + } + + public void LevelAwakenSystem() { + Item item = this.player.getInventory().getItem(35); + String add = null; + if (nbtItems.can_use(this.player, item)) { + add = nbtItems.getName(item); + } + this.addStrReplaceString("{天赋}", defaultAPI.getChatBySetting(this.player.getName())); + this.addStrReplaceString("{level}", String.valueOf(defaultAPI.getPlayerAttributeInt(this.player.getName(), baseAPI.PlayerConfigType.LEVEL))); + this.addStrReplaceString("{exp}", String.valueOf(defaultAPI.getPlayerAttributeInt(this.player.getName(), baseAPI.PlayerConfigType.EXP))); + this.addStrReplaceString("{mexp}", String.valueOf(DamageMath.getUpDataEXP(this.player))); + this.addStrReplaceString("{dw}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DAMAGE_W))); + this.addStrReplaceString("{df}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DAMAGE_F))); + this.addStrReplaceString("{dlw}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DEFENSE_W))); + this.addStrReplaceString("{dlf}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DEFENSE_F))); + this.addStrReplaceString("{b}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.CRriT))); + this.addStrReplaceString("{kb}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.ANTI_RIOT))); + this.addStrReplaceString("{kx}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.RESISTANCE))); + this.addStrReplaceString("{c}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.PENETRATION))); + this.addStrReplaceString("{饰品}", add != null ? add : "无"); + this.addStrReplaceString("{属性}", "null".equals(defaultAPI.getPlayerAttributeString(this.player.getName(), baseAPI.PlayerConfigType.ATTRIBUTE)) ? "无属性" : defaultAPI.getPlayerAttributeString(this.player.getName(), baseAPI.PlayerConfigType.ATTRIBUTE)); + } +} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/HealthAPIVariable.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/HealthAPIVariable.java deleted file mode 100644 index 1cf176f..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/HealthAPIVariable.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater; - -import cn.nukkit.Player; -import tip.utils.variables.BaseVariable; -import healthapi.PlayerHealth; -import cn.stevei5mc.NewTipsVariables.Main; - -public class HealthAPIVariable extends BaseVariable { - public HealthAPIVariable(Player player) { - super(player); - } - - public void strReplace() { - HealthAPIVar(); - } - -/** - * @author SmallasWater - */ - public void HealthAPIVar() { - PlayerHealth health = PlayerHealth.getPlayerHealth(this.player); - addStrReplaceString("{h}", String.format("%.1f", health.getHealth())); - addStrReplaceString("{mh}", health.getMaxHealth() + ""); - addStrReplaceString("{hb}", String.format("%.2f", health.getHealthPercentage() * 100.0D)); - addStrReplaceString("{Player-Health}", this.getPlayerHealth(player));//这个除外 - } - - public String getPlayerHealth(Player player) { - PlayerHealth health = PlayerHealth.getPlayerHealth(this.player); - String playerHealthLowColor = Main.getInstance().getConfigInPlayer().getString("HP.low_color");//low值 - int playerHealthMediumValue = Main.getInstance().getConfigInPlayer().getInt("HP.medium_value");//medium值 - String playerHealthMediumColor = Main.getInstance().getConfigInPlayer().getString("HP.medium_color"); - int playerHealthHgihValue = Main.getInstance().getConfigInPlayer().getInt("HP.high_value");//hgih值 - String playerHealthHgihColor = Main.getInstance().getConfigInPlayer().getString("HP.high_color"); - String playerHealth; - double healthValue = health.getHealth(); - String healthValue2 = String.valueOf(healthValue); - String healthMaxValue = String.valueOf(health.getMaxHealth()); - //low=1 - if (healthValue >= playerHealthHgihValue) { - playerHealth = playerHealthHgihColor.replace("{0}",healthValue2).replace("{1}",healthMaxValue); - }else if (healthValue >= playerHealthMediumValue) { - playerHealth = playerHealthMediumColor.replace("{0}",healthValue2).replace("{1}",healthMaxValue); - }else { - playerHealth = playerHealthLowColor.replace("{0}",healthValue2).replace("{1}",healthMaxValue); - } - return playerHealth; - } -} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/LevelAwakenSystemVariable.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/LevelAwakenSystemVariable.java deleted file mode 100644 index c69d406..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/LevelAwakenSystemVariable.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater; - -import cn.nukkit.Player; -import tip.utils.variables.BaseVariable; -import AwakenSystem.data.DamageMath; -import AwakenSystem.data.defaultAPI; -import AwakenSystem.data.baseAPI; -import AwakenSystem.utils.nbtItems; -import cn.nukkit.item.Item; - -public class LevelAwakenSystemVariable extends BaseVariable { - public LevelAwakenSystemVariable(Player player) { - super(player); - } - - public void strReplace() { - LevelAwakenSystem(); - } - -/** - * @author SmallasWater - */ - public void LevelAwakenSystem() { - Item item = this.player.getInventory().getItem(35); - String add = null; - if (nbtItems.can_use(this.player, item)) { - add = nbtItems.getName(item); - } - this.addStrReplaceString("{天赋}", defaultAPI.getChatBySetting(this.player.getName())); - this.addStrReplaceString("{level}", String.valueOf(defaultAPI.getPlayerAttributeInt(this.player.getName(), baseAPI.PlayerConfigType.LEVEL))); - this.addStrReplaceString("{exp}", String.valueOf(defaultAPI.getPlayerAttributeInt(this.player.getName(), baseAPI.PlayerConfigType.EXP))); - this.addStrReplaceString("{mexp}", String.valueOf(DamageMath.getUpDataEXP(this.player))); - this.addStrReplaceString("{dw}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DAMAGE_W))); - this.addStrReplaceString("{df}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DAMAGE_F))); - this.addStrReplaceString("{dlw}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DEFENSE_W))); - this.addStrReplaceString("{dlf}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.DEFENSE_F))); - this.addStrReplaceString("{b}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.CRriT))); - this.addStrReplaceString("{kb}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.ANTI_RIOT))); - this.addStrReplaceString("{kx}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.RESISTANCE))); - this.addStrReplaceString("{c}", String.valueOf(defaultAPI.getPlayerFinalAttributeInt(this.player, baseAPI.ItemADDType.PENETRATION))); - this.addStrReplaceString("{饰品}", add != null ? add : "无"); - this.addStrReplaceString("{属性}", "null".equals(defaultAPI.getPlayerAttributeString(this.player.getName(), baseAPI.PlayerConfigType.ATTRIBUTE)) ? "无属性" : defaultAPI.getPlayerAttributeString(this.player.getName(), baseAPI.PlayerConfigType.ATTRIBUTE)); - } -} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/OreAreaVariable.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/OreAreaVariable.java deleted file mode 100644 index 9d22fc7..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/OreAreaVariable.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater; - -import cn.nukkit.Player; -import tip.utils.variables.BaseVariable; -import ore.area.utils.player.PlayerClass; -import ore.area.utils.area.AreaClass; -import ore.area.utils.Tools; -import ore.area.AreaMainClass; -import java.util.LinkedHashMap; - -public class OreAreaVariable extends BaseVariable { - public OreAreaVariable(Player player) { - super(player); - } - - public void strReplace() { - OreAreaVarPlayer(); - OreAreaVarArea(); - } - - public void OreAreaVarPlayer() { - //这个代码的是复制TipsVeriable的 - PlayerClass playerClass = PlayerClass.getPlayerClass(player.getName()); - addStrReplaceString("{orearea-level-this}", playerClass.getMaxAreaLevel() + ""); - addStrReplaceString("{orearea-level-next}", playerClass.getMaxAreaLevel() + 1 + ""); - } - - //参考(复制但有改动) https://github.com/SmallasWater/OreArea/blob/master/src/main/java/ore/area/utils/OreAreaVariable.java - public void OreAreaVarArea() { - AreaClass areaClass = Tools.getDefaultArea(player, 2); - String time = "§c不在范围,无法获取可使用时间"; - String reset = "§c不在范围,无法获取刷新时间"; - String name = "§c没有解锁矿区"; - if(areaClass != null){ - if(AreaMainClass.getInstance().useTime.containsKey(player.getName())) { - LinkedHashMap map = AreaMainClass.getInstance().useTime.get(player.getName()); - if(map.containsKey(areaClass.getName())){ - int i = Math.round(map.get(areaClass.getName()) /60); - if(i != 0) { - time = "§7" +i + "§2分钟"; - }else{ - time = "§7" +areaClass.getUseTime() + "§2秒"; - } - } - }else{ - if(!areaClass.isKey()){ - time = "§c未开启"; - }else{ - PlayerClass playerClass = PlayerClass.getPlayerClass(player.getName()); - if(playerClass.canKey(areaClass.getName())) { - if(areaClass.getUseTime() == -1) { - time = "§7无时限"; - }else{ - int i = Math.round(areaClass.getUseTime() /60); - if(i != 0) { - time = "§7" +i + "§2分钟"; - }else{ - time = "§7" +areaClass.getUseTime() + "§2秒"; - } - } - }else{ - time = "§c未解锁矿区"; - } - } - } - if(AreaMainClass.timer.containsKey(areaClass.getName())) { - reset = String.valueOf(AreaMainClass.timer.get(areaClass.getName())); - }else{ - reset = "§c未刷新"; - } - name = areaClass.getName(); - } - addStrReplaceString("{orearea-time-use}", time); - addStrReplaceString("{orearea-time-reset}", reset); - addStrReplaceString("{orearea-name}", name); - } -} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RSWeaponVariable.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RSWeaponVariable.java deleted file mode 100644 index e584790..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RSWeaponVariable.java +++ /dev/null @@ -1,104 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater; - -import cn.nukkit.Player; -import tip.utils.variables.BaseVariable; -import weapon.items.Armor; -import weapon.items.Weapon; -import weapon.utils.PlayerAddAttributes; -import cn.nukkit.item.Item; -import cn.nukkit.Server; - -public class RSWeaponVariable extends BaseVariable { - public RSWeaponVariable(Player player) { - super(player); - } - - public void strReplace() { - RSWeapon(); - } - -/** - * @author SmallasWater - */ - public void RSWeapon() { - try { - Item item = this.player.getInventory().getItemInHand(); - if (Server.getInstance().getPluginManager().getPlugin("RSWeapon") != null) { - Weapon weapon = Weapon.getInstance(item); - String name = "§c无神器"; - int c = 0; - if (weapon != null) { - name = weapon.getName(); - if (!weapon.canUse(this.player)) { - name = name + " §c(无法使用)"; - } - c = weapon.getGemStones().size(); - } - Item het = this.player.getInventory().getHelmet(); - Item chest = this.player.getInventory().getChestplate(); - Item legging = this.player.getInventory().getLeggings(); - Item boot = this.player.getInventory().getBoots(); - int hSize = 0; - int cSize = 0; - int lSize = 0; - int bSize = 0; - String hetName = "§c无头盔"; - String chestName = "§c无胸凯"; - String leggingName = "§c无护腿"; - String bootName = "§c无靴子"; - Armor armorHet = Armor.getInstance(het); - Armor armorChest = Armor.getInstance(chest); - Armor armorLegging = Armor.getInstance(legging); - Armor armorBoot = Armor.getInstance(boot); - if (armorHet != null) { - hetName = armorHet.getName(); - if (!armorHet.canUse(this.player)) { - hetName = hetName + " §c(无法使用)"; - } - hSize = armorHet.getGemStones().size(); - } - if (armorChest != null) { - chestName = armorChest.getName(); - if (!armorChest.canUse(this.player)) { - chestName = chestName + " §c(无法使用)"; - } - cSize = armorChest.getGemStones().size(); - } - if (armorLegging != null) { - leggingName = armorLegging.getName(); - if (!armorLegging.canUse(this.player)) { - leggingName = leggingName + " §c(无法使用)"; - } - lSize = armorLegging.getGemStones().size(); - } - if (armorBoot != null) { - bootName = armorBoot.getName(); - if (!armorBoot.canUse(this.player)) { - bootName = bootName + " §c(无法使用)"; - } - bSize = armorBoot.getGemStones().size(); - } - try { - PlayerAddAttributes playerAddAttributes = new PlayerAddAttributes(); - this.string = playerAddAttributes.getStrReplace(this.player, this.string); - } catch (Exception var22) {} - this.addStrReplaceString("{头盔}", hetName); - this.addStrReplaceString("{头盔宝石}", hSize + ""); - this.addStrReplaceString("{胸甲}", chestName); - this.addStrReplaceString("{胸甲宝石}", cSize + ""); - this.addStrReplaceString("{护腿}", leggingName); - this.addStrReplaceString("{护腿宝石}", lSize + ""); - this.addStrReplaceString("{靴子}", bootName); - this.addStrReplaceString("{靴子宝石}", bSize + ""); - this.addStrReplaceString("{武器名称}", name); - this.addStrReplaceString("{宝石个数}", c + ""); - this.addStrReplaceString("{we-damage}", PlayerAddAttributes.getDamage(this.player) + ""); - this.addStrReplaceString("{we-armor}", PlayerAddAttributes.getArmor(this.player) + ""); - this.addStrReplaceString("{we-health}", PlayerAddAttributes.getHealth(this.player) + ""); - this.addStrReplaceString("{we-kick}", String.format("%.2f", PlayerAddAttributes.getKick(this.player))); - this.addStrReplaceString("{we-dkick}", String.format("%.2f", PlayerAddAttributes.getDKick(this.player))); - this.addStrReplaceString("{we-todamage}", PlayerAddAttributes.getToDamage(this.player) + ""); - } - } catch (Exception var23) {} - } -} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RsTaskVariable.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RsTaskVariable.java deleted file mode 100644 index 504de87..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RsTaskVariable.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater; - -import cn.nukkit.Player; -import tip.utils.variables.BaseVariable; -import com.task.utils.tasks.PlayerFile; -import com.task.utils.tasks.taskitems.PlayerTask; -import java.util.LinkedList; - -public class RsTaskVariable extends BaseVariable { - public RsTaskVariable(Player player) { - super(player); - } - - public void strReplace() { - RsTaskVar(); - } - - public void RsTaskVar() { - //这个代码的是复制TipsVeriable的 - PlayerFile file = PlayerFile.getPlayerFile(this.player.getName()); - LinkedList tasks = file.getInviteTasks(); - String taskName = "暂无"; - if (tasks.size() > 0) { - PlayerTask task = (PlayerTask)tasks.get(0); - if (task != null) { - taskName = task.getTaskName(); - } - } - this.addStrReplaceString("{task-name}", taskName); - this.addStrReplaceString("{task-count}", file.getCount() + ""); - } -} \ No newline at end of file diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/playerPointsVariable.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/playerPointsVariable.java deleted file mode 100644 index e1f1737..0000000 --- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/playerPointsVariable.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.stevei5mc.NewTipsVariables.variables.supportPlugins.smallasWater; - -import cn.nukkit.Player; -import tip.utils.variables.BaseVariable; -import net.player.api.Point; - -public class playerPointsVariable extends BaseVariable { - public playerPointsVariable(Player player) { - super(player); - } - - public void strReplace() { - playerPoint(); - } - - public void playerPoint() { - addStrReplaceString("{point}", String.format("%.2f", Point.myPoint(player))); //这个代码的是复制TipsVeriable的 - } -} \ No newline at end of file diff --git a/src/main/resources/SupportPluginsVariables.txt b/src/main/resources/SupportPluginsVariables.txt index e416217..f4cd7a5 100644 --- a/src/main/resources/SupportPluginsVariables.txt +++ b/src/main/resources/SupportPluginsVariables.txt @@ -4,12 +4,10 @@ NewTipsVariables(变量文档) EconomyAPI {economyApi-money} 玩家金钱数量 - HealthAPI {h} 玩家血量 {mh} 玩家血量上限 {hb} 玩家血量百分比 - LevelAwakenSystem {属性} 玩家的RPG属性 {天赋} 玩家评分 @@ -26,7 +24,10 @@ LevelAwakenSystem {c} 玩家穿透 {饰品} 玩家当前装备的饰品 {pvp} 玩家PVP 状态 (暂时不可用) - +LuckPerms +{LuckPerms-prefix} 获取玩家的prefix(前缀) +{LuckPerms-suffix} 获取玩家的suffix(后缀) +{LuckPerms-group} 获取玩家所在的权限组 OreArea {orearea-level-this} 获取玩家的矿区等级 {orearea-level-next} 获取玩家的矿区下一等级 @@ -35,7 +36,6 @@ OreArea {orearea-name} 获取玩家所在的矿区等级 playerPoints {point} 获取玩家的点券数量 - RsTask {task-name} 正在进行中的任务 (显示第一个) {task-count} 玩家任务积分 diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8f10e77..2a4b525 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -11,8 +11,10 @@ updata: #自动更新(需开启检查更新但暂时没有用) auto: false in-config: - check: false + #检查更新 + check: true #自动更新(需开启检查更新但暂时没有用) auto: false # 是否释放新的变量说明文档 -save-variables-doc: true \ No newline at end of file +save-variables-doc: true +debug: false \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 1377c74..2e1d6df 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: NewTipsVariables main: cn.stevei5mc.NewTipsVariables.Main -version: '1.0.0-beta8' +version: '1.0.0-beta9' author: stevei5mc api: ["1.0.14"]