Made Accept/Decline buttons, tooltip and prompt translatable

This commit is contained in:
William278 committed 2021-02-06 18:27:26 +00:00
1 parent 83611e4966
commit f4756378c2
3 files changed
+14 -5

No files matched your search

@@ -37,20 +37,20 @@ public class teleportRequestHandler {
}
public static void sendTpAcceptDenyButtons(Player p) {
// Send the "Accept" or "Decline" response buttons to the player who has recieved a request
// Send the "Accept" or "Decline" response buttons to the player who has received a request
// Options text
TextComponent options = new TextComponent("Click an option: ");
TextComponent options = new TextComponent(messageManager.getRawMessage("tpa_request_option_select"));
options.setColor(net.md_5.bungee.api.ChatColor.GRAY);
TextComponent separator = new TextComponent(" • ");
TextComponent separator = new TextComponent(messageManager.getRawMessage("list_item_divider"));
separator.setColor(net.md_5.bungee.api.ChatColor.GRAY);
// Build the components together
ComponentBuilder teleportResponses = new ComponentBuilder();
teleportResponses.append(options);
teleportResponses.append(createButton("[Accept]", net.md_5.bungee.api.ChatColor.GREEN, ClickEvent.Action.RUN_COMMAND, "/tpaccept", "Accept the teleport request (/tpaccept)", net.md_5.bungee.api.ChatColor.GRAY, false));
teleportResponses.append(createButton(messageManager.getRawMessage("tpa_accept_button"), net.md_5.bungee.api.ChatColor.GREEN, ClickEvent.Action.RUN_COMMAND, "/tpaccept", messageManager.getRawMessage("tpa_accept_button_tooltip"), net.md_5.bungee.api.ChatColor.GRAY, false));
teleportResponses.append(separator);
teleportResponses.append(createButton("[Decline]", net.md_5.bungee.api.ChatColor.RED, ClickEvent.Action.RUN_COMMAND, "/tpdeny", "Decline the teleport request (/tpdeny)", net.md_5.bungee.api.ChatColor.GRAY, false));
teleportResponses.append(createButton(messageManager.getRawMessage("tpa_decline_button"), net.md_5.bungee.api.ChatColor.RED, ClickEvent.Action.RUN_COMMAND, "/tpdeny", messageManager.getRawMessage("tpa_decline_button_tooltip"), net.md_5.bungee.api.ChatColor.GRAY, false));
// Create and send the message
p.spigot().sendMessage(teleportResponses.create());
+5
View File
@@ -56,6 +56,11 @@ error_spawn_undefined: '&4Error: &cThere is no spawn location defined on this se
error_tpa_no_pending_request: '&4Error: &cYou do not have a pending teleport request.'
error_player_not_found: '&4Error: &cCould not find the player %1%.'
return_by_death: '&7Return to where you died?:'
tpa_request_option_select: 'Click an option: '
tpa_accept_button: '[Accept]'
tpa_accept_button_tooltip: 'Accept the teleport request (/tpaccept)'
tpa_decline_button: '[Decline]'
tpa_decline_button_tooltip: 'Decline the teleport request (/tpdeny)'
tpa_you_accepted: '&aYou accepted %1%''s teleport request'
tpa_you_declined: '&cYou declined %1%''s teleport request'
tpa_has_accepted: '&a%1% accepted your teleport request'
+4
View File
@@ -47,6 +47,10 @@ error_spawn_undefined: '&4Error: &cThere is no spawn location defined on this se
error_tpa_no_pending_request: '&4錯誤: &c你并沒有等待中的傳送請求.'
error_player_not_found: '&4錯誤: &c找不到玩家->%1%.'
return_by_death: '返回到你死去的地方?:'
tpa_accept_button: '[Accept]'
tpa_accept_button_tooltip: 'Accept the teleport request (/tpaccept)'
tpa_decline_button: '[Decline]'
tpa_decline_button_tooltip: 'Decline the teleport request (/tpdeny)'
tpa_you_accepted: '&a你已接受 %1% 的傳送請求'
tpa_you_declined: '&c你已拒絕 %1% 的傳送請求'
tpa_has_accepted: '&a%1% 接受了你的傳送請求'