Skip to content

Commit

Permalink
dev-1.0.0-beta7
Browse files Browse the repository at this point in the history
1.0.0 beta7
  • Loading branch information
stevei5mc authored Mar 21, 2024
2 parents bcd734f + 8858721 commit e7859e6
Show file tree
Hide file tree
Showing 21 changed files with 311 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- name: 获取信息
id: get_info
run: echo "repository_name=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT
run: echo "repository_name=${GITHUB_REPOSITORY/${{ github.repository_owner }}\//}" >> $GITHUB_OUTPUT
- name: 拉取代码
uses: actions/checkout@v3
- name: 安装java8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- name: 获取信息
id: get_info
run: echo "repository_name=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT
run: echo "repository_name=${GITHUB_REPOSITORY/${{ github.repository_owner }}\//}" >> $GITHUB_OUTPUT
- name: 拉取代码
uses: actions/checkout@v3
- name: 安装java8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tagpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
id: get_info
run: |
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
echo "repository_name=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT
echo "repository_name=${GITHUB_REPOSITORY/${{ github.repository_owner }}\//}" >> $GITHUB_OUTPUT
- name: 拉取代码
uses: actions/checkout@v3
- name: 安装java8
Expand Down
29 changes: 3 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,6 @@
> **1、将插件放进`plugins`文件夹**
> **2、需确保安装`Tips`插件后重启服务器**
> **3、在`/plugins/NewTipsVariables`文件夹中的`.txt`文件获取相关变量介绍,也可在本页面获取相关的变量介绍**
## **[配置文件使用说明](./docs/config-info.md)**
## 变量介绍
### **文字相关的变量**
|变量名|对应内容|变量名|对应内容|变量名|对应内容|变量名|对应内容|
|-|-|-|-|-|-|-|-|
|{text-s0}|§0|{text-s1}|§1|{text-s2}|§2|{text-s3}|§3|
|{text-s4}|§4|{text-s5}|§5|{text-s6}|§6|{text-s7}|§7|
|{text-s8}|§8|{text-s9}|§9|{text-sa}|§a|{text-sb}|§b|
|{text-sc}|§c|{text-sd}|§d|{text-se}|§e|{text-sf}|§f|
|{text-bold}|§l|{text-italic}|§o|{text-reset}|§r|{text-mess}|§k|
|{text-next}|\n|---|---|---|---|---|---|
### **玩家相关的变量**
|变量|介绍|变量|介绍|
|-|-|-|-|
|{Player-Xp}|获取玩家在游戏中的经验等级|{Device-Model}|获取玩家使用的设备型号|
|{XUID}|获取玩家的xuid|{Player-Lang}|获取玩家客户端使用的语言|
|{Player-Ui}|获取玩家客户端使用的UI|{Device-Os}|获取玩家设备的系统|
|{{Player-Uuid}|获取玩家的uuid|{Player-Ping}|获取玩家当前的延迟|
|{Player-Food}|玩家当前的饥饿度|{Player-Health}|玩家当前的血量|
### **服务器相关的变量**
|变量|介绍|变量|介绍|
|-|-|-|-|
|{Server-Motd}|获取服务器主motd|{Server-SubMotd}|获取服务器副motd|
|{Server-Ip}|获取服务器IP|{Server-Port}|获取服务器端口|
|{Server-Tps}|获取服务器当前TPS|---|---|
### **[支持的插件](./docs/SupportPluginsVariables.md)**
### **[配置文件使用说明](./docs/config-info.md)**
### **变量介绍**
**[文字相关变量](./docs/text-variables.md) [玩家相关变量](./docs/player-variables.md) [服务器相关变量](./docs/server-variables.md) [支持的插件](./docs/SupportPluginsVariables.md)**
16 changes: 13 additions & 3 deletions docs/SupportPluginsVariables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
[返回](../README.md) [配置文件说明](./config-info.md)
# **NewTipsVariables(变量文档)**
> **支持的插件篇**
[![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&color=blue)
](./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)
](./SupportPluginsVariables.md)

---
> **按插件的英文字母排序**
> **TipsVeriable 相关变量移值中,部分变量名有改动**
Expand Down
30 changes: 19 additions & 11 deletions docs/config-info.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[返回](../README.md) [支持的插件](./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) [![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)

---
# **配置文件使用说明**
> **若未在此说明中写配置项出则代表该配置项还没有支持**
## **[config.yml](../src/main/resources/config.yml)**
Expand All @@ -10,6 +15,12 @@ save-variables-doc: true
> **1、该配置项启用后,服务器每次启动后都会生成新的变量文档**
> **2、若关闭后,就算删除变量文档也不会生成新的变量文档**
> **3、该配置项默认启用**
### **debug功能**
```
debug: false
```
> 1、这个功能默认关闭并不在配置文件中,需要手动填写
> 2、把`debug: true`复制进`config.yml`即可启用
## **[server.yml](../src/main/resources/server.yml)**
> **服务器相关变量配置文件**
```
Expand Down Expand Up @@ -41,11 +52,9 @@ Device:
Switch: "Switch"
Xbox: "Xbox"
Windows_Phone: "windows但是手机"
Unknown: "未知的系统"
UIProfile:
classic: "classic ui"
pocket: "pocket ui"
Unknown: "Unknown ui
```
> 1、**```OS```玩家的设备系统**
> 2、**```UIProfile```玩家的设备UI**
Expand All @@ -57,19 +66,18 @@ ping:
high_value: 120
high_color: "§c"
HP:
symbols: "§7/"
low_color: "§c"
low_color: "§c{0}§7/§c{1}"
medium_value: 9
medium_color: "§e"
medium_color: "§e{0}§7/§e{1}"
high_value: 15
high_color: "§a"
high_color: "§a{0}§7/§a{1}"
Food:
symbols: "§7/"
low_color: "§c"
empty_color: "§7{0}/{1}"
low_color: "§c{0}§7/§c{1}"
medium_value: 9
medium_color: "§e"
medium_color: "§e{0}§7/§e{1}"
high_value: 15
high_color: "§a"
high_color: "§a{0}§7/§a{1}"
```
> **1、```color```设置显示的颜色,```low``````medium``````high```为显示的范围**
> **2、```value```是一个范围值,```medium``````high```为可设置的范围值,```low```值只能为```0```**
Expand Down
22 changes: 22 additions & 0 deletions docs/player-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[![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&color=blue)](./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)](./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)

---
|变量|介绍|备注|
|-|-|-|
|{Player-Xp}|获取玩家在游戏中的经验等级||
|{Device-Model}|获取玩家使用的设备型号||
|{XUID}|获取玩家的xuid||
|{Player-Lang}|获取玩家客户端使用的语言||
|{Player-Ui}|获取玩家客户端使用的UI||
|{Device-Os}|获取玩家设备的系统||
|{{Player-Uuid}|获取玩家的uuid||
|{Player-Ping}|获取玩家当前的延迟||
|{Player-Food}|获取玩家当前的饥饿度||
|{Player-Health}|获取玩家当前的血量||
|{Player-World}|获取玩家所在的世界|**需在world_name.yml配置**|
|{Player-Controls}|获取玩家设备的操作方式||
16 changes: 16 additions & 0 deletions docs/server-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[![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&color=blue)](./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)](./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)

---
|变量|介绍|备注|
|-|-|-|
|{Server-Motd}|获取服务器主motd||
|{Server-SubMotd}|获取服务器副motd||
|{Server-Ip}|获取服务器IP||
|{Server-Port}|获取服务器端口||
|{Server-Tps}|获取服务器当前TPS||
|{WorldOnline@世界名}|获取指定世界的人数||
16 changes: 16 additions & 0 deletions docs/text-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[![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&color=blue)](./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)](./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)

---
|变量名|对应内容|变量名|对应内容|变量名|对应内容|变量名|对应内容|
|-|-|-|-|-|-|-|-|
|{text-s0}|§0|{text-s1}|§1|{text-s2}|§2|{text-s3}|§3|
|{text-s4}|§4|{text-s5}|§5|{text-s6}|§6|{text-s7}|§7|
|{text-s8}|§8|{text-s9}|§9|{text-sa}|§a|{text-sb}|§b|
|{text-sc}|§c|{text-sd}|§d|{text-se}|§e|{text-sf}|§f|
|{text-bold}|§l|{text-italic}|§o|{text-reset}|§r|{text-mess}|§k|
|{text-next}|\n|---|---|---|---|---|---|
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cn.stevei5mc</groupId>
<artifactId>NewTipsVariables</artifactId>
<version>1.0.0-beta6</version>
<version>1.0.0-beta7</version>

<repositories>
<repository>
Expand Down
32 changes: 25 additions & 7 deletions src/main/java/cn/stevei5mc/NewTipsVariables/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
public class Main extends PluginBase {
public static Player player;
private static Main instance;
private static Config config;
private static Config configInServer;
private static Config configInPlayer;
private Config config;
private Config configInServer;
private Config configInPlayer;
private Config worldName;
private Config language;
public static Main getInstance() {
return instance;
}
Expand All @@ -32,6 +34,7 @@ public void onEnable() {
//判断需要的前置插件是否存在
if (this.getServer().getPluginManager().getPlugin("Tips") != null) {
//存在则加载该插件
this.deBugMode();//用于加载debug信息
this.tipsvariables();//加载变量部分
this.loadover();//加载完成显示的内容
} else {
Expand All @@ -52,21 +55,33 @@ public void loadConfigRes() {
this.saveDefaultConfig();
this.saveResource("server.yml",false);
this.saveResource("player.yml",false);
this.saveResource("world_name.yml",false);
this.saveResource("language.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);
this.worldName = new Config(this.getDataFolder() + "/world_name.yml", Config.YAML);
this.language = new Config(this.getDataFolder() + "/language.yml", Config.YAML);
}

public void loadVarRes() {
boolean saveVariablesDoc = this.config.getBoolean("save-variables-doc");
if (saveVariablesDoc == true) {
if (saveVariablesDoc) {
//为true时就每次都加载最新的变量信息
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) {
String debugPerfix = "§7[§cDEBUG§7] ";
this.getLogger().warning(debugPerfix + "§cdebug模式已开启");
}
}

public void tipsvariables() {
Api.registerVariables("tipsText", tipsText.class);
Api.registerVariables("tipsServer", tipsServer.class);
Expand All @@ -83,16 +98,19 @@ public void loadover() {
this.getLogger().info("§a开源链接和使用方法: §bhttps://github.com/stevei5mc/NewTipsVariables");
}

@Override
public Config getConfig() {
return this.config;
}

public Config getConfigInServer() {
return this.configInServer;
}

public Config getConfigInPlayer() {
return this.configInPlayer;
}
public Config getWorldName() {
return this.worldName;
}
public Config getLanguage() {
return this.language;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,65 @@
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;

public class loadSupportPlugins {

public static void loadSupportVariables(Player player) {
boolean debug = Main.getInstance().getConfig().getBoolean("debug", false);
//加载相关插件的变量时的提示
String loadSuccessMsg1 = a找到插件§e【§b";
String loadSuccessMsg2 = "§e】§a相关变量已加载";
String loadFailureMsg1 = "§c无法找到插件§e【§b";
String loadFailureMsg2 = "§e】§c相关变量加载失败,请安装相关插件再试";
String debugPerfix = 7[§cDEBUG§7] ";
String loadPlugin;
String loadSuccessMsg = Main.getInstance().getLanguage().getString("debug_plugins_found");
String loadFailureMsg = Main.getInstance().getLanguage().getString("debug_plugins_not_found");
//需要加载的变量的插件

String loadPlugin1 = "playerPoints";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin1) != null) {
loadPlugin = "playerPoints";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) {
//存在
Api.registerVariables("playerPointsVariable", playerPointsVariable.class);
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin1 + loadSuccessMsg2);
} else {
//不存在
Server.getInstance().getLogger().info(loadFailureMsg1 + loadPlugin1 + loadFailureMsg2);
}
if (debug) {
Main.getInstance().getLogger().info(loadSuccessMsg.replace("{0}",loadPlugin));
}

String loadPlugin2 = "EconomyAPI";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin2) != null) {
} else {
if (debug) {
Main.getInstance().getLogger().info(loadFailureMsg.replace("{0}",loadPlugin));
}
}
loadPlugin = "EconomyAPI";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) {
//存在
Api.registerVariables("economyApiVariable", economyApiVariable.class);
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin2 + loadSuccessMsg2);
} else {
//不存在
Server.getInstance().getLogger().info(loadFailureMsg1 + loadPlugin2 + loadFailureMsg2);
}

String loadPlugin3 = "OreArea";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin3) != null) {
if (debug) {
Main.getInstance().getLogger().info(loadSuccessMsg.replace("{0}",loadPlugin));
}
} else {
if (debug) {
Main.getInstance().getLogger().info(loadFailureMsg.replace("{0}",loadPlugin));
}
}
loadPlugin = "OreArea";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) {
//存在
Api.registerVariables("OreAreaVariable", OreAreaVariable.class);
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin3 + loadSuccessMsg2);
} else {
//不存在
Server.getInstance().getLogger().info(loadFailureMsg1 + loadPlugin3 + loadFailureMsg2);
}

String loadPlugin4 = "RSTask";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin4) != null) {
//存在
if (debug) {
Main.getInstance().getLogger().info(loadSuccessMsg.replace("{0}",loadPlugin));
}
} else {
if (debug) {
Main.getInstance().getLogger().info(loadFailureMsg.replace("{0}",loadPlugin));
}
}
loadPlugin = "RSTask";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) {
Api.registerVariables("RsTaskVariable", RsTaskVariable.class);
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin4 + loadSuccessMsg2);
} else {
//不存在
Server.getInstance().getLogger().info(loadFailureMsg1 + loadPlugin4 + loadFailureMsg2);
if (debug) {
Main.getInstance().getLogger().info(loadSuccessMsg.replace("{0}",loadPlugin));
}
} else {
if (debug) {
Main.getInstance().getLogger().info(loadFailureMsg.replace("{0}",loadPlugin));
}
}
}
}
Loading

0 comments on commit e7859e6

Please sign in to comment.