Fix escape formatting (#5)

Fix escape formatting and refactor BlockEvent

Signed-off-by: Etzelia <etzelia@hotmail.com>

Reviewed-on: https://git.etztech.xyz/Minecraft/MineAlert/pulls/5
Reviewed-by: ZeroHD <joey@ahines.net>
master
Etzelia 2020-08-04 22:29:45 +02:00
parent cff2af302f
commit 23356da050
2 changed files with 32 additions and 32 deletions

View File

@ -74,9 +74,9 @@ public class GriefAlertListener implements Listener {
extra.append(" and pinging Discord"); extra.append(" and pinging Discord");
Embed embed = new Embed() Embed embed = new Embed()
.color(color.getInt()) .color(color.getInt())
.description(alert) .description(Javacord.escapeFormat(alert))
.timestamp(OffsetDateTime.now()) .timestamp(OffsetDateTime.now())
.author(new Author(Javacord.escapeFormat(playerName), .author(new Author(playerName,
!"".equals(usernameURL) ? usernameURL : "", !"".equals(usernameURL) ? usernameURL : "",
String.format("https://minotar.net/helm/%s/100.png", playerName), String.format("https://minotar.net/helm/%s/100.png", playerName),
"")); ""));

View File

@ -200,9 +200,9 @@ public class OreAlertListener implements Listener {
if (!"".equals(webhook)) { if (!"".equals(webhook)) {
Embed embed = new Embed() Embed embed = new Embed()
.color(Color.hexToInt(hexColor)) .color(Color.hexToInt(hexColor))
.description(message) .description(Javacord.escapeFormat(message))
.timestamp(OffsetDateTime.now()) .timestamp(OffsetDateTime.now())
.author(new Author(Javacord.escapeFormat(event.getPlayer().getName()), .author(new Author(event.getPlayer().getName(),
!"".equals(usernameURL) ? usernameURL : "", !"".equals(usernameURL) ? usernameURL : "",
String.format("https://minotar.net/helm/%s/100.png", event.getPlayer().getName()), String.format("https://minotar.net/helm/%s/100.png", event.getPlayer().getName()),
"")); ""));
@ -227,9 +227,8 @@ public class OreAlertListener implements Listener {
public static Queue<BlockEvent> getQueue() { public static Queue<BlockEvent> getQueue() {
return queue; return queue;
} }
}
class BlockEvent { private static class BlockEvent {
private final Player player; private final Player player;
private final Material material; private final Material material;
private final Location location; private final Location location;
@ -263,4 +262,5 @@ class BlockEvent {
public Date getTime() { public Date getTime() {
return time; return time;
} }
}
} }