mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Static Abuse Cleanup - MobHealthBarUtils (now MobHealthBarManager)
This commit is contained in:
parent
225045b49f
commit
fc9942fdc4
@ -120,7 +120,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
event.setDeathMessage(MobHealthbarUtils.fixDeathMessage(deathMessage, player));
|
event.setDeathMessage(pluginRef.getMobHealthBarManager().fixDeathMessage(deathMessage, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +70,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private PartyManager partyManager;
|
private PartyManager partyManager;
|
||||||
private LocaleManager localeManager;
|
private LocaleManager localeManager;
|
||||||
private ChatManager chatManager;
|
private ChatManager chatManager;
|
||||||
|
private MobHealthBarManager mobHealthBarManager;
|
||||||
|
|
||||||
/* File Paths */
|
/* File Paths */
|
||||||
private String mainDirectory;
|
private String mainDirectory;
|
||||||
@ -189,7 +190,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//Init Notification Manager
|
//Init Notification Manager
|
||||||
notificationManager = new NotificationManager();
|
notificationManager = new NotificationManager();
|
||||||
|
|
||||||
|
//Init Chat Manager
|
||||||
chatManager = new ChatManager(this);
|
chatManager = new ChatManager(this);
|
||||||
|
|
||||||
|
//Init Mob Health Bar Manager
|
||||||
|
mobHealthBarManager = new MobHealthBarManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -494,11 +499,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerDynamicSettings() {
|
private void registerDynamicSettings() {
|
||||||
dynamicSettingsManager = new DynamicSettingsManager();
|
dynamicSettingsManager = new DynamicSettingsManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfigFiles() {
|
private void loadConfigFiles() {
|
||||||
configManager = new ConfigManager();
|
configManager = new ConfigManager(this);
|
||||||
configManager.loadConfigs();
|
configManager.loadConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,4 +625,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public ChatManager getChatManager() {
|
public ChatManager getChatManager() {
|
||||||
return chatManager;
|
return chatManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MobHealthBarManager getMobHealthBarManager() {
|
||||||
|
return mobHealthBarManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.util.MobHealthbarUtils;
|
import com.gmail.nossr50.util.MobHealthBarManager;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
@ -122,7 +122,7 @@ public class BleedTimerTask extends BukkitRunnable {
|
|||||||
// debugMessage+="Rank4Bonus=["+String.valueOf(containerEntry.getValue().bleedRank >= 3)+"], ";
|
// debugMessage+="Rank4Bonus=["+String.valueOf(containerEntry.getValue().bleedRank >= 3)+"], ";
|
||||||
|
|
||||||
|
|
||||||
MobHealthbarUtils.handleMobHealthbars(target, damage, pluginRef); //Update health bars
|
pluginRef.getMobHealthBarManager().handleMobHealthbars(target, damage, pluginRef); //Update health bars
|
||||||
}
|
}
|
||||||
|
|
||||||
// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
|
// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
|
||||||
|
@ -12,8 +12,11 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
public final class MobHealthbarUtils {
|
public final class MobHealthBarManager {
|
||||||
private MobHealthbarUtils() {
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public MobHealthBarManager(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,7 +26,7 @@ public final class MobHealthbarUtils {
|
|||||||
* @param player The player who died
|
* @param player The player who died
|
||||||
* @return the fixed death message
|
* @return the fixed death message
|
||||||
*/
|
*/
|
||||||
public static String fixDeathMessage(String deathMessage, Player player) {
|
public String fixDeathMessage(String deathMessage, Player player) {
|
||||||
EntityDamageEvent lastDamageCause = player.getLastDamageCause();
|
EntityDamageEvent lastDamageCause = player.getLastDamageCause();
|
||||||
String replaceString = lastDamageCause instanceof EntityDamageByEntityEvent ? StringUtils.getPrettyEntityTypeString(((EntityDamageByEntityEvent) lastDamageCause).getDamager().getType()) : "a mob";
|
String replaceString = lastDamageCause instanceof EntityDamageByEntityEvent ? StringUtils.getPrettyEntityTypeString(((EntityDamageByEntityEvent) lastDamageCause).getDamager().getType()) : "a mob";
|
||||||
|
|
||||||
@ -36,7 +39,7 @@ public final class MobHealthbarUtils {
|
|||||||
* @param target the targetted entity
|
* @param target the targetted entity
|
||||||
* @param damage damage done by the attack triggering this
|
* @param damage damage done by the attack triggering this
|
||||||
*/
|
*/
|
||||||
public static void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
|
public void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
|
||||||
if (pluginRef.isHealthBarPluginEnabled() || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
|
if (pluginRef.isHealthBarPluginEnabled() || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -81,7 +84,7 @@ public final class MobHealthbarUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String createHealthDisplay(MobHealthbarType mobHealthbarType, LivingEntity entity, double damage) {
|
private String createHealthDisplay(MobHealthbarType mobHealthbarType, LivingEntity entity, double damage) {
|
||||||
double maxHealth = entity.getMaxHealth();
|
double maxHealth = entity.getMaxHealth();
|
||||||
double currentHealth = Math.max(entity.getHealth() - damage, 0);
|
double currentHealth = Math.max(entity.getHealth() - damage, 0);
|
||||||
double healthPercentage = (currentHealth / maxHealth) * 100.0D;
|
double healthPercentage = (currentHealth / maxHealth) * 100.0D;
|
||||||
@ -145,7 +148,7 @@ public final class MobHealthbarUtils {
|
|||||||
* @param livingEntity The {@link LivingEntity} of the livingEntity to check
|
* @param livingEntity The {@link LivingEntity} of the livingEntity to check
|
||||||
* @return true if the livingEntity is a boss, false otherwise
|
* @return true if the livingEntity is a boss, false otherwise
|
||||||
*/
|
*/
|
||||||
private static boolean isBoss(LivingEntity livingEntity) {
|
private boolean isBoss(LivingEntity livingEntity) {
|
||||||
switch (livingEntity.getType()) {
|
switch (livingEntity.getType()) {
|
||||||
case ENDER_DRAGON:
|
case ENDER_DRAGON:
|
||||||
case WITHER:
|
case WITHER:
|
@ -812,6 +812,6 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MobHealthbarUtils.handleMobHealthbars(target, damage, plugin);
|
pluginRef.getMobHealthBarManager().handleMobHealthbars(target, damage, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ Axes.Skills.SS.Refresh=[[GREEN]]Votre comp\u00e9tence [[YELLOW]]Tranche-cr\u00e2
|
|||||||
Axes.Skills.SS.Other.Off=Tranche-cr\u00e2ne[[GREEN]] s\'est termin\u00e9 pour [[YELLOW]]{0}
|
Axes.Skills.SS.Other.Off=Tranche-cr\u00e2ne[[GREEN]] s\'est termin\u00e9 pour [[YELLOW]]{0}
|
||||||
Axes.Skills.SS.Other.On=[[GREEN]]{0}[[DARK_GREEN]] a utilis\u00e9 [[RED]]Tranche-cr\u00e2ne !
|
Axes.Skills.SS.Other.On=[[GREEN]]{0}[[DARK_GREEN]] a utilis\u00e9 [[RED]]Tranche-cr\u00e2ne !
|
||||||
Axes.Skillup=Le talent Haches augmente de {0}. Total ({1})
|
Axes.Skillup=Le talent Haches augmente de {0}. Total ({1})
|
||||||
Axes.Ability.Bonus.0=Ma\u00eetrise des haches
|
|
||||||
Excavation.Ability.Lower=[[GRAY]]**VOUS ABAISSEZ VOTRE PELLE**
|
Excavation.Ability.Lower=[[GRAY]]**VOUS ABAISSEZ VOTRE PELLE**
|
||||||
Excavation.Ability.Ready=[[GREEN]]**VOUS LEVEZ VOTRE PELLE**
|
Excavation.Ability.Ready=[[GREEN]]**VOUS LEVEZ VOTRE PELLE**
|
||||||
Excavation.SubSkill.GigaDrillBreaker.Name=Foreur (Comp\u00e9tence)
|
Excavation.SubSkill.GigaDrillBreaker.Name=Foreur (Comp\u00e9tence)
|
||||||
|
Loading…
Reference in New Issue
Block a user