mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Most things that print to your chat will now print to action bar
This commit is contained in:
parent
19c38f0cb1
commit
d141a28747
@ -47,6 +47,7 @@ Version 2.1.0
|
||||
= (MySQL) When converting from MySQL to flatfile mcMMO will now properly include all users in the conversion process
|
||||
+ (Party) Parties can now have size limits (configurable in config.yml), party size is unlimited by default
|
||||
! (Party) Party member list will only include members of the party that you can see (aren't vanished)
|
||||
! (Skills) Fixed an edge case bug where Blast Mining wouldn't inform the player that it was on cooldown
|
||||
! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
|
||||
! (Skills) Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use
|
||||
! (Skills) Acrobatics' Roll exploit detection was tweaked to still allow for Roll to trigger even if it rewards no XP
|
||||
|
@ -10,8 +10,11 @@ public enum NotificationType {
|
||||
SUBSKILL_MESSAGE("SubSkillInteraction"),
|
||||
TOOL("ToolReady"),
|
||||
UNSKILLED("LevelRequirementNotMet"),
|
||||
ABILITY_OFF("AbilityOff"),
|
||||
ABILITY_COOLDOWN("AbilityCoolDown"),
|
||||
SUPER_ABILITY("SuperAbilityInteraction");
|
||||
ABILITY_REFRESHED("AbilityRefreshed"),
|
||||
SUPER_ABILITY("SuperAbilityInteraction"),
|
||||
SUPER_ABILITY_ALERT_OTHERS("SuperAbilityAlertOthers");
|
||||
|
||||
final String niceName;
|
||||
|
||||
|
@ -772,10 +772,11 @@ public class McMMOPlayer {
|
||||
ParticleEffectUtils.playAbilityEnabledEffect(player);
|
||||
|
||||
if (useChatNotifications()) {
|
||||
player.sendMessage(ability.getAbilityOn());
|
||||
InteractionManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, ability.getAbilityOn());
|
||||
//player.sendMessage(ability.getAbilityOn());
|
||||
}
|
||||
|
||||
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayer(player));
|
||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayer());
|
||||
|
||||
// Enable the ability
|
||||
profile.setAbilityDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||
|
@ -94,23 +94,23 @@ public enum SuperAbility {
|
||||
}
|
||||
|
||||
public String getAbilityOn() {
|
||||
return LocaleLoader.getString(this.abilityOn);
|
||||
return abilityOn;
|
||||
}
|
||||
|
||||
public String getAbilityOff() {
|
||||
return LocaleLoader.getString(this.abilityOff);
|
||||
return abilityOff;
|
||||
}
|
||||
|
||||
public String getAbilityPlayer(Player player) {
|
||||
return LocaleLoader.getString(this.abilityPlayer, player.getName());
|
||||
public String getAbilityPlayer() {
|
||||
return abilityPlayer;
|
||||
}
|
||||
|
||||
public String getAbilityPlayerOff(Player player) {
|
||||
return LocaleLoader.getString(this.abilityPlayerOff, player.getName());
|
||||
public String getAbilityPlayerOff() {
|
||||
return abilityPlayerOff;
|
||||
}
|
||||
|
||||
public String getAbilityRefresh() {
|
||||
return LocaleLoader.getString(this.abilityRefresh);
|
||||
return abilityRefresh;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -10,14 +10,15 @@ import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@ -108,12 +109,21 @@ public class InteractionManager {
|
||||
sendNotification(player, customEvent);
|
||||
}
|
||||
|
||||
public static void sendOtherPlayersSkillInfo(Player source, NotificationType notificationType, String key, String... values)
|
||||
{
|
||||
Location location = source.getLocation();
|
||||
for (Player otherPlayer : source.getWorld().getPlayers()) {
|
||||
if (otherPlayer != source && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
|
||||
sendPlayerInformation(otherPlayer, notificationType, key, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
|
||||
{
|
||||
|
||||
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
|
||||
|
||||
TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key, notificationType, values);
|
||||
TextComponent message = TextComponentFactory.getNotificationMultipleValues(key, notificationType, values);
|
||||
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
||||
|
||||
sendNotification(player, customEvent);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@ -21,6 +23,8 @@ public class AbilityCooldownTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
mcMMOPlayer.setAbilityInformed(ability, true);
|
||||
mcMMOPlayer.getPlayer().sendMessage(ability.getAbilityRefresh());
|
||||
|
||||
InteractionManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.ABILITY_REFRESHED, ability.getAbilityRefresh());
|
||||
//mcMMOPlayer.getPlayer().sendMessage(ability.getAbilityRefresh());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -56,10 +58,12 @@ public class AbilityDisableTask extends BukkitRunnable {
|
||||
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(ability.getAbilityOff());
|
||||
//player.sendMessage(ability.getAbilityOff());
|
||||
InteractionManager.sendPlayerInformation(player, NotificationType.ABILITY_OFF, ability.getAbilityOff());
|
||||
}
|
||||
|
||||
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayerOff(player));
|
||||
|
||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.gmail.nossr50.skills.mining;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||
@ -97,14 +99,16 @@ public class MiningManager extends SkillManager {
|
||||
Player player = getPlayer();
|
||||
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
||||
|
||||
if (targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true) || !blastMiningCooldownOver()) {
|
||||
//Blast mining cooldown check needs to be first so the player can be messaged
|
||||
if (!blastMiningCooldownOver() || targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
|
||||
|
||||
SkillUtils.sendSkillMessage(player, SuperAbility.BLAST_MINING.getAbilityPlayer(player));
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
||||
//SkillUtils.sendSkillMessage(player, SuperAbility.BLAST_MINING.getAbilityPlayer(player));
|
||||
InteractionManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom");
|
||||
//player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
||||
|
||||
tnt.setMetadata(mcMMO.tntMetadataKey, mcMMOPlayer.getPlayerMetadata());
|
||||
tnt.setFuseTicks(0);
|
||||
@ -290,7 +294,8 @@ public class MiningManager extends SkillManager {
|
||||
int timeRemaining = mcMMOPlayer.calculateTimeRemaining(SuperAbility.BLAST_MINING);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||
//getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||
InteractionManager.sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf("timeRemaining"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -671,6 +671,8 @@ Skills:
|
||||
Style:
|
||||
JSON:
|
||||
Notification:
|
||||
AbilityOff:
|
||||
Color: GRAY
|
||||
LevelRequirementNotMet:
|
||||
Color: RED
|
||||
AbilityCoolDown:
|
||||
@ -685,6 +687,10 @@ Style:
|
||||
Color: PURPLE
|
||||
SuperAbilityInteraction:
|
||||
Color: DARK_AQUA
|
||||
SuperAbilityAlertOthers:
|
||||
Color:
|
||||
Party: GREEN
|
||||
Others: DARK_RED
|
||||
ExperienceGain:
|
||||
Color: WHITE
|
||||
Hover:
|
||||
|
@ -241,6 +241,7 @@ Mining.Skills.SuperBreaker.Refresh=[[GREEN]]Your [[YELLOW]]Super Breaker [[GREEN
|
||||
Mining.Skillup=[[YELLOW]]Mining skill increased by {0}. Total ({1})
|
||||
#Blast Mining
|
||||
Mining.Blast.Boom=[[GRAY]]**BOOM**
|
||||
Mining.Blast.Cooldown=
|
||||
Mining.Blast.Effect=+{0} ore yield, -{1} debris yield, {2}x drops
|
||||
Mining.Blast.Radius.Increase=[[RED]]Blast Radius Increase: [[YELLOW]]+{0}
|
||||
Mining.Blast.Rank=[[RED]]Blast Mining: [[YELLOW]] Rank {0}/{1} [[GRAY]]({2})
|
||||
|
Loading…
Reference in New Issue
Block a user