2.2.2
This commit is contained in:
parent
c10baf11b6
commit
a8626e4eb9
BIN
lib/DemonVipSystem.jar
Normal file
BIN
lib/DemonVipSystem.jar
Normal file
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
package me.Demon.DemonLevels;
|
package me.Demon.DemonLevels;
|
||||||
|
|
||||||
import me.Demon.DemonLevels.api.DLevelAPI;
|
import me.Demon.DemonLevels.api.DLevelAPI;
|
||||||
|
import me.Demon.DemonLevels.manage.ServerManage;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@ -44,7 +45,9 @@ public class LevelExpansion extends PlaceholderExpansion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onPlaceholderRequest(Player player, String indentifier) {
|
public String onPlaceholderRequest(Player player, String indentifier) {
|
||||||
if (indentifier.equalsIgnoreCase("expbl")) {
|
if (indentifier.equalsIgnoreCase("prefix")) {
|
||||||
|
return DLevelAPI.getRankTitle(player.getLevel());
|
||||||
|
}else if (indentifier.equalsIgnoreCase("expbl")) {
|
||||||
if(Main.serverManage.getExpMultiplicity() <= 1.0){
|
if(Main.serverManage.getExpMultiplicity() <= 1.0){
|
||||||
return "0.00";
|
return "0.00";
|
||||||
}
|
}
|
||||||
|
@ -96,6 +99,9 @@ public class LevelExpansion extends PlaceholderExpansion {
|
||||||
}
|
}
|
||||||
// 如果剩余经验小于 1,000,000,直接格式化为 "x.xxx"
|
// 如果剩余经验小于 1,000,000,直接格式化为 "x.xxx"
|
||||||
return new DecimalFormat(",###.##").format(remainingExp);
|
return new DecimalFormat(",###.##").format(remainingExp);
|
||||||
|
}else if(indentifier.equalsIgnoreCase("dexp")){
|
||||||
|
ServerManage serverManage = Main.serverManage;
|
||||||
|
return String.format("%.1f", serverManage.getExpMultiplicity() * 100)+"%";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class Main extends JavaPlugin {
|
||||||
}
|
}
|
||||||
DemonAPI.sendConsoleMessage("§f[§6!§f] §aDemonLevels §f加载完成,祝你使用愉快!");
|
DemonAPI.sendConsoleMessage("§f[§6!§f] §aDemonLevels §f加载完成,祝你使用愉快!");
|
||||||
DemonAPI.sendConsoleMessage("§f[§6!§f] §b极光像素工作室出品");
|
DemonAPI.sendConsoleMessage("§f[§6!§f] §b极光像素工作室出品");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ 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.manage.ServerManage;
|
||||||
import me.Demon.DemonLevels.util.GameUtil;
|
import me.Demon.DemonLevels.util.ConvertUtil;
|
||||||
import me.Demon.DemonPlugin.DemonAPI;
|
import me.Demon.DemonPlugin.DemonAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
@ -14,8 +14,6 @@ import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.time.*;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -56,17 +54,17 @@ public class MainCmd implements CommandExecutor , TabCompleter {
|
||||||
}
|
}
|
||||||
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 = ConvertUtil.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 = ConvertUtil.convertInt(args[2]) * 60 * 60 * 1000L;
|
||||||
}
|
}
|
||||||
long expMultipleTime = System.currentTimeMillis() + defaultTime; // 本次经验倍率持续时间
|
long expMultipleTime = System.currentTimeMillis() + defaultTime; // 本次经验倍率持续时间
|
||||||
if(doubleExp >= 1.1) {
|
if(doubleExp >= 1.1) {
|
||||||
Main.serverManage.setExpMultiplicity(doubleExp,expMultipleTime);
|
Main.serverManage.setExpMultiplicity(doubleExp,expMultipleTime);
|
||||||
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"+GameUtil.formatTime(defaultTime));
|
p.sendTitle("§d§l"+doubleExp*100+"%","§f持续时间: §a"+ ConvertUtil.formatTime(defaultTime));
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,10 +74,10 @@ public class MainCmd implements CommandExecutor , TabCompleter {
|
||||||
if(args[0].equalsIgnoreCase("kmob")){
|
if(args[0].equalsIgnoreCase("kmob")){
|
||||||
if(args.length >= 3){
|
if(args.length >= 3){
|
||||||
String mobKey = args[1];
|
String mobKey = args[1];
|
||||||
int min = GameUtil.convertInt(args[2]);
|
int min = ConvertUtil.convertInt(args[2]);
|
||||||
int max = min;
|
int max = min;
|
||||||
if(args.length == 4){
|
if(args.length == 4){
|
||||||
max = GameUtil.convertInt(args[3]);
|
max = ConvertUtil.convertInt(args[3]);
|
||||||
Main.configYml.setKillsExp(mobKey,min,max);
|
Main.configYml.setKillsExp(mobKey,min,max);
|
||||||
DemonAPI.sendMessage(sender,"成功设置 §6"+mobKey+" §a经验掉落为: §d"+min+"§a~§d"+max);
|
DemonAPI.sendMessage(sender,"成功设置 §6"+mobKey+" §a经验掉落为: §d"+min+"§a~§d"+max);
|
||||||
}else{
|
}else{
|
||||||
|
@ -97,7 +95,7 @@ public class MainCmd implements CommandExecutor , TabCompleter {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getPlayer(name);
|
Player player = Bukkit.getPlayer(name);
|
||||||
int value = GameUtil.convertInt(args[2]);
|
int value = ConvertUtil.convertInt(args[2]);
|
||||||
if(args[0].equalsIgnoreCase("give")){
|
if(args[0].equalsIgnoreCase("give")){
|
||||||
if(player == null) {
|
if(player == null) {
|
||||||
DemonAPI.sendMessage(sender,"目标玩家不在线.");
|
DemonAPI.sendMessage(sender,"目标玩家不在线.");
|
||||||
|
|
|
@ -27,7 +27,6 @@ public class PlayerData {
|
||||||
this.exp = new BigInteger(expString);
|
this.exp = new BigInteger(expString);
|
||||||
String totalExpString = fileConfiguration.getString("totalExp");
|
String totalExpString = fileConfiguration.getString("totalExp");
|
||||||
this.totalExp = new BigInteger(totalExpString);
|
this.totalExp = new BigInteger(totalExpString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUuid() {
|
public String getUuid() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class JoinEvent implements Listener {
|
||||||
DLevelAPI.setTotalExp(p,bigInteger);
|
DLevelAPI.setTotalExp(p,bigInteger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin,100L);
|
}.runTaskLater(Main.plugin,40L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package me.Demon.DemonLevels.manage;
|
package me.Demon.DemonLevels.manage;
|
||||||
|
|
||||||
import me.Demon.DemonLevels.Main;
|
import me.Demon.DemonLevels.Main;
|
||||||
import me.Demon.DemonLevels.util.GameUtil;
|
import me.Demon.DemonLevels.util.ConvertUtil;
|
||||||
import me.Demon.DemonLevels.util.RandomUtil;
|
import me.Demon.DemonLevels.util.RandomUtil;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@ public class MobsManage {
|
||||||
String expString = yml.getString("MobKillExp."+mmKey);
|
String expString = yml.getString("MobKillExp."+mmKey);
|
||||||
if(expString.contains("~")){
|
if(expString.contains("~")){
|
||||||
String[] strings = expString.split("~");
|
String[] strings = expString.split("~");
|
||||||
minExp = GameUtil.convertInt(strings[0]);
|
minExp = ConvertUtil.convertInt(strings[0]);
|
||||||
maxExp = GameUtil.convertInt(strings[1]);
|
maxExp = ConvertUtil.convertInt(strings[1]);
|
||||||
randomModel = true;
|
randomModel = true;
|
||||||
}else{
|
}else{
|
||||||
minExp = GameUtil.convertInt(expString);
|
minExp = ConvertUtil.convertInt(expString);
|
||||||
maxExp = GameUtil.convertInt(expString);
|
maxExp = ConvertUtil.convertInt(expString);
|
||||||
}
|
}
|
||||||
if(Main.Debug){
|
if(Main.Debug){
|
||||||
System.out.println("[调试 - 等级] MM生物: "+mmKey+" Min: "+this.minExp+" Max: "+this.maxExp);
|
System.out.println("[调试 - 等级] MM生物: "+mmKey+" Min: "+this.minExp+" Max: "+this.maxExp);
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
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 static int convertInt(String string){
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(string);
|
|
||||||
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double convertDouble(String string){
|
|
||||||
try {
|
|
||||||
return Double.parseDouble(string);
|
|
||||||
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user