Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
prerelease: true

- name: Upload DeathMessages Nightly
if: github.ref_name == 'dev'
if: github.ref_name == 'dev' || github.event_name == 'pull_request'
uses: actions/upload-artifact@v6
with:
name: DeathMessages-Nightly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum Config {
ADD_PREFIX_TO_ALL_MESSAGES("Add-Prefix-To-All-Messages", true),

HOOKS_MYTHICMOBS_ENABLED("Hooks.MythicMobs.Enabled", true),
HOOKS_MYTHICMOBS_USE_MYTHICMOBS_DEATH_MESSAGE("Hooks.MythicMobs.UseMythicMobsDeathMessage", false),
HOOKS_WORLDGUARD_ENABLED("Hooks.WorldGuard.Enabled", true),
HOOKS_COMBATLOGX_ENABLED("Hooks.CombatLogX.Enabled", true),
HOOKS_VANISH_VANILLA_ENABLED("Hooks.Vanish.Vanilla", true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class HookInstance {

public MythicBukkit mythicMobs = null;
public boolean mythicmobsEnabled = false;
public boolean useMythicMobsDeathMessages = false;

public WorldGuardExtension worldGuardExtension;
public boolean worldGuardEnabled;
Expand Down Expand Up @@ -134,6 +135,7 @@ public void registerHooks() {
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null && FileStore.CONFIG.getBoolean(Config.HOOKS_MYTHICMOBS_ENABLED)) {
mythicMobs = MythicBukkit.inst();
mythicmobsEnabled = true;
useMythicMobsDeathMessages = FileStore.CONFIG.getBoolean(Config.HOOKS_MYTHICMOBS_USE_MYTHICMOBS_DEATH_MESSAGE);
Bukkit.getPluginManager().registerEvents(new MobDeath(), instance);
DeathMessages.LOGGER.info("MythicMobs Hook Enabled!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void onEntityDamage(EntityDamageEvent e) {
Set<String> listenedMobs = entityConfig.getKeys(false);
ConfigurationSection mobConfig = EntityDeathMessages.getInstance().getConfig().getConfigurationSection("Mythic-Mobs-Entities");

if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled) {
if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled && !DeathMessages.getHooks().useMythicMobsDeathMessages) {
listenedMobs.addAll(mobConfig.getKeys(false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onEntityDeath(EntityDamageByBlockEvent e) {
Set<String> listenedMobs = entityConfig.getKeys(false);
ConfigurationSection mobConfig = EntityDeathMessages.getInstance().getConfig().getConfigurationSection("Mythic-Mobs-Entities");

if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled) {
if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled && !DeathMessages.getHooks().useMythicMobsDeathMessages) {
listenedMobs.addAll(mobConfig.getKeys(false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void entityDamageByEntity(EntityDamageByEntityEvent e) {
Set<String> listenedMobs = entityConfig.getKeys(false);
ConfigurationSection mobsConfig = EntityDeathMessages.getInstance().getConfig().getConfigurationSection("Mythic-Mobs-Entities");

if (mobsConfig != null && DeathMessages.getHooks().mythicmobsEnabled) {
if (mobsConfig != null && DeathMessages.getHooks().mythicmobsEnabled && !DeathMessages.getHooks().useMythicMobsDeathMessages) {
listenedMobs.addAll(mobsConfig.getKeys(false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public static TextComponent getWeapon(boolean gang, PlayerCtx playerCtx, LivingE
//Bukkit.broadcastMessage("is myth - " + mmMobType);
msgs = sortList(getPlayerDeathMessages().getStringList("Custom-Mobs.Mythic-Mobs." + mmMobType + "." + affiliation + ".Weapon"), playerCtx.getPlayer(), mob);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -461,7 +461,7 @@ public static TextComponent getEntityDeathWeapon(Player p, Entity e, MobType mob

msgs = sortList(getEntityDeathMessages().getStringList("Mythic-Mobs-Entities." + mmMobType + ".Weapon"), p, e);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -533,7 +533,7 @@ public static TextComponent get(boolean gang, PlayerCtx playerCtx, LivingEntity
//System.out.println("is myth - " + mmMobType);
msgs = sortList(getPlayerDeathMessages().getStringList("Custom-Mobs.Mythic-Mobs." + mmMobType + "." + affiliation + "." + damageCause), playerCtx.getPlayer(), mob);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -588,7 +588,7 @@ public static TextComponent getProjectile(boolean gang, PlayerCtx playerCtx, Liv
String mmMobType = DeathMessages.getHooks().mythicMobs.getAPIHelper().getMythicMobInstance(mob).getMobType();
msgs = sortList(getPlayerDeathMessages().getStringList("Custom-Mobs.Mythic-Mobs." + mmMobType + "." + affiliation + "." + projectileDamage), playerCtx.getPlayer(), mob);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -680,7 +680,7 @@ public static TextComponent getEntityDeathProjectile(Player p, EntityCtx entityC

msgs = sortList(getEntityDeathMessages().getStringList("Mythic-Mobs-Entities." + mmMobType + "." + projectileDamage), p, entityCtx.getEntity());

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -770,7 +770,7 @@ public static TextComponent getEntityDeath(Player player, Entity e, String damag

msgs = sortList(getEntityDeathMessages().getStringList("Mythic-Mobs-Entities." + mmMobType + "." + damageCause), player, e);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down
3 changes: 3 additions & 0 deletions DeathMessagesLegacy/src/main/resources/Settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Hooks:
# Enable/Disable MythicMobs hook
MythicMobs:
Enabled: true
# Whether to let MythicMobs to handle MythicMobs mob's death message
# If enabled, DeathMessages will not broadcast death message if kill or killed by MythicMobs mobs
UseMythicMobsDeathMessage: false

# If WorldGuard is found, enable the hook
# This creates custom flags for regions. These flags are set to ALLOW by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum Config {
ADD_PREFIX_TO_ALL_MESSAGES("Add-Prefix-To-All-Messages", true),

HOOKS_MYTHICMOBS_ENABLED("Hooks.MythicMobs.Enabled", true),
HOOKS_MYTHICMOBS_USE_MYTHICMOBS_DEATH_MESSAGE("Hooks.MythicMobs.UseMythicMobsDeathMessage", false),
HOOKS_WORLDGUARD_ENABLED("Hooks.WorldGuard.Enabled", true),
HOOKS_COMBATLOGX_ENABLED("Hooks.CombatLogX.Enabled", true),
HOOKS_VANISH_VANILLA_ENABLED("Hooks.Vanish.Vanilla", true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class HookInstance {

public MythicBukkit mythicMobs = null;
public boolean mythicmobsEnabled = false;
public boolean useMythicMobsDeathMessages = false;

public WorldGuardExtension worldGuardExtension;
public boolean worldGuardEnabled;
Expand Down Expand Up @@ -132,6 +133,7 @@ public void registerHooks() {
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null && FileStore.CONFIG.getBoolean(Config.HOOKS_MYTHICMOBS_ENABLED)) {
mythicMobs = MythicBukkit.inst();
mythicmobsEnabled = true;
useMythicMobsDeathMessages = FileStore.CONFIG.getBoolean(Config.HOOKS_MYTHICMOBS_USE_MYTHICMOBS_DEATH_MESSAGE);
Bukkit.getPluginManager().registerEvents(new MobDeath(), instance);
DeathMessages.LOGGER.info("MythicMobs Hook Enabled!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onEntityDamage(EntityDamageEvent e) {
Set<String> listenedMobs = entityConfig.getKeys(false);
ConfigurationSection mobConfig = EntityDeathMessages.getInstance().getConfig().getConfigurationSection("Mythic-Mobs-Entities");

if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled) {
if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled && !DeathMessages.getHooks().useMythicMobsDeathMessages) {
listenedMobs.addAll(mobConfig.getKeys(false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onEntityDeath(EntityDamageByBlockEvent e) {
Set<String> listenedMobs = entityConfig.getKeys(false);
ConfigurationSection mobConfig = EntityDeathMessages.getInstance().getConfig().getConfigurationSection("Mythic-Mobs-Entities");

if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled) {
if (mobConfig != null && DeathMessages.getHooks().mythicmobsEnabled && !DeathMessages.getHooks().useMythicMobsDeathMessages) {
listenedMobs.addAll(mobConfig.getKeys(false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void entityDamageByEntity(EntityDamageByEntityEvent e) {
Set<String> listenedMobs = entityConfig.getKeys(false);
ConfigurationSection mobsConfig = EntityDeathMessages.getInstance().getConfig().getConfigurationSection("Mythic-Mobs-Entities");

if (mobsConfig != null && DeathMessages.getHooks().mythicmobsEnabled) {
if (mobsConfig != null && DeathMessages.getHooks().mythicmobsEnabled && !DeathMessages.getHooks().useMythicMobsDeathMessages) {
listenedMobs.addAll(mobsConfig.getKeys(false));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public static TextComponent getWeapon(boolean gang, PlayerCtx playerCtx, LivingE
//Bukkit.broadcastMessage("is myth - " + mmMobType);
msgs = sortList(getPlayerDeathMessages().getStringList("Custom-Mobs.Mythic-Mobs." + mmMobType + "." + affiliation + ".Weapon"), playerCtx.getPlayer(), mob);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -452,7 +452,7 @@ public static TextComponent getEntityDeathWeapon(Player p, Entity e, MobType mob

msgs = sortList(getEntityDeathMessages().getStringList("Mythic-Mobs-Entities." + mmMobType + ".Weapon"), p, e);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -524,7 +524,7 @@ public static TextComponent get(boolean gang, PlayerCtx playerCtx, LivingEntity
//System.out.println("is myth - " + mmMobType);
msgs = sortList(getPlayerDeathMessages().getStringList("Custom-Mobs.Mythic-Mobs." + mmMobType + "." + affiliation + "." + damageCause), playerCtx.getPlayer(), mob);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -579,7 +579,7 @@ public static TextComponent getProjectile(boolean gang, PlayerCtx playerCtx, Liv
String mmMobType = DeathMessages.getHooks().mythicMobs.getAPIHelper().getMythicMobInstance(mob).getMobType();
msgs = sortList(getPlayerDeathMessages().getStringList("Custom-Mobs.Mythic-Mobs." + mmMobType + "." + affiliation + "." + projectileDamage), playerCtx.getPlayer(), mob);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -671,7 +671,7 @@ public static TextComponent getEntityDeathProjectile(Player p, EntityCtx entityC

msgs = sortList(getEntityDeathMessages().getStringList("Mythic-Mobs-Entities." + mmMobType + "." + projectileDamage), p, entityCtx.getEntity());

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down Expand Up @@ -761,7 +761,7 @@ public static TextComponent getEntityDeath(Player player, Entity e, String damag

msgs = sortList(getEntityDeathMessages().getStringList("Mythic-Mobs-Entities." + mmMobType + "." + damageCause), player, e);

if (msgs.isEmpty()) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
if (msgs.isEmpty() || DeathMessages.getHooks().useMythicMobsDeathMessages) return Component.empty(); // Don't send mm mob death msg if no configured death msg.
}

if (Settings.getInstance().getConfig().getBoolean(Config.DEBUG.getPath()))
Expand Down
3 changes: 3 additions & 0 deletions DeathMessagesModern/src/main/resources/Settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Hooks:
# Enable/Disable MythicMobs hook
MythicMobs:
Enabled: true
# Whether to let MythicMobs to handle MythicMobs mob's death message
# If enabled, DeathMessages will not broadcast death message if kill or killed by MythicMobs mobs
UseMythicMobsDeathMessage: false

# If WorldGuard is found, enable the hook
# This creates custom flags for regions. These flags are set to ALLOW by default
Expand Down