Allowed ignoring offline players.

This commit is contained in:
ryanhamshire 2015-10-12 16:15:59 -07:00
parent a3a916f7d0
commit 58eedef773
2 changed files with 21 additions and 23 deletions

View File

@ -2141,17 +2141,12 @@ public class GriefPrevention extends JavaPlugin
if(args.length < 1) return false; if(args.length < 1) return false;
//validate target player //validate target player
Player targetPlayer = this.getServer().getPlayer(args[0]); OfflinePlayer targetPlayer = this.resolvePlayerByName(args[0]);
if(targetPlayer == null) if(targetPlayer == null)
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2); GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
return true; return true;
} }
else if(targetPlayer.hasPermission("griefprevention.notignorable"))
{
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotIgnorable);
return true;
}
this.setIgnoreStatus(player, targetPlayer, IgnoreMode.StandardIgnore); this.setIgnoreStatus(player, targetPlayer, IgnoreMode.StandardIgnore);

View File

@ -178,25 +178,28 @@ class PlayerEventHandler implements Listener
makeSocialLogEntry(player.getName(), message); makeSocialLogEntry(player.getName(), message);
//based on ignore lists, remove some of the audience //based on ignore lists, remove some of the audience
Set<Player> recipientsToRemove = new HashSet<Player>(); if(!player.hasPermission("griefprevention.notignorable"))
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
for(Player recipient : recipients)
{ {
if(playerData.ignoredPlayers.containsKey(recipient.getUniqueId())) Set<Player> recipientsToRemove = new HashSet<Player>();
{ PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
recipientsToRemove.add(recipient); for(Player recipient : recipients)
} {
else if(playerData.ignoredPlayers.containsKey(recipient.getUniqueId()))
{ {
PlayerData targetPlayerData = this.dataStore.getPlayerData(recipient.getUniqueId()); recipientsToRemove.add(recipient);
if(targetPlayerData.ignoredPlayers.containsKey(player.getUniqueId())) }
{ else
recipientsToRemove.add(recipient); {
} PlayerData targetPlayerData = this.dataStore.getPlayerData(recipient.getUniqueId());
} if(targetPlayerData.ignoredPlayers.containsKey(player.getUniqueId()))
} {
recipientsToRemove.add(recipient);
}
}
}
recipients.removeAll(recipientsToRemove); recipients.removeAll(recipientsToRemove);
}
} }
} }