Admin chat now sends useful information to admins/adminchat permissible

players
This commit is contained in:
nossr50 2019-05-17 04:27:27 -07:00
parent 1c130aad42
commit f3cbd450d0
4 changed files with 64 additions and 18 deletions

View File

@ -1,3 +1,12 @@
Version 2.1.62
OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled
New locale string - 'XPRate.Modified' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled
New locale string - 'XPRate.End' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled
New locale string - 'XPRate.AdminDetails.End' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued
New locale string - 'XPRate.AdminDetails.Start' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued
New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console
Version 2.1.61 Version 2.1.61
Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat'
Updated the Japanese locale (thanks snake0053) Updated the Japanese locale (thanks snake0053)

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.61</version> <version>2.1.62-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>

View File

@ -10,12 +10,15 @@ import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil; import org.bukkit.util.StringUtil;
import java.security.Permission;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -51,6 +54,23 @@ public class XprateCommand implements TabExecutor {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
} }
for(Player player : Bukkit.getServer().getOnlinePlayers())
{
if(player.isOp() || Permissions.adminChat(player))
{
String senderName = LocaleLoader.getString("Server.ConsoleName");
if(sender instanceof Player)
{
senderName = ((Player) sender).getDisplayName();
}
sender.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName));
}
}
sender.sendMessage(LocaleLoader.getString("XPRate.End"));
mcMMO.p.toggleXpEventEnabled(); mcMMO.p.toggleXpEventEnabled();
} }
@ -88,26 +108,38 @@ public class XprateCommand implements TabExecutor {
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate); ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if (mcMMO.p.isXPEventEnabled()) { if(AdvancedConfig.getInstance().useTitlesForXPEvent())
if(AdvancedConfig.getInstance().useTitlesForXPEvent()) {
{ NotificationManager.broadcastTitle(mcMMO.p.getServer(),
NotificationManager.broadcastTitle(mcMMO.p.getServer(), LocaleLoader.getString("Commands.Event.Start"),
LocaleLoader.getString("Commands.Event.Start"), LocaleLoader.getString("Commands.Event.XP", newXpRate),
LocaleLoader.getString("Commands.Event.XP", newXpRate), 10, 10*20, 20);
10, 10*20, 20);
}
if(Config.getInstance().broadcastEventMessages())
{
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)); if(Config.getInstance().broadcastEventMessages())
{
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
} }
for(Player player : Bukkit.getServer().getOnlinePlayers())
{
if(player.isOp() || Permissions.adminChat(player))
{
String senderName = LocaleLoader.getString("Server.ConsoleName");
if(sender instanceof Player)
{
senderName = ((Player) sender).getDisplayName();
}
sender.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate));
}
}
sender.sendMessage(LocaleLoader.getString("XPRate.Modified", newXpRate));
return true; return true;
default: default:

View File

@ -826,7 +826,12 @@ 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.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.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED!
Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x!
XPRate.Modified=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x!
XPRate.End=[[GRAY]]You ended the XP rate event.
XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
XPRate.AdminDetails.End=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has ended the XP rate event
XPRate.AdminDetails.Start=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has started an XP rate event of {0}x
Server.ConsoleName=[Server Console]
#GUIDES #GUIDES
Guides.Available=[[GRAY]]Guide for {0} available - type /{1} ? [page] Guides.Available=[[GRAY]]Guide for {0} available - type /{1} ? [page]