XP event now uses titles for ending and fixed negative number bug

This commit is contained in:
nossr50 2019-01-15 03:50:12 -08:00
parent f5b3cf4350
commit 5e3a72b30d
3 changed files with 25 additions and 2 deletions

View File

@ -46,6 +46,7 @@ Version 2.1.0
- (Locale) Removed localizations with the following codes for being almost empty: id, HR_hr, et_EE, lv, lt, no, pl_PL, pt_PT, tr_TR
- (Config) Removed SkillShot's IncreaseLevel & IncreasePercentage (replaced by RankDamageMultiplier)
- (Config) Removed AxeMastery's MaxBonus & MaxBonusLevel (replaced by RankDamageMultiplier)
= (Events) Fixed bug where XP rate could be a negative number
= (Experience) Fixed a bug where you could set a players levels into the negative and bad things would happen
= (Plugin Compatibility) mcMMO now fires new custom events relating to changes it makes to player scoreboards, plugin authors can listen to these events to improve compatibility
= (Items) Chimaera Wing now tracks cooldowns between sessions for players (no more disconnect abuse)

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.NotificationManager;
import com.google.common.collect.ImmutableList;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@ -24,7 +25,7 @@ public class XprateCommand implements TabExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if (!args[0].equalsIgnoreCase("reset")) {
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
return false;
}
@ -34,7 +35,18 @@ public class XprateCommand implements TabExecutor {
}
if (mcMMO.p.isXPEventEnabled()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.over"));
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
{
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Stop"),
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
10, 10*20, 20);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
mcMMO.p.toggleXpEventEnabled();
}
@ -62,6 +74,13 @@ public class XprateCommand implements TabExecutor {
}
int newXpRate = Integer.parseInt(args[0]);
if(newXpRate < 0)
{
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
return true;
}
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if (mcMMO.p.isXPEventEnabled()) {

View File

@ -751,7 +751,10 @@ 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.NegativeNumberWarn=Don't use negative numbers!
Commands.Event.Start=[[GREEN]]mcMMO[[GOLD]] Event!
Commands.Event.Stop=[[GREEN]]mcMMO[[DARK_AQUA]] Event Over!
Commands.Event.Stop.Subtitle=[[GREEN]]I hope you had fun!
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!