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");
Embed embed = new Embed()
.color(color.getInt())
.description(alert)
.description(Javacord.escapeFormat(alert))
.timestamp(OffsetDateTime.now())
.author(new Author(Javacord.escapeFormat(playerName),
.author(new Author(playerName,
!"".equals(usernameURL) ? usernameURL : "",
String.format("https://minotar.net/helm/%s/100.png", playerName),
""));

View File

@ -200,9 +200,9 @@ public class OreAlertListener implements Listener {
if (!"".equals(webhook)) {
Embed embed = new Embed()
.color(Color.hexToInt(hexColor))
.description(message)
.description(Javacord.escapeFormat(message))
.timestamp(OffsetDateTime.now())
.author(new Author(Javacord.escapeFormat(event.getPlayer().getName()),
.author(new Author(event.getPlayer().getName(),
!"".equals(usernameURL) ? usernameURL : "",
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() {
return queue;
}
}
class BlockEvent {
private final Player player;
private final Material material;
private final Location location;
private final Boolean parent;
private final Date time;
private static class BlockEvent {
private final Player player;
private final Material material;
private final Location location;
private final Boolean parent;
private final Date time;
BlockEvent(Player player, Material material, Location location, Boolean parent) {
this.player = player;
this.material = material;
this.location = location;
this.parent = parent;
this.time = Calendar.getInstance().getTime();
}
BlockEvent(Player player, Material material, Location location, Boolean parent) {
this.player = player;
this.material = material;
this.location = location;
this.parent = parent;
this.time = Calendar.getInstance().getTime();
}
public Player getPlayer() {
return player;
}
public Player getPlayer() {
return player;
}
public Material getMaterial() {
return material;
}
public Material getMaterial() {
return material;
}
public Location getLocation() {
return location;
}
public Location getLocation() {
return location;
}
public Boolean isParent() {
return parent;
}
public Boolean isParent() {
return parent;
}
public Date getTime() {
return time;
public Date getTime() {
return time;
}
}
}