测试版
This commit is contained in:
parent
acab27f283
commit
1c6c59b9a0
|
@ -46,9 +46,9 @@ public class LevelExpansion extends PlaceholderExpansion {
|
||||||
public String onPlaceholderRequest(Player player, String indentifier) {
|
public String onPlaceholderRequest(Player player, String indentifier) {
|
||||||
if (indentifier.equalsIgnoreCase("expbl")) {
|
if (indentifier.equalsIgnoreCase("expbl")) {
|
||||||
if(Main.serverManage.getExpMultiplicity() <= 1.0){
|
if(Main.serverManage.getExpMultiplicity() <= 1.0){
|
||||||
return "0.00%";
|
return "0.00";
|
||||||
}
|
}
|
||||||
return (Main.serverManage.getExpMultiplicity() * 100)+"%";
|
return (Main.serverManage.getExpMultiplicity() * 100)+"";
|
||||||
}else if (indentifier.equalsIgnoreCase("level")) {
|
}else if (indentifier.equalsIgnoreCase("level")) {
|
||||||
return ""+DLevelAPI.getPlayerLevel(player);
|
return ""+DLevelAPI.getPlayerLevel(player);
|
||||||
}else if(indentifier.equalsIgnoreCase("exp")){
|
}else if(indentifier.equalsIgnoreCase("exp")){
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package me.Demon.DemonLevels;
|
package me.Demon.DemonLevels;
|
||||||
|
|
||||||
|
import me.Demon.DemonLevels.command.MainCmd;
|
||||||
import me.Demon.DemonLevels.listener.MobDeath;
|
import me.Demon.DemonLevels.listener.MobDeath;
|
||||||
import me.Demon.DemonLevels.listener.JoinEvent;
|
import me.Demon.DemonLevels.listener.JoinEvent;
|
||||||
import me.Demon.DemonLevels.listener.UpgradePrompt;
|
import me.Demon.DemonLevels.listener.UpgradePrompt;
|
||||||
|
@ -27,9 +28,10 @@ public class Main extends JavaPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
DemonAPI.sendConsoleMessage("§f[§6!§f] §aAuRechargeData ("+plugin.getServer().getVersion()+") §f开始加载");
|
DemonAPI.sendConsoleMessage("§f[§6!§f] §aDemonLevels ("+plugin.getServer().getVersion()+") §f开始加载");
|
||||||
loadConfigData();
|
loadConfigData();
|
||||||
serverManage = new ServerManage(getConfig());
|
serverManage = new ServerManage(getConfig());
|
||||||
|
getCommand("dlevel").setExecutor(new MainCmd());
|
||||||
getServer().getPluginManager().registerEvents(new MobDeath(),this);
|
getServer().getPluginManager().registerEvents(new MobDeath(),this);
|
||||||
getServer().getPluginManager().registerEvents(new JoinEvent(),this);
|
getServer().getPluginManager().registerEvents(new JoinEvent(),this);
|
||||||
getServer().getPluginManager().registerEvents(new UpgradePrompt(),this);
|
getServer().getPluginManager().registerEvents(new UpgradePrompt(),this);
|
||||||
|
|
|
@ -2,12 +2,11 @@ package me.Demon.DemonLevels.api;
|
||||||
|
|
||||||
import com.yaohun.playermanage.PlayerManage;
|
import com.yaohun.playermanage.PlayerManage;
|
||||||
import me.Demon.DemonLevels.Main;
|
import me.Demon.DemonLevels.Main;
|
||||||
import me.Demon.DemonLevels.data.ChangExpEvant;
|
|
||||||
import me.Demon.DemonLevels.data.PlayerData;
|
import me.Demon.DemonLevels.data.PlayerData;
|
||||||
|
import me.Demon.DemonLevels.event.ChangExpEvant;
|
||||||
import me.Demon.DemonLevels.event.UpLevelEvant;
|
import me.Demon.DemonLevels.event.UpLevelEvant;
|
||||||
import me.Demon.DemonLevels.listener.MobDeath;
|
import me.Demon.DemonLevels.listener.MobDeath;
|
||||||
import me.Demon.DemonLevels.util.ScriptEngineAPI;
|
import me.Demon.DemonLevels.util.ScriptEngineAPI;
|
||||||
import me.Demon.DemonPlugin.DemonAPI;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
@ -84,7 +83,6 @@ public abstract class DLevelAPI {
|
||||||
if(level >= levelKey) {
|
if(level >= levelKey) {
|
||||||
String expFormat = list.get(i).getKey();
|
String expFormat = list.get(i).getKey();
|
||||||
expFormat = expFormat.replace("%level%", String.valueOf(level));
|
expFormat = expFormat.replace("%level%", String.valueOf(level));
|
||||||
System.out.println("[调试 - 等级] 所需经验等级公式: "+expFormat);
|
|
||||||
return ScriptEngineAPI.getExpFormat(expFormat);
|
return ScriptEngineAPI.getExpFormat(expFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +138,7 @@ public abstract class DLevelAPI {
|
||||||
playerData.setTotalExp(playerData.getTotalExp().add(addExp)); // 增加玩家总经验
|
playerData.setTotalExp(playerData.getTotalExp().add(addExp)); // 增加玩家总经验
|
||||||
int level = playerData.getLevel(); // 获取玩家当前等级
|
int level = playerData.getLevel(); // 获取玩家当前等级
|
||||||
BigInteger needExp = DLevelAPI.getLevelNeedExp(level); // 获取玩家升级所需经验
|
BigInteger needExp = DLevelAPI.getLevelNeedExp(level); // 获取玩家升级所需经验
|
||||||
playerData.setExp(playerData.getExp().add(addExp)); // 增加玩家当前经验
|
addExp = playerData.getExp().add(addExp); // 增加玩家当前经验
|
||||||
// 循环检查是否有足够的经验来升级
|
// 循环检查是否有足够的经验来升级
|
||||||
while (addExp.compareTo(needExp) >= 0) {
|
while (addExp.compareTo(needExp) >= 0) {
|
||||||
// 检查level是否小于0,如果是则退出循环
|
// 检查level是否小于0,如果是则退出循环
|
||||||
|
@ -275,4 +273,8 @@ public abstract class DLevelAPI {
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 2L);
|
}.runTaskLater(Main.plugin, 2L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getRankTitle(int level){
|
||||||
|
return Main.configYml.getRankTitle(level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.yaohun.playermanage.PlayerManage;
|
||||||
import me.Demon.DemonLevels.Main;
|
import me.Demon.DemonLevels.Main;
|
||||||
import me.Demon.DemonLevels.api.DLevelAPI;
|
import me.Demon.DemonLevels.api.DLevelAPI;
|
||||||
import me.Demon.DemonLevels.data.PlayerData;
|
import me.Demon.DemonLevels.data.PlayerData;
|
||||||
|
import me.Demon.DemonLevels.manage.ServerManage;
|
||||||
import me.Demon.DemonLevels.util.GameUtil;
|
import me.Demon.DemonLevels.util.GameUtil;
|
||||||
import me.Demon.DemonPlugin.DemonAPI;
|
import me.Demon.DemonPlugin.DemonAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -40,82 +41,32 @@ public class MainCmd implements CommandExecutor , TabCompleter {
|
||||||
sender.sendMessage("§r");
|
sender.sendMessage("§r");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(args.length == 3){
|
if(args.length == 1 && args[0].equalsIgnoreCase("reload")){
|
||||||
String name = args[1];
|
Main.plugin.reloadLoadData();
|
||||||
String uuid = PlayerManage.getNameToUuid(name);
|
DemonAPI.sendMessage(sender,"配置文件均已重新载入.");
|
||||||
if(uuid.equalsIgnoreCase("无数据")){
|
|
||||||
DemonAPI.sendMessage(sender,"未查询到该玩家的UUID.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Player player = Bukkit.getPlayer(name);
|
|
||||||
int value = GameUtil.convertInt(args[2]);
|
|
||||||
if(value <= 1){
|
|
||||||
DemonAPI.sendMessage(sender,"操作数值最低不得 §d低于1");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(player == null) {
|
|
||||||
DemonAPI.sendMessage(sender,"目标玩家不在线.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(args[0].equalsIgnoreCase("give")){
|
|
||||||
DLevelAPI.addExp(player,value);
|
|
||||||
DemonAPI.sendMessage(sender,"给予 §6"+name+" §a经验: §d+"+value);
|
|
||||||
}else if(args[0].equalsIgnoreCase("take")){
|
|
||||||
DLevelAPI.takeExp(player,value);
|
|
||||||
DemonAPI.sendMessage(sender,"扣除 §6"+name+" §a经验: §d-"+value);
|
|
||||||
}else if(args[0].equalsIgnoreCase("setlevel")){
|
|
||||||
DLevelAPI.setPlayerLevel(player,value);
|
|
||||||
DemonAPI.sendMessage(sender,"设置 §6"+name+" §a等级: §dLv."+value);
|
|
||||||
}else if(args[0].equalsIgnoreCase("settotal")){
|
|
||||||
BigInteger bigInteger = new BigInteger(args[2]);
|
|
||||||
DLevelAPI.setTotalExp(player,bigInteger);
|
|
||||||
DemonAPI.sendMessage(sender,"设置 §6"+name+" §a总经验: §d"+value);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(args.length == 2 && args[0].equalsIgnoreCase("look")){
|
if(args.length == 1 && args[0].equalsIgnoreCase("save")){
|
||||||
String playerName = args[1];
|
ServerManage serverManage = Main.serverManage;
|
||||||
String uuid = PlayerManage.getNameToUuid(playerName);
|
for (String uuid : serverManage.getDataHashMap().keySet()){
|
||||||
if(uuid.equalsIgnoreCase("无数据")){
|
serverManage.getDataHashMap().get(uuid).savePlayerData();
|
||||||
DemonAPI.sendMessage(sender,"未查询到该玩家的UUID.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Player player = Bukkit.getPlayer(playerName);
|
|
||||||
if(player == null) {
|
|
||||||
PlayerData data = new PlayerData(uuid);
|
|
||||||
DemonAPI.sendMessage(sender,"玩家 §e"+playerName+" §a的等级信息:");
|
|
||||||
int playerLevel = data.getLevel();
|
|
||||||
sender.sendMessage("§f- §a等级: §dLv."+playerLevel);
|
|
||||||
sender.sendMessage("§f- §a经验: §d"+data.getExp().toString()+"§a/§d"+ DLevelAPI.getLevelNeedExp(playerLevel));
|
|
||||||
sender.sendMessage("§f- §a等级: §dLv."+data.getTotalExp().toString());
|
|
||||||
}else{
|
|
||||||
PlayerData data = Main.serverManage.getPlayerData(uuid);
|
|
||||||
DemonAPI.sendMessage(sender,"玩家 §e"+playerName+" §a的等级信息:");
|
|
||||||
int playerLevel = data.getLevel();
|
|
||||||
sender.sendMessage("§f- §a等级: §dLv."+playerLevel);
|
|
||||||
sender.sendMessage("§f- §a经验: §d"+data.getExp().toString()+"§a/§d"+ DLevelAPI.getLevelNeedExp(playerLevel));
|
|
||||||
sender.sendMessage("§f- §a等级: §dLv."+data.getTotalExp().toString());
|
|
||||||
}
|
}
|
||||||
|
DemonAPI.sendMessage(sender,"玩家数据已保存.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(args[0].equalsIgnoreCase("dexp")){
|
if(args[0].equalsIgnoreCase("dexp")){
|
||||||
if(args.length >= 2){
|
if(args.length >= 2){
|
||||||
double doubleExp = GameUtil.convertDouble(args[1]);
|
double doubleExp = GameUtil.convertDouble(args[1]);
|
||||||
long defaultTime = 7 * 24 * 60 * 60 * 1000L; // 默认开启经验倍率时间7天
|
long defaultTime = 7 * 24 * 60 * 60 * 1000L; // 默认开启经验倍率时间7天
|
||||||
if(args.length == 3){
|
if(args.length >= 3){
|
||||||
defaultTime = GameUtil.convertInt(args[2]) * 60 * 60 * 1000L;
|
defaultTime = GameUtil.convertInt(args[2]) * 60 * 60 * 1000L;
|
||||||
}
|
}
|
||||||
long expMultipleTime = System.currentTimeMillis() + defaultTime; // 本次经验倍率持续时间
|
long expMultipleTime = System.currentTimeMillis() + defaultTime; // 本次经验倍率持续时间
|
||||||
if(doubleExp >= 1.1) {
|
if(doubleExp >= 1.1) {
|
||||||
// 将时间戳转换为 LocalDateTime
|
Main.serverManage.setExpMultiplicity(doubleExp,expMultipleTime);
|
||||||
LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(expMultipleTime), ZoneId.systemDefault());
|
|
||||||
// 定义日期时间格式化模式
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM月dd日HH时mm分");
|
|
||||||
// 格式化日期时间
|
|
||||||
String formattedDate = dateTime.format(formatter);
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
DemonAPI.sendMessage(p, "当前经验获取倍率为: §e§l"+doubleExp*100+"%");
|
DemonAPI.sendMessage(p, "当前经验获取倍率为: §e§l"+doubleExp*100+"%");
|
||||||
p.sendTitle("§d§l"+doubleExp*100+"%","§f持续时间: §a"+formattedDate);
|
p.sendTitle("§d§l"+doubleExp*100+"%","§f持续时间: §a"+GameUtil.formatTime(defaultTime));
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +89,60 @@ public class MainCmd implements CommandExecutor , TabCompleter {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(args.length == 3){
|
||||||
|
String name = args[1];
|
||||||
|
String uuid = PlayerManage.getNameToUuid(name);
|
||||||
|
if(uuid.equalsIgnoreCase("无数据")){
|
||||||
|
DemonAPI.sendMessage(sender,"未查询到该玩家的UUID.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Player player = Bukkit.getPlayer(name);
|
||||||
|
int value = GameUtil.convertInt(args[2]);
|
||||||
|
if(player == null) {
|
||||||
|
DemonAPI.sendMessage(sender,"目标玩家不在线.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(args[0].equalsIgnoreCase("give")){
|
||||||
|
DLevelAPI.addExp(player,value);
|
||||||
|
DemonAPI.sendMessage(sender,"给予 §6"+name+" §a经验: §d+"+value);
|
||||||
|
}else if(args[0].equalsIgnoreCase("take")){
|
||||||
|
DLevelAPI.takeExp(player,value);
|
||||||
|
DemonAPI.sendMessage(sender,"扣除 §6"+name+" §a经验: §d-"+value);
|
||||||
|
}else if(args[0].equalsIgnoreCase("setlevel")){
|
||||||
|
DLevelAPI.setPlayerLevel(player,value);
|
||||||
|
DemonAPI.sendMessage(sender,"设置 §6"+name+" §a等级: §dLv."+value);
|
||||||
|
}else if(args[0].equalsIgnoreCase("settotal")){
|
||||||
|
BigInteger bigInteger = new BigInteger(args[2]);
|
||||||
|
DLevelAPI.setTotalExp(player,bigInteger);
|
||||||
|
DemonAPI.sendMessage(sender,"设置 §6"+name+" §a总经验: §d"+bigInteger.toString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(args.length == 2 && args[0].equalsIgnoreCase("look")){
|
||||||
|
String playerName = args[1];
|
||||||
|
String uuid = PlayerManage.getNameToUuid(playerName);
|
||||||
|
if(uuid.equalsIgnoreCase("无数据")){
|
||||||
|
DemonAPI.sendMessage(sender,"未查询到该玩家的UUID.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Player player = Bukkit.getPlayer(playerName);
|
||||||
|
if(player == null) {
|
||||||
|
PlayerData data = new PlayerData(uuid);
|
||||||
|
DemonAPI.sendMessage(sender,"玩家 §e"+playerName+" §a的等级信息:");
|
||||||
|
int playerLevel = data.getLevel();
|
||||||
|
sender.sendMessage("§f- §a等级: §dLv."+playerLevel);
|
||||||
|
sender.sendMessage("§f- §a经验: §d"+data.getExp().toString()+"§a/§d"+ DLevelAPI.getLevelNeedExp(playerLevel));
|
||||||
|
sender.sendMessage("§f- §a等级: §d"+data.getTotalExp().toString());
|
||||||
|
}else{
|
||||||
|
PlayerData data = Main.serverManage.getPlayerData(uuid);
|
||||||
|
DemonAPI.sendMessage(sender,"玩家 §e"+playerName+" §a的等级信息:");
|
||||||
|
int playerLevel = data.getLevel();
|
||||||
|
sender.sendMessage("§f- §a等级: §dLv."+playerLevel);
|
||||||
|
sender.sendMessage("§f- §a经验: §d"+data.getExp().toString()+"§a/§d"+ DLevelAPI.getLevelNeedExp(playerLevel));
|
||||||
|
sender.sendMessage("§f- §a等级: §d"+data.getTotalExp().toString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,9 +154,12 @@ public class MainCmd implements CommandExecutor , TabCompleter {
|
||||||
completions.add("look");
|
completions.add("look");
|
||||||
completions.add("give");
|
completions.add("give");
|
||||||
completions.add("take");
|
completions.add("take");
|
||||||
completions.add("set");
|
completions.add("setlevel");
|
||||||
completions.add("settotal");
|
completions.add("settotal");
|
||||||
completions.add("kmob");
|
completions.add("kmob");
|
||||||
|
}else if(args.length == 2){
|
||||||
|
String[] onlinePlayers = Bukkit.getOnlinePlayers().stream().map(HumanEntity::getName).toArray(String[]::new);
|
||||||
|
completions.addAll(Arrays.asList(onlinePlayers));
|
||||||
}else if(args.length == 3){
|
}else if(args.length == 3){
|
||||||
completions.add("单位小时");
|
completions.add("单位小时");
|
||||||
completions.add("经验");
|
completions.add("经验");
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
package me.Demon.DemonLevels.data;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
public class ChangExpEvant extends Event {
|
|
||||||
|
|
||||||
private static HandlerList handlers = new HandlerList();
|
|
||||||
private final Player player;
|
|
||||||
private final int exp;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
public ChangExpEvant(Player player, int exp) {
|
|
||||||
this.player = player;
|
|
||||||
this.exp = exp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getExp() {
|
|
||||||
return exp;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -90,10 +90,26 @@ public class PlayerData {
|
||||||
if(player != null) {
|
if(player != null) {
|
||||||
System.out.println("[日志 - 等级] 玩家 " + player.getName() + " 已创建档案数据.");
|
System.out.println("[日志 - 等级] 玩家 " + player.getName() + " 已创建档案数据.");
|
||||||
yml.set("name",player.getName());
|
yml.set("name",player.getName());
|
||||||
|
// 判断玩家之前是否存在等级数据
|
||||||
|
FileConfiguration config = Main.plugin.getConfig();
|
||||||
|
String str = "levelstats."+player.getName()+".";
|
||||||
|
if(config.getInt(str+"level") >= 1){
|
||||||
|
int dlevel = config.getInt(str+"level");
|
||||||
|
int exp = config.getInt(str+"exp");
|
||||||
|
int totalExp = config.getInt(str+"totalExp");
|
||||||
|
yml.set("level", dlevel);
|
||||||
|
yml.set("exp", exp);
|
||||||
|
yml.set("totalExp", totalExp);
|
||||||
|
}else{
|
||||||
|
yml.set("level", 1);
|
||||||
|
yml.set("exp", 0);
|
||||||
|
yml.set("totalExp", 1);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
yml.set("level", 1);
|
||||||
|
yml.set("exp", 0);
|
||||||
|
yml.set("totalExp", 1);
|
||||||
}
|
}
|
||||||
yml.set("level",1);
|
|
||||||
yml.set("exp",0);
|
|
||||||
yml.set("totalExp",1);
|
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.fileConfiguration = yml;
|
this.fileConfiguration = yml;
|
||||||
saveFile();
|
saveFile();
|
||||||
|
|
|
@ -39,8 +39,9 @@ public class MobDeath implements Listener {
|
||||||
// 获取服务器当前经验倍率
|
// 获取服务器当前经验倍率
|
||||||
double serverDouble = Main.serverManage.getExpMultiplicity();
|
double serverDouble = Main.serverManage.getExpMultiplicity();
|
||||||
// 检测服务器经验倍率时间是否关闭
|
// 检测服务器经验倍率时间是否关闭
|
||||||
if(Main.serverManage.isExpMultipleTime()){
|
if(serverDouble >= 1.1 && Main.serverManage.isExpMultipleTime()){
|
||||||
Main.serverManage.setExpMultiplicity(1.0);
|
Main.serverManage.setExpMultiplicity(1.0,System.currentTimeMillis());
|
||||||
|
System.out.println("[调试 - 等级] 经验倍率已恢复默认1.0");
|
||||||
serverDouble = 1.0;
|
serverDouble = 1.0;
|
||||||
for (Player p :Bukkit.getOnlinePlayers()) {
|
for (Player p :Bukkit.getOnlinePlayers()) {
|
||||||
DemonAPI.sendMessage(p,"经验倍率加成已结束!已经恢复默认倍率。");
|
DemonAPI.sendMessage(p,"经验倍率加成已结束!已经恢复默认倍率。");
|
||||||
|
@ -62,7 +63,7 @@ public class MobDeath implements Listener {
|
||||||
int exp = (int) (mobsManage.getExp() * serverDouble * att_expAddition);
|
int exp = (int) (mobsManage.getExp() * serverDouble * att_expAddition);
|
||||||
// 假设serverDouble = 2.0 att_expAddition = 1.50;
|
// 假设serverDouble = 2.0 att_expAddition = 1.50;
|
||||||
// 则结果将会是 2.0 + 1.5 = 3.5 但实际上是 1.0 + 0.5 = 1.5
|
// 则结果将会是 2.0 + 1.5 = 3.5 但实际上是 1.0 + 0.5 = 1.5
|
||||||
double magnificationDisplay = (serverDouble + att_expAddition) - 2; // 获取玩家当前倍率
|
double magnificationDisplay = (serverDouble + (att_expAddition - 1)); // 获取玩家当前倍率
|
||||||
// 判断玩家是否在队伍之中
|
// 判断玩家是否在队伍之中
|
||||||
boolean isTeamExit = false;
|
boolean isTeamExit = false;
|
||||||
Map<TeamData, Double> teamMap = new HashMap<>();
|
Map<TeamData, Double> teamMap = new HashMap<>();
|
||||||
|
@ -153,7 +154,8 @@ public class MobDeath implements Listener {
|
||||||
|
|
||||||
public static void experienceGainTips(Player p,int exp,int magnificationDisplayString){
|
public static void experienceGainTips(Player p,int exp,int magnificationDisplayString){
|
||||||
String playName = "§8§l[ §b"+p.getName()+" §8§l]";
|
String playName = "§8§l[ §b"+p.getName()+" §8§l]";
|
||||||
String nowexp = "§8§l[ §e§lLv."+111+" §c§l"+111+"§f§l/§a§l"+111+" §8§l]";
|
PlayerData playerData = Main.serverManage.getPlayerData(p.getUniqueId().toString());
|
||||||
|
String nowexp = "§8§l[ §e§lLv."+playerData.getLevel()+" §c§l"+playerData.getExp().toString()+"§f§l/§a§l"+DLevelAPI.getLevelNeedExp(playerData.getLevel()).toString()+" §8§l]";
|
||||||
String addExp = "§8§l[ §d§l+" + exp + " §8§l]";
|
String addExp = "§8§l[ §d§l+" + exp + " §8§l]";
|
||||||
if(magnificationDisplayString >= 1){
|
if(magnificationDisplayString >= 1){
|
||||||
addExp = "§8§l[ §d§l++" + exp + "++ §8§l]";
|
addExp = "§8§l[ §d§l++" + exp + "++ §8§l]";
|
||||||
|
|
|
@ -24,7 +24,11 @@ public class ServerManage {
|
||||||
if(expMultipleTime <= 0){
|
if(expMultipleTime <= 0){
|
||||||
expMultipleTime = System.currentTimeMillis() + (1000 * 60);
|
expMultipleTime = System.currentTimeMillis() + (1000 * 60);
|
||||||
}
|
}
|
||||||
expMultiplicity = yml.getDouble("DoubleExp",1.0);
|
DemonAPI.sendConsoleMessage("§f[§a!§f] §f倍率持续时间 §8> §6"+DemonAPI.LongToStringData(expMultipleTime,"yyyy年MM月dd日"));
|
||||||
|
expMultiplicity = yml.getDouble("DoubleExp");
|
||||||
|
if(expMultiplicity <= 0){
|
||||||
|
expMultiplicity = 1.0;
|
||||||
|
}
|
||||||
DemonAPI.sendConsoleMessage("§f[§a!§f] §f全服经验倍率 §8> §6"+(expMultiplicity*100)+"%");
|
DemonAPI.sendConsoleMessage("§f[§a!§f] §f全服经验倍率 §8> §6"+(expMultiplicity*100)+"%");
|
||||||
if(Bukkit.getPluginManager().getPlugin("DemonVipSystem") != null){
|
if(Bukkit.getPluginManager().getPlugin("DemonVipSystem") != null){
|
||||||
LinkDemonVipSystem = true;
|
LinkDemonVipSystem = true;
|
||||||
|
@ -47,7 +51,8 @@ public class ServerManage {
|
||||||
return expMultiplicity;
|
return expMultiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExpMultiplicity(double expMultiplicity) {
|
public void setExpMultiplicity(double expMultiplicity,long expMultipleTime) {
|
||||||
|
this.expMultipleTime = expMultipleTime;
|
||||||
this.expMultiplicity = expMultiplicity;
|
this.expMultiplicity = expMultiplicity;
|
||||||
FileConfiguration yml = Main.plugin.getConfig();
|
FileConfiguration yml = Main.plugin.getConfig();
|
||||||
yml.set("ExpMultipleTime",this.expMultipleTime);
|
yml.set("ExpMultipleTime",this.expMultipleTime);
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package me.Demon.DemonLevels.util;
|
package me.Demon.DemonLevels.util;
|
||||||
|
|
||||||
|
import me.Demon.DemonLevels.Main;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class GameUtil {
|
public abstract class GameUtil {
|
||||||
|
|
||||||
public static int convertInt(String string){
|
public static int convertInt(String string){
|
||||||
|
@ -17,4 +27,23 @@ public abstract class GameUtil {
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatTime(long millis) {
|
||||||
|
// 转换毫秒为秒
|
||||||
|
long seconds = millis / 1000;
|
||||||
|
|
||||||
|
// 计算天、小时和分钟
|
||||||
|
long days = seconds / (24 * 3600);
|
||||||
|
long hours = (seconds % (24 * 3600)) / 3600;
|
||||||
|
long minutes = (seconds % 3600) / 60;
|
||||||
|
|
||||||
|
// 判断时间长度的范围,并格式化输出
|
||||||
|
if (days > 0) {
|
||||||
|
return String.format("%d天%d小时", days, hours);
|
||||||
|
} else if (hours > 0) {
|
||||||
|
return String.format("%d小时%d分钟", hours, minutes);
|
||||||
|
} else {
|
||||||
|
return String.format("%d分钟", minutes);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
CustonName:
|
CustonName:
|
||||||
105: "§9§l极§d§l限§c§l斗§e§l神"
|
105: "§9§l极§d§l限§c§l斗§e§l神"
|
||||||
100: "§9§l极§d§l限§c§l斗§e§l神"
|
100: "§9§l极§d§l限§c§l斗§e§l魂"
|
||||||
90: "§c封号斗魂"
|
90: "§c封号斗魂"
|
||||||
80: "§6魂斗者"
|
80: "§6魂斗罗"
|
||||||
70: "§d灵圣"
|
70: "§d魂圣"
|
||||||
60: "§e灵帝"
|
60: "§e魂帝"
|
||||||
50: "§c灵王"
|
50: "§c魂王"
|
||||||
40: "§6灵宗"
|
40: "§6魂宗"
|
||||||
30: "§5灵尊"
|
30: "§5魂尊"
|
||||||
20: "§3大灵师"
|
20: "§3大魂师"
|
||||||
10: "§2器师"
|
10: "§2魂师"
|
||||||
0: "§7器士"
|
0: "§7魂士"
|
||||||
NeelUpExp:
|
NeelUpExp:
|
||||||
0: "%level% * 100"
|
1: "%level% * 100"
|
||||||
5: "%level% * 200"
|
5: "%level% * 200"
|
||||||
10: "%level% * 400"
|
10: "%level% * 400"
|
||||||
15: "%level% * 800"
|
15: "%level% * 800"
|
||||||
20: "%level% * 1000"
|
20: "%level% * 1000"
|
||||||
25: "%level% * 1500"
|
25: "%level% * 1500"
|
||||||
30: "%level% * 5000"
|
30: "%level% * 2500"
|
||||||
35: "%level% * 6500"
|
35: "%level% * 4500"
|
||||||
40: "%level% * 8000"
|
40: "%level% * 6000"
|
||||||
45: "%level% * 10000"
|
45: "%level% * 7000"
|
||||||
50: "%level% * 12000"
|
50: "%level% * 8000"
|
||||||
55: "%level% * 14000"
|
55: "%level% * 10000"
|
||||||
60: "%level% * 15000"
|
60: "%level% * 12000"
|
||||||
65: "%level% * 20000"
|
65: "%level% * 16000"
|
||||||
70: "%level% * 25000"
|
70: "%level% * 20000"
|
||||||
75: "%level% * 100000"
|
75: "%level% * 400000"
|
||||||
80: "%level% * 200000"
|
80: "%level% * 100000"
|
||||||
85: "%level% * 400000"
|
85: "%level% * 200000"
|
||||||
90: "%level% * 600000"
|
90: "%level% * 400000"
|
||||||
95: "%level% * 1200000"
|
95: "%level% * 1000000"
|
||||||
100: "%level% * 3000000"
|
100: "%level% * 3000000"
|
||||||
105: "%level% * 5000000"
|
105: "%level% * 5000000"
|
||||||
110: "%level% * 8000000"
|
110: "%level% * 8000000"
|
||||||
|
@ -81,7 +81,6 @@ MobKillExp:
|
||||||
星斗森林_10000翠魔鸟: 800~1500
|
星斗森林_10000翠魔鸟: 800~1500
|
||||||
星斗森林_10000化蛇: 800~1500
|
星斗森林_10000化蛇: 800~1500
|
||||||
星斗森林_10000青影狮鹫: 800~1500
|
星斗森林_10000青影狮鹫: 800~1500
|
||||||
经验猪: 2500~5000
|
|
||||||
极寒冰域_1000炽眼猪妖: 500~800
|
极寒冰域_1000炽眼猪妖: 500~800
|
||||||
极寒冰域_1000三足金乌: 500~800
|
极寒冰域_1000三足金乌: 500~800
|
||||||
极寒冰域_1000极寒九婴: 500~800
|
极寒冰域_1000极寒九婴: 500~800
|
||||||
|
@ -97,20 +96,50 @@ MobKillExp:
|
||||||
冰火两仪眼_10000暗黑邪神虎: 1200~1800
|
冰火两仪眼_10000暗黑邪神虎: 1200~1800
|
||||||
冰火两仪眼_10000冰碧蝎: 1200~1800
|
冰火两仪眼_10000冰碧蝎: 1200~1800
|
||||||
冰火两仪眼_10000翠魔鸟: 1200~1800
|
冰火两仪眼_10000翠魔鸟: 1200~1800
|
||||||
冰火两仪眼_奇茸通天菊: 100~800
|
冰火两仪眼_奇茸通天菊: 1000~1800
|
||||||
冰火两仪眼_八瓣仙兰: 100~800
|
冰火两仪眼_八瓣仙兰: 1000~1800
|
||||||
冰火两仪眼_相思断肠红: 100~800
|
冰火两仪眼_相思断肠红: 1000~1800
|
||||||
冰火两仪眼_水仙玉肌骨: 100~800
|
冰火两仪眼_水仙玉肌骨: 1000~1800
|
||||||
杀戮都市_风灵狼: 3000~5000
|
冰火两仪眼_烈火杏娇疏: 1000~1800
|
||||||
杀戮都市_鬼藤: 3000~5000
|
杀戮都市_风灵狼: 1800~2500
|
||||||
杀戮都市_疾风魔狼: 3000~5000
|
杀戮都市_鬼藤: 1800~2500
|
||||||
杀戮都市_曼陀罗蛇: 3000~5000
|
杀戮都市_疾风魔狼: 1800~2500
|
||||||
杀戮都市_粉红娘娘: 3000~5000
|
杀戮都市_曼陀罗蛇: 1800~2500
|
||||||
杀戮都市_冰蚕: 3000~5000
|
杀戮都市_粉红娘娘: 1800~2500
|
||||||
杀戮都市_鬼虎: 3000~5000c
|
杀戮都市_冰蚕: 1800~2500
|
||||||
杀戮都市_四眼鳞甲兽: 3000~5000
|
杀戮都市_鬼虎: 1800~2500
|
||||||
杀戮都市_魔暝鹿: 3000~5000
|
杀戮都市_四眼鳞甲兽: 1800~2500
|
||||||
杀戮都市_杀戮暴徒: 5000~7000
|
杀戮都市_魔暝鹿: 1800~2500
|
||||||
杀戮都市_堕落暴徒: 4000~6000
|
杀戮都市_杀戮暴徒: 2000~2500
|
||||||
武魂殿_巡逻魂师: 6000~9000
|
杀戮都市_堕落暴徒: 2000~2500
|
||||||
武魂殿_魂师喽啰: 7000~10000
|
武魂殿魂师_守卫魂师: 2000~3000
|
||||||
|
武魂殿魂师_巡逻魂师: 2250~3000
|
||||||
|
武魂殿魂师_殿堂魂师: 2500~3000
|
||||||
|
武魂殿魂师_精英魂师: 3000~4000
|
||||||
|
封神一考_魂兽: 3000~4000
|
||||||
|
封神二考_魂兽: 3000~4000
|
||||||
|
封神三考_魂兽: 3000~4000
|
||||||
|
封神一考_考官: 5000~10000
|
||||||
|
封神二考_考官: 5000~10000
|
||||||
|
封神三考_考官: 5000~10000
|
||||||
|
封神四考_魂兽: 3500~4500
|
||||||
|
封神五考_魂兽: 3500~4500
|
||||||
|
封神六考_魂兽: 3500~4500
|
||||||
|
封神七考_魂兽: 4000~5000
|
||||||
|
封神八考_魂兽: 4000~5000
|
||||||
|
封神九考_魂兽: 4000~5000
|
||||||
|
封神四考_考官: 5000~10000
|
||||||
|
封神五考_考官: 5000~10000
|
||||||
|
封神六考_考官: 5000~10000
|
||||||
|
封神七考_考官: 5000~10000
|
||||||
|
封神八考_考官: 5000~10000
|
||||||
|
天使神域_圣殿护卫: 7000~10000
|
||||||
|
天使神域_天翼圣卫: 7000~10000
|
||||||
|
天使神域_星辰守卫: 8000~11000
|
||||||
|
天使神域_银羽神卫: 8000~11000
|
||||||
|
神域灵兽_御金玲龙: 6000~9000
|
||||||
|
神域灵兽_神御玲龙: 6000~9000
|
||||||
|
经验灵兽_1: 1000~2500
|
||||||
|
经验灵兽_2: 2500~3500
|
||||||
|
活动魂兽1: 1000~2500
|
||||||
|
活动魂兽2: 2500~3500
|
||||||
|
|
4
src/main/resources/config.yml
Normal file
4
src/main/resources/config.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# 多倍经验
|
||||||
|
DoubleExp: 1.0
|
||||||
|
# 多倍经验持续时间
|
||||||
|
ExpMultipleTime: -1
|
|
@ -1,6 +1,6 @@
|
||||||
name: DemonLevels
|
name: DemonLevels
|
||||||
main: me.Demon.DemonLevels.Main
|
main: me.Demon.DemonLevels.Main
|
||||||
version: 1.4.3
|
version: 2.1.6
|
||||||
depend: [DemonTeam]
|
depend: [DemonTeam]
|
||||||
commands:
|
commands:
|
||||||
dlevel:
|
dlevel:
|
Loading…
Reference in New Issue
Block a user