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,40 +227,40 @@ 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;
private final Boolean parent; private final Boolean parent;
private final Date time; private final Date time;
BlockEvent(Player player, Material material, Location location, Boolean parent) { BlockEvent(Player player, Material material, Location location, Boolean parent) {
this.player = player; this.player = player;
this.material = material; this.material = material;
this.location = location; this.location = location;
this.parent = parent; this.parent = parent;
this.time = Calendar.getInstance().getTime(); this.time = Calendar.getInstance().getTime();
} }
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
public Material getMaterial() { public Material getMaterial() {
return material; return material;
} }
public Location getLocation() { public Location getLocation() {
return location; return location;
} }
public Boolean isParent() { public Boolean isParent() {
return parent; return parent;
} }
public Date getTime() { public Date getTime() {
return time; return time;
}
} }
} }