-
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.
将部分插件的变量放在一起避免过于分散
- Loading branch information
Showing
8 changed files
with
145 additions
and
199 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
128 changes: 128 additions & 0 deletions
128
...main/java/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/SmallasWaterPlugins.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,128 @@ | ||
package cn.stevei5mc.NewTipsVariables.variables.supportPlugins; | ||
|
||
import tip.utils.Api; | ||
import cn.nukkit.Server; | ||
import cn.nukkit.Player; | ||
import cn.stevei5mc.NewTipsVariables.Main; | ||
import tip.utils.variables.BaseVariable; | ||
import cn.stevei5mc.NewTipsVariables.variables.supportPlugins.loadSupportPlugins; | ||
import healthapi.PlayerHealth; | ||
import net.player.api.Point; | ||
import com.task.utils.tasks.PlayerFile; | ||
import com.task.utils.tasks.taskitems.PlayerTask; | ||
import java.util.LinkedList; | ||
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 SmallasWaterPlugins extends BaseVariable { | ||
public SmallasWaterPlugins(Player player) { | ||
super(player); | ||
} | ||
|
||
public void strReplace() { | ||
ruoShuiPlugins(); | ||
} | ||
|
||
public void ruoShuiPlugins() { | ||
String loadPlugin; | ||
boolean debug = Main.deBug; | ||
String loadSMsg = loadSupportPlugins.loadSuccessMsg; | ||
String loadFMsg = loadSupportPlugins.loadFailureMsg; | ||
//需要加载的变量的插件 | ||
loadPlugin = "playerPoints"; | ||
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) { | ||
//存在 | ||
addStrReplaceString("{point}", String.format("%.2f", Point.myPoint(player))); | ||
if (debug) {Main.getInstance().getLogger().info(loadSMsg.replace("{0}",loadPlugin));} | ||
} else { | ||
if (debug) {Main.getInstance().getLogger().info(loadFMsg.replace("{0}",loadPlugin));} | ||
} | ||
loadPlugin = "OreArea"; | ||
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) { | ||
//这个代码的是复制TipsVeriable的 | ||
PlayerClass playerClass = PlayerClass.getPlayerClass(player.getName()); | ||
addStrReplaceString("{orearea-level-this}", playerClass.getMaxAreaLevel() + ""); | ||
addStrReplaceString("{orearea-level-next}", playerClass.getMaxAreaLevel() + 1 + ""); | ||
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{ | ||
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); | ||
if (debug) {Main.getInstance().getLogger().info(loadSMsg.replace("{0}",loadPlugin));} | ||
} else { | ||
if (debug) {Main.getInstance().getLogger().info(loadFMsg.replace("{0}",loadPlugin));} | ||
} | ||
loadPlugin = "RSTask"; | ||
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) { | ||
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() + ""); | ||
if (debug) {Main.getInstance().getLogger().info(loadSMsg.replace("{0}",loadPlugin));} | ||
} else { | ||
if (debug) {Main.getInstance().getLogger().info(loadFMsg.replace("{0}",loadPlugin));} | ||
} | ||
loadPlugin = "HealthAPI"; | ||
if (Server.getInstance().getPluginManager().getPlugin(loadPlugin) != null) { | ||
PlayerHealth health = PlayerHealth.getPlayerHealth(player); | ||
addStrReplaceString("{h}", String.format("%.1f", health.getHealth())); | ||
addStrReplaceString("{mh}", health.getMaxHealth() + ""); | ||
addStrReplaceString("{hb}", String.format("%.2f", health.getHealthPercentage() * 100.0D)); | ||
if (debug) {Main.getInstance().getLogger().info(loadSMsg.replace("{0}",loadPlugin));} | ||
} else { | ||
if (debug) {Main.getInstance().getLogger().info(loadFMsg.replace("{0}",loadPlugin));} | ||
} | ||
} | ||
} |
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
22 changes: 0 additions & 22 deletions
22
...n/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/HealthAPIVariable.java
This file was deleted.
Oops, something went wrong.
78 changes: 0 additions & 78 deletions
78
.../cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/OreAreaVariable.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...a/cn/stevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/RsTaskVariable.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...tevei5mc/NewTipsVariables/variables/supportPlugins/smallasWater/playerPointsVariable.java
This file was deleted.
Oops, something went wrong.