Skip to content

Commit

Permalink
添加对RsTask插件的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
stevei5mc committed Feb 4, 2024
1 parent 30fe497 commit e9b1812
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 2 deletions.
5 changes: 5 additions & 0 deletions SupportPluginsVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
## Q
---
## R
### **[RsTask](https://github.com/MemoriesOfTime/RSTask)**
|变量名|变量介绍|
|-|-|
|{task-name}|正在进行中的任务 (显示第一个)|
|{task-count}|玩家任务积分|
---
## S
---
Expand Down
Binary file added lib/RsTask_v1.8.4.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
<scope>system</scope>
<systemPath> ${project.basedir}/lib/OreArea_v1.3.8.jar</systemPath>
</dependency>
<dependency>
<groupId>com.smallaswater.rstask</groupId>
<artifactId>RsTask</artifactId>
<version>1.8.4</version>
<scope>system</scope>
<systemPath> ${project.basedir}/lib/RsTask_v1.8.4.jar</systemPath>
</dependency>
</dependencies>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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;

public class loadSupportPlugins {

Expand Down Expand Up @@ -53,6 +54,18 @@ public static void loadSupportVariables(Player player) {
Api.addVariable("{orearea-level-this}", loadPlugin3Failure);Api.addVariable("{orearea-level-next}", loadPlugin3Failure);
Api.addVariable("{orearea-time-use}", loadPlugin3Failure);Api.addVariable("{orearea-time-reset}", loadPlugin3Failure);
Api.addVariable("{orearea-name}", loadPlugin3Failure);
}
}

String loadPlugin4 = "RsTask";
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin4) != null) {
//存在
Api.registerVariables("RsTaskVariable", RsTaskVariable.class);
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin4 + loadSuccessMsg2);
} else {
//不存在
String loadPlugin4Failure = loadFailureMsg1 + loadPlugin4 + loadFailureMsg2;
Server.getInstance().getLogger().info(loadPlugin4Failure);
Api.addVariable("{task-name}", loadPlugin4Failure);Api.addVariable("{task-count}", loadPlugin4Failure);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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<PlayerTask> 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() + "");
}
}
6 changes: 5 additions & 1 deletion src/main/resources/SupportPluginsVariables.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ O
{orearea-name} 获取玩家所在的矿区等级
P
playerPoints
{point} 获取玩家的点券数量
{point} 获取玩家的点券数量
R
RsTask
{task-name} 正在进行中的任务 (显示第一个)
{task-count} 玩家任务积分

0 comments on commit e9b1812

Please sign in to comment.