Make this code a lot smarter

This commit is contained in:
Keir Nellyer 2016-07-07 17:57:19 -04:00
parent e6de1ec13e
commit bc2b7884ee

View File

@ -6,14 +6,12 @@ import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Level;
import com.google.common.base.Preconditions;
import mineplex.core.account.CoreClientManager;
import mineplex.core.chatsnap.Snapshot;
import mineplex.core.chatsnap.SnapshotManager;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
@ -114,9 +112,7 @@ public class ReportManager
checkNotNull(report);
checkNotNull(reportHandler);
Optional<Long> reportIdOptional = report.getId();
Preconditions.checkArgument(reportIdOptional.isPresent(), "Report id is not present.");
long reportId = reportIdOptional.get();
long reportId = report.getId().orElseThrow(() -> new IllegalStateException("Report id is not present."));
Optional<Integer> handlerIdOptional = report.getHandlerId();
@ -134,7 +130,6 @@ public class ReportManager
}
else
{
String handlerName = reportHandler.getName();
int handlerId = _clientManager.Get(reportHandler).getAccountId();
report.setHandlerId(handlerId);