mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-31 04:36:29 +00:00
Preliminary MiniMessage support
This commit is contained in:
@@ -59,6 +59,8 @@ dependencies {
|
||||
testImplementation 'com.github.seeseemelk:MockBukkit-v1.15:0.3.0-SNAPSHOT'
|
||||
testImplementation 'org.reflections:reflections:0.9.12'
|
||||
|
||||
implementation 'net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT' // minimessage
|
||||
implementation 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT' // minimessage
|
||||
implementation 'net.islandearth:languagy-api:2.0.2-SNAPSHOT' // languagy
|
||||
implementation 'co.aikar:acf-paper:0.5.0-SNAPSHOT' // commands
|
||||
implementation 'co.aikar:idb-core:1.0.0-SNAPSHOT' // database
|
||||
@@ -74,6 +76,7 @@ dependencies {
|
||||
exclude group: 'org.spigotmc'
|
||||
}
|
||||
compileOnly ('com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT') {
|
||||
exclude group: 'com.google'
|
||||
exclude group: 'org.bukkit'
|
||||
exclude group: 'org.spigotmc'
|
||||
}
|
||||
|
||||
@@ -3,10 +3,14 @@ package net.islandearth.rpgregions.translation;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.islandearth.languagy.api.language.Language;
|
||||
import net.islandearth.rpgregions.RPGRegions;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -59,25 +63,31 @@ public enum Translations {
|
||||
|
||||
public void send(Player player) {
|
||||
String message = RPGRegions.getAPI().getTranslator().getTranslationFor(player, this.getPath());
|
||||
player.sendMessage(this.setPapi(player, message));
|
||||
Component component = MiniMessage.markdown().parse(this.setPapi(player, message));
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
}
|
||||
|
||||
public void send(Player player, String... values) {
|
||||
String message = RPGRegions.getAPI().getTranslator().getTranslationFor(player, this.getPath());
|
||||
message = this.setPapi(player, replaceVariables(message, values));
|
||||
player.sendMessage(message);
|
||||
Component component = MiniMessage.markdown().parse(message);
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
}
|
||||
|
||||
public void sendList(Player player) {
|
||||
List<String> messages = RPGRegions.getAPI().getTranslator().getTranslationListFor(player, this.getPath());
|
||||
messages.forEach(message -> player.sendMessage(this.setPapi(player, message)));
|
||||
messages.forEach(message -> {
|
||||
Component component = MiniMessage.markdown().parse(this.setPapi(player, message));
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
});
|
||||
}
|
||||
|
||||
public void sendList(Player player, String... values) {
|
||||
List<String> messages = RPGRegions.getAPI().getTranslator().getTranslationListFor(player, this.getPath());
|
||||
messages.forEach(message -> {
|
||||
message = this.setPapi(player, replaceVariables(message, values));
|
||||
player.sendMessage(message);
|
||||
Component component = MiniMessage.markdown().parse(message);
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ teleport: "&aClick to teleport"
|
||||
cannot_teleport: "&cWe can't teleport you because that world doesn't exist!"
|
||||
unknown_region: "Unknown Realm"
|
||||
exit: "&cExit"
|
||||
cannot_enter: "&cYou require %0 to enter this area."
|
||||
cannot_enter: "<red>You require %0 to enter this area.</red>"
|
||||
previous_page_lore:
|
||||
- "&fGo to the previous page"
|
||||
next_page_lore:
|
||||
|
||||
Reference in New Issue
Block a user