Skip to content

Commit

Permalink
Merge pull request #1 from stevei5mc/dev
Browse files Browse the repository at this point in the history
Dev 1.0.0-beta1
  • Loading branch information
stevei5mc authored Jan 16, 2024
2 parents 2aaacce + 98313bd commit 08e9d3d
Show file tree
Hide file tree
Showing 14 changed files with 293 additions and 15 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: 获取信息
id: get_info
run: echo "repository_name=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT
- name: 拉取代码
uses: actions/checkout@v3
- name: 安装java8
Expand All @@ -26,14 +29,13 @@ jobs:
distribution: 'temurin'
cache: maven
- name: 构建
run: mvn -B package --file pom.xml
- name: 收集构建文件
run: |
mvn -B package --file pom.xml
mkdir staging && cp target/*.jar staging
pwd
ls -la
- name: 收集构建文件
uses: actions/upload-artifact@v1
with:
name: UnicodeVariables
name: ${{ steps.get_info.outputs.repository_name }}
path: staging
23 changes: 12 additions & 11 deletions .github/workflows/tagpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: 获取信息
id: get_info
run: |
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
echo "repository_name=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT
- name: 拉取代码
uses: actions/checkout@v3
- name: 安装java8
Expand All @@ -27,31 +32,27 @@ jobs:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: 获取tag版本号
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: 构建
run: mvn -B package --file pom.xml
- name: 收集构建文件
run: |
mvn -B package --file pom.xml
mkdir staging && cp target/*.jar staging
pwd
ls -la
- name: 收集构建文件
uses: actions/upload-artifact@v1
with:
name: UnicodeVariables
name: ${{ steps.get_info.outputs.repository_name }}
path: staging
- name: 创建新版本
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Release V${{ steps.get_version.outputs.VERSION }}
tag_name: ${{ steps.get_info.outputs.VERSION }}
release_name: Release V${{ steps.get_info.outputs.VERSION }}
body: |
Release V${{ steps.get_version.outputs.VERSION }}
V${{ steps.get_info.outputs.VERSION }}
更新日志将在后续发布,敬请期待!
draft: false
prerelease: false
Expand All @@ -62,6 +63,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./target/UnicodeVariables-${{ steps.get_version.outputs.VERSION }}.jar
asset_name: UnicodeVariables-${{ steps.get_version.outputs.VERSION }}.jar
asset_path: ./target/${{ steps.get_info.outputs.repository_name }}-${{ steps.get_info.outputs.VERSION }}.jar
asset_name: ${{ steps.get_info.outputs.repository_name }}-${{ steps.get_info.outputs.VERSION }}.jar
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/*
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# NewTipsVeriable
## 敬请期待
## 插件介绍
> 该插件可以为Tips添加更多的变量内容,更多变量敬请期待
## 使用方法
> 1、将插件放进`plugins`文件夹
> 2、需确保安装`Tips`插件后重启服务器
> 3、在`/plugins/NewTipsVariables`文件夹中的txt文件获取相关变量介绍,也可在本页面获取相关的变量介绍
## 变量介绍
### 文字相关的变量
|变量名|对应内容|变量名|对应内容|变量名|对应内容|变量名|对应内容|
|-|-|-|-|-|-|-|-|
|{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}|§r|---|---|---|---|---|---|
### 玩家相关的变量
|变量|介绍|变量|介绍|
|-|-|-|-|
|{xp}|获取玩家在游戏中的经验等级(minecraft的)|{DeviceModel}|获取玩家使用的设备型号|
|{XUID}|获取玩家的xuid|{PlayerLang}|获取玩家客户端使用的语言|
### 服务器相关的变量
|变量|介绍|变量|介绍|
|-|-|-|-|
|{Motd}|获取服务器主motd|{SubMotd}|获取服务器副motd|
|{ServerIp}|获取服务器IP|{ServerPort}|获取服务器端口|
75 changes: 75 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

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

<repositories>
<repository>
<id>opencollab-repo-release</id>
<url>https://repo.opencollab.dev/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>opencollab-repo-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>repo-lanink-cn</id>
<url>https://repo.lanink.cn/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>cn.nukkit</groupId>
<artifactId>nukkit</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.smallaswater.tips</groupId>
<artifactId>Tips</artifactId>
<version>2.1.8</version>
<scope>provided</scope>
</dependency>
</dependencies>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

</plugins>
</build>

</project>
49 changes: 49 additions & 0 deletions src/main/java/cn/stevei5mc/NewTipsVariables/main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package cn.stevei5mc.NewTipsVariables;

import cn.nukkit.plugin.PluginBase;
import cn.nukkit.plugin.PluginManager;
import tip.utils.Api;
import cn.stevei5mc.NewTipsVariables.variables.tipstext;
import cn.stevei5mc.NewTipsVariables.variables.tipsserver;
import cn.stevei5mc.NewTipsVariables.variables.tipsplayer;

public class main extends PluginBase {
public void onEnable() {
this.loadresource();
if (this.getServer().getPluginManager().getPlugin("Tips") != null) {
this.tipsvariables();
this.loadover();
} else {
this.getLogger().warning("§c未检测到前置插件§aTips§c,请安装§aTips§c再试!!!");
this.getLogger().warning("§b下载地址: §ehttps://ci.lanink.cn/job/Tips/");
this.onDisable();
}
}

public void onDisable() {
this.getLogger().info("停止运行");
this.getLogger().info("§6感谢你的使用");
}

public void loadresource() {
this.getDataFolder().mkdirs(); //创建插件文件夹
//每次都加载最新的变量信息
this.saveResource("text-variables.txt","/text-variables.txt",true);
this.saveResource("server-variables.txt","/server-variables.txt",true);
this.saveResource("player-variables.txt","/player-variables.txt",true);
this.getLogger().info("变量说明文件生成成功");
}

public void tipsvariables() {
Api.registerVariables("tipstext", tipstext.class);
Api.registerVariables("tipsserver", tipsserver.class);
Api.registerVariables("tipsplayer", tipsplayer.class);
}

public void loadover() {
this.getLogger().info("加载成功");
this.getLogger().warning("§c警告:");
this.getLogger().warning("§c本插件为免费且开源的一款插件,如果你是付费获取到的那么你就被骗了");
this.getLogger().info("§a开源链接和使用方法: §bhttps://github.com/stevei5mc/NewTipsVariables");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cn.stevei5mc.NewTipsVariables.variables;

import cn.nukkit.Player;
import cn.nukkit.Server;
import tip.utils.variables.BaseVariable;

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

public void strReplace() {
playervar();
}

public void playervar() {
addStrReplaceString("{xp}", String.valueOf(player.getExperienceLevel()));
addStrReplaceString("{DeviceModel}", player.getLoginChainData().getDeviceModel());
addStrReplaceString("{XUID}", String.valueOf(player.getLoginChainData().getXUID()));
addStrReplaceString("{PlayerLang}", player.getLoginChainData().getLanguageCode());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cn.stevei5mc.NewTipsVariables.variables;

import cn.nukkit.Player;
import cn.nukkit.Server;
import tip.utils.variables.BaseVariable;

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

public void strReplace() {
scv();
}

public void scv() {
addStrReplaceString("{Motd}", Server.getInstance().getMotd());
addStrReplaceString("{SubMotd}", Server.getInstance().getSubMotd());
addStrReplaceString("{ServerIp}", Server.getInstance().getIp());
addStrReplaceString("{ServerPort}", String.valueOf(Server.getInstance().getPort()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package cn.stevei5mc.NewTipsVariables.variables;

import cn.nukkit.Player;
import tip.utils.variables.BaseVariable;

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

public void strReplace() {
tc();
}

public void tc() {
addStrReplaceString("{text-s0}", "§0");
addStrReplaceString("{text-s1}", "§1");
addStrReplaceString("{text-s2}", "§2");
addStrReplaceString("{text-s3}", "§3");
addStrReplaceString("{text-s4}", "§4");
addStrReplaceString("{text-s5}", "§5");
addStrReplaceString("{text-s6}", "§6");
addStrReplaceString("{text-s7}", "§7");
addStrReplaceString("{text-s8}", "§8");
addStrReplaceString("{text-s9}", "§9");
addStrReplaceString("{text-sa}", "§a");
addStrReplaceString("{text-sb}", "§b");
addStrReplaceString("{text-sc}", "§c");
addStrReplaceString("{text-sd}", "§d");
addStrReplaceString("{text-se}", "§e");
addStrReplaceString("{text-sf}", "§f");
addStrReplaceString("{text-bold}", "§l");
addStrReplaceString("{text-italic}", "§o");
addStrReplaceString("{text-reset}", "§r");
addStrReplaceString("{text-mess}", "§k");
addStrReplaceString("{text-next}", "\n");
}
}
6 changes: 6 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 更新功能(这个功能展示没有用)
updata:
#检查更新(暂时没有用)
check: false
#自动更新(需开启检查更新但暂时没有用)
auto: false
5 changes: 5 additions & 0 deletions src/main/resources/player-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
变量名 变量说明
{xp} 获取玩家在游戏中的经验等级(minecraft的)
{DeviceModel} 获取玩家使用的设备型号
{XUID} 获取玩家的xuid
{PlayerLang} 获取玩家客户端使用的语言
5 changes: 5 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: NewTipsVariables
main: cn.stevei5mc.NewTipsVariables.main
version: '1.0.0-beta1'
author: stevei5mc
api: ["1.0.14"]
5 changes: 5 additions & 0 deletions src/main/resources/server-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
变量名 变量说明
{Motd} 获取服务器主motd
{SubMotd} 获取服务器副motd
{ServerIp} 获取服务器IP
{ServerPort} 获取服务器端口
22 changes: 22 additions & 0 deletions src/main/resources/text-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
变量名 === 对应内容
{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

0 comments on commit 08e9d3d

Please sign in to comment.