Skip to content

Commit

Permalink
Fix NPE if no prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Dec 16, 2024
1 parent fa9998f commit 635157d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void onEntityDeath(EntityDeathEvent e) {

if (!(pm.getLastEntityDamager() instanceof LivingEntity) || pm.getLastEntityDamager() == e.getEntity()) {
TextComponent[] naturalDeath = Assets.playerNatureDeathMessage(pm, player);
TextComponent oldNaturalDeath = naturalDeath[0].append(naturalDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldNaturalDeath = naturalDeath[0] != null ? naturalDeath[0].append(naturalDeath[1]) : naturalDeath[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastDeathMessageEvent event = new BroadcastDeathMessageEvent(
player,
Expand Down Expand Up @@ -90,7 +90,7 @@ void onEntityDeath(EntityDeathEvent e) {
}

TextComponent[] playerDeath = Assets.playerDeathMessage(pm, gangKill);
TextComponent oldPlayerDeath = playerDeath[0].append(playerDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldPlayerDeath = playerDeath[0] != null ? playerDeath[0].append(playerDeath[1]) : playerDeath[1]; // Dreeam TODO: Remove in 1.4.21

if (ent instanceof Player) {
BroadcastDeathMessageEvent event = new BroadcastDeathMessageEvent(
Expand Down Expand Up @@ -137,7 +137,7 @@ void onEntityDeath(EntityDeathEvent e) {
if (damager == null) return; // Entity killed by Entity should not include in DM

TextComponent[] entityDeath = Assets.entityDeathMessage(em, mobType);
TextComponent oldEntityDeath = entityDeath[0].append(entityDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldEntityDeath = entityDeath[0] != null ? entityDeath[0].append(entityDeath[1]) : entityDeath[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastEntityDeathMessageEvent event = new BroadcastEntityDeathMessageEvent(
damager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void untagPlayer(PlayerUntagEvent e) {

deathMessage[1] = deathMessageBody;

TextComponent oldDeathMessage = deathMessage[0].append(deathMessage[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldDeathMessage = deathMessage[0] != null ? deathMessage[0].append(deathMessage[1]) : deathMessage[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastDeathMessageEvent event = new BroadcastDeathMessageEvent(
player,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onMythicMobDeath(MythicMobDeathEvent e) {
getEntity.ifPresent(em -> {
PlayerManager damager = em.getLastPlayerDamager();
TextComponent[] mythicDeath = Assets.entityDeathMessage(em, MobType.MYTHIC_MOB);
TextComponent oldMythicDeath = mythicDeath[0].append(mythicDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldMythicDeath = mythicDeath[0] != null ? mythicDeath[0].append(mythicDeath[1]) : mythicDeath[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastEntityDeathMessageEvent event = new BroadcastEntityDeathMessageEvent(
damager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void onEntityDeath(EntityDeathEvent e) {

if (!(pm.getLastEntityDamager() instanceof LivingEntity) || pm.getLastEntityDamager() == e.getEntity()) {
TextComponent[] naturalDeath = Assets.playerNatureDeathMessage(pm, player);
TextComponent oldNaturalDeath = naturalDeath[0].append(naturalDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldNaturalDeath = naturalDeath[0] != null ? naturalDeath[0].append(naturalDeath[1]) : naturalDeath[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastDeathMessageEvent event = new BroadcastDeathMessageEvent(
player,
Expand Down Expand Up @@ -90,7 +90,7 @@ void onEntityDeath(EntityDeathEvent e) {
}

TextComponent[] playerDeath = Assets.playerDeathMessage(pm, gangKill);
TextComponent oldPlayerDeath = playerDeath[0].append(playerDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldPlayerDeath = playerDeath[0] != null ? playerDeath[0].append(playerDeath[1]) : playerDeath[1]; // Dreeam TODO: Remove in 1.4.21

if (ent instanceof Player) {
BroadcastDeathMessageEvent event = new BroadcastDeathMessageEvent(
Expand Down Expand Up @@ -137,7 +137,7 @@ void onEntityDeath(EntityDeathEvent e) {
if (damager == null) return; // Entity killed by Entity should not include in DM

TextComponent[] entityDeath = Assets.entityDeathMessage(em, mobType);
TextComponent oldEntityDeath = entityDeath[0].append(entityDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldEntityDeath = entityDeath[0] != null ? entityDeath[0].append(entityDeath[1]) : entityDeath[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastEntityDeathMessageEvent event = new BroadcastEntityDeathMessageEvent(
damager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void untagPlayer(PlayerUntagEvent e) {

deathMessage[1] = deathMessageBody;

TextComponent oldDeathMessage = deathMessage[0].append(deathMessage[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldDeathMessage = deathMessage[0] != null ? deathMessage[0].append(deathMessage[1]) : deathMessage[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastDeathMessageEvent event = new BroadcastDeathMessageEvent(
player,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onMythicMobDeath(MythicMobDeathEvent e) {
getEntity.ifPresent(em -> {
PlayerManager damager = em.getLastPlayerDamager();
TextComponent[] mythicDeath = Assets.entityDeathMessage(em, MobType.MYTHIC_MOB);
TextComponent oldMythicDeath = mythicDeath[0].append(mythicDeath[1]); // Dreeam TODO: Remove in 1.4.21
TextComponent oldMythicDeath = mythicDeath[0] != null ? mythicDeath[0].append(mythicDeath[1]) : mythicDeath[1]; // Dreeam TODO: Remove in 1.4.21

BroadcastEntityDeathMessageEvent event = new BroadcastEntityDeathMessageEvent(
damager,
Expand Down

0 comments on commit 635157d

Please sign in to comment.