提高1.20.x兼容性

This commit is contained in:
zhangyuheng 2024-08-02 22:26:45 +08:00
parent c74b332e65
commit 4a8ae8b568
2 changed files with 8 additions and 9 deletions

View File

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

View File

@ -81,12 +81,10 @@ public class EnvironmentEvents implements Listener {
private static boolean isNotExplodeEntity(Entity damager) { private static boolean isNotExplodeEntity(Entity damager) {
String materialName = damager.getType().name(); String materialName = damager.getType().name();
return !materialName.equals("creeper") return !materialName.contains("CREEPER")
&& !materialName.equals("wither_skull") && !materialName.contains("WITHER_SKULL")
&& !materialName.equals("fireball") && !materialName.contains("FIREBALL")
&& !materialName.equals("end_crystal") && !materialName.contains("CRYSTAL");
&& !materialName.equals("dragon_fireball")
&& !materialName.equals("small_fireball");
} }
@EventHandler(priority = EventPriority.HIGHEST) // dragon_break_block @EventHandler(priority = EventPriority.HIGHEST) // dragon_break_block
@ -151,7 +149,8 @@ public class EnvironmentEvents implements Listener {
@EventHandler(priority = EventPriority.HIGHEST) // tnt_explode @EventHandler(priority = EventPriority.HIGHEST) // tnt_explode
public void onTntExplode(EntityExplodeEvent event) { public void onTntExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (!entity.getType().name().contains("tnt")) { XLogger.debug("EntityExplodeEvent#name(): " + entity.getType().name());
if (!entity.getType().name().contains("TNT")) {
return; return;
} }
event.blockList().removeIf(block -> { event.blockList().removeIf(block -> {
@ -166,7 +165,7 @@ public class EnvironmentEvents implements Listener {
if (entity.getType() != EntityType.ARMOR_STAND) { if (entity.getType() != EntityType.ARMOR_STAND) {
return; return;
} }
if (!event.getDamager().getType().name().contains("tnt")) { if (!event.getDamager().getType().name().contains("TNT")) {
return; return;
} }
DominionDTO dom = Cache.instance.getDominionByLoc(entity.getLocation()); DominionDTO dom = Cache.instance.getDominionByLoc(entity.getLocation());