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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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