Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format-strings instead of string concatenation #360

Open
main-- opened this issue Jan 1, 2012 · 3 comments
Open

Format-strings instead of string concatenation #360

main-- opened this issue Jan 1, 2012 · 3 comments
Labels
PR: Better Coding Improvements in code, but not introducing new features. Resolution: Accepted MV-Team is aware of the issue/PR and will be looking into it. Type: Idea Suggestion for a new feature or enhancement.

Comments

@main--
Copy link
Member

main-- commented Jan 1, 2012

Does @Multiverse notify all MV-Devs? I hope so.

I would like to know your opinion about changes like this one:

Now:

message.sendMessages(teleporter, new String[]{"You don't have permission to teleport another player to a " + ChatColor.GREEN + destination.getType() + " Destination.", ChatColor.RED + "   (multiverse.teleport.other." + destination.getIdentifier() + ")"});

(taken from TeleportCommand.java @ 562de0f, just as example)


How I would like to change that:

message.sendMessages(teleporter, new String[] {String.format("You don't have permission to teleport another player to a %s%s Destination.", ChatColor.GREEN, destination.getType()), String.format("%s(multiverse.teleport.other.%s)", ChatColor.RED, destination.getIdentifier())});
@fernferret
Copy link
Member

It does not. Honestly I'm pretty indifferent about these, On one hand, the first only needs one change if a format change is required, but the second is more easy to format as you can read the whole string and then do stuff.

So I say go for it.

@fernferret
Copy link
Member

I've started doing this, but this is a biggie. However it will help a TON with localization, leaving open for a while (until most are fixed)

@fernferret
Copy link
Member

Moved to Localization Milestone. We need to get a 2.3 out quick-faster than we did 2.2.

@benwoo1110 benwoo1110 mentioned this issue Feb 10, 2023
75 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Better Coding Improvements in code, but not introducing new features. Resolution: Accepted MV-Team is aware of the issue/PR and will be looking into it. Type: Idea Suggestion for a new feature or enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants