PVP四项改进:回声碎片CLI入口/击杀≥10奖励盔甲药水/世界击杀纳入总榜/选装前无敌
This commit is contained in:
@@ -110,6 +110,10 @@ public class AreaCLIManager {
|
|||||||
p.sendMessage(clickableAction("🏛", "公共设施列表/传送",
|
p.sendMessage(clickableAction("🏛", "公共设施列表/传送",
|
||||||
"/protect listpublic"));
|
"/protect listpublic"));
|
||||||
|
|
||||||
|
// ★ 回声碎片:领地记录查询工具
|
||||||
|
p.sendMessage(clickableAction("🔮", "回声碎片(领地记录工具)",
|
||||||
|
"/protect echoshard"));
|
||||||
|
|
||||||
// ★ 管理员配置入口
|
// ★ 管理员配置入口
|
||||||
if (areaProtect.isAreaAdmin(p)) {
|
if (areaProtect.isAreaAdmin(p)) {
|
||||||
p.sendMessage(clickableAction("⚙", "全局配置",
|
p.sendMessage(clickableAction("⚙", "全局配置",
|
||||||
|
|||||||
@@ -6065,6 +6065,21 @@ public class AreaProtection implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===== 回声碎片(领地记录查询工具)=====
|
||||||
|
if (sub.equals("echoshard") || sub.equals("回声碎片")) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("§c仅玩家可用");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Player p = (Player) sender;
|
||||||
|
if (plugin.landRecordManager != null) {
|
||||||
|
plugin.landRecordManager.giveEchoShard(p);
|
||||||
|
} else {
|
||||||
|
p.sendMessage("§c领地记录管理器未初始化");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ===== UI模式偏好 =====
|
// ===== UI模式偏好 =====
|
||||||
if (sub.equals("uimode") || sub.equals("偏好")) {
|
if (sub.equals("uimode") || sub.equals("偏好")) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
|
|||||||
@@ -960,6 +960,7 @@ public class PVPArenaManager implements Listener {
|
|||||||
|
|
||||||
player.sendMessage("§a§l欢迎来到PVP竞技场!");
|
player.sendMessage("§a§l欢迎来到PVP竞技场!");
|
||||||
player.sendMessage("§7请先选择你的装备套装,确认后将发放PVP装备");
|
player.sendMessage("§7请先选择你的装备套装,确认后将发放PVP装备");
|
||||||
|
player.sendMessage("§e§l★ 选装期间免疫一切伤害,请放心选择");
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
|
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
|
||||||
|
|
||||||
plugin.getLogger().info("[PVP] 玩家 " + playerName + " 进入PVP竞技场(已备份清空原背包,等待选装备)");
|
plugin.getLogger().info("[PVP] 玩家 " + playerName + " 进入PVP竞技场(已备份清空原背包,等待选装备)");
|
||||||
@@ -1127,6 +1128,20 @@ public class PVPArenaManager implements Listener {
|
|||||||
|
|
||||||
// ==================== 事件处理器 ====================
|
// ==================== 事件处理器 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ★ 选装前无敌:玩家在PVP世界中未完成装备选择时,免疫一切伤害
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) {
|
||||||
|
if (!(event.getEntity() instanceof Player)) return;
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
String name = player.getName();
|
||||||
|
// 在PVP世界中但未确认装备 → 取消所有伤害
|
||||||
|
if (inPVPArena.contains(name) && !equipmentConfirmed.contains(name)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家死亡事件 — 死亡后强制离开PVP
|
* 玩家死亡事件 — 死亡后强制离开PVP
|
||||||
*/
|
*/
|
||||||
@@ -1155,6 +1170,30 @@ public class PVPArenaManager implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ★ 击杀≥10奖励:替换完整铁甲 + 喷溅瞬间治疗2 ×1(一次性)
|
||||||
|
if (newKills >= 10) {
|
||||||
|
Player killerP = (Player) killer;
|
||||||
|
if (!killerP.hasPermission("sdf1.kit.pvp.reward10")) {
|
||||||
|
// 替换完整铁甲
|
||||||
|
killerP.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
|
||||||
|
killerP.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
|
||||||
|
killerP.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
|
||||||
|
killerP.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
|
||||||
|
// 喷溅瞬间治疗2 ×1(正确NBT)
|
||||||
|
ItemStack potion = new ItemStack(Material.SPLASH_POTION, 1);
|
||||||
|
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
|
||||||
|
potionMeta.setBasePotionType(org.bukkit.potion.PotionType.HEALING);
|
||||||
|
potionMeta.addCustomEffect(new org.bukkit.potion.PotionEffect(
|
||||||
|
org.bukkit.potion.PotionEffectType.INSTANT_HEALTH, 1, 1, false, false), true);
|
||||||
|
potion.setItemMeta(potionMeta);
|
||||||
|
killerP.getInventory().addItem(potion);
|
||||||
|
// 授予临时权限标记(本次重启内有效,防止重复发放)
|
||||||
|
killerP.addAttachment(plugin, "sdf1.kit.pvp.reward10", true);
|
||||||
|
killerP.sendMessage("§a§l[PVP] §f击杀达 §610 §f次!获得 §b铁甲套装 §f+ §c喷溅瞬间治疗II ×1");
|
||||||
|
killerP.playSound(killerP.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 击杀者连杀会话
|
// 击杀者连杀会话
|
||||||
PVPManager.KillSession ks = arenaKillSessions.get(kName);
|
PVPManager.KillSession ks = arenaKillSessions.get(kName);
|
||||||
if (ks == null
|
if (ks == null
|
||||||
@@ -2091,6 +2130,16 @@ public class PVPArenaManager implements Listener {
|
|||||||
return inPVPArena.contains(playerName);
|
return inPVPArena.contains(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取PVP世界击杀数据(供外部排行榜汇总) */
|
||||||
|
public Map<String, Integer> getPVPWorldKills() {
|
||||||
|
return Collections.unmodifiableMap(pvpKills);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取PVP世界死亡数据(供外部排行榜汇总) */
|
||||||
|
public Map<String, Integer> getPVPWorldDeaths() {
|
||||||
|
return Collections.unmodifiableMap(pvpDeaths);
|
||||||
|
}
|
||||||
|
|
||||||
public World getPVPWorld() {
|
public World getPVPWorld() {
|
||||||
return Bukkit.getWorld(pvpWorldName);
|
return Bukkit.getWorld(pvpWorldName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1350,9 +1350,28 @@ public class PVPManager implements Listener {
|
|||||||
if (region == null) {
|
if (region == null) {
|
||||||
p.sendMessage("§6§l" + target
|
p.sendMessage("§6§l" + target
|
||||||
+ " 的PVP战绩:");
|
+ " 的PVP战绩:");
|
||||||
|
|
||||||
|
// ★ PVP世界战绩(从PvPArenaManager获取)
|
||||||
|
int pvpWorldKills = 0;
|
||||||
|
int pvpWorldDeaths = 0;
|
||||||
|
if (plugin.getPVPArenaManager() != null) {
|
||||||
|
Map<String, Integer> wk = plugin.getPVPArenaManager().getPVPWorldKills();
|
||||||
|
Map<String, Integer> wd = plugin.getPVPArenaManager().getPVPWorldDeaths();
|
||||||
|
pvpWorldKills = wk.getOrDefault(target, 0);
|
||||||
|
pvpWorldDeaths = wd.getOrDefault(target, 0);
|
||||||
|
}
|
||||||
|
if (pvpWorldKills > 0 || pvpWorldDeaths > 0) {
|
||||||
|
double pvpKd = pvpWorldDeaths > 0
|
||||||
|
? (double) pvpWorldKills / pvpWorldDeaths : pvpWorldKills;
|
||||||
|
p.sendMessage("§e- §fPVP世界 §a击杀:" + pvpWorldKills
|
||||||
|
+ " §c死亡:" + pvpWorldDeaths
|
||||||
|
+ " §eKD:" + String.format("%.2f", pvpKd));
|
||||||
|
}
|
||||||
|
|
||||||
|
// PVP区域战绩
|
||||||
List<Map<String, Object>> all =
|
List<Map<String, Object>> all =
|
||||||
getAllRegions();
|
getAllRegions();
|
||||||
boolean has = false;
|
boolean has = pvpWorldKills > 0 || pvpWorldDeaths > 0;
|
||||||
for (Map<String, Object> row :
|
for (Map<String, Object> row :
|
||||||
all) {
|
all) {
|
||||||
String rn = (String) row
|
String rn = (String) row
|
||||||
@@ -1370,6 +1389,21 @@ public class PVPManager implements Listener {
|
|||||||
has = true;
|
has = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ★ 总计
|
||||||
|
int totalKills = pvpWorldKills;
|
||||||
|
int totalDeaths = pvpWorldDeaths;
|
||||||
|
for (Map<String, Object> row : all) {
|
||||||
|
String rn = (String) row.get("name");
|
||||||
|
totalKills += getKills(target, rn);
|
||||||
|
totalDeaths += getDeaths(target, rn);
|
||||||
|
}
|
||||||
|
if (totalKills > 0 || totalDeaths > 0) {
|
||||||
|
double totalKd = totalDeaths > 0
|
||||||
|
? (double) totalKills / totalDeaths : totalKills;
|
||||||
|
p.sendMessage("§6§l- §f总计 §a击杀:" + totalKills
|
||||||
|
+ " §c死亡:" + totalDeaths
|
||||||
|
+ " §eKD:" + String.format("%.2f", totalKd));
|
||||||
|
}
|
||||||
if (!has)
|
if (!has)
|
||||||
p.sendMessage(
|
p.sendMessage(
|
||||||
"§7暂无记录");
|
"§7暂无记录");
|
||||||
|
|||||||
Reference in New Issue
Block a user