mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Skill Unlock notifications now have sounds
This commit is contained in:
parent
6ad9c8e664
commit
e962f645b6
@ -149,9 +149,9 @@ public class McMMOPlayer {
|
||||
updateXPBar(primarySkillType, plugin);
|
||||
}
|
||||
|
||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType)
|
||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel)
|
||||
{
|
||||
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, profile.getSkillLevel(primarySkillType));
|
||||
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
||||
}
|
||||
|
||||
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin)
|
||||
|
@ -30,8 +30,13 @@ public class SelfListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
PrimarySkillType skill = event.getSkill();
|
||||
|
||||
//Players can gain multiple levels especially during xprate events
|
||||
for(int i = 0; i < event.getLevelsGained(); i++)
|
||||
{
|
||||
int previousLevelGained = event.getSkillLevel() - i;
|
||||
//Send player skill unlock notifications
|
||||
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill());
|
||||
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
|
||||
}
|
||||
|
||||
if(Config.getInstance().getScoreboardsEnabled())
|
||||
ScoreboardManager.handleLevelUp(player, skill);
|
||||
|
@ -8,11 +8,14 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
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.Server;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class NotificationManager {
|
||||
@ -122,6 +125,9 @@ public class NotificationManager {
|
||||
//CHAT MESSAGE
|
||||
mcMMOPlayer.getPlayer().spigot().sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
||||
|
||||
//Unlock Sound Effect
|
||||
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
||||
|
||||
//ACTION BAR MESSAGE
|
||||
/*if(AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.SUBSKILL_UNLOCKED))
|
||||
mcMMOPlayer.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(LocaleLoader.getString("JSON.SkillUnlockMessage",
|
||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.config.SoundConfig;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -14,7 +15,12 @@ public class SoundManager {
|
||||
*/
|
||||
public static void sendSound(Player player, Location location, SoundType soundType)
|
||||
{
|
||||
player.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory)
|
||||
{
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType)
|
||||
|
Loading…
Reference in New Issue
Block a user