mirror of
https://github.com/zeshan321/ActionHealth.git
synced 2024-09-28 07:07:36 +02:00
Merge branch 'master' into 3.3.6
This commit is contained in:
commit
705aabe419
@ -95,3 +95,7 @@ ShowMiniaturePets: true
|
|||||||
Name Change: false
|
Name Change: false
|
||||||
Name:
|
Name:
|
||||||
- Snow Golem = New name
|
- Snow Golem = New name
|
||||||
|
|
||||||
|
# Translate names using Client Language. Need to install LanguageUtils
|
||||||
|
# https://www.spigotmc.org/resources/1-7-x-1-12-language-utils.8859/
|
||||||
|
Use Client Language: false
|
@ -1,7 +1,7 @@
|
|||||||
name: ActionHealth
|
name: ActionHealth
|
||||||
main: com.zeshanaslam.actionhealth.Main
|
main: com.zeshanaslam.actionhealth.Main
|
||||||
version: 3.3.6
|
version: 3.3.6
|
||||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs]
|
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
||||||
commands:
|
commands:
|
||||||
Actionhealth:
|
Actionhealth:
|
||||||
description: Actionhealth main commands.
|
description: Actionhealth main commands.
|
@ -43,7 +43,7 @@ public class LookThread extends BukkitRunnable {
|
|||||||
for (LivingEntity livingEntity : entities) {
|
for (LivingEntity livingEntity : entities) {
|
||||||
if (!plugin.healthUtil.matchesRequirements(player, livingEntity)) continue;
|
if (!plugin.healthUtil.matchesRequirements(player, livingEntity)) continue;
|
||||||
|
|
||||||
String name = plugin.healthUtil.getName(livingEntity);
|
String name = plugin.healthUtil.getName(livingEntity, player);
|
||||||
|
|
||||||
if (TargetHelper.canSee(player, livingEntity.getLocation(), transparentTypeIds) && !plugin.healthUtil.isBlacklisted(livingEntity, name)) {
|
if (TargetHelper.canSee(player, livingEntity.getLocation(), transparentTypeIds) && !plugin.healthUtil.isBlacklisted(livingEntity, name)) {
|
||||||
plugin.healthUtil.sendHealth(player, livingEntity, livingEntity.getHealth());
|
plugin.healthUtil.sendHealth(player, livingEntity, livingEntity.getHealth());
|
||||||
|
@ -23,6 +23,7 @@ public class Main extends JavaPlugin {
|
|||||||
public int taskID = -1;
|
public int taskID = -1;
|
||||||
public boolean mcMMOEnabled;
|
public boolean mcMMOEnabled;
|
||||||
public boolean mythicMobsEnabled;
|
public boolean mythicMobsEnabled;
|
||||||
|
public boolean langUtilsEnabled;
|
||||||
|
|
||||||
public List<UUID> toggle = new ArrayList<>();
|
public List<UUID> toggle = new ArrayList<>();
|
||||||
|
|
||||||
@ -58,6 +59,10 @@ public class Main extends JavaPlugin {
|
|||||||
if (Bukkit.getServer().getPluginManager().isPluginEnabled("MythicMobs")) {
|
if (Bukkit.getServer().getPluginManager().isPluginEnabled("MythicMobs")) {
|
||||||
mythicMobsEnabled = true;
|
mythicMobsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Bukkit.getServer().getPluginManager().isPluginEnabled("LangUtils")) {
|
||||||
|
langUtilsEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,6 +26,7 @@ public class ConfigStore {
|
|||||||
public boolean canSee;
|
public boolean canSee;
|
||||||
public boolean invisiblePotion;
|
public boolean invisiblePotion;
|
||||||
public boolean spectatorMode;
|
public boolean spectatorMode;
|
||||||
|
public boolean useClientLanguage;
|
||||||
public String filledHeartIcon;
|
public String filledHeartIcon;
|
||||||
public String halfHeartIcon;
|
public String halfHeartIcon;
|
||||||
public String emptyHeartIcon;
|
public String emptyHeartIcon;
|
||||||
@ -91,6 +92,7 @@ public class ConfigStore {
|
|||||||
translate.put(split[0], split[1]);
|
translate.put(split[0], split[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
useClientLanguage = plugin.getConfig().getBoolean("Use Client Language");
|
||||||
|
|
||||||
// Load disabled regions
|
// Load disabled regions
|
||||||
regions = plugin.getConfig().getStringList("Disabled regions");
|
regions = plugin.getConfig().getStringList("Disabled regions");
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.zeshanaslam.actionhealth.support;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.meowj.langutils.lang.LanguageHelper;
|
||||||
|
|
||||||
|
public class LangUtilsSupport {
|
||||||
|
|
||||||
|
public String getName(Entity entity, Player player) {
|
||||||
|
return LanguageHelper.getEntityName(entity, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName(Entity entity, String locale) {
|
||||||
|
return LanguageHelper.getEntityName(entity, locale);
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.zeshanaslam.actionhealth.utils;
|
|||||||
|
|
||||||
import com.zeshanaslam.actionhealth.Main;
|
import com.zeshanaslam.actionhealth.Main;
|
||||||
import com.zeshanaslam.actionhealth.api.HealthSendEvent;
|
import com.zeshanaslam.actionhealth.api.HealthSendEvent;
|
||||||
|
import com.zeshanaslam.actionhealth.support.LangUtilsSupport;
|
||||||
import com.zeshanaslam.actionhealth.support.McMMOSupport;
|
import com.zeshanaslam.actionhealth.support.McMMOSupport;
|
||||||
import com.zeshanaslam.actionhealth.support.MythicMobsSupport;
|
import com.zeshanaslam.actionhealth.support.MythicMobsSupport;
|
||||||
import com.zeshanaslam.actionhealth.support.PreAction;
|
import com.zeshanaslam.actionhealth.support.PreAction;
|
||||||
@ -82,7 +83,7 @@ public class HealthUtil {
|
|||||||
|
|
||||||
if (health < 0.0 || entity.isDead()) health = 0.0;
|
if (health < 0.0 || entity.isDead()) health = 0.0;
|
||||||
|
|
||||||
String name = getName(entity);
|
String name = getName(entity, receiver);
|
||||||
if (plugin.healthUtil.isBlacklisted(entity, name)) return null;
|
if (plugin.healthUtil.isBlacklisted(entity, name)) return null;
|
||||||
if (plugin.configStore.stripName) name = ChatColor.stripColor(name);
|
if (plugin.configStore.stripName) name = ChatColor.stripColor(name);
|
||||||
|
|
||||||
@ -172,7 +173,7 @@ public class HealthUtil {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName(LivingEntity entity) {
|
public String getName(LivingEntity entity, Player receiver) {
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
// Supporting mcmmo health bar to get to display correct name.
|
// Supporting mcmmo health bar to get to display correct name.
|
||||||
@ -185,10 +186,12 @@ public class HealthUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMOName == null) {
|
if (mcMMOName == null) {
|
||||||
if (entity.getCustomName() == null) {
|
if (entity.getCustomName() != null) {
|
||||||
name = getNameReflection(entity);
|
name = entity.getCustomName();
|
||||||
|
} else if(plugin.langUtilsEnabled && plugin.configStore.useClientLanguage && receiver != null) {
|
||||||
|
name = new LangUtilsSupport().getName(entity, receiver);
|
||||||
} else {
|
} else {
|
||||||
name = entity.getCustomName();
|
name = getNameReflection(entity);
|
||||||
}
|
}
|
||||||
} else if (mcMMOName.equals("")) {
|
} else if (mcMMOName.equals("")) {
|
||||||
name = getNameReflection(entity);
|
name = getNameReflection(entity);
|
||||||
|
Loading…
Reference in New Issue
Block a user