-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...rikster/chatty/chat/component/impl/InternalPlaceholdersReplacementsStringTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ru.brikster.chatty.chat.component.impl; | ||
|
||
import org.bukkit.OfflinePlayer; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Objects; | ||
|
||
public final class InternalPlaceholdersReplacementsStringTransformer implements ReplacementsStringTransformer { | ||
|
||
@Override | ||
public String transform(@NotNull OfflinePlayer sender, @NotNull String message) { | ||
return message.replace("{player}", sender instanceof Player | ||
? ((Player) sender).getDisplayName() | ||
: Objects.requireNonNull(sender.getName(), "Player name cannot be null")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...t/src/main/java/ru/brikster/chatty/chat/component/impl/ReplacementsStringTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ru.brikster.chatty.chat.component.impl; | ||
|
||
import org.bukkit.OfflinePlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface ReplacementsStringTransformer { | ||
|
||
String transform(@NotNull OfflinePlayer sender, @NotNull String message); | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...brikster/chatty/chat/component/impl/papi/PlaceholderApiReplacementsStringTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ru.brikster.chatty.chat.component.impl.papi; | ||
|
||
import me.clip.placeholderapi.PlaceholderAPI; | ||
import org.bukkit.OfflinePlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
import ru.brikster.chatty.chat.component.impl.ReplacementsStringTransformer; | ||
|
||
public final class PlaceholderApiReplacementsStringTransformer implements ReplacementsStringTransformer { | ||
|
||
@Override | ||
public String transform(@NotNull OfflinePlayer sender, @NotNull String message) { | ||
return PlaceholderAPI.setPlaceholders(sender, message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters