Skip to content

Commit

Permalink
Bump block costs by one block, better message colour detection
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 8, 2023
1 parent c25ad3e commit e55e2f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Expand Up @@ -32,14 +32,14 @@ public float getCost(BlockSource source, PathPoint point) {
Material below = source.getMaterialAt(pos.getBlockX(), pos.getBlockY() - 1, pos.getBlockZ());
Material in = source.getMaterialAt(pos);
if (above == WEB || in == WEB)
return 1F;
return 2F;
if (below == Material.SOUL_SAND || below == Material.ICE)
return 1F;
return 2F;
if (isLiquidOrInLiquid(source.getWorld().getBlockAt(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()))) {
if (in == Material.LAVA) {
return 2F;
return 3F;
}
return 1F;
return 2F;
}
return 0F; // TODO: add light level-specific costs?
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/citizensnpcs/api/util/Messaging.java
Expand Up @@ -173,9 +173,10 @@ public static String parseComponents(String raw) {
private static String prettify(String message) {
String trimmed = message.trim();
String messageColour = MESSAGE_COLOUR;
if (!trimmed.isEmpty()) {
if (trimmed.charAt(0) == ChatColor.COLOR_CHAR) {
ChatColor test = ChatColor.getByChar(trimmed.substring(1, 2));
String parsed = convertLegacyCodes(trimmed);
if (!parsed.isEmpty()) {
if (parsed.charAt(0) == ChatColor.COLOR_CHAR) {
ChatColor test = ChatColor.getByChar(parsed.substring(1, 2));
if (test == null) {
message = messageColour + message;
} else {
Expand Down

0 comments on commit e55e2f0

Please sign in to comment.