From 8601071e833f607f41bd6a7d7387aaf0d363bb36 Mon Sep 17 00:00:00 2001
From: stevei5mc <2978383306@qq.com>
Date: Mon, 5 Feb 2024 14:46:09 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AF=B9=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E6=94=AF=E6=8C=81=20=E5=BF=AB?=
=?UTF-8?q?=E8=BF=87=E5=B9=B4=E4=BA=86=E7=89=88=E6=9C=AC=E5=B0=B1=E7=9B=B4?=
=?UTF-8?q?=E6=8E=A5=E8=B7=B3=E5=88=B0beta6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
.../cn/stevei5mc/NewTipsVariables/Main.java | 35 ++++++++++++++-----
src/main/resources/config.yml | 18 +++++++---
src/main/resources/plugin.yml | 2 +-
4 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/pom.xml b/pom.xml
index b680cb4..db64ac2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
cn.stevei5mc
NewTipsVariables
- 1.0.0-beta3
+ 1.0.0-beta6
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
index 1532538..19e6bb8 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
@@ -10,12 +10,19 @@
import cn.stevei5mc.NewTipsVariables.variables.tipsServerConfig;
import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.loadSupportPlugins;
import cn.nukkit.Player;
+import cn.nukkit.utils.Config;
public class Main extends PluginBase {
public static Player player;
-
+ private static Main instance;
+ private static Config config;
+ public static Main getInstance() {
+ return instance;
+ }
+
public void onEnable() {
- this.loadresource();//先把资源文件给加载了
+ this.loadConfigRes();//加载配置文件
+ this.loadVarRes();//加载变量文档
//判断需要的前置插件是否存在
if (this.getServer().getPluginManager().getPlugin("Tips") != null) {
//存在则加载该插件
@@ -34,12 +41,20 @@ public void onDisable() {
this.getLogger().info("§6感谢你的使用");
}
- public void loadresource() {
+ public void loadConfigRes() {
this.getDataFolder().mkdirs(); //创建插件文件夹
- //每次都加载最新的变量信息
- this.saveResource("base-variables.txt","/base-variables.txt",true);
- this.saveResource("SupportPluginsVariables.txt","SupportPluginsVariables.txt",true);
- this.getLogger().info("§a变量说明文件加载成功");
+ this.saveDefaultConfig();
+ this.config = new Config(this.getDataFolder() + "/config.yml", Config.YAML);
+ }
+
+ public void loadVarRes() {
+ boolean saveVariablesDoc = this.config.getBoolean("save-variables-doc");
+ if (saveVariablesDoc == true) {
+ //为true时就每次都加载最新的变量信息
+ this.saveResource("base-variables.txt","/base-variables.txt",true);
+ this.saveResource("SupportPluginsVariables.txt","SupportPluginsVariables.txt",true);
+ this.getLogger().info("§a变量说明文件加载成功");
+ }
}
public void tipsvariables() {
@@ -56,5 +71,9 @@ public void loadover() {
this.getLogger().warning("§c警告:");
this.getLogger().warning("§c本插件为免费且开源的一款插件,如果你是付费获取到的那么你就被骗了");
this.getLogger().info("§a开源链接和使用方法: §bhttps://github.com/stevei5mc/NewTipsVariables");
- }
+ }
+
+ public Config getConfig() {
+ return this.config;
+ }
}
\ No newline at end of file
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index eab1a3f..c02fe3f 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,10 +1,18 @@
+version: 1
# 更新功能(这个功能展示没有用)
-# 整个配置文件都没有用
updata:
- #检查更新(暂时没有用)
- check: false
- #自动更新(需开启检查更新但暂时没有用)
- auto: false
+ in-plugin:
+ #检查更新(暂时没有用)
+ check: false
+ #自动更新(需开启检查更新但暂时没有用)
+ auto: false
+ in-config:
+ #检查更新(暂时没有用)
+ check: false
+ #自动更新(需开启检查更新但暂时没有用)
+ auto: false
+# 是否释放新的变量说明文档
+save-variables-doc: true
player:
# 玩家设备的系统
DeviceOS:
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index f913fbc..4060c5f 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,5 @@
name: NewTipsVariables
main: cn.stevei5mc.NewTipsVariables.Main
-version: '1.0.0-beta3'
+version: '1.0.0-beta6'
author: stevei5mc
api: ["1.0.14"]
\ No newline at end of file
From ec01badc9763d336c0f7534d3c1f1c65d45ee01f Mon Sep 17 00:00:00 2001
From: stevei5mc <2978383306@qq.com>
Date: Tue, 6 Feb 2024 19:47:36 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8A=A0=E8=BD=BD?=
=?UTF-8?q?=E9=A1=BA=E5=BA=8F+=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AF=B4=E6=98=8E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 3 +--
config-info.md | 9 +++++++++
src/main/java/cn/stevei5mc/NewTipsVariables/Main.java | 11 ++++++++---
3 files changed, 18 insertions(+), 5 deletions(-)
create mode 100644 config-info.md
diff --git a/.gitignore b/.gitignore
index 114a58d..c8b241f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-target/*
-config.yml.md
\ No newline at end of file
+target/*
\ No newline at end of file
diff --git a/config-info.md b/config-info.md
new file mode 100644
index 0000000..abb3798
--- /dev/null
+++ b/config-info.md
@@ -0,0 +1,9 @@
+# **配置文件使用说明**
+## **[config.yml](src/main/resources/config.yml)**
+### **是否释放新的变量说明文档**
+```
+save-variables-doc: true
+```
+> 1、该配置项启用后,服务器每次启动后都会生成新的变量文档
+> 2、若关闭后,就算删除变量文档也不会生成新的变量文档
+> 3、该配置项默认启用
\ No newline at end of file
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
index 19e6bb8..b1329c4 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
@@ -20,9 +20,13 @@ public static Main getInstance() {
return instance;
}
- public void onEnable() {
+ public void onLoad() {
+ instance = this;
this.loadConfigRes();//加载配置文件
this.loadVarRes();//加载变量文档
+ }
+
+ public void onEnable() {
//判断需要的前置插件是否存在
if (this.getServer().getPluginManager().getPlugin("Tips") != null) {
//存在则加载该插件
@@ -51,8 +55,8 @@ public void loadVarRes() {
boolean saveVariablesDoc = this.config.getBoolean("save-variables-doc");
if (saveVariablesDoc == true) {
//为true时就每次都加载最新的变量信息
- this.saveResource("base-variables.txt","/base-variables.txt",true);
- this.saveResource("SupportPluginsVariables.txt","SupportPluginsVariables.txt",true);
+ this.saveResource("base-variables.txt",true);
+ this.saveResource("SupportPluginsVariables.txt",true);
this.getLogger().info("§a变量说明文件加载成功");
}
}
@@ -73,6 +77,7 @@ public void loadover() {
this.getLogger().info("§a开源链接和使用方法: §bhttps://github.com/stevei5mc/NewTipsVariables");
}
+ @Override
public Config getConfig() {
return this.config;
}
From 2ae624b9fa67ad5c4f37697c607cc6efd5800ea2 Mon Sep 17 00:00:00 2001
From: stevei5mc <2978383306@qq.com>
Date: Tue, 6 Feb 2024 22:54:17 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config-info.md | 15 +++++++++++-
.../cn/stevei5mc/NewTipsVariables/Main.java | 7 ++++++
.../variables/tipsServerConfig.java | 24 ++++++++++++-------
src/main/resources/config.yml | 7 ------
src/main/resources/server.yml | 6 +++++
5 files changed, 42 insertions(+), 17 deletions(-)
create mode 100644 src/main/resources/server.yml
diff --git a/config-info.md b/config-info.md
index abb3798..5e5eceb 100644
--- a/config-info.md
+++ b/config-info.md
@@ -1,9 +1,22 @@
# **配置文件使用说明**
## **[config.yml](src/main/resources/config.yml)**
+> **主配置文件**
### **是否释放新的变量说明文档**
```
save-variables-doc: true
```
> 1、该配置项启用后,服务器每次启动后都会生成新的变量文档
> 2、若关闭后,就算删除变量文档也不会生成新的变量文档
-> 3、该配置项默认启用
\ No newline at end of file
+> 3、该配置项默认启用
+## **[server.yml](src/main/resources/server.yml)**
+> **服务器相关变量配置文件**
+```
+TPS:
+ low_color: "§c"
+ medium_value: 9
+ medium_color: "§e"
+ high_value: 15
+ high_color: "§a"
+```
+> 1、color设置显示的颜色,low、medium、high为显示的范围
+> 2、value是一个范围值,medium、high为可设置的范围值,low值只能为0
\ No newline at end of file
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
index b1329c4..7132f58 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
@@ -16,6 +16,7 @@ public class Main extends PluginBase {
public static Player player;
private static Main instance;
private static Config config;
+ private static Config configInServer;
public static Main getInstance() {
return instance;
}
@@ -48,7 +49,9 @@ public void onDisable() {
public void loadConfigRes() {
this.getDataFolder().mkdirs(); //创建插件文件夹
this.saveDefaultConfig();
+ this.saveResource("server.yml",false);
this.config = new Config(this.getDataFolder() + "/config.yml", Config.YAML);
+ this.configInServer = new Config(this.getDataFolder() + "/server.yml", Config.YAML);
}
public void loadVarRes() {
@@ -81,4 +84,8 @@ public void loadover() {
public Config getConfig() {
return this.config;
}
+
+ public Config getConfigInServer() {
+ return this.configInServer;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsServerConfig.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsServerConfig.java
index db5038b..3d59b4f 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsServerConfig.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsServerConfig.java
@@ -3,6 +3,7 @@
import cn.nukkit.Player;
import cn.nukkit.Server;
import tip.utils.variables.BaseVariable;
+import cn.stevei5mc.NewTipsVariables.Main;
public class tipsServerConfig extends BaseVariable {
public tipsServerConfig(Player player) {
@@ -17,18 +18,23 @@ public void serverVarConfig() {
addStrReplaceString("{Server-Tps}", this.getServerTps(player));
}
- //这下面的内容是要从config.yml获取内容的,但是现在还不行
-
public static String getServerTps(Player player) {
- String serverTps = "§a15";
- if (Server.getInstance().getTicksPerSecond() >= 0) {
- serverTps = "§c" + Server.getInstance().getTicksPerSecond();
+ String serverTpslowColor = Main.getInstance().getConfigInServer().getString("TPS.low_color");
+ int serverTpsMediumValue = Main.getInstance().getConfigInServer().getInt("TPS.medium_value");
+ String serverTpsMediumColor = Main.getInstance().getConfigInServer().getString("TPS.medium_color");
+ int serverTpsHgihValue = Main.getInstance().getConfigInServer().getInt("TPS.high_value");
+ String serverTpsHgihColor = Main.getInstance().getConfigInServer().getString("TPS.high_color");
+ String serverTps = serverTpsHgihColor + serverTpsHgihValue;
+ float tpsValue = Server.getInstance().getTicksPerSecond();
+ //最低值为0
+ if (tpsValue >= 0) {
+ serverTps = serverTpslowColor + tpsValue;
}
- if (Server.getInstance().getTicksPerSecond() >= 9) {
- serverTps = "§e" + Server.getInstance().getTicksPerSecond();
+ if (tpsValue >= serverTpsMediumValue) {
+ serverTps = serverTpsMediumColor + tpsValue;
}
- if (Server.getInstance().getTicksPerSecond() >= 15) {
- serverTps = "§a" + Server.getInstance().getTicksPerSecond();
+ if (tpsValue >= serverTpsHgihValue) {
+ serverTps = serverTpsHgihColor + tpsValue;
}
return serverTps;
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index c02fe3f..56cdd1b 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -63,11 +63,4 @@ player:
medium_value: 9
medium_color: "§e"
high_value: 15
- high_color: "§a"
-server:
- TPS:
- low_color: "§c"
- medium_value: 9
- medium_color: "§e"
- high_value: 15
high_color: "§a"
\ No newline at end of file
diff --git a/src/main/resources/server.yml b/src/main/resources/server.yml
new file mode 100644
index 0000000..ea0a81b
--- /dev/null
+++ b/src/main/resources/server.yml
@@ -0,0 +1,6 @@
+TPS:
+ low_color: "§c"
+ medium_value: 9
+ medium_color: "§e"
+ high_value: 15
+ high_color: "§a"
\ No newline at end of file
From 821bd3505bc6f369ff935b1ff98566fcb09d229a Mon Sep 17 00:00:00 2001
From: stevei5mc <2978383306@qq.com>
Date: Wed, 7 Feb 2024 19:43:24 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../cn/stevei5mc/NewTipsVariables/Main.java | 7 +
.../variables/tipsPlayerConfig.java | 122 ++++++++++++------
src/main/resources/config.yml | 53 +-------
src/main/resources/player.yml | 40 ++++++
src/main/resources/server.yml | 1 +
5 files changed, 129 insertions(+), 94 deletions(-)
create mode 100644 src/main/resources/player.yml
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
index 7132f58..a01f1ac 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
@@ -17,6 +17,7 @@ public class Main extends PluginBase {
private static Main instance;
private static Config config;
private static Config configInServer;
+ private static Config configInPlayer;
public static Main getInstance() {
return instance;
}
@@ -50,8 +51,10 @@ public void loadConfigRes() {
this.getDataFolder().mkdirs(); //创建插件文件夹
this.saveDefaultConfig();
this.saveResource("server.yml",false);
+ this.saveResource("player.yml",false);
this.config = new Config(this.getDataFolder() + "/config.yml", Config.YAML);
this.configInServer = new Config(this.getDataFolder() + "/server.yml", Config.YAML);
+ this.configInPlayer = new Config(this.getDataFolder() + "/player.yml", Config.YAML);
}
public void loadVarRes() {
@@ -88,4 +91,8 @@ public Config getConfig() {
public Config getConfigInServer() {
return this.configInServer;
}
+
+ public Config getConfigInPlayer() {
+ return this.configInPlayer;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java
index 7e0ae7a..7aeca4e 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java
@@ -3,6 +3,7 @@
import cn.nukkit.Player;
import cn.nukkit.Server;
import tip.utils.variables.BaseVariable;
+import cn.stevei5mc.NewTipsVariables.Main;
public class tipsPlayerConfig extends BaseVariable {
public tipsPlayerConfig(Player player) {
@@ -20,79 +21,116 @@ public void playerVarConfig() {
addStrReplaceString("{Player-Food}", this.getPlayerFood(player));
addStrReplaceString("{Player-Health}", this.getPlayerHealth(player));
}
-
- //这下面的内容是要从config.yml获取内容的,但是现在还不行
/*这ui档案应该只有classic ui和pocket ui这两种UI(测试出来的)
Unknown UI是为了保险起见加上去的*/
private String playerUiString(int uiprofile) {
+ String classicUi = Main.getInstance().getConfigInPlayer().getString("Device.UIProfile.classic");
+ String pocketUi = Main.getInstance().getConfigInPlayer().getString("Device.UIProfile.pocket");
+ String unknownUi = Main.getInstance().getConfigInPlayer().getString("Device.UIProfile.Unknown");
switch (uiprofile) {
- case 0: return "classic ui";
- case 1: return "pocket ui";
- default: return "Unknown UI";
+ case 0: return classicUi;
+ case 1: return pocketUi;
+ default: return unknownUi;
}
}
//获取玩家的饱食度状态
public static String getPlayerFood(Player player) {
- String playerFood = "§a15";
- if (player.getFoodData().getLevel() >= 0) {
- playerFood = "§c" + player.getFoodData().getLevel();
+ String playerFoodLowColor = Main.getInstance().getConfigInPlayer().getString("Food.low_color");
+ int playerFoodMediumValue = Main.getInstance().getConfigInPlayer().getInt("Food.medium_value");
+ String playerFoodMediumColor = Main.getInstance().getConfigInPlayer().getString("Food.medium_color");
+ int playerFoodHgihValue = Main.getInstance().getConfigInPlayer().getInt("Food.high_value");
+ String playerFoodHgihColor = Main.getInstance().getConfigInPlayer().getString("Food.high_color");
+ String playerFood = playerFoodHgihColor + playerFoodHgihValue;
+ float foodValue = player.getFoodData().getLevel();
+ //最低值为0
+ if (foodValue >= 0) {
+ playerFood = playerFoodLowColor + foodValue;
}
- if (player.getFoodData().getLevel() >= 9) {
- playerFood = "§e" + player.getFoodData().getLevel();
+ if (foodValue >= playerFoodMediumValue) {
+ playerFood = playerFoodMediumColor + foodValue;
}
- if (player.getFoodData().getLevel() >= 15) {
- playerFood = "§a" + player.getFoodData().getLevel();
+ if (foodValue >= playerFoodHgihValue) {
+ playerFood = playerFoodHgihColor + foodValue;
}
return playerFood;
}
//获取玩家的生命值状态
public static String getPlayerHealth(Player player) {
- String playerFood = "§a15";
- if (player.getHealth() >= 0) {
- playerFood = "§c" + player.getHealth();
+ String playerHealthLowColor = Main.getInstance().getConfigInPlayer().getString("HP.low_color");
+ int playerHealthMediumValue = Main.getInstance().getConfigInPlayer().getInt("HP.medium_value");
+ String playerHealthMediumColor = Main.getInstance().getConfigInPlayer().getString("HP.medium_color");
+ int playerHealthHgihValue = Main.getInstance().getConfigInPlayer().getInt("HP.high_value");
+ String playerHealthHgihColor = Main.getInstance().getConfigInPlayer().getString("HP.high_color");
+ String playerHealth = playerHealthHgihColor + playerHealthHgihValue;
+ float healthValue = player.getHealth();
+ //最低值为0
+ if (healthValue >= 0) {
+ playerHealth = playerHealthLowColor + healthValue;
}
- if (player.getHealth() >= 9) {
- playerFood = "§e" + player.getHealth();
+ if (healthValue >= playerHealthMediumValue) {
+ playerHealth = playerHealthMediumColor + healthValue;
}
- if (player.getHealth() >= 15) {
- playerFood = "§a" + player.getHealth();
+ if (healthValue >= playerHealthHgihValue) {
+ playerHealth = playerHealthHgihColor + healthValue;
}
- return playerFood;
+ return playerHealth;
}
private String mapDeviceOSToString(int os) {
+ String osAndroid = Main.getInstance().getConfigInPlayer().getString("Device.OS.Android");
+ String osIOS = Main.getInstance().getConfigInPlayer().getString("Device.OS.iOS");
+ String osMacOS = Main.getInstance().getConfigInPlayer().getString("Device.OS.macOS");
+ String osFireOS = Main.getInstance().getConfigInPlayer().getString("Device.OS.Fire_OS");
+ String osGearVR = Main.getInstance().getConfigInPlayer().getString("Device.OS.Gear_VR");
+ String osHoloLens = Main.getInstance().getConfigInPlayer().getString("Device.OS.HoloLens");
+ String osWindows10 = Main.getInstance().getConfigInPlayer().getString("Device.OS.Windows_10");
+ String osWindows = Main.getInstance().getConfigInPlayer().getString("Device.OS.Windows");
+ String osDedicated = Main.getInstance().getConfigInPlayer().getString("Device.OS.Dedicated");
+ String osTvOS = Main.getInstance().getConfigInPlayer().getString("Device.OS.tvOS");
+ String osPlayStation = Main.getInstance().getConfigInPlayer().getString("Device.OS.PlayStation");
+ String osSwitch = Main.getInstance().getConfigInPlayer().getString("Device.OS.Switch");
+ String osXbox = Main.getInstance().getConfigInPlayer().getString("Device.OS.Xbox");
+ String osWindowsPhone = Main.getInstance().getConfigInPlayer().getString("Device.OS.Windows_Phone");
+ String osUnknown = Main.getInstance().getConfigInPlayer().getString("Device.OS.Unknown");
switch (os) {
- case 1: return "Android";
- case 2: return "iOS";
- case 3: return "macOS";
- case 4: return "Fire OS";
- case 5: return "Gear VR";
- case 6: return "HoloLens";
- case 7: return "Windows 10";
- case 8: return "Windows";
- case 9: return "Dedicated";
- case 10: return "tvOS";
- case 11: return "PlayStation";
- case 12: return "Switch";
- case 13: return "Xbox";
- case 14: return "Windows Phone";
+ case 1: return osAndroid;
+ case 2: return osIOS;
+ case 3: return osMacOS;
+ case 4: return osFireOS;
+ case 5: return osGearVR;
+ case 6: return osHoloLens;
+ case 7: return osWindows10;
+ case 8: return osWindows;
+ case 9: return osDedicated;
+ case 10: return osTvOS;
+ case 11: return osPlayStation;
+ case 12: return osSwitch;
+ case 13: return osXbox;
+ case 14: return osWindowsPhone;
+ default: return osUnknown;
}
- return "Unknown";
}
public static String getPlayerPing(Player player) {
- String playerMS = "§a0";
- if (player.getPing() >= 0) {
- playerMS = "§a" + player.getPing();
+ String playerPingLowColor = Main.getInstance().getConfigInPlayer().getString("ping.low_color");
+ int playerPingMediumValue = Main.getInstance().getConfigInPlayer().getInt("ping.medium_value");
+ String playerPingMediumColor = Main.getInstance().getConfigInPlayer().getString("ping.medium_color");
+ int playerPingHgihValue = Main.getInstance().getConfigInPlayer().getInt("ping.high_value");
+ String playerPingHgihColor = Main.getInstance().getConfigInPlayer().getString("ping.high_color");
+ String playerMS = playerPingHgihColor + playerPingHgihValue;
+ int pingValue = player.getPing();
+ //最低值为0
+ if (pingValue >= 0) {
+ playerMS = playerPingLowColor + pingValue;
}
- if (player.getPing() >= 80) {
- playerMS = "§e" + player.getPing();
+ if (pingValue >= playerPingMediumValue) {
+ playerMS = playerPingMediumColor + pingValue;
}
- if (player.getPing() >= 120) {
- playerMS = "§c" + player.getPing();
+ if (pingValue >= playerPingHgihValue) {
+ playerMS = playerPingHgihColor + pingValue;
}
return playerMS;
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 56cdd1b..231b165 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -12,55 +12,4 @@ updata:
#自动更新(需开启检查更新但暂时没有用)
auto: false
# 是否释放新的变量说明文档
-save-variables-doc: true
-player:
- # 玩家设备的系统
- DeviceOS:
- Android: "安卓"
- iOS: "苹果"
- macOS: "苹果但是电脑"
- Fire_OS: "Fire_OS"
- Gear_VR: "Gear_VR"
- HoloLens: "HoloLens"
- Windows_10: "Windows 10"
- Windows: "Windows"
- Dedicated: "Dedicated"
- tvOS: "tvOS"
- PlayStation: "PlayStation"
- Switch: "Switch"
- Xbox: "Xbox"
- Windows_Phone: "windows但是手机"
- Unknown: "未知的系统"
- # 玩家的ui样式
- UIProfile:
- classic: "classic ui"
- pocket: "pocket ui"
- Unknown: "Unknown ui"
- # 玩家的延迟显示
- ping:
- #配置说明,下面同理
- #low的最低值为0,因此不提供相关设置
- #设置最低值的显示颜色
- low_color: "§a"
- #设置中等值为多少
- medium_value: 80
- #设置中等值的显示颜色
- medium_color: "§e"
- #设置最高值为多少
- high_value: 120
- #设置最高值的显示颜色
- high_color: "§c"
- # 玩家的血量状态
- HP:
- low_color: "§c"
- medium_value: 9
- medium_color: "§e"
- high_value: 15
- high_color: "§a"
- # 玩家的饱食度状态
- Food:
- low_color: "§c"
- medium_value: 9
- medium_color: "§e"
- high_value: 15
- high_color: "§a"
\ No newline at end of file
+save-variables-doc: true
\ No newline at end of file
diff --git a/src/main/resources/player.yml b/src/main/resources/player.yml
new file mode 100644
index 0000000..6a13b34
--- /dev/null
+++ b/src/main/resources/player.yml
@@ -0,0 +1,40 @@
+version: 1
+Device:
+ OS:
+ Android: "安卓"
+ iOS: "苹果"
+ macOS: "苹果但是电脑"
+ Fire_OS: "Fire_OS"
+ Gear_VR: "Gear_VR"
+ HoloLens: "HoloLens"
+ Windows_10: "Windows 10"
+ Windows: "Windows"
+ Dedicated: "Dedicated"
+ tvOS: "tvOS"
+ PlayStation: "PlayStation"
+ Switch: "Switch"
+ Xbox: "Xbox"
+ Windows_Phone: "windows但是手机"
+ Unknown: "未知的系统"
+ UIProfile:
+ classic: "classic ui"
+ pocket: "pocket ui"
+ Unknown: "Unknown ui"
+ping:
+ low_color: "§a"
+ medium_value: 80
+ medium_color: "§e"
+ high_value: 120
+ high_color: "§c"
+HP:
+ low_color: "§c"
+ medium_value: 9
+ medium_color: "§e"
+ high_value: 15
+ high_color: "§a"
+Food:
+ low_color: "§c"
+ medium_value: 9
+ medium_color: "§e"
+ high_value: 15
+ high_color: "§a"
\ No newline at end of file
diff --git a/src/main/resources/server.yml b/src/main/resources/server.yml
index ea0a81b..e1a7df1 100644
--- a/src/main/resources/server.yml
+++ b/src/main/resources/server.yml
@@ -1,3 +1,4 @@
+version: 1
TPS:
low_color: "§c"
medium_value: 9
From 1cd593a7b89d2ef1c8ae6dbc945bfdb94b362369 Mon Sep 17 00:00:00 2001
From: stevei5mc <2978383306@qq.com>
Date: Wed, 7 Feb 2024 22:56:48 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B?=
=?UTF-8?q?=E7=BB=86=E8=8A=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 1 +
SupportPluginsVariables.md | 2 +-
config-info.md | 66 +++++++++++++++++--
.../variables/tipsPlayerConfig.java | 16 +++--
src/main/resources/config.yml | 2 +
src/main/resources/player.yml | 4 ++
src/main/resources/server.yml | 2 +
7 files changed, 81 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 4c4e313..e039f22 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@
> **1、将插件放进`plugins`文件夹**
> **2、需确保安装`Tips`插件后重启服务器**
> **3、在`/plugins/NewTipsVariables`文件夹中的`.txt`文件获取相关变量介绍,也可在本页面获取相关的变量介绍**
+## **[配置文件使用说明](config-info.md)**
## 变量介绍
### 文字相关的变量
|变量名|对应内容|变量名|对应内容|变量名|对应内容|变量名|对应内容|
diff --git a/SupportPluginsVariables.md b/SupportPluginsVariables.md
index f326d43..765f921 100644
--- a/SupportPluginsVariables.md
+++ b/SupportPluginsVariables.md
@@ -1,4 +1,4 @@
-[返回](README.md)
+[返回](README.md) [配置文件说明](config-info.md)
# NewTipsVariables(变量文档)
> **支持的插件篇**
> **按插件的英文字母排序**
diff --git a/config-info.md b/config-info.md
index 5e5eceb..c977df2 100644
--- a/config-info.md
+++ b/config-info.md
@@ -1,13 +1,17 @@
+[返回](README.md) [支持的插件](SupportPluginsVariables.md)
# **配置文件使用说明**
+> **若未在此说明中写配置项出则代表该配置项还没有支持**
+```
+```
## **[config.yml](src/main/resources/config.yml)**
> **主配置文件**
### **是否释放新的变量说明文档**
```
save-variables-doc: true
```
-> 1、该配置项启用后,服务器每次启动后都会生成新的变量文档
-> 2、若关闭后,就算删除变量文档也不会生成新的变量文档
-> 3、该配置项默认启用
+> **1、该配置项启用后,服务器每次启动后都会生成新的变量文档**
+> **2、若关闭后,就算删除变量文档也不会生成新的变量文档**
+> **3、该配置项默认启用**
## **[server.yml](src/main/resources/server.yml)**
> **服务器相关变量配置文件**
```
@@ -18,5 +22,57 @@ TPS:
high_value: 15
high_color: "§a"
```
-> 1、color设置显示的颜色,low、medium、high为显示的范围
-> 2、value是一个范围值,medium、high为可设置的范围值,low值只能为0
\ No newline at end of file
+> **1、```color```设置显示的颜色,```low```、```medium```、```high```为显示的范围**
+> **2、```value```是一个范围值,```medium```、```high```为可设置的范围值,```low```值只能为```0```**
+## **[player.yml](src/main/resources/player.yml)**
+> **玩家相关变量配置文件**
+```
+Device:
+ OS:
+ Android: "安卓"
+ iOS: "苹果"
+ macOS: "苹果但是电脑"
+ Fire_OS: "Fire_OS"
+ Gear_VR: "Gear_VR"
+ HoloLens: "HoloLens"
+ Windows_10: "Windows 10"
+ Windows: "Windows"
+ Dedicated: "Dedicated"
+ tvOS: "tvOS"
+ PlayStation: "PlayStation"
+ Switch: "Switch"
+ Xbox: "Xbox"
+ Windows_Phone: "windows但是手机"
+ Unknown: "未知的系统"
+ UIProfile:
+ classic: "classic ui"
+ pocket: "pocket ui"
+ Unknown: "Unknown ui
+```
+> 1、**```OS```玩家的设备系统**
+> 2、**```UIProfile```玩家的设备UI**
+```
+ping:
+ low_color: "§a"
+ medium_value: 80
+ medium_color: "§e"
+ high_value: 120
+ high_color: "§c"
+HP:
+ symbols: "§7/"
+ low_color: "§c"
+ medium_value: 9
+ medium_color: "§e"
+ high_value: 15
+ high_color: "§a"
+Food:
+ symbols: "§7/"
+ low_color: "§c"
+ medium_value: 9
+ medium_color: "§e"
+ high_value: 15
+ high_color: "§a"
+```
+> **1、```color```设置显示的颜色,```low```、```medium```、```high```为显示的范围**
+> **2、```value```是一个范围值,```medium```、```high```为可设置的范围值,```low```值只能为```0```**
+> **3、```symbols```是用来设置分割符号的,例如: ```HP: 20/20```**
\ No newline at end of file
diff --git a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java
index 7aeca4e..d0ca869 100644
--- a/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java
+++ b/src/main/java/cn/stevei5mc/NewTipsVariables/variables/tipsPlayerConfig.java
@@ -37,6 +37,7 @@ private String playerUiString(int uiprofile) {
//获取玩家的饱食度状态
public static String getPlayerFood(Player player) {
+ String playerFoodSymbols = Main.getInstance().getConfigInPlayer().getString("Food.symbols");
String playerFoodLowColor = Main.getInstance().getConfigInPlayer().getString("Food.low_color");
int playerFoodMediumValue = Main.getInstance().getConfigInPlayer().getInt("Food.medium_value");
String playerFoodMediumColor = Main.getInstance().getConfigInPlayer().getString("Food.medium_color");
@@ -44,21 +45,23 @@ public static String getPlayerFood(Player player) {
String playerFoodHgihColor = Main.getInstance().getConfigInPlayer().getString("Food.high_color");
String playerFood = playerFoodHgihColor + playerFoodHgihValue;
float foodValue = player.getFoodData().getLevel();
+ int foodMaxValue = player.getFoodData().getMaxLevel();
//最低值为0
if (foodValue >= 0) {
- playerFood = playerFoodLowColor + foodValue;
+ playerFood = playerFoodLowColor + foodValue + playerFoodSymbols + playerFoodLowColor + foodMaxValue;
}
if (foodValue >= playerFoodMediumValue) {
- playerFood = playerFoodMediumColor + foodValue;
+ playerFood = playerFoodMediumColor + foodValue + playerFoodSymbols + playerFoodMediumColor + foodMaxValue;
}
if (foodValue >= playerFoodHgihValue) {
- playerFood = playerFoodHgihColor + foodValue;
+ playerFood = playerFoodHgihColor + foodValue + playerFoodSymbols + playerFoodHgihColor + foodMaxValue;
}
return playerFood;
}
//获取玩家的生命值状态
public static String getPlayerHealth(Player player) {
+ String playerHealthSymbols = Main.getInstance().getConfigInPlayer().getString("HP.symbols");
String playerHealthLowColor = Main.getInstance().getConfigInPlayer().getString("HP.low_color");
int playerHealthMediumValue = Main.getInstance().getConfigInPlayer().getInt("HP.medium_value");
String playerHealthMediumColor = Main.getInstance().getConfigInPlayer().getString("HP.medium_color");
@@ -66,15 +69,16 @@ public static String getPlayerHealth(Player player) {
String playerHealthHgihColor = Main.getInstance().getConfigInPlayer().getString("HP.high_color");
String playerHealth = playerHealthHgihColor + playerHealthHgihValue;
float healthValue = player.getHealth();
+ int healthMaxValue = player.getMaxHealth();
//最低值为0
if (healthValue >= 0) {
- playerHealth = playerHealthLowColor + healthValue;
+ playerHealth = playerHealthLowColor + healthValue + playerHealthSymbols + playerHealthLowColor + healthMaxValue;
}
if (healthValue >= playerHealthMediumValue) {
- playerHealth = playerHealthMediumColor + healthValue;
+ playerHealth = playerHealthMediumColor + healthValue + playerHealthSymbols + playerHealthMediumColor + healthMaxValue;
}
if (healthValue >= playerHealthHgihValue) {
- playerHealth = playerHealthHgihColor + healthValue;
+ playerHealth = playerHealthHgihColor + healthValue + playerHealthSymbols + playerHealthHgihColor + healthMaxValue;
}
return playerHealth;
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 231b165..04e74d7 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,3 +1,5 @@
+#使用说明: https://github.com/stevei5mc/NewTipsVariables/blob/main/README.md
+#配置文件版本,勿动
version: 1
# 更新功能(这个功能展示没有用)
updata:
diff --git a/src/main/resources/player.yml b/src/main/resources/player.yml
index 6a13b34..b953968 100644
--- a/src/main/resources/player.yml
+++ b/src/main/resources/player.yml
@@ -1,3 +1,5 @@
+#使用说明: https://github.com/stevei5mc/NewTipsVariables/blob/main/README.md
+#配置文件版本,勿动
version: 1
Device:
OS:
@@ -27,12 +29,14 @@ ping:
high_value: 120
high_color: "§c"
HP:
+ symbols: "§7/"
low_color: "§c"
medium_value: 9
medium_color: "§e"
high_value: 15
high_color: "§a"
Food:
+ symbols: "§7/"
low_color: "§c"
medium_value: 9
medium_color: "§e"
diff --git a/src/main/resources/server.yml b/src/main/resources/server.yml
index e1a7df1..596722f 100644
--- a/src/main/resources/server.yml
+++ b/src/main/resources/server.yml
@@ -1,3 +1,5 @@
+#使用说明: https://github.com/stevei5mc/NewTipsVariables/blob/main/README.md
+#配置文件版本,勿动
version: 1
TPS:
low_color: "§c"
From e7dbbe471599a4c6d34ac202817626e22d39f5fe Mon Sep 17 00:00:00 2001
From: stevei5mc <2978383306@qq.com>
Date: Wed, 7 Feb 2024 23:04:15 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?=
=?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config-info.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/config-info.md b/config-info.md
index c977df2..f93ac02 100644
--- a/config-info.md
+++ b/config-info.md
@@ -1,8 +1,6 @@
[返回](README.md) [支持的插件](SupportPluginsVariables.md)
# **配置文件使用说明**
> **若未在此说明中写配置项出则代表该配置项还没有支持**
-```
-```
## **[config.yml](src/main/resources/config.yml)**
> **主配置文件**
### **是否释放新的变量说明文档**