Skip to content

Commit

Permalink
Don't send empty messages to players
Browse files Browse the repository at this point in the history
  • Loading branch information
cjburkey01 committed Jan 4, 2022
1 parent ff1f631 commit d1a365b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/cjburkey/claimchunk/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public static void toPlayer(@NotNull Player ply, @NotNull BaseComponent msg) {
}

public static void toPlayer(Player ply, String text) {
toPlayer(ply, toComponent(ply, text));
if (!text.isBlank()) {
toPlayer(ply, toComponent(ply, text));
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public void fromCCConfig(@NotNull CCConfig config) {
if (material == null) {
Utils.warn(
"Material type \"%s\" not found when loading from"
+ " preventAdjacent, this one will be removed!",
+ " preventAdjacent, this one will be removed!",
blockType);
}
return material;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public void onPlayerMove(PlayerMoveEvent e) {
} else {
msg = claimChunk.getMessages().chunkLeave.replace("%%PLAYER%%", name);
}
Utils.toPlayer(e.getPlayer(), msg);
if (!msg.isBlank()) {
Utils.toPlayer(e.getPlayer(), msg);
}
}
}
}
Expand Down Expand Up @@ -129,7 +131,7 @@ private void showTitle(Player player, Chunk newChunk) {
}

private void showTitleRaw(boolean isOwnerDisplay, Player player, String msg) {
if (claimChunk.chConfig().getDisplayNameOfOwner() || !isOwnerDisplay) {
if ((claimChunk.chConfig().getDisplayNameOfOwner() || !isOwnerDisplay) && !msg.isBlank()) {
Utils.toPlayer(player, msg);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cjburkey/claimchunk/lib/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public Metrics(JavaPlugin plugin, int serviceId) {
.setHeader(
Arrays.asList(
"bStats (https://bStats.org) collects some basic information"
+ " for plugin authors, like how many people use their"
+ " plugin and their total player count.",
+ " for plugin authors, like how many people use their"
+ " plugin and their total player count.",
"It's recommended to keep bStats enabled, but if you're not"
+ " comfortable with this, you can turn this setting off.",
"There is no performance penalty associated with having metrics"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void removeFromMap() {
} catch (Exception e) {
Utils.err(
"Failed to unregister command! If you are reloading, updates to permissions"
+ " won't appear until a server reboot.");
+ " won't appear until a server reboot.");
if (Utils.getDebugEnableOverride()) {
e.printStackTrace();
}
Expand Down

0 comments on commit d1a365b

Please sign in to comment.