-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a default impl for I18nAdapter in paper
- Loading branch information
1 parent
847736c
commit 5027f38
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/main/java/com/nookure/core/inv/paper/DefaultPaperAdapter.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,21 @@ | ||
package com.nookure.core.inv.paper; | ||
|
||
import com.nookure.core.inv.I18nAdapter; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.minimessage.MiniMessage; | ||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class DefaultPaperAdapter extends I18nAdapter<Player> { | ||
|
||
@Override | ||
public String translate(String key, boolean isKey, @Nullable Player player) { | ||
return LegacyComponentSerializer.legacySection().serialize(translateComponent(key, isKey, player)); | ||
} | ||
|
||
@Override | ||
public Component translateComponent(String key, boolean isKey, @Nullable Player player) { | ||
return MiniMessage.miniMessage().deserialize(key); | ||
} | ||
} |