mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 08:36:45 +01:00
Encapsulate admin notifications + add prefix
This commit is contained in:
parent
92e6cedb14
commit
b0dc41b4d9
@ -10,7 +10,6 @@ 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.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -18,7 +17,6 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.security.Permission;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -61,17 +59,9 @@ public class XprateCommand implements TabExecutor {
|
||||
senderName = ((Player) sender).getDisplayName();
|
||||
}
|
||||
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player.isOp() || Permissions.adminChat(player))
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName));
|
||||
}
|
||||
}
|
||||
|
||||
NotificationManager.sendAdminNotification(LocaleLoader.getString("XPRate.AdminDetails.End", senderName));
|
||||
sender.sendMessage(LocaleLoader.getString("XPRate.End"));
|
||||
|
||||
|
||||
mcMMO.p.toggleXpEventEnabled();
|
||||
}
|
||||
|
||||
@ -122,7 +112,6 @@ public class XprateCommand implements TabExecutor {
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||
}
|
||||
|
||||
|
||||
String senderName = LocaleLoader.getString("Server.ConsoleName");
|
||||
|
||||
if(sender instanceof Player)
|
||||
@ -130,17 +119,10 @@ public class XprateCommand implements TabExecutor {
|
||||
senderName = ((Player) sender).getDisplayName();
|
||||
}
|
||||
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player.isOp() || Permissions.adminChat(player))
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate));
|
||||
}
|
||||
}
|
||||
|
||||
//Admin notification
|
||||
NotificationManager.sendAdminNotification(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate));
|
||||
sender.sendMessage(LocaleLoader.getString("XPRate.Modified", newXpRate));
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -30,7 +30,10 @@ import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.meta.OldName;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
|
||||
@ -25,7 +24,6 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
@ -40,13 +38,10 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
@ -29,7 +30,6 @@ import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
|
@ -10,12 +10,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class LocaleLoader {
|
||||
|
@ -6,7 +6,10 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -154,4 +157,22 @@ public class NotificationManager {
|
||||
String.valueOf(RankUtils.getRank(mcMMOPlayer.getPlayer(),
|
||||
subSkillType)))));*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to all admins with the admin notification formatting from the locale
|
||||
* Admins are currently players with either Operator status or Admin Chat permission
|
||||
* @param msg message contents
|
||||
*/
|
||||
public static void sendAdminNotification(String msg) {
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player.isOp() || Permissions.adminChat(player))
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Notifications.Admin", msg));
|
||||
}
|
||||
}
|
||||
|
||||
//Copy it out to Console too
|
||||
mcMMO.p.getLogger().info(LocaleLoader.getString("Notifications.Admin", msg));
|
||||
}
|
||||
}
|
||||
|
@ -829,9 +829,10 @@ 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.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 {1}x
|
||||
XPRate.AdminDetails.End=The user {0} [[GRAY]]has ended the XP rate event
|
||||
XPRate.AdminDetails.Start=The user {0} [[GRAY]]has started an XP rate event of {1}x
|
||||
Server.ConsoleName=[Server Console]
|
||||
Notifications.Admin=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0}
|
||||
|
||||
#GUIDES
|
||||
Guides.Available=[[GRAY]]Guide for {0} available - type /{1} ? [page]
|
||||
|
Loading…
Reference in New Issue
Block a user