Skip to content

Commit

Permalink
made the code a bit prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
RealRTTV committed Sep 28, 2024
1 parent 3227e53 commit e1ca3e6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public static int reply(FabricClientCommandSource source, Component message) thr
}

String text = message.getString();
String command = String.format("w %s %s", currentTarget, text);

if (3 + currentTarget.length() + 1 + text.length() > 256) {
throw MESSAGE_TOO_LONG_EXCEPTION.create(256 - (3 + currentTarget.length() + 1), text.length());
if (command.length() > 256) {
throw MESSAGE_TOO_LONG_EXCEPTION.create(256 - (command.length() - text.length()), text.length());
}

source.getClient().getConnection().sendCommand(String.format("w %s %s", currentTarget, text));
source.getClient().getConnection().sendCommand(command);

return Command.SINGLE_SUCCESS;
}
Expand Down

0 comments on commit e1ca3e6

Please sign in to comment.