diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/artifacts/RomanAC_jar.xml b/.idea/artifacts/RomanAC_jar.xml
deleted file mode 100644
index 7e851c4..0000000
--- a/.idea/artifacts/RomanAC_jar.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- $PROJECT_DIR$/out/artifacts/RomanAC_jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index e40703e..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/discord.xml b/.idea/discord.xml
deleted file mode 100644
index d8e9561..0000000
--- a/.idea/discord.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index aa00ffa..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
deleted file mode 100644
index 88cedb2..0000000
--- a/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index ae9c995..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index ff1a178..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
deleted file mode 100644
index 2b63946..0000000
--- a/.idea/uiDesigner.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0edf83c..a95fdfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,10 @@
+
+ jitpack.io
+ https://jitpack.io
+
spigotmc-repo
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
@@ -70,6 +74,11 @@
+
+ com.github.micartey
+ webhookly
+ master-SNAPSHOT
+
org.spigotmc
spigot-api
diff --git a/src/main/java/it/creeper/roman/Roman.java b/src/main/java/it/creeper/roman/Roman.java
index f0e8b89..553f62d 100644
--- a/src/main/java/it/creeper/roman/Roman.java
+++ b/src/main/java/it/creeper/roman/Roman.java
@@ -25,7 +25,7 @@ public final class Roman extends JavaPlugin {
public Mathemathics math;
public Data data;
public Map hittedPlayers = new HashMap<>();
- public static Long minToTick(long min) {
+ public static long minToTick(long min) {
return min * 60 * 20;
}
public void onEnable() {
@@ -105,4 +105,5 @@ public Ban getBanManager() {
public Mathemathics getMath() {
return math;
}
+
}
diff --git a/src/main/java/it/creeper/roman/notify/CheatNotify.java b/src/main/java/it/creeper/roman/notify/CheatNotify.java
index dcd24cf..9aaa426 100644
--- a/src/main/java/it/creeper/roman/notify/CheatNotify.java
+++ b/src/main/java/it/creeper/roman/notify/CheatNotify.java
@@ -3,12 +3,12 @@
import it.creeper.roman.Roman;
import it.creeper.roman.check.CheckInfo;
import me.clip.placeholderapi.PlaceholderAPI;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Server;
+import me.micartey.webhookly.DiscordWebhook;
+import me.micartey.webhookly.embeds.EmbedObject;
+import org.bukkit.*;
import org.bukkit.entity.Player;
+import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@@ -74,11 +74,26 @@ public void fail(Player player, String... debug) {
//Bukkit.broadcast(ChatColor.translateAlternateColorCodes('&', ALERT_PREFIX + " "+"&6"+ cheater.getName() + " &r&7potrebbe star utilizzando &2&l"+check+" &r&7VL: " + vl.get(cheater)), "roman.notify");
Bukkit.broadcast(ChatColor.translateAlternateColorCodes('&', ALERT_PREFIX + " " + ALERT_MESSAGE + " &7" + Arrays.toString(debug)), "roman.notify");
ALERT_MESSAGE = plugin.getConfig().getString("messages.alert-message");
+
+ // webhook discord
+
+ DiscordWebhook webhook = new DiscordWebhook(plugin.getConfig().getString("discord.webhook-url"));
+ webhook.setAvatarUrl(plugin.getConfig().getString("discord.webhook-avatar"));
+ webhook.setUsername(plugin.getConfig().getString("discord.webhook-username"));
+
+ EmbedObject embed = new EmbedObject()
+ .setTitle(plugin.getConfig().getString("discord.embed-title"))
+ .setColor(new Color(255, 0 ,0))
+ .setDescription(ALERT_MESSAGE);
+
+ webhook.getEmbeds().add(embed);
+ webhook.execute();
+
}
} else {
- System.out.println("Nessuna annotazione MyAnnotation trovata sulla classe chiamante.");
+ System.out.println("// FAIL //");
}
- } catch (ClassNotFoundException e) {
+ } catch (ClassNotFoundException | IOException e) {
e.printStackTrace();
}
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index c39d5e0..68e8865 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -33,3 +33,11 @@ checks:
punishment: "kick"
test-1: false
test-2: false
+
+
+discord:
+ webhook-url: ""
+ webhook-avatar: ""
+ webhook-username: ""
+ # now we do the embed
+ embed-title: ""