From 14ca84fa97b166ecd3d9e1f718634f8b3dc1a7bd Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 13 Jan 2019 21:48:38 -0800 Subject: [PATCH] Holiday strings added to locale + some JSON integration for April Fools Day --- .../nossr50/datatypes/interactions/NotificationType.java | 1 + src/main/java/com/gmail/nossr50/util/HolidayManager.java | 8 +++++--- src/main/resources/advanced.yml | 1 + src/main/resources/locale/locale_en_US.properties | 5 ++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java b/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java index f313207be..a8a63f712 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java @@ -7,6 +7,7 @@ public enum NotificationType { XP_GAIN("ExperienceGain"), SUBSKILL_UNLOCKED("SubSkillUnlocked"), LEVEL_UP_MESSAGE("LevelUps"), + HOLIDAY("Holiday"), SUBSKILL_MESSAGE("SubSkillInteraction"), SUBSKILL_MESSAGE_FAILURE("SubSkillFailure"), TOOL("ToolReady"), diff --git a/src/main/java/com/gmail/nossr50/util/HolidayManager.java b/src/main/java/com/gmail/nossr50/util/HolidayManager.java index d3a459058..e1d88462c 100644 --- a/src/main/java/com/gmail/nossr50/util/HolidayManager.java +++ b/src/main/java/com/gmail/nossr50/util/HolidayManager.java @@ -1,8 +1,11 @@ package com.gmail.nossr50.util; import com.gmail.nossr50.commands.skills.AprilCommand; +import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.sounds.SoundManager; @@ -220,8 +223,7 @@ public final class HolidayManager { return; } - sender.sendMessage(ChatColor.BLUE + "Happy " + (currentYear - START_YEAR) + " Year Anniversary! In honor of all of"); - sender.sendMessage(ChatColor.BLUE + "nossr50's work and all the devs, here's a firework show!"); + sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR))); if (sender instanceof Player) { final int firework_amount = 10; for (int i = 0; i < firework_amount; i++) { @@ -360,7 +362,7 @@ public final class HolidayManager { public void levelUpApril(Player player, FakeSkillType fakeSkillType) { int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkillType.MINING)) + 1; SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP); - player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")"); + NotificationManager.sendPlayerInformation(player, NotificationType.HOLIDAY, "Holiday.AprilFools.Levelup", StringUtils.getCapitalized(fakeSkillType.toString()), String.valueOf(levelTotal)); ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size()))); } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index ed92733f4..20c45a53e 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -21,6 +21,7 @@ Skills: LevelRequirementNotMet: true AbilityCoolDown: true LevelUps: true + Holiday: true ToolReady: true SubSkillInteraction: true SubSkillFailure: true diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 09cc8d406..99dbea269 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -998,4 +998,7 @@ Scoreboard.Misc.Ability=Ability #DATABASE RECOVERY Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded. Profile.Loading.Failure=[[RED]]mcMMO still cannot load your data. You may want to [[AQUA]]contact the server owner.\n[[YELLOW]]You can still play on the server, but you will have [[BOLD]]no mcMMO levels[[YELLOW]] and any XP you get [[BOLD]]will not be saved[[YELLOW]]. -Profile.Loading.AdminFailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup. \ No newline at end of file +Profile.Loading.AdminFailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup. +#Holiday +Holiday.AprilFools.Levelup=[[GOLD]]{0} is now level [[GREEN]]{1}[[GOLD]]! +Holiday.Anniversary=[[BLUE]]Happy {0} Year Anniversary!\n[[BLUE]]In honor of all of nossr50's work and all the devs, here's a firework show! \ No newline at end of file