diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index c186b7b..0047074 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -4,7 +4,7 @@ me.justindevb VulcanReplay VulcanReplay - 1.3 + 1.4 http://maven.apache.org clean package install diff --git a/pom.xml b/pom.xml index e5817ea..f12bacd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ me.justindevb VulcanReplay - 1.3 + 1.4 jar VulcanReplay diff --git a/src/main/java/me/justindevb/VulcanReplay/PlayerListener.java b/src/main/java/me/justindevb/VulcanReplay/Listeners/PlayerListener.java similarity index 87% rename from src/main/java/me/justindevb/VulcanReplay/PlayerListener.java rename to src/main/java/me/justindevb/VulcanReplay/Listeners/PlayerListener.java index b1527a1..de7a33f 100644 --- a/src/main/java/me/justindevb/VulcanReplay/PlayerListener.java +++ b/src/main/java/me/justindevb/VulcanReplay/Listeners/PlayerListener.java @@ -1,4 +1,4 @@ -package me.justindevb.VulcanReplay; +package me.justindevb.VulcanReplay.Listeners; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -8,6 +8,9 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import me.justindevb.VulcanReplay.PlayerCache; +import me.justindevb.VulcanReplay.VulcanReplay; + public class PlayerListener implements Listener { private VulcanReplay vulcanReplay; diff --git a/src/main/java/me/justindevb/VulcanReplay/VulcanListener.java b/src/main/java/me/justindevb/VulcanReplay/Listeners/VulcanListener.java similarity index 89% rename from src/main/java/me/justindevb/VulcanReplay/VulcanListener.java rename to src/main/java/me/justindevb/VulcanReplay/Listeners/VulcanListener.java index fbf8fac..1603ef3 100644 --- a/src/main/java/me/justindevb/VulcanReplay/VulcanListener.java +++ b/src/main/java/me/justindevb/VulcanReplay/Listeners/VulcanListener.java @@ -1,4 +1,4 @@ -package me.justindevb.VulcanReplay; +package me.justindevb.VulcanReplay.Listeners; import java.awt.Color; import java.io.IOException; @@ -9,11 +9,11 @@ import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Random; import java.util.concurrent.TimeUnit; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Location; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -25,6 +25,9 @@ import me.frep.vulcan.api.event.VulcanFlagEvent; import me.frep.vulcan.api.event.VulcanPunishEvent; import me.jumper251.replay.api.ReplayAPI; +import me.justindevb.VulcanReplay.Util.DiscordWebhook; +import me.justindevb.VulcanReplay.PlayerCache; +import me.justindevb.VulcanReplay.VulcanReplay; public class VulcanListener implements Listener { @@ -40,6 +43,7 @@ public class VulcanListener implements Listener { private String SERVER_NAME = ""; private double PLAYER_RANGE = 0D; private long delay = 2; + private boolean OVERWRITE = false; final ReplayAPI replay = ReplayAPI.getInstance(); @@ -110,8 +114,7 @@ public void run() { replay.stopReplay(replayName, true); vulcanReplay.log("Saving recording of attempted hack...", false); vulcanReplay.log("Saved as: " + replayName, false); - sendDiscordWebhook(replayName, p, - getOnlineTime(loginTime, System.currentTimeMillis())); + sendDiscordWebhook(replayName, p, getOnlineTime(loginTime, System.currentTimeMillis())); punishList.remove(p.getName()); if (alertList.contains(p.getName())) @@ -196,9 +199,27 @@ private String getTimeStamp() { String[] part = time.split("T"); - return part[0]; + if (this.OVERWRITE) + return part[0]; + + return part[0] + "." + getRandomSalt(); + } + /** + * Random number between 1 and 100 + * @return + */ + private int getRandomSalt() { + Random rand = new Random(); + int n = 100 - 1 + 1; + int val = rand.nextInt() % n; + return Math.abs(val); + } + + /** + * Initialize our config values + */ private void initConfigFields() { FileConfiguration config = vulcanReplay.getConfig(); this.WEBHOOK_URL = config.getString("Discord.Webhook"); @@ -210,6 +231,7 @@ private void initConfigFields() { this.disabledRecordings = config.getStringList("General.Disabled-Recordings"); this.delay = config.getLong("General.Recording-Length"); + this.OVERWRITE = config.getBoolean("General.Overwrite"); } private long getOnlineTime(long loginTime, long currentTime) { diff --git a/src/main/java/me/justindevb/VulcanReplay/DiscordWebhook.java b/src/main/java/me/justindevb/VulcanReplay/Util/DiscordWebhook.java similarity index 99% rename from src/main/java/me/justindevb/VulcanReplay/DiscordWebhook.java rename to src/main/java/me/justindevb/VulcanReplay/Util/DiscordWebhook.java index 5ae1da6..f90cd10 100644 --- a/src/main/java/me/justindevb/VulcanReplay/DiscordWebhook.java +++ b/src/main/java/me/justindevb/VulcanReplay/Util/DiscordWebhook.java @@ -1,4 +1,4 @@ -package me.justindevb.VulcanReplay; +package me.justindevb.VulcanReplay.Util; import javax.net.ssl.HttpsURLConnection; import java.awt.Color; diff --git a/src/main/java/me/justindevb/VulcanReplpay/util/UpdateChecker.java b/src/main/java/me/justindevb/VulcanReplay/Util/UpdateChecker.java similarity index 96% rename from src/main/java/me/justindevb/VulcanReplpay/util/UpdateChecker.java rename to src/main/java/me/justindevb/VulcanReplay/Util/UpdateChecker.java index e3e7e12..3ee425c 100644 --- a/src/main/java/me/justindevb/VulcanReplpay/util/UpdateChecker.java +++ b/src/main/java/me/justindevb/VulcanReplay/Util/UpdateChecker.java @@ -1,4 +1,4 @@ -package me.justindevb.VulcanReplpay.util; +package me.justindevb.VulcanReplay.Util; import java.io.IOException; import java.io.InputStream; diff --git a/src/main/java/me/justindevb/VulcanReplay/VulcanReplay.java b/src/main/java/me/justindevb/VulcanReplay/VulcanReplay.java index 3aa58d8..e833bbc 100644 --- a/src/main/java/me/justindevb/VulcanReplay/VulcanReplay.java +++ b/src/main/java/me/justindevb/VulcanReplay/VulcanReplay.java @@ -11,10 +11,13 @@ import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import me.justindevb.VulcanReplpay.util.UpdateChecker; +import me.justindevb.VulcanReplay.Listeners.PlayerListener; +import me.justindevb.VulcanReplay.Listeners.VulcanListener; +import me.justindevb.VulcanReplay.Util.UpdateChecker; public class VulcanReplay extends JavaPlugin { @@ -31,6 +34,8 @@ public void onEnable() { initBstats(); checkForUpdate(); + + handleReload(); } @@ -110,11 +115,12 @@ private void initConfig() { list.add("strafe"); config.addDefault("Genral.Disabled-Recordings", list); config.addDefault("General.Recording-Length", 2); + config.addDefault("General.Overwrite", false); String path = "Discord."; config.addDefault(path + "Enabled", true); config.addDefault(path + "Webhook", "Enter webhook here"); - config.addDefault(path + "Avatar", "Enter link to a discord avatar"); + config.addDefault(path + "Avatar", "https://i.imgur.com/JPG1Kwk.png"); config.addDefault(path + "Username", "VulcanReplay"); config.addDefault(path + "Server-Name", "Server"); config.options().copyDefaults(true); @@ -186,4 +192,18 @@ private void checkForUpdate() { }); } + /** + * Attempt to handle if the plugin was reloaded with /reload or PlugMan + */ + private void handleReload() { + Bukkit.getScheduler().runTask(this, () -> { + if (!Bukkit.getOnlinePlayers().isEmpty()) { + for (Player p : Bukkit.getOnlinePlayers()) { + PlayerCache cachedPlayer = new PlayerCache(p, this); + putCachedPlayer(p.getUniqueId(), cachedPlayer); + } + } + }); + } + } diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$1.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$1.class deleted file mode 100644 index a55d8e0..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$1.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Author.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Author.class deleted file mode 100644 index f1e1071..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Author.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Field.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Field.class deleted file mode 100644 index a758380..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Field.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Footer.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Footer.class deleted file mode 100644 index e426916..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Footer.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Image.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Image.class deleted file mode 100644 index 48de0dd..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Image.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Thumbnail.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Thumbnail.class deleted file mode 100644 index 4c62584..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject$Thumbnail.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject.class deleted file mode 100644 index be7f6a1..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$EmbedObject.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook.class b/target/classes/me/justindevb/VulcanReplay/DiscordWebhook.class deleted file mode 100644 index 8363eef..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/PlayerListener.class b/target/classes/me/justindevb/VulcanReplay/Listeners/PlayerListener.class similarity index 59% rename from target/classes/me/justindevb/VulcanReplay/PlayerListener.class rename to target/classes/me/justindevb/VulcanReplay/Listeners/PlayerListener.class index 43506e4..552e576 100644 Binary files a/target/classes/me/justindevb/VulcanReplay/PlayerListener.class and b/target/classes/me/justindevb/VulcanReplay/Listeners/PlayerListener.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/VulcanListener$1.class b/target/classes/me/justindevb/VulcanReplay/Listeners/VulcanListener$1.class similarity index 50% rename from target/classes/me/justindevb/VulcanReplay/VulcanListener$1.class rename to target/classes/me/justindevb/VulcanReplay/Listeners/VulcanListener$1.class index 630184a..0157380 100644 Binary files a/target/classes/me/justindevb/VulcanReplay/VulcanListener$1.class and b/target/classes/me/justindevb/VulcanReplay/Listeners/VulcanListener$1.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Listeners/VulcanListener.class b/target/classes/me/justindevb/VulcanReplay/Listeners/VulcanListener.class new file mode 100644 index 0000000..8d09138 Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Listeners/VulcanListener.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$1.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$1.class new file mode 100644 index 0000000..4679c13 Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$1.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Author.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Author.class new file mode 100644 index 0000000..8379f6e Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Author.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Field.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Field.class new file mode 100644 index 0000000..505b13d Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Field.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Footer.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Footer.class new file mode 100644 index 0000000..4931f96 Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Footer.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Image.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Image.class new file mode 100644 index 0000000..79df7b5 Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Image.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Thumbnail.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Thumbnail.class new file mode 100644 index 0000000..1cbe96f Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject$Thumbnail.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject.class new file mode 100644 index 0000000..a7f35d5 Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$EmbedObject.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$JSONObject.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$JSONObject.class similarity index 69% rename from target/classes/me/justindevb/VulcanReplay/DiscordWebhook$JSONObject.class rename to target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$JSONObject.class index f61e9ee..803825f 100644 Binary files a/target/classes/me/justindevb/VulcanReplay/DiscordWebhook$JSONObject.class and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook$JSONObject.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook.class b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook.class new file mode 100644 index 0000000..4a6e821 Binary files /dev/null and b/target/classes/me/justindevb/VulcanReplay/Util/DiscordWebhook.class differ diff --git a/target/classes/me/justindevb/VulcanReplpay/util/UpdateChecker.class b/target/classes/me/justindevb/VulcanReplay/Util/UpdateChecker.class similarity index 84% rename from target/classes/me/justindevb/VulcanReplpay/util/UpdateChecker.class rename to target/classes/me/justindevb/VulcanReplay/Util/UpdateChecker.class index 831819a..d507db9 100644 Binary files a/target/classes/me/justindevb/VulcanReplpay/util/UpdateChecker.class and b/target/classes/me/justindevb/VulcanReplay/Util/UpdateChecker.class differ diff --git a/target/classes/me/justindevb/VulcanReplay/VulcanListener.class b/target/classes/me/justindevb/VulcanReplay/VulcanListener.class deleted file mode 100644 index 6526551..0000000 Binary files a/target/classes/me/justindevb/VulcanReplay/VulcanListener.class and /dev/null differ diff --git a/target/classes/me/justindevb/VulcanReplay/VulcanReplay.class b/target/classes/me/justindevb/VulcanReplay/VulcanReplay.class index c67b579..0e2aef8 100644 Binary files a/target/classes/me/justindevb/VulcanReplay/VulcanReplay.class and b/target/classes/me/justindevb/VulcanReplay/VulcanReplay.class differ diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml index 0b3c048..6457bf9 100644 --- a/target/classes/plugin.yml +++ b/target/classes/plugin.yml @@ -1,6 +1,6 @@ name: VulcanReplay main: me.justindevb.VulcanReplay.VulcanReplay -version: 1.3 +version: 1.4 author: JustinDevB depend: [AdvancedReplay, Vulcan] api-version: 1.13 \ No newline at end of file diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 9e04477..8ddb30f 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Wed Nov 24 10:02:13 CST 2021 +#Wed Nov 24 13:33:52 CST 2021 groupId=me.justindevb artifactId=VulcanReplay -version=1.3 +version=1.4 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index d09d2c7..5568c49 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,15 +1,15 @@ +me\justindevb\VulcanReplay\Util\DiscordWebhook$1.class me\justindevb\VulcanReplay\VulcanReplay.class -me\justindevb\VulcanReplay\VulcanListener.class -me\justindevb\VulcanReplay\DiscordWebhook$EmbedObject$Image.class -me\justindevb\VulcanReplay\DiscordWebhook$JSONObject.class -me\justindevb\VulcanReplay\DiscordWebhook.class -me\justindevb\VulcanReplay\DiscordWebhook$EmbedObject$Author.class -me\justindevb\VulcanReplay\DiscordWebhook$EmbedObject.class -me\justindevb\VulcanReplay\VulcanListener$1.class -me\justindevb\VulcanReplay\PlayerListener.class -me\justindevb\VulcanReplay\DiscordWebhook$EmbedObject$Footer.class -me\justindevb\VulcanReplpay\util\UpdateChecker.class -me\justindevb\VulcanReplay\DiscordWebhook$EmbedObject$Field.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$EmbedObject$Author.class +me\justindevb\VulcanReplay\Listeners\PlayerListener.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$EmbedObject$Thumbnail.class +me\justindevb\VulcanReplay\Listeners\VulcanListener.class +me\justindevb\VulcanReplay\Util\UpdateChecker.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$EmbedObject$Field.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$EmbedObject.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$EmbedObject$Image.class me\justindevb\VulcanReplay\PlayerCache.class -me\justindevb\VulcanReplay\DiscordWebhook$1.class -me\justindevb\VulcanReplay\DiscordWebhook$EmbedObject$Thumbnail.class +me\justindevb\VulcanReplay\Listeners\VulcanListener$1.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$JSONObject.class +me\justindevb\VulcanReplay\Util\DiscordWebhook$EmbedObject$Footer.class +me\justindevb\VulcanReplay\Util\DiscordWebhook.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index f84f205..12ff32f 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,6 +1,6 @@ -C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplpay\util\UpdateChecker.java +C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\Util\DiscordWebhook.java +C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\Util\UpdateChecker.java C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\PlayerCache.java -C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\PlayerListener.java -C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\VulcanListener.java +C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\Listeners\PlayerListener.java +C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\Listeners\VulcanListener.java C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\VulcanReplay.java -C:\Users\Justin\eclipse-workspace\VulcanReplay\src\main\java\me\justindevb\VulcanReplay\DiscordWebhook.java diff --git a/target/original-VulcanReplay-1.3.jar b/target/original-VulcanReplay-1.3.jar deleted file mode 100644 index d080372..0000000 Binary files a/target/original-VulcanReplay-1.3.jar and /dev/null differ diff --git a/target/original-VulcanReplay-1.4.jar b/target/original-VulcanReplay-1.4.jar new file mode 100644 index 0000000..c7c9b0b Binary files /dev/null and b/target/original-VulcanReplay-1.4.jar differ