PC-1021 Prevent 'null' player being punished

This commit is contained in:
Keir Nellyer 2016-10-03 10:00:04 +01:00
parent 7926d88d5b
commit 17b04a6a84

View File

@ -12,7 +12,6 @@ import java.util.logging.Level;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin;
@ -248,11 +247,8 @@ public class ReportManager
checkNotNull(report);
checkNotNull(reportResult);
return _reportRepository.getAccountUUID(report.getSuspectId()).thenAccept(suspectUUID ->
return _reportRepository.getAccountName(report.getSuspectId()).thenAccept(suspectName ->
{
OfflinePlayer suspect = Bukkit.getOfflinePlayer(suspectUUID);
String suspectName = suspect.getName();
if (reportCloser != null)
{
int closerId = _clientManager.Get(reportCloser).getAccountId();
@ -292,7 +288,7 @@ public class ReportManager
// TODO: force moderator to choose a punishment (requires new punish gui)
CommandCenter.Instance.onPlayerCommandPreprocess(
new PlayerCommandPreprocessEvent(reportCloser,
String.format("/punish %s Report #%s - %s", suspectName, reportId, reason)));
String.format("/punish %s Report #%d - %s", suspectName, reportId, reason)));
}
// TODO: send these after punishment has been decided (requires new punish gui)