Most things that print to your chat will now print to action bar

This commit is contained in:
nossr50
2019-01-11 07:11:17 -08:00
parent 19c38f0cb1
commit d141a28747
13 changed files with 70 additions and 28 deletions

View File

@ -32,10 +32,6 @@ public class StringUtils {
public static String getPrettyAbilityString(SuperAbility ability) {
return createPrettyString(ability.toString());
}
public static String getPrettyTreeSpeciesString(TreeSpecies species) {
return createPrettyString(species.toString());
}
public static String getWildcardConfigBlockDataString(BlockData data) {
return getWildcardConfigMaterialString(data.getMaterial());

View File

@ -34,10 +34,17 @@ public class TextComponentFactory {
* @param values
* @return
*/
public static TextComponent getNotificationTextComponentFromLocale(String localeKey, NotificationType notificationType, String... values)
public static TextComponent getNotificationMultipleValues(String localeKey, NotificationType notificationType, String... values)
{
//TODO: Make this colored
return new TextComponent(LocaleLoader.getString(localeKey, values));
String preColoredString = LocaleLoader.getString(localeKey, values);
/*for(int x = 0; x < values.length; x++)
{
}*/
return new TextComponent(preColoredString);
}
public static TextComponent getNotificationTextComponentFromLocale(String localeKey, NotificationType notificationType)
@ -573,6 +580,7 @@ public class TextComponentFactory {
{
if(Permissions.isSubSkillEnabled(player, subSkillType))
{
if(InteractionManager.getInteractRegister().get(subSkillType.getNiceNameNoSpaces(subSkillType)) == null)
textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, subSkillType));
}
}

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbility;
@ -12,6 +13,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.RandomChance;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillWeightedActivationCheckEvent;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
@ -31,6 +33,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.awt.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
@ -130,12 +133,12 @@ public class SkillUtils {
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? PrimarySkill.getSkill(skillName) != null : isLocalizedSkill(skillName);
}
public static void sendSkillMessage(Player player, String message) {
public static void sendSkillMessage(Player player, NotificationType notificationType, String key) {
Location location = player.getLocation();
for (Player otherPlayer : player.getWorld().getPlayers()) {
if (otherPlayer != player && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
otherPlayer.sendMessage(message);
InteractionManager.sendOtherPlayersSkillInfo(player, notificationType, key);
}
}
}