Prechádzať zdrojové kódy

XP events now use the Title API
Configurable in advanced.yml

nossr50 6 rokov pred
rodič
commit
d9dd4ea016

+ 1 - 0
Changelog.txt

@@ -15,6 +15,7 @@ Version 2.1.0
  + Added links to mcMMO related websites to various commands
  + Certain elements of mcMMO's UI have been restyled
  + Added the tagline "Overhaul Era" to various locations until 3.0.0 comes out
+ + (Events) Starting an XP event will now use the title API (toggle this in advanced.yml)
  + (Sound) Volume and Pitch of sounds can now be configured in the new sounds.yml file
  + (MySQL) Added support for SSL for MySQL/MariaDB (On by default)
  + (Skills) Adding a new subskill to child skills called 'Understanding The Art' this adds nothing new, but tracks your progress in that child skill, which was previous a bit obfuscated.

+ 11 - 2
src/main/java/com/gmail/nossr50/commands/XprateCommand.java

@@ -3,6 +3,8 @@ package com.gmail.nossr50.commands;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.gmail.nossr50.config.AdvancedConfig;
+import com.gmail.nossr50.util.player.NotificationManager;
 import org.bukkit.command.Command;
 import org.bukkit.command.CommandSender;
 import org.bukkit.command.TabExecutor;
@@ -65,8 +67,15 @@ public class XprateCommand implements TabExecutor {
                 ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
 
                 if (mcMMO.p.isXPEventEnabled()) {
-                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.0"));
-                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.1", newXpRate));
+                    if(AdvancedConfig.getInstance().useTitlesForXPEvent())
+                    {
+                        NotificationManager.broadcastTitle(mcMMO.p.getServer(),
+                                LocaleLoader.getString("Commands.Event.Start"),
+                                LocaleLoader.getString("Commands.Event.XP", newXpRate),
+                                10, 10*20, 20);
+                    }
+                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
+                    mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
                 }
                 else {
                     sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));

+ 5 - 0
src/main/java/com/gmail/nossr50/config/AdvancedConfig.java

@@ -707,6 +707,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
         return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat", false);
     }
 
+    public boolean useTitlesForXPEvent()
+    {
+        return config.getBoolean("Feedback.Events.XP.SendTitles", true);
+    }
+
     /*
      * JSON Style Settings
      */

+ 10 - 0
src/main/java/com/gmail/nossr50/util/player/NotificationManager.java

@@ -5,12 +5,14 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
 import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
+import com.gmail.nossr50.locale.LocaleLoader;
 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.Server;
 import org.bukkit.entity.Player;
 
 public class NotificationManager {
@@ -106,4 +108,12 @@ public class NotificationManager {
 
         sendNotification(mcMMOPlayer.getPlayer(), customEvent);
     }
+
+    public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3)
+    {
+        for(Player player : server.getOnlinePlayers())
+        {
+            player.sendTitle(title, subtitle, i1, i2, i3);
+        }
+    }
 }

+ 6 - 2
src/main/resources/advanced.yml

@@ -14,6 +14,10 @@
 #  Settings for the Skills
 ###
 Feedback:
+    # If sendtitles is true messages will be sent using the title api (BIG TEXT ON SCREEN)
+    Events:
+        XP:
+            SendTitles: true
     #The actionbar is the message location right above the health bar
     ## If you disable the action bar messages, mcMMO will send the message to the chat system instead
     ActionBarNotifications:
@@ -22,7 +26,7 @@ Feedback:
             SendCopyOfMessageToChat: false
         HardcoreMode:
             Enabled: true
-            SendCopyOfMessageToChat: false
+            SendCopyOfMessageToChat: true
         RequirementsNotMet:
             Enabled: true
             SendCopyOfMessageToChat: false
@@ -61,7 +65,7 @@ Feedback:
             SendCopyOfMessageToChat: false
         NoPermission:
             Enabled: true
-            SendCopyOfMessageToChat: false
+            SendCopyOfMessageToChat: true
         PartyMessage:
             Enabled: true
             SendCopyOfMessageToChat: true

+ 2 - 0
src/main/resources/locale/locale_en_US.properties

@@ -744,6 +744,8 @@ Commands.xprate.over=[[RED]]mcMMO XP Rate Event is OVER!!
 Commands.xprate.proper.0=[[RED]]Proper usage to change the XP rate is /xprate <integer> <true/false>
 Commands.xprate.proper.1=[[RED]]Proper usage to restore the XP rate to default is /xprate reset
 Commands.xprate.proper.2=[[RED]]Please specify true or false to indicate if this is an xp event or not
+Commands.Event.Start=[[GREEN]]mcMMO[[GOLD]] Event!
+Commands.Event.XP=[[DARK_AQUA]]XP Rate is now [[GOLD]]{0}[[DARK_AQUA]]x!
 Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED!
 Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x!
 XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!