Fix brackets not being escaped properly in descriptions

Signed-off-by: BuildTools <[email protected]>
This commit is contained in:
BuildTools committed 2021-07-14 16:50:19 +03:00
1 parent 06754c88a4
commit 280a37ef5b
7 files changed
+14 -14

No files matched your search

@@ -9,7 +9,7 @@ public class EditingHandler {
public static void showEditHomeOptions(Player p, Home home) {
MessageManager.sendMessage(p, "edit_home_title", home.getName());
p.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("edit_description")).replaceFirst(false).replace("%1%", home.getDescription()).toComponent());
MessageManager.sendMessage(p, "edit_description", MineDown.escape(home.getDescription().replace("]", "]").replace("[", "[").replace("(", "❲").replace(")", "❳")));
MessageManager.sendMessage(p, "edit_location",
Integer.toString((int) home.getX()),
Integer.toString((int) home.getY()),
@@ -37,7 +37,7 @@ public class EditingHandler {
public static void showEditWarpOptions(Player p, Warp warp) {
MessageManager.sendMessage(p, "edit_warp_title", warp.getName());
p.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("edit_description")).replaceFirst(false).replace("%1%", warp.getDescription()).toComponent());
MessageManager.sendMessage(p, "edit_description", MineDown.escape(warp.getDescription().replace("]", "]").replace("[", "[").replace("(", "❲").replace(")", "❳")));
MessageManager.sendMessage(p, "edit_location",
Integer.toString((int) warp.getX()),
Integer.toString((int) warp.getY()),
@@ -163,7 +163,7 @@ public class EditHomeCommand extends CommandBase implements TabCompleter {
}
// Confirmation message
MessageManager.sendMessage(p, "edit_home_update_description", homeName, MineDown.escape(newDescriptionString));
MessageManager.sendMessage(p, "edit_home_update_description", homeName, MineDown.escape(newDescriptionString.replace("]", "]").replace("[", "[").replace("(", "❲").replace(")", "❳")));
} catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home description.");
}
@@ -158,7 +158,7 @@ public class EditWarpCommand extends CommandBase implements TabCompleter {
}
// Confirmation message
MessageManager.sendMessage(p, "edit_warp_update_description", warpName, MineDown.escape(newDescriptionString));
MessageManager.sendMessage(p, "edit_warp_update_description", warpName, MineDown.escape(newDescriptionString.replace("]", "]").replace("[", "[").replace("(", "❲").replace(")", "❳")));
} catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a warp's description.");
}
@@ -46,7 +46,7 @@ public class HomeListCommand extends CommandBase {
ArrayList<String> homeList = new ArrayList<>();
for (Home home : homes) {
homeList.add(MessageManager.getRawMessage("home_list_item", home.getName(), MineDown.escape(home.getDescription())));
homeList.add(MessageManager.getRawMessage("home_list_item", home.getName(), MineDown.escape(home.getDescription().replace("]", "]").replace("[", "[").replace("(", "❲").replace(")", "❳"))));
}
final int itemsPerPage = HuskHomes.getSettings().getPrivateHomesPerPage();
@@ -48,7 +48,7 @@ public class WarpListCommand extends CommandBase {
}
}
}
warpList.add(MessageManager.getRawMessage("warp_list_item", warp.getName(), MineDown.escape(warp.getDescription()))); //todo escape formatting on warp desc
warpList.add(MessageManager.getRawMessage("warp_list_item", warp.getName(), MineDown.escape(warp.getDescription().replace("]", "]").replace("[", "[").replace("(", "❲").replace(")", "❳"))));
}
if (warpList.isEmpty()) {
MessageManager.sendMessage(player, "error_no_warps_set");
+4 -4
View File
@@ -15,9 +15,9 @@ error_home_invalid: '[Error:](#ff3300) [You do not have a home named "%1%"](#ff7
error_warp_invalid: '[Error:](#ff3300) [There is no warp set named "%1%"](#ff7e5e)'
error_invalid_syntax: '[Error:](#ff3300) [Incorrect syntax. Usage: %1%](#ff7e5e)'
edit_home_title: '\n[Edit home details for](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)'
edit_home_options: '\n[[Teleport]](green show_text=&7Teleport to your home run_command=/huskhomes:home %1%) [[Delete]](red show_text=&7Delete your home run_command=/huskhomes:delhome %1%) [[Relocate]](blue show_text=&7Update your home''s location run_command=/huskhomes:edithome %1% location)\n[[Rename]](yellow show_text=&7Change the name of your home run_command=/huskhomes:edithome %1% rename ) [[Edit Description]](gold show_text=&7Update the description of your home run_command=/huskhomes:edithome %1% description )\n'
edit_home_options_make_public: '\n[[Teleport]](green show_text=&7Teleport to your home run_command=/huskhomes:home %1%) [[Delete]](red show_text=&7Delete your home run_command=/huskhomes:delhome %1%) [[Relocate]](blue show_text=&7Update your home''s location run_command=/huskhomes:edithome %1% location)\n[[Rename]](yellow show_text=&7Change the name of your home run_command=/huskhomes:edithome %1% rename ) [[Edit Description]](gold show_text=&7Update the description of your home run_command=/huskhomes:edithome %1% description ) [[Make Public]](dark_green show_text=&7Open your home to the public run_command=/huskhomes:edithome %1% public)\n'
edit_home_options_make_private: '\n[[Teleport]](green show_text=&7Teleport to your home run_command=/huskhomes:home %1%) [[Delete]](red show_text=&7Delete your home run_command=/huskhomes:delhome %1%) [[Relocate]](blue show_text=&7Update your home''s location run_command=/huskhomes:edithome %1% location)\n[[Rename]](yellow show_text=&7Change the name of your home run_command=/huskhomes:edithome %1% rename ) [[Edit Description]](gold show_text=&7Update the description of your home run_command=/huskhomes:edithome %1% description ) [[Make Private]](dark_red show_text=&7Make your home private run_command=/huskhomes:edithome %1% private)\n'
edit_home_options: '\n[[Teleport]](green show_text=&7Teleport to your home run_command=/huskhomes:home %1%) [[Delete]](red show_text=&7Delete your home run_command=/huskhomes:delhome %1%) [[Relocate]](blue show_text=&7Update your home''s location run_command=/huskhomes:edithome %1% location)\n[[Rename]](yellow show_text=&7Change the name of your home suggest_command=/huskhomes:edithome %1% rename ) [[Edit Description]](gold show_text=&7Update the description of your home suggest_command=/huskhomes:edithome %1% description )\n'
edit_home_options_make_public: '\n[[Teleport]](green show_text=&7Teleport to your home run_command=/huskhomes:home %1%) [[Delete]](red show_text=&7Delete your home run_command=/huskhomes:delhome %1%) [[Relocate]](blue show_text=&7Update your home''s location run_command=/huskhomes:edithome %1% location)\n[[Rename]](yellow show_text=&7Change the name of your home suggest_command=/huskhomes:edithome %1% rename ) [[Edit Description]](gold show_text=&7Update the description of your home suggest_command=/huskhomes:edithome %1% description ) [[Make Public]](dark_green show_text=&7Open your home to the public run_command=/huskhomes:edithome %1% public)\n'
edit_home_options_make_private: '\n[[Teleport]](green show_text=&7Teleport to your home run_command=/huskhomes:home %1%) [[Delete]](red show_text=&7Delete your home run_command=/huskhomes:delhome %1%) [[Relocate]](blue show_text=&7Update your home''s location run_command=/huskhomes:edithome %1% location)\n[[Rename]](yellow show_text=&7Change the name of your home suggest_command=/huskhomes:edithome %1% rename ) [[Edit Description]](gold show_text=&7Update the description of your home suggest_command=/huskhomes:edithome %1% description ) [[Make Private]](dark_red show_text=&7Make your home private run_command=/huskhomes:edithome %1% private)\n'
edit_home_privacy_private: '• Access: &#ff7e5e&Private &7(Only you can use it)'
edit_home_privacy_public: '• Access: &aPublic &7(Anyone can use it)'
edit_home_privacy_public_success: '[Successfully made your home,](#00fb9a) [%1%](#00fb9a bold)[, open to the public.](#00fb9a)'
@@ -32,7 +32,7 @@ edit_home_update_location: '[Re-located](#00fb9a) [%1%](#00fb9a bold) [to your c
edit_home_update_description: '[Changed the description for](#00fb9a) [%1%](#00fb9a bold) [to "%2%"](#00fb9a)'
edit_home_update_name: '[Successfully changed your home''s name: %1% →](#00fb9a) [%2%](#00fb9a bold)'
edit_warp_title: '\n[Edit details for the warp](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)'
edit_warp_options: '\n[[Teleport]](green show_text=&7Teleport to this warp run_command=/huskhomes:warp %1%) [[Delete]](red show_text=&7Delete this warp run_command=/huskhomes:delwarp %1%) [[Relocate]](blue show_text=&7Update this warp''s location run_command=/huskhomes:editwarp %1% location)\n[[Rename]](yellow show_text=&7Change the name of this warp run_command=/huskhomes:editwarp %1% rename ) [[Edit Description]](gold show_text=&7Update this warp''s description run_command=/huskhomes:editwarp %1% description )\n'
edit_warp_options: '\n[[Teleport]](green show_text=&7Teleport to this warp run_command=/huskhomes:warp %1%) [[Delete]](red show_text=&7Delete this warp run_command=/huskhomes:delwarp %1%) [[Relocate]](blue show_text=&7Update this warp''s location run_command=/huskhomes:editwarp %1% location)\n[[Rename]](yellow show_text=&7Change the name of this warp suggest_command=/huskhomes:editwarp %1% rename ) [[Edit Description]](gold show_text=&7Update this warp''s description suggest_command=/huskhomes:editwarp %1% description )\n'
error_edit_warp_description_length: '[Error:](#ff3300) [Warp descriptions must be less than 255 characters in length.](#ff7e5e)'
error_edit_warp_description_characters: '[Error:](#ff3300) [Warp descriptions may only contain alphanumeric (A-Z, 0-9) characters, hyphens (-) and underscores (_)](#ff7e5e)'
edit_warp_update_location: '[Re-located the warp](#00fb9a) [%1%](#00fb9a bold) [to your current position.](#00fb9a)'
+4 -4
View File
@@ -15,9 +15,9 @@ error_home_invalid: '[Errore:](#ff3300) [Non hai nessuna home chiamata "%1%"](#f
error_warp_invalid: '[Errore:](#ff3300) [Non c’’è nessun warp chiamato "%1%"](#ff7e5e)'
error_invalid_syntax: '[Errore:](#ff3300) [Comando non riconosciuto. Utilizza: %1%](#ff7e5e)'
edit_home_title: '[Modifica della home](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)'
edit_home_options: '[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home run_command=/huskhomes:edithome %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home run_command=/huskhomes:edithome %1% description )'
edit_home_options_make_public: '[[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home run_command=/huskhomes:edithome %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home run_command=/huskhomes:edithome %1% description ) [[Rendi Pubblica]](dark_green show_text=&7Rendi la tua home pubblica run_command=/huskhomes:edithome %1% public)'
edit_home_options_make_private: '[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home run_command=/huskhomes:edithome %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home run_command=/huskhomes:edithome %1% description ) [[Rendi Privata]](dark_red show_text=&7Rendi la tua home privata run_command=/huskhomes:edithome %1% private)'
edit_home_options: '[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home suggest_command=/huskhomes:edithome %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home suggest_command=/huskhomes:edithome %1% description )'
edit_home_options_make_public: '[[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home suggest_command=/huskhomes:edithome %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home suggest_command=/huskhomes:edithome %1% description ) [[Rendi Pubblica]](dark_green show_text=&7Rendi la tua home pubblica run_command=/huskhomes:edithome %1% public)'
edit_home_options_make_private: '[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home suggest_command=/huskhomes:edithome %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home suggest_command=/huskhomes:edithome %1% description ) [[Rendi Privata]](dark_red show_text=&7Rendi la tua home privata run_command=/huskhomes:edithome %1% private)'
edit_home_privacy_private: '• Accesso: &#ff7e5e&Privata &7(Solo tu puoi usarla)'
edit_home_privacy_public: '• Accesso: &aPubblica &7(Tutti possono usarla)'
edit_home_privacy_public_success: '[Hai impostato la privacy della tua home](#00fb9a) [%1%](#00fb9a bold) [come pubblica.](#00fb9a)'
@@ -32,7 +32,7 @@ edit_home_update_location: '[Hai riposizionato la home](#00fb9a) [%1%](#00fb9a b
edit_home_update_description: '[Hai cambiato la descrizione di](#00fb9a) [%1%](#00fb9a bold) [in "%2%"](#00fb9a)'
edit_home_update_name: '[Hai cambiato il nome della tua home: %1% →](#00fb9a) [%2%](#00fb9a bold)'
edit_warp_title: '[Modifica dettagli del warp](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)'
edit_warp_options: '[[Teletrasporto]](green show_text=&7Teletrasportati al warp run_command=/huskhomes:warp %1%) [[Cancella]](red show_text=&7Cancella il warp run_command=/huskhomes:delwarp %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate del warp run_command=/huskhomes:editwarp %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome del warp run_command=/huskhomes:editwarp %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione del warp run_command=/huskhomes:editwarp %1% description )'
edit_warp_options: '[[Teletrasporto]](green show_text=&7Teletrasportati al warp run_command=/huskhomes:warp %1%) [[Cancella]](red show_text=&7Cancella il warp run_command=/huskhomes:delwarp %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate del warp run_command=/huskhomes:editwarp %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome del warp suggest_command=/huskhomes:editwarp %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione del warp suggest_command=/huskhomes:editwarp %1% description )'
error_edit_warp_description_length: '[Error:](#ff3300) [Warp descriptions must be less than 255 characters in length.](#ff7e5e)'
error_edit_warp_description_characters: '[Error:](#ff3300) [Warp descriptions may only contain alphanumeric (A-Z, 0-9) characters, hyphens (-) and underscores (_)](#ff7e5e)'
edit_warp_update_location: '[Riposizionato il warp](#00fb9a) [%1%](#00fb9a bold) [alla tua posizione attuale.](#00fb9a)'