修复了在1.21中风弹的击退效果无法被拦截的漏洞 #17

This commit is contained in:
ZhangYuheng 2024-09-19 14:44:08 +08:00
parent 99405c3828
commit 72a5a84a65
2 changed files with 15 additions and 1 deletions

View File

@ -7,7 +7,7 @@ plugins {
}
group = "cn.lunadeer"
version = "2.8.1-beta"
version = "2.8.2-beta"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))

View File

@ -7,6 +7,7 @@ import cn.lunadeer.dominion.dtos.PlayerDTO;
import cn.lunadeer.minecraftpluginutils.Common;
import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Teleport;
import com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
@ -790,6 +791,19 @@ public class PlayerEvents implements Listener {
checkFlag(dom, Flag.SHOOT, player, event);
}
@EventHandler(priority = EventPriority.HIGHEST) // shoot - wind_charge knock back
public void onWindChargeKnockBack(EntityKnockbackByEntityEvent event) {
Entity entity = event.getHitBy();
if (!(entity instanceof WindCharge windCharge)) {
return;
}
if (!(windCharge.getShooter() instanceof Player player)) {
return;
}
DominionDTO dom = Cache.instance.getDominionByLoc(windCharge.getLocation());
checkFlag(dom, Flag.SHOOT, player, event);
}
@EventHandler(priority = EventPriority.HIGHEST) // trade
public void onTrade(InventoryOpenEvent event) {
if (event.getInventory().getType() != InventoryType.MERCHANT) {