Correction de bug dans les tooltips des messages privés + les messages envoyés à soi-même ne sont affichés qu'une seule fois
This commit is contained in:
parent
a5d5ff78fd
commit
b688a8e928
@ -227,7 +227,7 @@ public class PrivateMessagesManager extends BukkitRunnable {
|
||||
int secKey = new Random().nextInt();
|
||||
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
if (sender.isPlayer() && !destUserName.equalsIgnoreCase(sender.senderName)) {
|
||||
MPMessageElement el = new MPMessageElement(time, secKey, sender.senderName, sender.senderName, message, true, true);
|
||||
el.setDestNick(destUserName);
|
||||
el.save();
|
||||
@ -301,12 +301,12 @@ public class PrivateMessagesManager extends BukkitRunnable {
|
||||
private void tryDisplayMessage(MPMessageElement message) {
|
||||
|
||||
try {
|
||||
|
||||
OnlinePlayer op = OnlinePlayerManager.get(new OffPlayer(message.getViewerNick()).getBukkitOnlinePlayer());
|
||||
|
||||
OffPlayer offP = new OffPlayer(message.getViewerNick());
|
||||
|
||||
MessageSender sender = new MessageSender(message.getSourceNick());
|
||||
|
||||
boolean isIgnoring = sender.isPlayer() && op.getEssentialsUser().isIgnoredPlayer(new OffPlayer(message.getSourceNick()).getEssentialsUser());
|
||||
boolean isIgnoring = sender.isPlayer() && offP.getEssentialsUser().isIgnoredPlayer(new OffPlayer(message.getSourceNick()).getEssentialsUser());
|
||||
|
||||
|
||||
if (isIgnoring) {
|
||||
@ -314,6 +314,8 @@ public class PrivateMessagesManager extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
|
||||
OnlinePlayer op = OnlinePlayerManager.get(offP.getBukkitOnlinePlayer());
|
||||
|
||||
if (op == null) return; // la cible n'est pas en ligne
|
||||
|
||||
if (!op.isAuthenticated()) return; // la cible n'a pas fait son /login
|
||||
@ -337,7 +339,7 @@ public class PrivateMessagesManager extends BukkitRunnable {
|
||||
|
||||
List<String> tooltipLines = new ArrayList<String>();
|
||||
tooltipLines.add(ChatColor.GRAY+affDate);
|
||||
tooltipLines.add(ChatColor.GRAY+"de "+ChatColor.RESET+new OffPlayer(message.getSourceNick()).getDisplayName()+ChatColor.GRAY+" ("+displayablePlayerStatus(getPlayerStatut(message.getSourceNick()))+ChatColor.GRAY+")");
|
||||
tooltipLines.add(ChatColor.GRAY+"de "+ChatColor.RESET+new MessageSender(message.getSourceNick()).getDisplayName()+ChatColor.GRAY+" ("+displayablePlayerStatus(getPlayerStatut(message.getSourceNick()))+ChatColor.GRAY+")");
|
||||
if (message.getDestGroup() == null) // vers un joueur
|
||||
tooltipLines.add(ChatColor.GRAY+"vers "+ChatColor.RESET+new OffPlayer(message.getDestNick()).getDisplayName()+ChatColor.GRAY+" ("+displayablePlayerStatus(getPlayerStatut(message.getDestNick()))+ChatColor.GRAY+")");
|
||||
else { // vers un groupe
|
||||
@ -484,8 +486,15 @@ public class PrivateMessagesManager extends BukkitRunnable {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param playerName le pseudo du joueur, insensible à la casse.
|
||||
* @return Le statut du joueur passé en paramètre.<br/>
|
||||
* <code>null</code> si le paramètre est <code>null</code>.
|
||||
*/
|
||||
private PlayerStatut getPlayerStatut(String playerName) {
|
||||
if (playerName == null)
|
||||
return null;
|
||||
if (!AbstractCommandExecutor.isValidPlayerName(playerName))
|
||||
return PlayerStatut.OFFLINE;
|
||||
OnlinePlayer op = OnlinePlayerManager.get(playerName);
|
||||
|
Loading…
Reference in New Issue
Block a user