-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from stevei5mc/dev
Dev 1.0.0-beta3
- Loading branch information
Showing
22 changed files
with
423 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
[返回](README.md) | ||
# NewTipsVariables(变量文档) | ||
> **支持的插件篇** | ||
> **按插件的英文字母排序** | ||
> **TipsVeriable 相关变量移值中,部分变量名有改动** | ||
## A | ||
--- | ||
## B | ||
--- | ||
## C | ||
--- | ||
## D | ||
--- | ||
## **E** | ||
### **[EconomyAPI](https://github.com/Nukkit-coders/EconomyAPI)** | ||
|变量名|变量介绍| | ||
|-|-| | ||
|{economyApi-money}|玩家金钱数量| | ||
--- | ||
## F | ||
--- | ||
## G | ||
--- | ||
## H | ||
--- | ||
## I | ||
--- | ||
## J | ||
--- | ||
## K | ||
--- | ||
## L | ||
--- | ||
## M | ||
--- | ||
## N | ||
--- | ||
## **O** | ||
### **[OreArea](https://github.com/SmallasWater/OreArea)** | ||
**注意: 变量`{orearea-time-use}`在有限时的矿区会有BUG(到秒就不动了)** | ||
|变量名|变量介绍| | ||
|-|-| | ||
|{orearea-level-this}|获取玩家的矿区等级| | ||
|{orearea-level-next}|获取玩家的矿区下一等级| | ||
|{orearea-time-use}|获取玩家所在的矿区可以使用的时间| | ||
|{orearea-time-reset}|获取玩家所在的刷新时间| | ||
|{orearea-name}|获取玩家所在的矿区等级| | ||
--- | ||
## **P** | ||
### **[playerPoints](https://github.com/SmallasWater/PlayerPoints)** | ||
|变量名|变量介绍| | ||
|-|-| | ||
|{point}|获取玩家的点券数量| | ||
--- | ||
## Q | ||
--- | ||
## R | ||
### **[RsTask](https://github.com/MemoriesOfTime/RSTask)** | ||
|变量名|变量介绍| | ||
|-|-| | ||
|{task-name}|正在进行中的任务 (显示第一个)| | ||
|{task-count}|玩家任务积分| | ||
--- | ||
## S | ||
--- | ||
## T | ||
--- | ||
## U | ||
--- | ||
## V | ||
--- | ||
## W | ||
--- | ||
## X | ||
--- | ||
## Y | ||
--- | ||
## Z | ||
--- |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/economyApiVariable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cn.stevei5mc.NewTipsVariables.variables.supportPlugins; | ||
|
||
import cn.nukkit.Player; | ||
import tip.utils.variables.BaseVariable; | ||
import me.onebone.economyapi.EconomyAPI; | ||
|
||
public class economyApiVariable extends BaseVariable { | ||
public economyApiVariable(Player player) { | ||
super(player); | ||
} | ||
|
||
public void strReplace() { | ||
economyApi(); | ||
} | ||
|
||
public void economyApi() { | ||
addStrReplaceString("{economyApi-money}", String.format("%.2f", EconomyAPI.getInstance().myMoney(player))); //这个代码的是复制TipsVeriable的 | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/loadSupportPlugins.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package cn.stevei5mc.NewTipsVariables.variables.supportPlugins; | ||
|
||
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; | ||
|
||
public class loadSupportPlugins { | ||
|
||
public static void loadSupportVariables(Player player) { | ||
//加载相关插件的变量时的提示 | ||
String loadSuccessMsg1 = "§a找到插件§e【§b"; | ||
String loadSuccessMsg2 = "§e】§a相关变量已加载"; | ||
String loadFailureMsg1 = "§c无法找到插件§e【§b"; | ||
String loadFailureMsg2 = "§e】§c相关变量加载失败,请安装相关插件再试"; | ||
//需要加载的变量的插件 | ||
|
||
String loadPlugin1 = "playerPoints"; | ||
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin1) != null) { | ||
//存在 | ||
Api.registerVariables("playerPointsVariable", playerPointsVariable.class); | ||
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin1 + loadSuccessMsg2); | ||
} else { | ||
//不存在 | ||
Server.getInstance().getLogger().info(loadFailureMsg1 + loadPlugin1 + loadFailureMsg2); | ||
} | ||
|
||
String loadPlugin2 = "EconomyAPI"; | ||
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin2) != 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) { | ||
//存在 | ||
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) { | ||
//存在 | ||
Api.registerVariables("RsTaskVariable", RsTaskVariable.class); | ||
Server.getInstance().getLogger().info(loadSuccessMsg1 + loadPlugin4 + loadSuccessMsg2); | ||
} else { | ||
//不存在 | ||
Server.getInstance().getLogger().info(loadFailureMsg1 + loadPlugin4 + loadFailureMsg2); | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
.../cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/OreAreaVariable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
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<String,Integer> 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); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...a/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RsTaskVariable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() + ""); | ||
} | ||
} |
Oops, something went wrong.