diff --git a/README.md b/README.md index 90ee275..37fcd06 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,29 @@ # DeathMessages +![GitHub License](https://img.shields.io/github/license/Winds-Studio/DeathMessages?style=for-the-badge)![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/Winds-Studio/DeathMessages/build.yml?style=for-the-badge)![Github Stars](https://img.shields.io/github/stars/Winds-Studio/DeathMessages?style=for-the-badge) + **_!Active testing - report any bugs or give suggestions_** -![GitHub License](https://img.shields.io/github/license/Winds-Studio/DeathMessages?style=for-the-badge)![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/Winds-Studio/DeathMessages/build.yml?style=for-the-badge)![Github Stars](https://img.shields.io/github/stars/Winds-Studio/DeathMessages?style=for-the-badge) -Original Download Link: [SpigotMC](https://www.spigotmc.org/resources/deathmessages-deathmessagesprime-remastered.3789/) (Outdated) ## Features -- Supporting 1.12.2 - Latest Minecraft version (1.20.2) -- Compatible with Spigot / Paper / Paper forks / Forge&Bukkit Hybrid Servers -- Folia Support - Fix a bunch of errors or issues from original DeathMessages - Highly Optimized - Active Development +Compatibility + +- Support Java 17 and higher +- Support 1.12.2 - Latest Minecraft version (1.20.2) +- Compatible with Spigot / Paper / Paper Forks / Forge+Bukkit Hybrid Server +- Folia Support + +## Portals + +- [Github Releases](https://github.com/Winds-Studio/DeathMessages/releases) (Latest DEV Version) +- [SpigotMC](https://www.spigotmc.org/resources/deathmessages-deathmessagesprime-remastered.3789/) (Original DM and Outdated) + ## Contact - 📫 Discord: `dreeam___` | QQ: `2682173972` @@ -28,13 +37,14 @@ For Developers: ## TODOs -- Adventure - To replace the replaceAll and bukkit ChatColor -- Command system, tab complete and some refactor -- Look into get entity name -- Add version comment in config -- Config -- Improve hoverEvent(opt code/showItem or showEntity) -- More issues can track in [here](https://bbs.breeze.asia/d/128-si-wang-ti-shi-wen-ti) +> - Adventure - To replace the replaceAll and bukkit ChatColor +> - Command system, tab complete and some refactor +> - Look into get entity name +> - Add version comment ins config +> - Config +> - Improve hoverEvent(opt code/showItem or showEntity) +> - VersionChecker & Custom bstats charts +> - More issues can track in [here](https://bbs.breeze.asia/d/128-si-wang-ti-shi-wen-ti) ## Special Thanks To: diff --git a/src/main/java/dev/mrshawn/deathmessages/DeathMessages.java b/src/main/java/dev/mrshawn/deathmessages/DeathMessages.java index 19c6d18..2b2f269 100644 --- a/src/main/java/dev/mrshawn/deathmessages/DeathMessages.java +++ b/src/main/java/dev/mrshawn/deathmessages/DeathMessages.java @@ -30,8 +30,8 @@ import dev.mrshawn.deathmessages.listeners.customlisteners.BroadcastEntityDeathListener; import dev.mrshawn.deathmessages.listeners.customlisteners.BroadcastPlayerDeathListener; import dev.mrshawn.deathmessages.listeners.mythicmobs.MobDeath; -import dev.mrshawn.deathmessages.worldguard.WorldGuard7Extension; -import dev.mrshawn.deathmessages.worldguard.WorldGuardExtension; +import dev.mrshawn.deathmessages.hooks.WorldGuard7Extension; +import dev.mrshawn.deathmessages.hooks.WorldGuardExtension; import io.lumine.mythic.bukkit.MythicBukkit; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import org.apache.logging.log4j.LogManager; @@ -81,7 +81,7 @@ public void onEnable() { initializeOnlinePlayers(); checkGameRules(); new Metrics(this, 12365); - LogManager.getLogger().info("bStats Hook Enabled!"); + LogManager.getLogger(getName()).info("bStats Hook Enabled!"); } public void onLoad() { @@ -147,26 +147,27 @@ private void initializeHooks() { if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { new PlaceholderAPIExtension(this).register(); placeholderAPIEnabled = true; - LogManager.getLogger().info("PlaceholderAPI Hook Enabled!"); + LogManager.getLogger(getName()).info("PlaceholderAPI Hook Enabled!"); } if (worldGuardEnabled) { - LogManager.getLogger().info("WorldGuard Hook Enabled!"); + LogManager.getLogger(getName()).info("WorldGuard Hook Enabled!"); } if (Bukkit.getPluginManager().getPlugin("DiscordBotAPI") != null && config.getBoolean(Config.HOOKS_DISCORD_ENABLED)) { discordBotAPIExtension = new DiscordBotAPIExtension(); - LogManager.getLogger().info("DiscordBotAPI Hook Enabled!"); + LogManager.getLogger(getName()).info("DiscordBotAPI Hook Enabled!"); + LogManager.getLogger(getName()).warn("WARNING: You are using a outdated plugin! DiscordBotAPI support will be removed in DeathMessages 1.4.19, use DiscordSRV instead!"); } if (Bukkit.getPluginManager().getPlugin("DiscordSRV") != null && config.getBoolean(Config.HOOKS_DISCORD_ENABLED)) { discordSRVExtension = new DiscordSRVExtension(); - LogManager.getLogger().info("DiscordSRV Hook Enabled!"); + LogManager.getLogger(getName()).info("DiscordSRV Hook Enabled!"); } if (Bukkit.getPluginManager().isPluginEnabled("PlugMan") && worldGuardExtension != null) { Plugin plugMan = Bukkit.getPluginManager().getPlugin("PlugMan"); - LogManager.getLogger().info("PlugMan found. Adding this plugin to its ignored plugins list due to WorldGuard hook being enabled!"); + LogManager.getLogger(getName()).info("PlugMan found. Adding this plugin to its ignored plugins list due to WorldGuard hook being enabled!"); try { List ignoredPlugins = (List) plugMan.getClass().getMethod("getIgnoredPlugins").invoke(plugMan); if (!ignoredPlugins.contains("DeathMessages")) { @@ -180,20 +181,20 @@ private void initializeHooks() { if (Bukkit.getPluginManager().getPlugin("CombatLogX") != null && config.getBoolean(Config.HOOKS_COMBATLOGX_ENABLED)) { combatLogXAPIEnabled = true; Bukkit.getPluginManager().registerEvents(new PlayerUntag(), this); - LogManager.getLogger().info("CombatLogX Hook Enabled!"); + LogManager.getLogger(getName()).info("CombatLogX Hook Enabled!"); } if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null && config.getBoolean(Config.HOOKS_MYTHICMOBS_ENABLED)) { mythicMobs = MythicBukkit.inst(); mythicmobsEnabled = true; - LogManager.getLogger().info("MythicMobs Hook Enabled!"); + LogManager.getLogger(getName()).info("MythicMobs Hook Enabled!"); Bukkit.getPluginManager().registerEvents(new MobDeath(), this); } if (config.getBoolean(Config.HOOKS_BUNGEE_ENABLED)) { Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); Bukkit.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new PluginMessaging()); - LogManager.getLogger().info("Bungee Hook enabled!"); + LogManager.getLogger(getName()).info("Bungee Hook enabled!"); if (config.getBoolean(Config.HOOKS_BUNGEE_SERVER_NAME_GET_FROM_BUNGEE)) { bungeeInit = true; } else { @@ -248,6 +249,7 @@ public static DeathMessages getInstance() { public static EventPriority getEventPriority() { return eventPriority; } + public @NotNull BukkitAudiences adventure() { if(this.adventure == null) { throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!"); diff --git a/src/main/java/dev/mrshawn/deathmessages/worldguard/WorldGuard7Extension.java b/src/main/java/dev/mrshawn/deathmessages/hooks/WorldGuard7Extension.java similarity index 97% rename from src/main/java/dev/mrshawn/deathmessages/worldguard/WorldGuard7Extension.java rename to src/main/java/dev/mrshawn/deathmessages/hooks/WorldGuard7Extension.java index 00c9451..8f26962 100644 --- a/src/main/java/dev/mrshawn/deathmessages/worldguard/WorldGuard7Extension.java +++ b/src/main/java/dev/mrshawn/deathmessages/hooks/WorldGuard7Extension.java @@ -1,4 +1,4 @@ -package dev.mrshawn.deathmessages.worldguard; +package dev.mrshawn.deathmessages.hooks; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.util.Location; diff --git a/src/main/java/dev/mrshawn/deathmessages/worldguard/WorldGuardExtension.java b/src/main/java/dev/mrshawn/deathmessages/hooks/WorldGuardExtension.java similarity index 96% rename from src/main/java/dev/mrshawn/deathmessages/worldguard/WorldGuardExtension.java rename to src/main/java/dev/mrshawn/deathmessages/hooks/WorldGuardExtension.java index e007747..0e5ac8b 100644 --- a/src/main/java/dev/mrshawn/deathmessages/worldguard/WorldGuardExtension.java +++ b/src/main/java/dev/mrshawn/deathmessages/hooks/WorldGuardExtension.java @@ -1,4 +1,4 @@ -package dev.mrshawn.deathmessages.worldguard; +package dev.mrshawn.deathmessages.hooks; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.flags.StateFlag; diff --git a/src/main/java/dev/mrshawn/deathmessages/listeners/PluginMessaging.java b/src/main/java/dev/mrshawn/deathmessages/listeners/PluginMessaging.java index 508f8e9..7cc45fd 100644 --- a/src/main/java/dev/mrshawn/deathmessages/listeners/PluginMessaging.java +++ b/src/main/java/dev/mrshawn/deathmessages/listeners/PluginMessaging.java @@ -35,7 +35,7 @@ public void onPluginMessageReceived(String channel, @NotNull Player player, byte if (subChannel.equals("GetServer")) { String serverName = stream.readUTF(); - LogManager.getLogger().info("Server-Name successfully initialized from Bungee! (" + serverName + ")"); + LogManager.getLogger(DeathMessages.getInstance().getName()).info("Server-Name successfully initialized from Bungee! (" + serverName + ")"); DeathMessages.bungeeServerName = serverName; config.set(Config.HOOKS_BUNGEE_SERVER_NAME_DISPLAY_NAME, Config.HOOKS_BUNGEE_SERVER_NAME_DISPLAY_NAME, serverName); config.save(); @@ -66,7 +66,7 @@ public void onPluginMessageReceived(String channel, @NotNull Player player, byte public static void sendServerNameRequest(Player p) { if (!config.getBoolean(Config.HOOKS_BUNGEE_ENABLED)) return; - LogManager.getLogger().info("Attempting to initialize server-name variable from Bungee..."); + LogManager.getLogger(DeathMessages.getInstance().getName()).info("Attempting to initialize server-name variable from Bungee..."); ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("GetServer"); p.sendPluginMessage(DeathMessages.getInstance(), "BungeeCord", out.toByteArray()); diff --git a/src/main/java/dev/mrshawn/deathmessages/utils/Assets.java b/src/main/java/dev/mrshawn/deathmessages/utils/Assets.java index 2ca19a4..967835e 100644 --- a/src/main/java/dev/mrshawn/deathmessages/utils/Assets.java +++ b/src/main/java/dev/mrshawn/deathmessages/utils/Assets.java @@ -333,7 +333,7 @@ public static TextComponent getNaturalDeath(PlayerManager pm, String damageCause displayName = i.getItemMeta().getDisplayName(); } - HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().getAsString())); + HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().toString())); Component weapon = Component.text() .append(Assets.convertFromLegacy(displayName)) @@ -415,7 +415,7 @@ public static TextComponent getWeapon(boolean gang, PlayerManager pm, LivingEnti displayName = i.getItemMeta().getDisplayName(); } - HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().getAsString())); + HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().toString())); Component weapon = Component.text() .append(Assets.convertFromLegacy(displayName)) @@ -500,7 +500,7 @@ public static TextComponent getEntityDeathWeapon(Player p, Entity e, MobType mob displayName = i.getItemMeta().getDisplayName(); } - HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().getAsString())); + HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().toString())); Component weapon = Component.text() .append(Assets.convertFromLegacy(displayName)) @@ -622,7 +622,7 @@ public static TextComponent getProjectile(boolean gang, PlayerManager pm, Living showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount()); } else { displayName = i.getItemMeta().getDisplayName(); - showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().getAsString())); + showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().toString())); } Component weapon = Component.text() @@ -708,7 +708,7 @@ public static TextComponent getEntityDeathProjectile(Player p, EntityManager em, displayName = i.getItemMeta().getDisplayName(); } - HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().getAsString())); + HoverEvent showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(i.getItemMeta().toString())); Component weapon = Component.text() .append(Assets.convertFromLegacy(displayName)) diff --git a/src/main/java/dev/mrshawn/deathmessages/utils/CommentedConfiguration.java b/src/main/java/dev/mrshawn/deathmessages/utils/CommentedConfiguration.java index 6e302e2..b73d690 100644 --- a/src/main/java/dev/mrshawn/deathmessages/utils/CommentedConfiguration.java +++ b/src/main/java/dev/mrshawn/deathmessages/utils/CommentedConfiguration.java @@ -16,6 +16,7 @@ */ package dev.mrshawn.deathmessages.utils; +import dev.mrshawn.deathmessages.DeathMessages; import org.apache.logging.log4j.LogManager; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; @@ -292,7 +293,7 @@ private CommentedConfiguration flagAsFailed() { FileInputStream stream = new FileInputStream(file); return loadConfiguration(new InputStreamReader(stream, StandardCharsets.UTF_8)); } catch (FileNotFoundException ex) { - LogManager.getLogger().warn("File " + file.getName() + " doesn't exist."); + LogManager.getLogger(DeathMessages.getInstance().getName()).warn("File " + file.getName() + " doesn't exist."); return new CommentedConfiguration().flagAsFailed(); } }