diff --git a/pom.xml b/pom.xml index 3ca214f..83e2161 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,11 @@ DemonLevels 1.0.0 + + me.Demon.DemonHunHuanSx + DemonHunHuanSx + 1.12.2 + com.vexview.api vexview diff --git a/src/main/java/com/io/yaohun/worldbosshurt/Main.java b/src/main/java/com/io/yaohun/worldbosshurt/Main.java index 906ef59..bb2baed 100644 --- a/src/main/java/com/io/yaohun/worldbosshurt/Main.java +++ b/src/main/java/com/io/yaohun/worldbosshurt/Main.java @@ -1,16 +1,18 @@ package com.io.yaohun.worldbosshurt; -import com.io.yaohun.worldbosshurt.listener.BossArmor; -import com.io.yaohun.worldbosshurt.listener.BossDamageByPlayer; -import com.io.yaohun.worldbosshurt.listener.BossKillsDeath; -import com.io.yaohun.worldbosshurt.listener.BossSpawnLogs; +import com.io.yaohun.worldbosshurt.command.BossSpawnerCmd; +import com.io.yaohun.worldbosshurt.listener.*; import com.io.yaohun.worldbosshurt.mangage.BossManage; import com.io.yaohun.worldbosshurt.mangage.RewardManage; +import com.io.yaohun.worldbosshurt.util.BossStack; import me.Demon.DemonPlugin.DemonAPI; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import java.io.File; @@ -25,10 +27,13 @@ public class Main extends JavaPlugin { public void onEnable() { plugin = this; reloadMobDataYml(); + getCommand("bossspawner").setExecutor(new BossSpawnerCmd()); getServer().getPluginManager().registerEvents(new BossSpawnLogs(),this); getServer().getPluginManager().registerEvents(new BossArmor(),this); getServer().getPluginManager().registerEvents(new BossDamageByPlayer(),this); getServer().getPluginManager().registerEvents(new BossKillsDeath(),this); + getServer().getPluginManager().registerEvents(new BossDeathEvent(),this); + getServer().getPluginManager().registerEvents(new BossProveEvent(),this); Bukkit.getConsoleSender().sendMessage("§b[BossHurt] §f插件成功载入Server!"); Bukkit.getConsoleSender().sendMessage("§b[BossHurt] §f妖魂QQ:1763917516"); } @@ -46,8 +51,41 @@ public class Main extends JavaPlugin { DemonAPI.sendMessage(sender,"配置文件已重载."); return true; } - if(Command.equalsIgnoreCase("bosspz")){ - + if(Command.equalsIgnoreCase("bosspz")){ // /bosspz + if(args.length >= 2 && args[0].equalsIgnoreCase("give") && sender.isOp()){ + String bossName = args[1]; + if(args.length == 2) { + Player player = (Player) sender; + ItemStack pingzheng = BossStack.BossSlashProof(bossName).clone(); + DemonAPI.giveItem(player,pingzheng); + DemonAPI.sendMessage(player,"恭喜你获得了 "+pingzheng.getItemMeta().getDisplayName()); + } + if(args.length == 3) { + String playName = args[2]; + Player player = Bukkit.getPlayer(playName); + if (player == null) { + DemonAPI.sendMessage(sender, "目标玩家不在线无法发送凭证。"); + return true; + } + ItemStack pingzheng = BossStack.BossSlashProof(bossName).clone(); + DemonAPI.giveItem(player,pingzheng); + DemonAPI.sendMessage(player,"恭喜你获得了 "+pingzheng.getItemMeta().getDisplayName()); + } + return true; + } + if(args.length == 2 && args[0].equalsIgnoreCase("tpall") && sender.isOp()){ + Player p = (Player) sender; + for (Entity entity : p.getWorld().getEntities()){ + if(entity.getCustomName() != null) { + String customName = entity.getCustomName().replaceAll("§[a-zA-Z0-9]", ""); + if (customName.contains(args[1])) { + entity.teleport(p.getLocation()); + } + } + } + sender.sendMessage("操作执行成功.#"+args[1]); + return true; + } } return false; } diff --git a/src/main/java/com/io/yaohun/worldbosshurt/event/WorldBossDeathEvent.java b/src/main/java/com/io/yaohun/worldbosshurt/event/WorldBossDeathEvent.java index 47a2826..bb8e069 100644 --- a/src/main/java/com/io/yaohun/worldbosshurt/event/WorldBossDeathEvent.java +++ b/src/main/java/com/io/yaohun/worldbosshurt/event/WorldBossDeathEvent.java @@ -1,13 +1,18 @@ package com.io.yaohun.worldbosshurt.event; import com.io.yaohun.worldbosshurt.data.BossData; +import com.io.yaohun.worldbosshurt.data.RewardData; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import java.util.LinkedHashMap; + public class WorldBossDeathEvent extends Event { private static HandlerList handlers = new HandlerList(); private BossData bossData; + private RewardData rewardData; + private LinkedHashMap sortedMap; @Override public HandlerList getHandlers() { @@ -16,8 +21,10 @@ public class WorldBossDeathEvent extends Event { public static HandlerList getHandlerList() { return handlers; } - public WorldBossDeathEvent(BossData bossData) { + public WorldBossDeathEvent(BossData bossData,RewardData rewardData,LinkedHashMap sortedMap) { this.bossData = bossData; + this.rewardData = rewardData; + this.sortedMap = sortedMap; } public String getBossKey(){ @@ -27,4 +34,14 @@ public class WorldBossDeathEvent extends Event { public String getMobName() { return bossData.getBossName(); } + public BossData getBossData() { + return bossData; + } + + public RewardData getRewardData() { + return rewardData; + } + public LinkedHashMap getSortedMap() { + return sortedMap; + } } diff --git a/src/main/java/com/io/yaohun/worldbosshurt/listener/BossDeathEvent.java b/src/main/java/com/io/yaohun/worldbosshurt/listener/BossDeathEvent.java new file mode 100644 index 0000000..b4acedc --- /dev/null +++ b/src/main/java/com/io/yaohun/worldbosshurt/listener/BossDeathEvent.java @@ -0,0 +1,33 @@ +package com.io.yaohun.worldbosshurt.listener; + +import com.io.yaohun.worldbosshurt.data.RewardData; +import com.io.yaohun.worldbosshurt.event.WorldBossDeathEvent; +import me.Demon.DemonPlugin.DemonAPI; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import java.util.LinkedHashMap; +import java.util.List; + +public class BossDeathEvent implements Listener { + + @EventHandler + public void onBossDeath(WorldBossDeathEvent e){ + RewardData rewardData = e.getRewardData(); + LinkedHashMap hashMap = e.getSortedMap(); + int rank = 1; + for (String name : hashMap.keySet()){ + if(rank >= 6){break;} + List rankRewardList = rewardData.getTopCmdList(rank); + if(rankRewardList.size() >= 1){ + Player onlinePlayer = Bukkit.getPlayer(name); + if(onlinePlayer != null && onlinePlayer.isOnline()){ + DemonAPI.ConsoleOutCommandList(onlinePlayer,rankRewardList); + } + } + rank++; + } + } +} diff --git a/src/main/java/com/io/yaohun/worldbosshurt/listener/BossKillsDeath.java b/src/main/java/com/io/yaohun/worldbosshurt/listener/BossKillsDeath.java index ab04463..affc4a1 100644 --- a/src/main/java/com/io/yaohun/worldbosshurt/listener/BossKillsDeath.java +++ b/src/main/java/com/io/yaohun/worldbosshurt/listener/BossKillsDeath.java @@ -1,6 +1,148 @@ package com.io.yaohun.worldbosshurt.listener; +import com.io.yaohun.worldbosshurt.Main; +import com.io.yaohun.worldbosshurt.data.BossData; +import com.io.yaohun.worldbosshurt.data.RewardData; +import com.io.yaohun.worldbosshurt.event.WorldBossDeathEvent; +import com.io.yaohun.worldbosshurt.mangage.BossManage; +import com.io.yaohun.worldbosshurt.util.BossStack; +import com.io.yaohun.worldbosshurt.util.BossUtil; +import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicMobDeathEvent; +import me.Demon.DemonPlugin.DemonAPI; +import org.bukkit.Bukkit; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.scheduler.BukkitRunnable; + +import java.text.DecimalFormat; +import java.util.*; +import java.util.stream.Collectors; public class BossKillsDeath implements Listener { + + @EventHandler + public void onkilldrop(MythicMobDeathEvent e){ + if(e.getKiller() instanceof Player) { // 判断斩杀者是玩家 + Entity entity = e.getEntity(); + BossManage bossManage = Main.bossManage; + String customName = entity.getCustomName(); + if(customName != null && bossManage.isCustomNameContains(customName)){ + BossData bossData = bossManage.getBossData(customName); + if(bossData == null){return;} + String worldName = entity.getWorld().getName(); + if (!worldName.equalsIgnoreCase("teamDungee")) { + Player player = ((Player) e.getKiller()).getPlayer(); + String message = BossUtil.getFinallyKills().replace("%p%", player.getName()); // 获取最终击杀提示 + 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); + // 执行命令并发放奖励 + if(bossData.getKillsReward() != null){ + if (!Kills_Group_Key.equalsIgnoreCase("魂环")) { + List commands = rewardData.getKillsCmdList(); + DemonAPI.ConsoleOutCommandList(player, commands); + }else{ + sendRingRewards(player,bossData,rewardData); + } + } + new BukkitRunnable() { + public void run() { + statisticalSettlementOfDamages(bossData,rewardData); + } + }.runTaskLater(Main.plugin, 10L); + } + } + } + } + + /* + * 将对boss造成伤害的存进Hash + * 并进行排序随后发送全服公告 + * */ + public static void statisticalSettlementOfDamages(BossData bossData,RewardData rewardData) { + double totalDamage = 0; // 获取本次造成总伤害 + HashMap hashMap = new HashMap<>(); + Map damageMap = BossDamageByPlayer.damageMap; + List playerList = new ArrayList<>(); + for (Player player : damageMap.keySet()) { + if (player != null && player.isOnline()) { + double damage = damageMap.get(player); // 获取该玩家造成伤害 + totalDamage += damage; // 统计玩家造成总计伤害 + hashMap.put(player.getName(), damage); // 将玩家名和伤害存储 + playerList.add(player); // 将玩家存入在线玩家列表 + } + } + if (hashMap.size() < 1) { return; } + LinkedHashMap sortedMap = hashMap.entrySet() + .stream() + .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (e1, e2) -> e1, + LinkedHashMap::new + )); + 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("§e世界级Boss: "+bossData.getBossName()+" §e伤害排名如下:"); + int rank = 1; + for (String top_Name : sortedMap.keySet()){ + if(rank == 6){break;} + double damage = sortedMap.get(top_Name); + Bukkit.broadcastMessage("§e第" + rank + "名 - §c" + top_Name + " §e总计伤害: §c" + new DecimalFormat("00.00").format(damage) + "k §e伤害占总比: §c" + new DecimalFormat("0.00").format(damage / totalDamage * 100) + "%"); + rank++; + } + 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){ + 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) + "%"); + // 判断玩家造成伤害是否达到100K并发放奖励 + if(damage >= 100){ + List damageRewardList = rewardData.getDamageCmdList(); + DemonAPI.ConsoleOutCommandList(player,damageRewardList); + }else{ + DemonAPI.sendMessage(player,"你造成的总伤害不足§4100,000§a无法获得参与奖。"); + } + } + WorldBossDeathEvent worldBossDeathEvent = new WorldBossDeathEvent(bossData,rewardData,sortedMap); + Bukkit.getPluginManager().callEvent(worldBossDeathEvent); + } + + public void sendRingRewards(Player player,BossData bossData,RewardData rewardData) { + String name = player.getName(); + if(DemonAPI.getRandomInt(100,1) >= 10){ + DemonAPI.sendMessage(player,"很遗憾,这只灵兽的最终一击并未掉落任何奖励。"); + }else{ + String bossKey = bossData.getBossKey(); + if (DemonAPI.getRandomInt(100,1) >= 2) { + if (DemonAPI.getRandomInt(100, 1) > 10) { + player.getInventory().addItem(BossStack.BossSlashProof(bossKey)); + Bukkit.broadcastMessage("§6[§4公告§6] §e"+name+" §a通过最终一击获得了 §c§l猎杀凭证 §f("+bossKey+")"); + } else { + if(rewardData.getRewardKey().contains("百万年")){ + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mythicmobs items give " + name + " 百万年" + bossKey + "灵环无献祭"); + DemonAPI.sendMessage(player,"恭喜你获得了 §6§l百万年灵环 §f(" + bossKey + ")"); + Bukkit.broadcastMessage("§6[§4公告§6] §e" + name + " §a通过最终一击获得了 §6§l百万年灵环 §f(" + bossKey + ")"); + } else { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mythicmobs items give " + name + " 十万年" + bossKey + "灵环无献祭"); + DemonAPI.sendMessage(player,"恭喜你获得了 §c§l十万年灵环 §f(" + bossKey + ")"); + Bukkit.broadcastMessage("§6[§4公告§6] §e" + name + " §a通过最终一击获得了 §c§l十万年灵环 §f(" + bossKey + ")"); + } + } + } else { + if(rewardData.getRewardKey().contains("百万年")){ + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mythicmobs items give " + name + " 百万年" + bossKey + "灵环"); + DemonAPI.sendMessage(player,"恭喜你获得了 §6§l百万年灵环 §f(" + bossKey + ")§d[含献祭]"); + Bukkit.broadcastMessage("§6[§4公告§6] §e" + name + " §a通过最终一击获得了 §6§l百万年灵环 §f(" + bossKey + ")§d[含献祭]"); + }else { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mythicmobs items give " + name + " 十万年" + bossKey + "灵环"); + DemonAPI.sendMessage(player,"恭喜你获得了 §c§l十万年灵环 §f(" + bossKey + ")§d[含献祭]"); + Bukkit.broadcastMessage("§6[§4公告§6] §e" + name + " §a通过最终一击获得了 §c§l十万年灵环 §f(" + bossKey + ")§d[含献祭]"); + } + } + } + } + } diff --git a/src/main/java/com/io/yaohun/worldbosshurt/listener/BossProveEvent.java b/src/main/java/com/io/yaohun/worldbosshurt/listener/BossProveEvent.java new file mode 100644 index 0000000..9b45307 --- /dev/null +++ b/src/main/java/com/io/yaohun/worldbosshurt/listener/BossProveEvent.java @@ -0,0 +1,164 @@ +package com.io.yaohun.worldbosshurt.listener; + +import com.io.yaohun.worldbosshurt.util.BossStack; +import me.Demon.DemonHunHuanSX.HunHuanAPI; +import me.Demon.DemonHunHuanSX.Main; +import me.Demon.DemonPlugin.DemonAPI; +import me.Demon.ItemKuAPI; +import net.minecraft.server.v1_12_R1.NBTTagCompound; +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.List; + +public class BossProveEvent implements Listener { + + public static String invTitle = "斗魂偙国 - 十万年凭证兑换"; + /* + * 交换兑换十万年魂环 + * */ + @EventHandler + public void onclick(InventoryClickEvent e){ + int rawSlot = e.getRawSlot(); + Player p = (Player) e.getWhoClicked(); + Inventory inv = e.getInventory(); + ItemStack item = e.getCurrentItem(); + if(inv != null && invTitle.equalsIgnoreCase(inv.getTitle())){ + e.setCancelled(true); + if(!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)){ + p.playSound(p.getLocation(),Sound.BLOCK_COMPARATOR_CLICK,1.6F,1.8F); + NBTTagCompound nbt = BossStack.getNBT(item); + if(nbt.hasKey("hhkey")){ + String hhkey = nbt.getString("hhkey"); + p.closeInventory(); // 关闭界面 + ItemStack needStack = BossStack.BossSlashProof(hhkey); + if(!DemonAPI.isPlayerItemsLore(p,needStack,8)){ + DemonAPI.sendMessage(p,"兑换失败,缺少该十万年灵兽的猎杀凭证。",Sound.ENTITY_VILLAGER_NO); + return; + } + ItemStack laborStack = ItemKuAPI.getItems("劳动者结晶",1); + if(!DemonAPI.isPlayerItemsLore(p,laborStack,2)){ + DemonAPI.sendMessage(p,"兑换失败,缺少劳动者结晶。",Sound.ENTITY_VILLAGER_NO); + return; + } + DemonAPI.removePlayerItemsLore(p,needStack,8); // 扣除凭证 + DemonAPI.removePlayerItemsLore(p,laborStack,2); // 扣除劳动者结晶 + ItemStack hh_item = HunHuanAPI.getHHItems("十万年_"+hhkey+"灵环"); + p.getInventory().addItem(hh_item); + p.sendMessage(Main.prefix+"兑换成功,你获得了 "+hh_item.getItemMeta().getDisplayName()); + return; + } + if(nbt.hasKey("hhkeypro")){ + String hhkey = nbt.getString("hhkeypro"); + p.closeInventory(); // 关闭界面 + ItemStack needStack = BossStack.BossSlashProof(hhkey); + if(!DemonAPI.isPlayerItemsLore(p,needStack,12)){ + DemonAPI.sendMessage(p,"兑换失败,缺少该十万年灵兽的猎杀凭证。",Sound.ENTITY_VILLAGER_NO); + return; + } + // 获取灵环精片 + ItemStack spermTablets = ItemKuAPI.getItems("灵环精片",1); + if(!DemonAPI.isPlayerItemsLore(p,spermTablets,64)){ + DemonAPI.sendMessage(p,"兑换失败,缺少灵环精片。",Sound.ENTITY_VILLAGER_NO); + return; + } + ItemStack laborStack = ItemKuAPI.getItems("劳动者结晶",1); + if(!DemonAPI.isPlayerItemsLore(p,laborStack,10)){ + DemonAPI.sendMessage(p,"兑换失败,缺少劳动者结晶。",Sound.ENTITY_VILLAGER_NO); + return; + } + DemonAPI.removePlayerItemsLore(p,needStack,12); // 扣除凭证 + DemonAPI.removePlayerItemsLore(p,laborStack,10); // 扣除劳动者结晶 + DemonAPI.removePlayerItemsLore(p,spermTablets,64); // 扣除灵环精片 + ItemStack hh_item = HunHuanAPI.getHHItems("十万年_"+hhkey+"灵环"); + ItemMeta meta = hh_item.getItemMeta(); + List lore = meta.getLore(); + lore.add("§d十万年灵兽自愿献祭标识"); + meta.setLore(lore); + hh_item.setItemMeta(meta); + p.getInventory().addItem(hh_item); + p.sendMessage(Main.prefix+"兑换成功,你获得了 "+hh_item.getItemMeta().getDisplayName()); + } + } + } + } + /* + * 玩家手持凭证打开兑换界面 + * */ + @EventHandler + public void onUse(PlayerInteractEvent e){ + Player player = e.getPlayer(); + ItemStack item = player.getInventory().getItemInMainHand(); + if(e.getHand() == EquipmentSlot.HAND){ + if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){ + if(BossStack.isItemBossProve(item)){ + e.setCancelled(true); + BossProveEvent.OpenGui(player); + player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK,1.6F,1.8F); + } + } + } + } + + public static void OpenGui(Player p){ + Inventory inv = Bukkit.createInventory(null,27,invTitle); + inv.setItem(0,Show_Items("巨兽泰坦")); + inv.setItem(1,Show_Items("青天牛马")); + inv.setItem(2,Show_Items("奇灵舞魅兔")); + inv.setItem(3,Show_Items("冰封魔焰虎")); + inv.setItem(4,Show_Items("噬魂蛛皇")); + inv.setItem(5,Show_Items("雷暴狮王")); + inv.setItem(18,Hd_Items("巨兽泰坦")); + inv.setItem(19,Hd_Items("青天牛马")); + inv.setItem(20,Hd_Items("奇灵舞魅兔")); + inv.setItem(21,Hd_Items("冰封魔焰虎")); + inv.setItem(22,Hd_Items("噬魂蛛皇")); + inv.setItem(23,Hd_Items("雷暴狮王")); + p.openInventory(inv); + } + + public static ItemStack Show_Items(String keyName){ + ItemStack item = HunHuanAPI.getHHItems("十万年_"+keyName+"灵环"); + ItemMeta meta = item.getItemMeta(); + List lore = meta.getLore(); + lore.add(" "); + lore.add("§7-----[兑换需求材料]-----"); + lore.add("§c§l猎杀凭证 §f("+keyName+") §7x 8"); + lore.add("§2§l劳动者结晶 §7x 2"); + lore.add("§a§l✔§f左键点击兑换"); + meta.setLore(lore); + item.setItemMeta(meta); + NBTTagCompound nbt = BossStack.getNBT(item); + nbt.setString("hhkey",keyName); + return BossStack.setNBT(item,nbt); + } + + public static ItemStack Hd_Items(String keyName){ + ItemStack item = HunHuanAPI.getHHItems("十万年_"+keyName+"灵环"); + ItemMeta meta = item.getItemMeta(); + List lore = meta.getLore(); + lore.add("§d十万年灵兽自愿献祭标识"); + lore.add(" "); + lore.add("§7-----[兑换需求材料]-----"); + lore.add("§c§l猎杀凭证 §f("+keyName+") §7x 12"); + lore.add("§b§l灵环精片 §7x 64"); + lore.add("§2§l劳动者结晶 §7x 10"); + lore.add("§a§l✔§f左键点击兑换"); + lore.add("§b#活动期间限时开放"); + meta.setLore(lore); + item.setItemMeta(meta); + NBTTagCompound nbt = BossStack.getNBT(item); + nbt.setString("hhkeypro",keyName); + return BossStack.setNBT(item,nbt); + } +} diff --git a/src/main/java/com/io/yaohun/worldbosshurt/mangage/RewardManage.java b/src/main/java/com/io/yaohun/worldbosshurt/mangage/RewardManage.java index 1317737..580faed 100644 --- a/src/main/java/com/io/yaohun/worldbosshurt/mangage/RewardManage.java +++ b/src/main/java/com/io/yaohun/worldbosshurt/mangage/RewardManage.java @@ -2,6 +2,7 @@ package com.io.yaohun.worldbosshurt.mangage; import com.io.yaohun.worldbosshurt.data.BossData; import com.io.yaohun.worldbosshurt.data.RewardData; +import com.sun.xml.internal.txw2.output.StreamSerializer; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; @@ -20,4 +21,11 @@ public class RewardManage { } Bukkit.getConsoleSender().sendMessage("§b[BossHurt] §f已导入奖励方案: §a" + rewardDataMap.size() + "个"); } + + public RewardData getRewardData(String string) { + if(rewardDataMap.get(string) != null){ + return rewardDataMap.get(string); + } + return null; + } } diff --git a/src/main/java/com/io/yaohun/worldbosshurt/util/BossStack.java b/src/main/java/com/io/yaohun/worldbosshurt/util/BossStack.java index cb75a3c..0fc6079 100644 --- a/src/main/java/com/io/yaohun/worldbosshurt/util/BossStack.java +++ b/src/main/java/com/io/yaohun/worldbosshurt/util/BossStack.java @@ -45,4 +45,17 @@ public class BossStack { nbt.setString("stex","cailiao_68"); return setNBT(item,nbt); } + + public static boolean isItemBossProve(ItemStack item){ + if(DemonAPI.itemIsNull(item) || DemonAPI.itemIsLore(item)){ + return false; + } + ItemMeta meta = item.getItemMeta(); + if(meta.getDisplayName().contains("§c§l猎杀凭证")){ + if(meta.getLore().contains("§7灵兽§a掉落§7的凭证,§a集齐多张")){ + return true; + } + } + return false; + } } diff --git a/src/main/java/com/io/yaohun/worldbosshurt/util/BossUtil.java b/src/main/java/com/io/yaohun/worldbosshurt/util/BossUtil.java index 266bd05..a82e9e8 100644 --- a/src/main/java/com/io/yaohun/worldbosshurt/util/BossUtil.java +++ b/src/main/java/com/io/yaohun/worldbosshurt/util/BossUtil.java @@ -14,6 +14,12 @@ import java.util.stream.Collectors; public class BossUtil { + public static String finallyKills = "§6[§4公告§6] §a玩家 §c%p% §a夺取了 §r%mobs% §6§l最终一击!"; + + public static String getFinallyKills() { + return finallyKills; + } + /* * 增加玩家每月Boss击杀数 * */