mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-08 03:29:41 +01:00
Merge pull request #1509 from Maxetto/patch-1
Be able to replace sender name in every message
This commit is contained in:
commit
2281c16344
2
pom.xml
2
pom.xml
@ -345,7 +345,7 @@
|
|||||||
<!-- Our Repo (Many libs) -->
|
<!-- Our Repo (Many libs) -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>codemc-repo</id>
|
<id>codemc-repo</id>
|
||||||
<url>http://ci.codemc.org/plugin/repository/maven-public/</url>
|
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<!-- bStats Repo -->
|
<!-- bStats Repo -->
|
||||||
|
@ -18,6 +18,8 @@ public class Messages {
|
|||||||
// Custom Authme tag replaced to new line
|
// Custom Authme tag replaced to new line
|
||||||
private static final String NEWLINE_TAG = "%nl%";
|
private static final String NEWLINE_TAG = "%nl%";
|
||||||
|
|
||||||
|
private static final String PLAYER_TAG = "%username%";
|
||||||
|
|
||||||
/** Contains the keys of the singular messages for time units. */
|
/** Contains the keys of the singular messages for time units. */
|
||||||
private static final Map<TimeUnit, MessageKey> TIME_UNIT_SINGULARS = ImmutableMap.<TimeUnit, MessageKey>builder()
|
private static final Map<TimeUnit, MessageKey> TIME_UNIT_SINGULARS = ImmutableMap.<TimeUnit, MessageKey>builder()
|
||||||
.put(TimeUnit.SECONDS, MessageKey.SECOND)
|
.put(TimeUnit.SECONDS, MessageKey.SECOND)
|
||||||
@ -51,7 +53,7 @@ public class Messages {
|
|||||||
public void send(CommandSender sender, MessageKey key) {
|
public void send(CommandSender sender, MessageKey key) {
|
||||||
String[] lines = retrieve(key);
|
String[] lines = retrieve(key);
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
sender.sendMessage(line);
|
sender.sendMessage(line.replaceAll(PLAYER_TAG, sender.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ public class Messages {
|
|||||||
* @param replacements The replacements to apply for the tags
|
* @param replacements The replacements to apply for the tags
|
||||||
*/
|
*/
|
||||||
public void send(CommandSender sender, MessageKey key, String... replacements) {
|
public void send(CommandSender sender, MessageKey key, String... replacements) {
|
||||||
String message = retrieveSingle(key, replacements);
|
String message = retrieveSingle(key, replacements).replaceAll(PLAYER_TAG, sender.getName());
|
||||||
for (String line : message.split("\n")) {
|
for (String line : message.split("\n")) {
|
||||||
sender.sendMessage(line);
|
sender.sendMessage(line);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user