Skip to content

Commit

Permalink
Optimize death messages get
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jan 12, 2024
1 parent e6e3766 commit 22ae922
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
14 changes: 7 additions & 7 deletions Core/src/main/java/dev/mrshawn/deathmessages/utils/Assets.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static TextComponent getNaturalDeath(PlayerManager pm, String damageCause
LogManager.getLogger(DeathMessages.getInstance().getName()).warn("Fallback this death to [Natural-Cause.Unknown] message node");
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);
msg = playerDeathPlaceholders(msg, pm, null);

TextComponent.Builder base = Component.text();
Expand Down Expand Up @@ -376,7 +376,7 @@ public static TextComponent getWeapon(boolean gang, PlayerManager pm, LivingEnti
LogManager.getLogger(DeathMessages.getInstance().getName()).warn("Fallback this death to Basic-Mode of PlayerDeathMessages");
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);
msg = playerDeathPlaceholders(msg, pm, mob);

TextComponent.Builder base = Component.text();
Expand Down Expand Up @@ -450,7 +450,7 @@ public static TextComponent getEntityDeathWeapon(Player p, Entity e, MobType mob
return Component.empty();
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);
msg = entityDeathPlaceholders(msg, p, e, hasOwner);

TextComponent.Builder base = Component.text();
Expand Down Expand Up @@ -526,7 +526,7 @@ public static TextComponent get(boolean gang, PlayerManager pm, LivingEntity mob
}
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);

TextComponent.Builder base = Component.text();

Expand Down Expand Up @@ -576,7 +576,7 @@ public static TextComponent getProjectile(boolean gang, PlayerManager pm, Living
}
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);
msg = playerDeathPlaceholders(msg, pm, mob);

TextComponent.Builder base = Component.text();
Expand Down Expand Up @@ -646,7 +646,7 @@ public static TextComponent getEntityDeathProjectile(Player p, EntityManager em,
if (tameable.getOwner() != null) hasOwner = true;
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);
msg = entityDeathPlaceholders(msg, p, em.getEntity(), hasOwner);

TextComponent.Builder base = Component.text();
Expand Down Expand Up @@ -721,7 +721,7 @@ public static TextComponent getEntityDeath(Player player, Entity e, String damag
return Component.empty();
}

String msg = msgs.get(ThreadLocalRandom.current().nextInt(msgs.size()));
String msg = (msgs.size() > 1) ? msgs.get(ThreadLocalRandom.current().nextInt(msgs.size())) : msgs.get(0);

TextComponent.Builder base = Component.text();

Expand Down
6 changes: 0 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,5 @@ allprojects {
url = uri("https://repo.auxilor.io/repository/maven-public/")
}
}

tasks {
build {
dependsOn(shadowJar)
}
}
}
// Dreeam end

0 comments on commit 22ae922

Please sign in to comment.