Skip to content

Commit 2329f0f

Browse files
committed
Fix placeholder issue where placeholder would return null if no nickname had been set, fix README
1 parent 7ce2f87 commit 2329f0f

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ Mini-Message comes prepackaged with Paper and all forks of Paper support Mini-Me
9090
- Valid Tags are: `reset`, `underline`, `italic`, `strikethrough`, `bold`, and `obsfucated`.
9191

9292
## PlaceholderAPI
93-
- `%simplenicks_mininick%`
94-
- Nickname pre-parsed
93+
- Download the `player` ecloud expansion for Placeholder API
94+
- Use `%player_displayname%`
9595

96+
- If you have a specific setup that needs the minimessage formatting before it has been parsed, i.e. the `"<red>Nickname</red>"` version, you can use `%simplenicks_mininick%`
97+
- This won't be necessary for most users though, the previous one will work best.
9698
## TODO
9799
- Create a `/nick whois` or similar command to determine "who is the player(s) with this nickname".

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>simplexity</groupId>
88
<artifactId>SimpleNicks</artifactId>
9-
<version>2.0.1</version>
9+
<version>2.0.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SimpleNicks</name>

src/main/java/simplexity/simplenicks/util/SNExpansion.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import org.jetbrains.annotations.NotNull;
66
import simplexity.simplenicks.SimpleNicks;
77

8+
import java.util.Locale;
9+
810
public class SNExpansion extends PlaceholderExpansion {
911
@Override
1012
public @NotNull String getIdentifier() {
@@ -24,7 +26,11 @@ public class SNExpansion extends PlaceholderExpansion {
2426
@Override
2527
public String onRequest(OfflinePlayer player, @NotNull String params) {
2628
if (params.equalsIgnoreCase("mininick")) {
27-
return NickHandler.getInstance().getNickname(player);
29+
String nickname = NickHandler.getInstance().getNickname(player);
30+
if (nickname != null) {
31+
return nickname;
32+
}
33+
return player.getName();
2834
}
2935
return null;
3036
}

src/main/resources/plugin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ permissions:
2121
simplenick.admin:
2222
description: allows user to set and reset other players' nicknames
2323
default: op
24+
children:
25+
simplenick.nick: true
26+
simplenick.nick.set: true
2427
simplenick.admin.reset:
2528
default: op
2629
description: Allows the user to clear another player's nickname

0 commit comments

Comments
 (0)