世界BOSS

This commit is contained in:
yaohunya 2024-08-02 12:11:31 +08:00
parent e22728ab08
commit e0ccdfc871
7 changed files with 56 additions and 40 deletions

View File

@ -37,7 +37,7 @@ public class BossSpawnerCmd implements CommandExecutor , TabCompleter {
sender.sendMessage("§r");
return true;
}
if(args.length == 1){
if(args.length >= 1 && sender.isOp()){
BossManage bossManage = Main.bossManage;
if(bossManage.isBossSurvive()){
Bukkit.getConsoleSender().sendMessage("[日志-世界Boss] 系统尝试多次执行召唤boss已被拦截.");
@ -45,16 +45,19 @@ public class BossSpawnerCmd implements CommandExecutor , TabCompleter {
}
BossDamageByPlayer.damageMap.clear(); // 清理之前的伤害数据缓存
boolean antiSpawn = false;
if(args.length == 1) {
String stats_type = BossSpawnUtil.getTheCurrentServerPlayerStatus();
if(stats_type.equalsIgnoreCase("NoPlayer")){
if (stats_type.equalsIgnoreCase("NoPlayer")) {
Bukkit.broadcastMessage("§6[§4公告§6] §a世界BOSS召唤失败,在线器师人数过低无法挑战.");
return true;
antiSpawn = true;
}
if(stats_type.equalsIgnoreCase("NoLevel")){
if (stats_type.equalsIgnoreCase("NoLevel")) {
Bukkit.broadcastMessage("§6[§4公告§6] §a世界BOSS召唤失败,在线器师无一人达到90级封号斗魂.");
return true;
antiSpawn = true;
}
if(stats_type.equalsIgnoreCase("Start")) {
}
if(!antiSpawn){
String bossKey = args[0];
BossData bossData = bossManage.getBossData(bossKey);
if(bossData != null){

View File

@ -43,8 +43,14 @@ public class BossDamageByPlayer implements Listener {
Bukkit.getConsoleSender().sendMessage("[世界boss-日志] 因 "+customName+" §r离开团队副本,此Boss已清理.");
return;
}
UUID Mob_uuid = e.getEntity().getUniqueId();
if(!BossSpawnLogs.WhiteBossList.contains(Mob_uuid)){
boolean isBossName = false;
for (String bossName : BossSpawnLogs.WhiteBossList){
if(customName.contains(bossName)){
isBossName = true;
break;
}
}
if(!isBossName){
e.getEntity().remove();
Bukkit.broadcastMessage("§6[§4公告§6] §a"+customName+"§a被卷入了异次元时空.");
return;

View File

@ -18,13 +18,15 @@ public class BossDeathEvent implements Listener {
RewardData rewardData = e.getRewardData();
LinkedHashMap<String, Double> hashMap = e.getSortedMap();
int rank = 1;
for (String name : hashMap.keySet()){
if(rank >= 6){break;}
for (String name : hashMap.keySet()) {
if (rank >= 6) {
break;
}
List<String> rankRewardList = rewardData.getTopCmdList(rank);
if(rankRewardList.size() >= 1){
if (rankRewardList.size() >= 1) {
Player onlinePlayer = Bukkit.getPlayer(name);
if(onlinePlayer != null && onlinePlayer.isOnline()){
DemonAPI.ConsoleOutCommandList(onlinePlayer,rankRewardList);
if (onlinePlayer != null && onlinePlayer.isOnline()) {
DemonAPI.ConsoleOutCommandList(onlinePlayer, rankRewardList);
}
}
rank++;

View File

@ -30,7 +30,7 @@ public class BossKillsDeath implements Listener {
BossManage bossManage = Main.bossManage;
String customName = entity.getCustomName();
if(customName != null && bossManage.isCustomNameContains(customName)){
BossData bossData = bossManage.getBossData(customName);
BossData bossData = bossManage.getNameToData(customName);
if(bossData == null){return;}
String worldName = entity.getWorld().getName();
if (!worldName.equalsIgnoreCase("teamDungee")) {
@ -39,21 +39,22 @@ public class BossKillsDeath implements Listener {
Bukkit.broadcastMessage(message.replace("%mobs%",bossData.getBossName())); // 发送最终击杀提示
BossUtil.addMonthlyKillBoss(player.getName()); // 为玩家累积最终斩杀次数
String Kills_Group_Key = bossData.getKillsReward(); // 获取击杀奖励组名
RewardData rewardData = Main.rewardManage.getRewardData(Kills_Group_Key);
RewardData killsRewardData = Main.rewardManage.getRewardData(Kills_Group_Key);
// 执行命令并发放奖励
if(bossData.getKillsReward() != null){
if (!Kills_Group_Key.equalsIgnoreCase("魂环")) {
List<String> commands = rewardData.getKillsCmdList();
List<String> commands = killsRewardData.getKillsCmdList();
DemonAPI.ConsoleOutCommandList(player, commands);
}else{
sendRingRewards(player,bossData,rewardData);
sendRingRewards(player,bossData,killsRewardData);
}
}
new BukkitRunnable() {
public void run() {
statisticalSettlementOfDamages(bossData,rewardData);
statisticalSettlementOfDamages(bossData,Main.rewardManage.getRewardData(bossData.getTopReward()));
cancel();
}
}.runTaskLater(Main.plugin, 10L);
}.runTaskLater(Main.plugin, 20L);
}
}
}
@ -99,14 +100,18 @@ public class BossKillsDeath implements Listener {
}
Bukkit.broadcastMessage("§c§M §6§m §e§m §a§m §b§m §C§L▍ §c§l伤§6§l害§E§L统§A§l计§B§L表 §C§l▍§b§M §a§M §e§M §6§m §c§m §r");
for (Player player : playerList){
if(BossDamageByPlayer.damageMap.get(player) != null) {
double damage = BossDamageByPlayer.damageMap.get(player); // 获取玩家造成伤害
player.sendMessage("§e您造成的总伤害: §c" + new DecimalFormat(",###.00").format(damage) + "k §e伤害占总比: §c" + new DecimalFormat("0.00").format(damage / totalDamage * 100) + "%");
if(rewardData != null) {
// 判断玩家造成伤害是否达到100K并发放奖励
if(damage >= 100){
if (damage >= 10) {
List<String> damageRewardList = rewardData.getDamageCmdList();
DemonAPI.ConsoleOutCommandList(player,damageRewardList);
}else{
DemonAPI.sendMessage(player,"你造成的总伤害不足§4100,000§a无法获得参与奖。");
DemonAPI.ConsoleOutCommandList(player, damageRewardList);
} else {
DemonAPI.sendMessage(player, "你造成的总伤害不足§4100,000§a无法获得参与奖。");
}
}
}
}
WorldBossDeathEvent worldBossDeathEvent = new WorldBossDeathEvent(bossData,rewardData,sortedMap);

View File

@ -12,12 +12,8 @@ public class BossSpawnUtil {
if(online_size <= 0){
return "NoPlayer";
}
// 在线人数大于15人 可召唤
if (online_size > 15) {
return "Start";
}
// 在线人数小于5人 但有90级玩家 可召唤
if (online_size < 15) {
// 在线人数小于15人 但有90级玩家 可召唤
if (online_size <= 14) {
for (Player p : Bukkit.getOnlinePlayers()){
double level = DLevelAPI.getOffPlayer_Level(p.getName());
Bukkit.getConsoleSender().sendMessage("[世界BOSS-输出日志] 玩家 "+p.getName()+" 等级: "+level+" 需求等级: 90级");
@ -26,6 +22,10 @@ public class BossSpawnUtil {
}
}
}
// 在线人数大于15人 可召唤
if (online_size >= 15) {
return "Start";
}
return "NoLevel";
}
}

View File

@ -35,8 +35,8 @@ public class BossUtil {
* */
public static String getTimeMonthly(){
FileConfiguration yml = Main.plugin.getConfig();
if(yml.getString("Timemonth") != null){
return yml.getString("Timemonth");
if(yml.getString("TimeMonth") != null){
return yml.getString("TimeMonth");
}
return "2022/04";
}

View File

@ -1,6 +1,6 @@
name: WorldBossHurt
main: com.io.yaohun.worldbosshurt.Main
version: 1.0.0
version: 1.0.2
commands:
bosspz:
bossreload: