From b4ea5bb23a598c0d936b909d41c01eb68693dbb2 Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Wed, 16 Jul 2025 04:25:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=82=BB=E9=80=BCUUID=F0=9F=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/Blu43Entity.java | 14 ++++++++++---- .../superbwarfare/entity/ClaymoreEntity.java | 13 +++++++++---- .../superbwarfare/entity/Tm62Entity.java | 14 ++++++++++---- .../entity/projectile/C4Entity.java | 14 ++++++++++---- .../entity/vehicle/Hpj11Entity.java | 17 +++++++++++------ .../entity/vehicle/LaserTowerEntity.java | 13 +++++++++---- 6 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java index 80cc74611..35920c4d1 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/Blu43Entity.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.entity; +import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; @@ -125,10 +126,15 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity { } else { String s = compound.getString("Owner"); - if (this.getServer() == null) { - uuid = UUID.fromString(s); - } else { - uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + try { + if (this.getServer() == null) { + uuid = UUID.fromString(s); + } else { + uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + } + } catch (Exception exception) { + Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception); + uuid = null; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java index 2a1fcb4b0..865265f98 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/ClaymoreEntity.java @@ -130,10 +130,15 @@ public class ClaymoreEntity extends Entity implements GeoEntity, OwnableEntity { } else { String s = compound.getString("Owner"); - if (this.getServer() == null) { - uuid = UUID.fromString(s); - } else { - uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + try { + if (this.getServer() == null) { + uuid = UUID.fromString(s); + } else { + uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + } + } catch (Exception exception) { + Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception); + uuid = null; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/Tm62Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/Tm62Entity.java index ac52d6441..50dacf78e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/Tm62Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/Tm62Entity.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.entity; +import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.init.ModDamageTypes; @@ -134,10 +135,15 @@ public class Tm62Entity extends Entity implements GeoEntity, OwnableEntity { } else { String s = compound.getString("Owner"); - if (this.getServer() == null) { - uuid = UUID.fromString(s); - } else { - uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + try { + if (this.getServer() == null) { + uuid = UUID.fromString(s); + } else { + uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + } + } catch (Exception exception) { + Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception); + uuid = null; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/C4Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/C4Entity.java index 266a8b9d4..b0d2789d1 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/C4Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/C4Entity.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.entity.projectile; +import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModEntities; @@ -144,10 +145,15 @@ public class C4Entity extends Entity implements GeoEntity, OwnableEntity { } else { String s = compound.getString("Owner"); - if (this.getServer() == null) { - uuid = UUID.fromString(s); - } else { - uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + try { + if (this.getServer() == null) { + uuid = UUID.fromString(s); + } else { + uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + } + } catch (Exception exception) { + Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception); + uuid = null; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java index 95571746b..5694f8ced 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java @@ -110,7 +110,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti } @Override - public void addAdditionalSaveData(CompoundTag compound) { + public void addAdditionalSaveData(@NotNull CompoundTag compound) { super.addAdditionalSaveData(compound); compound.putInt("AnimTime", this.entityData.get(ANIM_TIME)); compound.putBoolean("Active", this.entityData.get(ACTIVE)); @@ -120,7 +120,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti } @Override - public void readAdditionalSaveData(CompoundTag compound) { + public void readAdditionalSaveData(@NotNull CompoundTag compound) { super.readAdditionalSaveData(compound); this.entityData.set(ANIM_TIME, compound.getInt("AnimTime")); this.entityData.set(ACTIVE, compound.getBoolean("Active")); @@ -131,10 +131,15 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti } else { String s = compound.getString("Owner"); - if (this.getServer() == null) { - uuid = UUID.fromString(s); - } else { - uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + try { + if (this.getServer() == null) { + uuid = UUID.fromString(s); + } else { + uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + } + } catch (Exception exception) { + Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception); + uuid = null; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java index 979adc217..8d47d4914 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java @@ -110,10 +110,15 @@ public class LaserTowerEntity extends VehicleEntity implements GeoEntity, Ownabl } else { String s = compound.getString("Owner"); - if (this.getServer() == null) { - uuid = UUID.fromString(s); - } else { - uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + try { + if (this.getServer() == null) { + uuid = UUID.fromString(s); + } else { + uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); + } + } catch (Exception exception) { + Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception); + uuid = null; } }