diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4788b4b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,113 @@
+# User-specific stuff
+.idea/
+
+*.iml
+*.ipr
+*.iws
+
+# IntelliJ
+out/
+
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+target/
+
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+.flattened-pom.xml
+
+# Common working directory
+run/
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..0fecd7c
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,74 @@
+
+
+ 4.0.0
+
+ me.almana
+ DamageIndicator
+ 1.0
+ jar
+
+ DamageIndicator
+
+
+ 1.8
+ UTF-8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 16
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+ false
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ papermc-repo
+ https://papermc.io/repo/repository/maven-public/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+
+
+
+ io.papermc.paper
+ paper-api
+ 1.18.1-R0.1-SNAPSHOT
+ provided
+
+
+
diff --git a/src/main/java/me/almana/damageindicator/Commands/DamageIndicatorCommand.java b/src/main/java/me/almana/damageindicator/Commands/DamageIndicatorCommand.java
new file mode 100644
index 0000000..32911d7
--- /dev/null
+++ b/src/main/java/me/almana/damageindicator/Commands/DamageIndicatorCommand.java
@@ -0,0 +1,154 @@
+package me.almana.damageindicator.Commands;
+
+import me.almana.damageindicator.DamageIndicator;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.format.TextColor;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabExecutor;
+import org.bukkit.plugin.Plugin;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DamageIndicatorCommand implements TabExecutor {
+
+ private Plugin plugin = DamageIndicator.getPlugin();
+
+ @Override
+ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
+
+ if (command.getName().equalsIgnoreCase("damageindicator")) {
+
+ if (args.length > 0) {
+
+ if (args[0].equalsIgnoreCase("disable")) {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Disabling plugin...").color(TextColor.color(243, 141, 102)));
+ sender.sendMessage(message);
+ plugin.getServer().getPluginManager().disablePlugin(plugin);
+ } else if (args[0].equalsIgnoreCase("setItem")) {
+
+ if (args.length > 1 && args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Set item indicator to ")).color(TextColor.color(197, 233, 127))
+ .append(Component.text(args[1])).color(TextColor.color(197, 233, 127));
+ sender.sendMessage(message);
+
+ Boolean b = Boolean.parseBoolean(args[1]);
+ plugin.getConfig().set("ITEM", b);
+ plugin.getConfig().set("ARMOR_STAND", !b);
+ } else {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Usage: /damageindicator setitem [true/false]")).color(TextColor.color(243, 141, 102));
+ sender.sendMessage(message);
+ }
+ } else if (args[0].equalsIgnoreCase("setstand")) {
+
+ if (args.length > 1 && args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Set stand indicator to ")).color(TextColor.color(197, 233, 127))
+ .append(Component.text(args[1])).color(TextColor.color(197, 233, 127));
+ sender.sendMessage(message);
+
+ Boolean b = Boolean.parseBoolean(args[1]);
+ plugin.getConfig().set("ITEM", !b);
+ plugin.getConfig().set("ARMOR_STAND", b);
+ } else {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Usage: /damageindicator setstand [true/false]")).color(TextColor.color(243, 141, 102));
+ sender.sendMessage(message);
+ }
+ } else if (args[0].equalsIgnoreCase("onlyplayer")) {
+
+ if (args.length > 1 && args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Set only player to ")).color(TextColor.color(197, 233, 127))
+ .append(Component.text(args[1])).color(TextColor.color(197, 233, 127));
+ sender.sendMessage(message);
+
+ Boolean b = Boolean.parseBoolean(args[1]);
+ plugin.getConfig().set("ONLY_PLAYER", b);
+ } else {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Usage: /damageindicator onlyplayer [true/false]")).color(TextColor.color(243, 141, 102));
+ sender.sendMessage(message);
+ }
+ } else if (args[0].equalsIgnoreCase("info")) {
+
+ TextComponent message = Component.text("[Damage Indicator] \n", TextColor.color(27, 141, 255))
+ .append(Component.text("Plugin Author: AlmanaX21\n").color(TextColor.color(253, 204, 87)))
+ .append(Component.text("Server Version: ").color(TextColor.color(253, 204, 87)))
+ .append(Component.text(plugin.getServer().getVersion()).color(TextColor.color(253, 204, 87)))
+ .append(Component.text("\n"))
+ .append(Component.text("--------------------\n").color(TextColor.color(102, 119, 112)))
+ .append(Component.text("Config\n")).color(TextColor.color(115, 145, 226))
+ .append(Component.text("Only Player: ").color(TextColor.color(115, 145, 226))).append(Component.text(plugin.getConfig().getBoolean("ONLY_PLAYER")))
+ .append(Component.newline())
+ .append(Component.text("X offset: ").color(TextColor.color(115, 145, 226)))
+ .append(Component.text(plugin.getConfig().getDouble("LOCATION.X")).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
+ .append(Component.text("Y offset: ").color(TextColor.color(115, 145, 226)))
+ .append(Component.text(plugin.getConfig().getDouble("LOCATION.Y")).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
+ .append(Component.text("Z offset: ").color(TextColor.color(115, 145, 226)))
+ .append(Component.text(plugin.getConfig().getDouble("LOCATION.Z")).color(TextColor.color(115, 145, 226)));
+ sender.sendMessage(message);
+ } else if (args[0].equalsIgnoreCase("setoffset")) {
+ if (args.length == 4) {
+
+ double x = Double.parseDouble(args[1]);
+ double y = Double.parseDouble(args[2]);
+ double z = Double.parseDouble(args[3]);
+
+ plugin.getConfig().set("LOCATION.X", x);
+ plugin.getConfig().set("LOCATION.Y", y);
+ plugin.getConfig().set("LOCATION.Z", z);
+
+ TextComponent message = Component.text("[Damage Indicator] \n", TextColor.color(27, 141, 255))
+ .append(Component.text("X offset: ").color(TextColor.color(115, 145, 226)))
+ .append(Component.text(x).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
+ .append(Component.text("Y offset: ").color(TextColor.color(115, 145, 226)))
+ .append(Component.text(y).color(TextColor.color(115, 145, 226))).append(Component.text("\n"))
+ .append(Component.text("Z offset: ").color(TextColor.color(115, 145, 226)))
+ .append(Component.text(z).color(TextColor.color(115, 145, 226)));
+ sender.sendMessage(message);
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public @Nullable List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
+
+ List arg1 = new ArrayList<>();
+ List arg2 = new ArrayList<>();
+ if (args.length == 1) {
+
+ arg1.add("disable");
+ arg1.add("info");
+ arg1.add("onlyplayer");
+ arg1.add("setoffset");
+
+ return arg1;
+ } else if (args.length == 2) {
+ if (args[0].equalsIgnoreCase("onlyplayer")) {
+
+ arg2.add("true");
+ arg2.add("false");
+ return arg2;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/me/almana/damageindicator/Commands/PlayerStatCommand.java b/src/main/java/me/almana/damageindicator/Commands/PlayerStatCommand.java
new file mode 100644
index 0000000..3361212
--- /dev/null
+++ b/src/main/java/me/almana/damageindicator/Commands/PlayerStatCommand.java
@@ -0,0 +1,69 @@
+package me.almana.damageindicator.Commands;
+
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.format.TextColor;
+import org.bukkit.Bukkit;
+import org.bukkit.Statistic;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabExecutor;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+public class PlayerStatCommand implements TabExecutor {
+
+ @Override
+ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
+
+ if (args.length == 0 && sender instanceof Player player) {
+
+ int i = player.getStatistic(Statistic.DAMAGE_DEALT);
+ int j = player.getStatistic(Statistic.DAMAGE_ABSORBED);
+
+ TextComponent message = Component.text("[Damage Indicator] \n", TextColor.color(27, 141, 255))
+ .append(Component.text(player.getName()).color(TextColor.color(180, 118, 234)))
+ .append(Component.text("\n"))
+ .append(Component.text("Damage dealt: ").color(TextColor.color(180, 118, 234)))
+ .append(Component.text(i).color(TextColor.color(180, 118, 234)))
+ .append(Component.text("\n"))
+ .append(Component.text("Damage absorbed: ").color(TextColor.color(180, 118, 234)))
+ .append(Component.text(j).color(TextColor.color(180, 118, 234)));
+ player.sendMessage(message);
+ } else if (args.length == 1) {
+
+ Player player = Bukkit.getPlayer(args[0]);
+
+ if (!(player == null)) {
+
+ int i = player.getStatistic(Statistic.DAMAGE_DEALT);
+ int j = player.getStatistic(Statistic.DAMAGE_ABSORBED);
+
+ TextComponent message = Component.text("[Damage Indicator] \n", TextColor.color(27, 141, 255))
+ .append(Component.text(player.getName()).color(TextColor.color(180, 118, 234)))
+ .append(Component.text("\n"))
+ .append(Component.text("Damage dealt: ").color(TextColor.color(180, 118, 234)))
+ .append(Component.text(i).color(TextColor.color(180, 118, 234)))
+ .append(Component.text("\n"))
+ .append(Component.text("Damage absorbed: ").color(TextColor.color(180, 118, 234)))
+ .append(Component.text(j).color(TextColor.color(180, 118, 234)));
+ player.sendMessage(message);
+ } else {
+
+ TextComponent message = Component.text("[Damage Indicator] ", TextColor.color(27, 141, 255))
+ .append(Component.text("Player not found.").color(TextColor.color(188, 57, 80)));
+ sender.sendMessage(message);
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public @Nullable List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/me/almana/damageindicator/DamageIndicator.java b/src/main/java/me/almana/damageindicator/DamageIndicator.java
new file mode 100644
index 0000000..b56d06d
--- /dev/null
+++ b/src/main/java/me/almana/damageindicator/DamageIndicator.java
@@ -0,0 +1,38 @@
+package me.almana.damageindicator;
+
+import me.almana.damageindicator.Commands.DamageIndicatorCommand;
+import me.almana.damageindicator.Commands.PlayerStatCommand;
+import me.almana.damageindicator.Listener.DamageListener;
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.java.JavaPlugin;
+
+public final class DamageIndicator extends JavaPlugin {
+
+ private static DamageIndicator plugin;
+
+ public static DamageIndicator getPlugin() {
+ return plugin;
+ }
+
+ @Override
+ public void onEnable() {
+
+ plugin = this;
+ getServer().getPluginManager().registerEvents(new DamageListener(), this);
+ getServer().getPluginCommand("damageindicator").setExecutor(new DamageIndicatorCommand());
+ getServer().getPluginCommand("playerstat").setExecutor(new PlayerStatCommand());
+ getConfig().options().copyDefaults();
+ saveDefaultConfig();
+ Boolean enable = getConfig().getBoolean("ENABLE_PLUGIN");
+ if (!enable) {
+
+ this.getServer().getPluginManager().disablePlugin(this);
+ Bukkit.getLogger().warning("[DAMAGE INDICATOR]:- Diabled itself due to config.");
+ } else {
+
+ Bukkit.getLogger().info("[DAMAGE INDICATOR]:- ENABLED SUCCESSFULLY.");
+ Bukkit.getLogger().info("[DAMAGE INDICATOR]:- By AlmanaX21#3208");
+ }
+
+ }
+}
diff --git a/src/main/java/me/almana/damageindicator/Listener/DamageListener.java b/src/main/java/me/almana/damageindicator/Listener/DamageListener.java
new file mode 100644
index 0000000..6147e0e
--- /dev/null
+++ b/src/main/java/me/almana/damageindicator/Listener/DamageListener.java
@@ -0,0 +1,87 @@
+package me.almana.damageindicator.Listener;
+
+
+import me.almana.damageindicator.DamageIndicator;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.plugin.Plugin;
+
+public class DamageListener implements Listener {
+
+ Plugin plugin = DamageIndicator.getPlugin();
+
+ @EventHandler
+ public void onDamage(EntityDamageByEntityEvent e){
+
+ Boolean onlyPlayer = plugin.getConfig().getBoolean("ONLY_PLAYER");
+
+
+ if (onlyPlayer && e.getEntity() instanceof Player victim && e.getDamager() instanceof Player) {
+
+ Location drop = victim.getEyeLocation().add(0, - 0.1, 0);
+
+ if (e.isCritical()) {
+
+ ArmorStand a = (ArmorStand) drop.getWorld().spawnEntity(drop, EntityType.ARMOR_STAND);
+ a.setInvisible(true);
+ a.setInvulnerable(true);
+ a.setMarker(true);
+ TextComponent c = Component.text(Math.round(e.getFinalDamage()), NamedTextColor.RED);
+ a.setCustomNameVisible(true);
+ a.setSmall(true);
+ a.customName(c);
+ Bukkit.getScheduler().runTaskLater(DamageIndicator.getPlugin(), a::remove,20L);
+ } else {
+
+ ArmorStand a = (ArmorStand) drop.getWorld().spawnEntity(drop, EntityType.ARMOR_STAND);
+ a.setInvisible(true);
+ a.setInvulnerable(true);
+ a.setMarker(true);
+ TextComponent c = Component.text(Math.round(e.getFinalDamage()), NamedTextColor.GOLD);
+ a.setCustomNameVisible(true);
+ a.setSmall(true);
+ a.customName(c);
+ Bukkit.getScheduler().runTaskLater(DamageIndicator.getPlugin(), a::remove,20L);
+ }
+ } else if (!onlyPlayer && e.getDamager() instanceof Player) {
+
+ Entity victim = e.getEntity();
+ Location drop = victim.getLocation().add(plugin.getConfig().getDouble("LOCATION.X"), plugin.getConfig().getDouble("LOCATION.Y"), plugin.getConfig().getDouble("LOCATION.Z"));
+
+ if (e.isCritical()) {
+
+ ArmorStand a = (ArmorStand) drop.getWorld().spawnEntity(drop, EntityType.ARMOR_STAND);
+ a.setInvisible(true);
+ a.setInvulnerable(true);
+ a.setMarker(true);
+ TextComponent c = Component.text(Math.round(e.getFinalDamage()), NamedTextColor.RED);
+ a.setCustomNameVisible(true);
+ a.setSmall(true);
+ a.customName(c);
+ Bukkit.getScheduler().runTaskLater(DamageIndicator.getPlugin(), a::remove,20L);
+ } else {
+
+ ArmorStand a = (ArmorStand) drop.getWorld().spawnEntity(drop, EntityType.ARMOR_STAND);
+ a.setInvisible(true);
+ a.setInvulnerable(true);
+ a.setMarker(true);
+ TextComponent c = Component.text(Math.round(e.getFinalDamage()), NamedTextColor.GOLD);
+ a.setCustomNameVisible(true);
+ a.setSmall(true);
+ a.customName(c);
+
+ Bukkit.getScheduler().runTaskLater(DamageIndicator.getPlugin(), a::remove,20L);
+ }
+ }
+ }
+}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
new file mode 100644
index 0000000..84a848c
--- /dev/null
+++ b/src/main/resources/config.yml
@@ -0,0 +1,22 @@
+#
+#
+# Plugin by AlmanaX21
+#
+#
+
+
+# If you are having any issues, simply disable the plugin here.
+
+ENABLE_PLUGIN: true
+
+# If damage indicator should be shown for only player
+
+ONLY_PLAYER: true
+
+# Only change if you know what you are doing
+# Offset control for armour stand update
+
+LOCATION:
+ X: 0
+ Y: 0.8
+ Z: 0
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
new file mode 100644
index 0000000..069b7c6
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,12 @@
+name: DamageIndicator
+version: '${project.version}'
+main: me.almana.damageindicator.DamageIndicator
+api-version: 1.18
+author: [AlmanaX21]
+commands:
+ damageindicator:
+ description: The all util command for the plugin.
+ permission: damageindicator.admin
+ playerstat:
+ description: Gets damage stats of player
+ permission: damageindicator.stats